26#if defined (HAVE_CONFIG_H)
59blas_axpy (
const F77_INT& n,
const double& alpha,
const double *
x,
62 F77_FUNC (daxpy, DAXPY) (n, alpha,
x, incx, y, incy);
66blas_axpy (
const F77_INT& n,
const float& alpha,
const float *
x,
69 F77_FUNC (saxpy, SAXPY) (n, alpha,
x, incx, y, incy);
94template <
typename T,
typename R>
104 for (
F77_INT k = 0; k < na - nb + 1; k++)
105 for (
F77_INT j = 0; j < nb; j++)
106 for (
F77_INT i = 0; i < mb; i++)
109 T b_val =
static_cast<T
>(b[i + j*mb]);
112 blas_axpy (
len, b_val, &a[mb-i-1 + (k+nb-j-1)*ma], 1,
120 for (
F77_INT k = 0; k < na; k++)
121 for (
F77_INT j = 0; j < nb; j++)
122 for (
F77_INT i = 0; i < mb; i++)
125 T b_val =
static_cast<T
>(b[i + j*mb]);
128 blas_axpy (ma, b_val, &a[k*ma], 1, &c[i + (j+k)*
len], 1);
133template <
typename T,
typename R>
137 T *c,
const dim_vector& ccd,
int nd,
bool inner)
141 F77_INT ad0 = to_f77_int (ad(0));
142 F77_INT ad1 = to_f77_int (ad(1));
144 F77_INT bd0 = to_f77_int (bd(0));
145 F77_INT bd1 = to_f77_int (bd(1));
147 convolve_2d<T, R> (a, ad0, ad1, b, bd0, bd1, c, inner);
161 convolve_nd<T, R> (a + ma*(ja+jb), ad, acd,
162 b + mb*(nb-jb-1), bd, bcd,
163 c + ldc*ja, ccd, nd-1, inner);
169 convolve_nd<T, R> (a + ma*ja, ad, acd, b + mb*jb, bd, bcd,
170 c + ldc*(ja+jb), ccd, nd-1, inner);
176template <
typename T,
typename R>
183 const int nd = std::max (a.
ndims (), b.
ndims ());
189 for (
int i = 0; i < nd; i++)
192 cdims(i) = std::max (adims(i) - bdims(i) + 1,
195 cdims(i) = std::max (adims(i) + bdims(i) - 1,
201 if (cdims.
numel () == 0)
207 for (
int i = 0; i < nd; i++)
212 bool reordered =
false;
213 for (
int i = 0; i < nd; i++)
214 for (
int j = (i+1); j < nd; j++)
215 if (apdims(i) < apdims(j))
217 std::swap (apdims(i), apdims(j));
218 std::swap (cdims(i), cdims(j));
219 std::swap (order(i), order(j));
240 c = c.ipermute (order);
256 for (
int i = 0; i < nd; i++)
264#define CONV_DEFS(TPREF, RPREF) \
266 convn (const TPREF ## NDArray& a, const RPREF ## NDArray& b, \
269 return convolve (a, b, ct); \
272 convn (const TPREF ## Matrix& a, const RPREF ## Matrix& b, \
275 return convolve (a, b, ct); \
278 convn (const TPREF ## Matrix& a, const RPREF ## ColumnVector& c, \
279 const RPREF ## RowVector& r, convn_type ct) \
281 return convolve (a, c * r, ct); \
291OCTAVE_END_NAMESPACE(octave)
N Dimensional Array with copy-on-write semantics.
const dim_vector & dims() const
Return a const-reference so that dims ()(i) works efficiently.
int ndims() const
Size of the specified dimension.
bool isempty() const
Size of the specified dimension.
const T * data() const
Size of the specified dimension.
Template for N-dimensional array classes with like-type math operators.
MArray< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
Vector representing the dimensions (size) of an Array.
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
static dim_vector alloc(int n)
dim_vector cumulative() 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)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define F77_CONST_CMPLX_ARG(x)
#define F77_DBLE_CMPLX_ARG(x)
octave_f77_int_type F77_INT
#define F77_CONST_DBLE_CMPLX_ARG(x)
std::complex< double > Complex
std::complex< float > FloatComplex
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)
F77_RET_T const F77_DBLE * x
F77_RET_T F77_FUNC(xerbla, XERBLA)(F77_CONST_CHAR_ARG_DEF(s_arg