26 #if defined (HAVE_CONFIG_H)
56 template <
typename T,
typename R>
63 #define FORWARD_IMPL(T_CXX, R_CXX, T, R, T_CAST, T_CONST_CAST, \
67 F77_FUNC (f##conv2o, F##CONV2O) (const F77_INT&, const F77_INT&, \
68 const T*, const F77_INT&, \
69 const F77_INT&, const R*, T *); \
73 F77_FUNC (f##conv2i, F##CONV2I) (const F77_INT&, const F77_INT&, \
74 const T*, const F77_INT&, \
75 const F77_INT&, const R*, T *); \
78 convolve_2d<T_CXX, R_CXX> (const T_CXX *a, F77_INT ma, F77_INT na, \
79 const R_CXX *b, F77_INT mb, F77_INT nb, \
80 T_CXX *c, bool inner) \
83 F77_XFCN (f##conv2i, F##CONV2I, (ma, na, T_CONST_CAST (a), \
84 mb, nb, R_CONST_CAST (b), \
87 F77_XFCN (f##conv2o, F##CONV2O, (ma, na, T_CONST_CAST (a), \
88 mb, nb, R_CONST_CAST (b), \
95 FORWARD_IMPL (std::complex<
double>, std::complex<
double>,
108 template <typename T, typename R>
111 T *c, const
dim_vector& ccd,
int nd,
bool inner)
115 F77_INT ad0 = to_f77_int (ad(0));
116 F77_INT ad1 = to_f77_int (ad(1));
118 F77_INT bd0 = to_f77_int (bd(0));
119 F77_INT bd1 = to_f77_int (bd(1));
121 convolve_2d<T, R> (a, ad0, ad1, b, bd0, bd1, c, inner);
135 convolve_nd<T, R> (a + ma*(ja+jb), ad, acd,
136 b + mb*(nb-jb-1), bd, bcd,
137 c + ldc*ja, ccd, nd-1, inner);
143 convolve_nd<T, R> (a + ma*ja, ad, acd, b + mb*jb, bd, bcd,
144 c + ldc*(ja+jb), ccd, nd-1, inner);
151 template <
typename T,
typename R>
164 for (
int i = 0; i < nd; i++)
167 cdims(i) =
std::max (adims(i) - bdims(i) + 1,
170 cdims(i) =
std::max (adims(i) + bdims(i) - 1,
191 for (
int i = 0; i < nd; i++)
199 #define CONV_DEFS(TPREF, RPREF) \
201 convn (const TPREF ## NDArray& a, const RPREF ## NDArray& b, \
204 return convolve (a, b, ct); \
207 convn (const TPREF ## Matrix& a, const RPREF ## Matrix& b, \
210 return convolve (a, b, ct); \
213 convn (const TPREF ## Matrix& a, const RPREF ## ColumnVector& c, \
214 const RPREF ## RowVector& r, convn_type ct) \
216 return convolve (a, c * r, ct); \
charNDArray max(char d, const charNDArray &m)
N Dimensional Array with copy-on-write semantics.
OCTARRAY_API Array< T, Alloc > index(const octave::idx_vector &i) const
Indexing without resizing.
OCTARRAY_OVERRIDABLE_FUNC_API const T * data(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API bool isempty(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
OCTARRAY_API T * fortran_vec(void)
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API int ndims(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.
OCTAVE_API 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)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#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)