26 #if defined (HAVE_CONFIG_H)
38 template <
typename T,
typename R>
45 #define FORWARD_IMPL(T_CXX, R_CXX, T, R, T_CAST, T_CONST_CAST, \
49 F77_FUNC (f##conv2o, F##CONV2O) (const F77_INT&, const F77_INT&, \
50 const T*, const F77_INT&, \
51 const F77_INT&, const R*, T *); \
55 F77_FUNC (f##conv2i, F##CONV2I) (const F77_INT&, const F77_INT&, \
56 const T*, const F77_INT&, \
57 const F77_INT&, const R*, T *); \
60 convolve_2d<T_CXX, R_CXX> (const T_CXX *a, F77_INT ma, F77_INT na, \
61 const R_CXX *b, F77_INT mb, F77_INT nb, \
62 T_CXX *c, bool inner) \
65 F77_XFCN (f##conv2i, F##CONV2I, (ma, na, T_CONST_CAST (a), \
66 mb, nb, R_CONST_CAST (b), \
69 F77_XFCN (f##conv2o, F##CONV2O, (ma, na, T_CONST_CAST (a), \
70 mb, nb, R_CONST_CAST (b), \
77 FORWARD_IMPL (std::complex<
double>, std::complex<
double>,
90 template <typename T, typename R>
93 T *c, const
dim_vector& ccd,
int nd,
bool inner)
97 F77_INT ad0 = octave::to_f77_int (ad(0));
98 F77_INT ad1 = octave::to_f77_int (ad(1));
100 F77_INT bd0 = octave::to_f77_int (bd(0));
101 F77_INT bd1 = octave::to_f77_int (bd(1));
103 convolve_2d<T, R> (a, ad0, ad1, b, bd0, bd1, c, inner);
117 convolve_nd<T, R> (a + ma*(ja+jb), ad, acd,
118 b + mb*(nb-jb-1), bd, bcd,
119 c + ldc*ja, ccd, nd-1, inner);
125 convolve_nd<T, R> (a + ma*ja, ad, acd, b + mb*jb, bd, bcd,
126 c + ldc*(ja+jb), ccd, nd-1, inner);
133 template <
typename T,
typename R>
146 for (
int i = 0; i < nd; i++)
149 cdims(i) =
std::max (adims(i) - bdims(i) + 1,
152 cdims(i) =
std::max (adims(i) + bdims(i) - 1,
173 for (
int i = 0; i < nd; i++)
181 #define CONV_DEFS(TPREF, RPREF) \
183 convn (const TPREF ## NDArray& a, const RPREF ## NDArray& b, \
186 return convolve (a, b, ct); \
189 convn (const TPREF ## Matrix& a, const RPREF ## Matrix& b, \
192 return convolve (a, b, ct); \
195 convn (const TPREF ## Matrix& a, const RPREF ## ColumnVector& c, \
196 const RPREF ## RowVector& r, convn_type ct) \
198 return convolve (a, c * r, ct); \
charNDArray max(char d, const charNDArray &m)
N Dimensional Array with copy-on-write semantics.
Array< T > index(const idx_vector &i) const
Indexing without resizing.
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
int ndims(void) const
Size of the specified dimension.
const T * fortran_vec(void) const
Size of the specified dimension.
bool isempty(void) const
Size of the specified dimension.
Template for N-dimensional array classes with like-type math operators.
Vector representing the dimensions (size) of an Array.
static dim_vector alloc(int n)
dim_vector cumulative(void) const
Return cumulative dimensions.
dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
static idx_vector make_range(octave_idx_type start, octave_idx_type step, octave_idx_type len)
#define F77_CONST_CMPLX_ARG(x)
#define F77_DBLE_CMPLX_ARG(x)
double _Complex F77_DBLE_CMPLX
octave_f77_int_type F77_INT
#define F77_CONST_DBLE_CMPLX_ARG(x)
F77_RET_T const F77_INT const F77_INT const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE * Z
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
std::complex< double > Complex
std::complex< float > FloatComplex
#define CONV_DEFS(TPREF, RPREF)
static MArray< T > convolve(const MArray< T > &a, const MArray< R > &b, convn_type ct)
#define FORWARD_IMPL(T_CXX, R_CXX, T, R, T_CAST, T_CONST_CAST, R_CONST_CAST, f, F)
R 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)
static void convolve_2d(const T *a, F77_INT ma, F77_INT na, const R *b, F77_INT mb, F77_INT nb, T *c, bool inner)