23 #if defined (HAVE_CONFIG_H) 35 template <
typename T,
typename R>
42 #define FORWARD_IMPL(T_CXX, R_CXX, T, R, T_CAST, T_CONST_CAST, \ 46 F77_FUNC (f##conv2o, F##CONV2O) (const F77_INT&, const F77_INT&, \ 47 const T*, const F77_INT&, \ 48 const F77_INT&, const R*, T *); \ 52 F77_FUNC (f##conv2i, F##CONV2I) (const F77_INT&, const F77_INT&, \ 53 const T*, const F77_INT&, \ 54 const F77_INT&, const R*, T *); \ 57 convolve_2d<T_CXX, R_CXX> (const T_CXX *a, F77_INT ma, F77_INT na, \ 58 const R_CXX *b, F77_INT mb, F77_INT nb, \ 59 T_CXX *c, bool inner) \ 62 F77_XFCN (f##conv2i, F##CONV2I, (ma, na, T_CONST_CAST (a), \ 63 mb, nb, R_CONST_CAST (b), \ 66 F77_XFCN (f##conv2o, F##CONV2O, (ma, na, T_CONST_CAST (a), \ 67 mb, nb, R_CONST_CAST (b), \ 87 template <typename T, typename R>
94 F77_INT ad0 = octave::to_f77_int (ad(0));
95 F77_INT ad1 = octave::to_f77_int (ad(1));
97 F77_INT bd0 = octave::to_f77_int (bd(0));
98 F77_INT bd1 = octave::to_f77_int (bd(1));
100 convolve_2d<T, R> (
a, ad0, ad1,
b, bd0, bd1,
c, inner);
114 convolve_nd<T, R> (
a + ma*(ja+jb), ad, acd,
115 b + mb*(nb-jb-1), bd, bcd,
116 c + ldc*ja, ccd, nd-1, inner);
122 convolve_nd<T, R> (
a + ma*ja, ad, acd,
b + mb*jb, bd, bcd,
123 c + ldc*(ja+jb), ccd, nd-1, inner);
130 template <
typename T,
typename R>
135 if (
a.isempty () ||
b.isempty ())
143 for (
int i = 0;
i < nd;
i++)
147 static_cast<octave_idx_type> (0));
150 static_cast<octave_idx_type> (0));
160 convolve_nd<T, R> (
a.fortran_vec (), adims, adims.cumulative (),
170 for (
int i = 0;
i < nd;
i++)
178 #define CONV_DEFS(TPREF, RPREF) \ 180 convn (const TPREF ## NDArray& a, const RPREF ## NDArray& b, \ 183 return convolve (a, b, ct); \ 186 convn (const TPREF ## Matrix& a, const RPREF ## Matrix& b, \ 189 return convolve (a, b, ct); \ 192 convn (const TPREF ## Matrix& a, const RPREF ## ColumnVector& c, \ 193 const RPREF ## RowVector& r, convn_type ct) \ 195 return convolve (a, c * r, ct); \ double _Complex F77_DBLE_CMPLX
Template for N-dimensional array classes with like-type math operators.
static MArray< T > convolve(const MArray< T > &a, const MArray< R > &b, convn_type ct)
#define F77_DBLE_CMPLX_ARG(x)
dim_vector cumulative(void) const
Return cumulative dimensions.
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
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
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 dim_vector alloc(int n)
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)
N Dimensional Array with copy-on-write semantics.
charNDArray max(char d, const charNDArray &m)
#define F77_CONST_DBLE_CMPLX_ARG(x)
octave_f77_int_type F77_INT
#define F77_CONST_CMPLX_ARG(x)
std::complex< float > FloatComplex
std::complex< double > Complex
Vector representing the dimensions (size) of an Array.
static idx_vector make_range(octave_idx_type start, octave_idx_type step, octave_idx_type len)
#define FORWARD_IMPL(T_CXX, R_CXX, T, R, T_CAST, T_CONST_CAST, R_CONST_CAST, f, F)