view liboctave/numeric/oct-convn.h @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 6f07492c9c20
children 9a0ce9eea1b7 e88a07dec498
line wrap: on
line source

////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009-2022 The Octave Project Developers
//
// See the file COPYRIGHT.md in the top-level directory of this
// distribution or <https://octave.org/copyright/>.
//
// This file is part of Octave.
//
// Octave is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Octave is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Octave; see the file COPYING.  If not, see
// <https://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////

#if ! defined (octave_oct_convn_h)
#define octave_oct_convn_h 1

#include "octave-config.h"

#include "mx-fwd.h"

// The remaining includes can be removed when the global enum
// declaration, the convert_enum function, and the deprecated functions
// at the end of this file are removed.

#include <cstdlib>
#include "dMatrix.h"
#include "dNDArray.h"
#include "CMatrix.h"
#include "CNDArray.h"
#include "fMatrix.h"
#include "fNDArray.h"
#include "fCMatrix.h"
#include "fCNDArray.h"

// FIXME: Is there any sane way to move a global enum to a namespace and
// tag the global one as deprecated when it is used as a parameter in
// public functions that also need to be tagged as deprecated?

enum convn_type
{
  convn_full,
  convn_same,
  convn_valid
};

namespace octave
{
  enum convn_type
  {
    convn_full,
    convn_same,
    convn_valid
  };

  // double real X double real

  extern OCTAVE_API NDArray
  convn (const NDArray& a, const NDArray& b, convn_type ct);

  extern OCTAVE_API Matrix
  convn (const Matrix& a, const Matrix& b, convn_type ct);

  extern OCTAVE_API Matrix
  convn (const Matrix& a, const ColumnVector& c, const RowVector& r,
         convn_type ct);

  // double complex X double real

  extern OCTAVE_API ComplexNDArray
  convn (const ComplexNDArray& a, const NDArray& b, convn_type ct);

  extern OCTAVE_API ComplexMatrix
  convn (const ComplexMatrix& a, const Matrix& b, convn_type ct);

  extern OCTAVE_API ComplexMatrix
  convn (const ComplexMatrix& a, const ColumnVector& c, const RowVector& r,
         convn_type ct);

  // double complex X double complex

  extern OCTAVE_API ComplexNDArray
  convn (const ComplexNDArray& a, const ComplexNDArray& b, convn_type ct);

  extern OCTAVE_API ComplexMatrix
  convn (const ComplexMatrix& a, const ComplexMatrix& b, convn_type ct);

  extern OCTAVE_API ComplexMatrix
  convn (const ComplexMatrix& a, const ComplexColumnVector& c,
         const ComplexRowVector& r, convn_type ct);

  // float real X float real

  extern OCTAVE_API FloatNDArray
  convn (const FloatNDArray& a, const FloatNDArray& b, convn_type ct);

  extern OCTAVE_API FloatMatrix
  convn (const FloatMatrix& a, const FloatMatrix& b, convn_type ct);

  extern OCTAVE_API FloatMatrix
  convn (const FloatMatrix& a, const FloatColumnVector& c,
         const FloatRowVector& r, convn_type ct);

  // float complex X float real

  extern OCTAVE_API FloatComplexNDArray
  convn (const FloatComplexNDArray& a, const FloatNDArray& b, convn_type ct);

  extern OCTAVE_API FloatComplexMatrix
  convn (const FloatComplexMatrix& a, const FloatMatrix& b, convn_type ct);

  extern OCTAVE_API FloatComplexMatrix
  convn (const FloatComplexMatrix& a, const FloatColumnVector& c,
         const FloatRowVector& r, convn_type ct);

  // float complex X float complex

  extern OCTAVE_API FloatComplexNDArray
  convn (const FloatComplexNDArray& a, const FloatComplexNDArray& b,
         convn_type ct);

  extern OCTAVE_API FloatComplexMatrix
  convn (const FloatComplexMatrix& a, const FloatComplexMatrix& b,
         convn_type ct);

  extern OCTAVE_API FloatComplexMatrix
  convn (const FloatComplexMatrix& a, const FloatComplexColumnVector& c,
         const FloatComplexRowVector& r, convn_type ct);

  convn_type convert_enum (::convn_type ct)
  {
    switch (ct)
      {
      case ::convn_full:
        return convn_full;

      case ::convn_same:
        return convn_same;

      case ::convn_valid:
        return convn_valid;

      default:
        abort ();
      }
  }
}

#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline NDArray
convn (const NDArray& a, const NDArray& b, convn_type ct)
{
  return octave::convn (a, b, static_cast<octave::convn_type> (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline Matrix
convn (const Matrix& a, const Matrix& b, convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline Matrix
convn (const Matrix& a, const ColumnVector& c, const RowVector& r,
       convn_type ct)
{
  return octave::convn (a, c, r, octave::convert_enum (ct));
}

// double complex X double real

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline ComplexNDArray
convn (const ComplexNDArray& a, const NDArray& b, convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline ComplexMatrix
convn (const ComplexMatrix& a, const Matrix& b, convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline ComplexMatrix
convn (const ComplexMatrix& a, const ColumnVector& c, const RowVector& r,
       convn_type ct)
{
  return octave::convn (a, c, r, octave::convert_enum (ct));
}

// double complex X double complex

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline ComplexNDArray
convn (const ComplexNDArray& a, const ComplexNDArray& b, convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline ComplexMatrix
convn (const ComplexMatrix& a, const ComplexMatrix& b, convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline ComplexMatrix
convn (const ComplexMatrix& a, const ComplexColumnVector& c,
       const ComplexRowVector& r, convn_type ct)
{
  return octave::convn (a, c, r, octave::convert_enum (ct));
}

// float real X float real

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline FloatNDArray
convn (const FloatNDArray& a, const FloatNDArray& b, convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline FloatMatrix
convn (const FloatMatrix& a, const FloatMatrix& b, convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline FloatMatrix
convn (const FloatMatrix& a, const FloatColumnVector& c,
       const FloatRowVector& r, convn_type ct)
{
  return octave::convn (a, c, r, octave::convert_enum (ct));
}

// float complex X float real

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline FloatComplexNDArray
convn (const FloatComplexNDArray& a, const FloatNDArray& b,
       convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline FloatComplexMatrix
convn (const FloatComplexMatrix& a, const FloatMatrix& b,
       convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline FloatComplexMatrix
convn (const FloatComplexMatrix& a, const FloatColumnVector& c,
       const FloatRowVector& r, convn_type ct)
{
  return octave::convn (a, c, r, octave::convert_enum (ct));
}

// float complex X float complex

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline FloatComplexNDArray
convn (const FloatComplexNDArray& a, const FloatComplexNDArray& b,
       convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline FloatComplexMatrix
convn (const FloatComplexMatrix& a, const FloatComplexMatrix& b,
       convn_type ct)
{
  return octave::convn (a, b, octave::convert_enum (ct));
}

OCTAVE_DEPRECATED (7, "use 'octave::convn' instead")
inline FloatComplexMatrix
convn (const FloatComplexMatrix& a, const FloatComplexColumnVector& c,
       const FloatComplexRowVector& r, convn_type ct)
{
  return octave::convn (a, c, r, octave::convert_enum (ct));
}
#endif

#endif