36 template <
class T,
class R>
43 #define FORWARD_IMPL(T,R,f,F) \
46 F77_FUNC (f##conv2o, F##CONV2O) (const octave_idx_type&, \
47 const octave_idx_type&, \
48 const T*, const octave_idx_type&, \
49 const octave_idx_type&, const R*, T *); \
53 F77_FUNC (f##conv2i, F##CONV2I) (const octave_idx_type&, \
54 const octave_idx_type&, \
55 const T*, const octave_idx_type&, \
56 const octave_idx_type&, const R*, T *); \
59 convolve_2d<T, R> (const T *a, octave_idx_type ma, octave_idx_type na, \
60 const R *b, octave_idx_type mb, octave_idx_type nb, \
64 F77_XFCN (f##conv2i, F##CONV2I, (ma, na, a, mb, nb, b, c)); \
66 F77_XFCN (f##conv2o, F##CONV2O, (ma, na, a, mb, nb, b, c)); \
76 template <class T, class R>
79 T *c, const
dim_vector& ccd,
int nd,
bool inner)
82 convolve_2d<T, R> (a, ad(0), ad(1), b, bd(0), bd(1), c, inner);
94 convolve_nd<T, R> (a + ma*(ja+jb), ad, acd,
95 b + mb*(nb-jb-1), bd, bcd,
96 c + ldc*ja, ccd, nd-1, inner);
102 convolve_nd<T, R> (a + ma*ja, ad, acd, b + mb*jb, bd, bcd,
103 c + ldc*(ja+jb), ccd, nd-1, inner);
110 template <
class T,
class R>
123 for (
int i = 0; i < nd; i++)
126 cdims(i) =
std::max (adims(i) - bdims(i) + 1,
127 static_cast<octave_idx_type> (0));
129 cdims(i) =
std::max (adims(i) + bdims(i) - 1,
130 static_cast<octave_idx_type> (0));
135 convolve_nd<T, R> (a.
fortran_vec (), adims, adims.cumulative (),
145 for (
int i = 0; i < nd; i++)
153 #define CONV_DEFS(TPREF, RPREF) \
155 convn (const TPREF ## NDArray& a, const RPREF ## NDArray& b, convn_type ct) \
157 return convolve (a, b, ct); \
160 convn (const TPREF ## Matrix& a, const RPREF ## Matrix& b, convn_type ct) \
162 return convolve (a, b, ct); \
165 convn (const TPREF ## Matrix& a, const RPREF ## ColumnVector& c, \
166 const RPREF ## RowVector& r, convn_type ct) \
168 return convolve (a, c * r, ct); \
bool is_empty(void) const
static MArray< T > convolve(const MArray< T > &a, const MArray< R > &b, convn_type ct)
dim_vector cumulative(void) const
Return cumulative dimensions.
#define FORWARD_IMPL(T, R, f, F)
F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type double const octave_idx_type double const octave_idx_type double const octave_idx_type double * Z
F77_RET_T const double const double double * d
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
void convolve_nd(const T *a, const dim_vector &ad, const dim_vector &acd, const R *b, const dim_vector &bd, const dim_vector &bcd, T *c, const dim_vector &ccd, int nd, bool inner)
#define CONV_DEFS(TPREF, RPREF)
static void convolve_2d(const T *a, octave_idx_type ma, octave_idx_type na, const R *b, octave_idx_type mb, octave_idx_type nb, T *c, bool inner)
dim_vector redim(int n) const
static dim_vector alloc(int n)
Handles the reference counting for all the derived classes.
charNDArray max(char d, const charNDArray &m)
std::complex< float > FloatComplex
std::complex< double > Complex
const T * fortran_vec(void) const
static idx_vector make_range(octave_idx_type start, octave_idx_type step, octave_idx_type len)
Array< T > index(const idx_vector &i) const
Indexing without resizing.