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>
122 for (
int i = 0; i < nd; i++)
125 cdims(i) =
std::max (adims(i) - bdims(i) + 1,
126 static_cast<octave_idx_type> (0));
128 cdims(i) =
std::max (adims(i) + bdims(i) - 1,
129 static_cast<octave_idx_type> (0));
134 convolve_nd<T, R> (a.
fortran_vec (), adims, adims.cumulative (),
144 for (
int i = 0; i < nd; i++)
152 #define CONV_DEFS(TPREF, RPREF) \
154 convn (const TPREF ## NDArray& a, const RPREF ## NDArray& b, convn_type ct) \
156 return convolve (a, b, ct); \
159 convn (const TPREF ## Matrix& a, const RPREF ## Matrix& b, convn_type ct) \
161 return convolve (a, b, ct); \
164 convn (const TPREF ## Matrix& a, const RPREF ## ColumnVector& c, \
165 const RPREF ## RowVector& r, convn_type ct) \
167 return convolve (a, c * r, ct); \