38 _idxadds_helper (T *a, T v) : m_array (a), m_val (v) { }
41 { m_array[i] += m_val; }
52 _idxadda_helper (T *a,
const T *v) : m_array (a), m_vals (v) { }
55 { m_array[i] += *m_vals++; }
77 idx.loop (
len, _idxadds_helper<T> (this->fortran_vec (), val));
95 idx.loop (
len, _idxadda_helper<T> (this->fortran_vec (), vals.
data ()));
98 template <
typename T, T op (
typename ref_param<T>::type,
99 typename ref_param<T>::type)>
100 struct _idxbinop_helper
103 _idxbinop_helper (T *a,
const T *v) : m_array (a), m_vals (v) { }
106 { m_array[i] = op (m_array[i], *m_vals++); }
113 template <
typename T>
128 idx.loop (
len, _idxbinop_helper<T, octave::math::min> (this->fortran_vec (),
132 template <
typename T>
147 idx.loop (
len, _idxbinop_helper<T, octave::math::max> (this->fortran_vec (),
151 template <
typename T>
179 sdv(dim) = ddv(dim) = 0;
181 (*current_liboctave_error_handler) (
"accumdim: dimension mismatch");
184 const T *src = vals.
data ();
193 idx.loop (
len, _idxadda_helper<T> (dst + j*
n, src + j*ns));
215 template <
typename T>
227 template <
typename T>
238 template <
typename T>
249 template <
typename T>
260 template <
typename T>
273 template <
typename T>
284 template <
typename T>
295 template <
typename T>
306 template <
typename T>
319 #define MARRAY_NDS_OP(OP, FN) \
320 template <typename T> \
322 operator OP (const MArray<T>& a, const T& s) \
324 return do_ms_binary_op<T, T, T> (a, s, FN); \
334 #define MARRAY_SND_OP(OP, FN) \
335 template <typename T> \
337 operator OP (const T& s, const MArray<T>& a) \
339 return do_sm_binary_op<T, T, T> (s, a, FN); \
349 #define MARRAY_NDND_OP(FCN, OP, FN) \
350 template <typename T> \
352 FCN (const MArray<T>& a, const MArray<T>& b) \
354 return do_mm_binary_op<T, T, T> (a, b, FN, FN, FN, #FCN); \
362 template <typename T>
369 template <
typename T>
376 template <
typename T>
385 #define INSTANTIATE_MARRAY(T, API) \
386 template <> API void \
387 MArray<T>::instantiation_guard () { } \
389 template class API MArray<T>
MArray< T > & quotient_eq(MArray< T > &a, const MArray< T > &b)
#define MARRAY_NDS_OP(OP, FN)
MArray< T > operator-(const MArray< T > &a, const T &s)
MArray< T > & product_eq(MArray< T > &a, const MArray< T > &b)
MArray< T > quotient(const MArray< T > &a, const MArray< T > &b)
MArray< T > & operator*=(MArray< T > &a, const T &s)
MArray< T > & operator+=(MArray< T > &a, const T &s)
#define MARRAY_SND_OP(OP, FN)
MArray< T > & operator/=(MArray< T > &a, const T &s)
MArray< T > & operator-=(MArray< T > &a, const T &s)
MArray< T > product(const MArray< T > &a, const MArray< T > &b)
#define MARRAY_NDND_OP(FCN, OP, FN)
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
N Dimensional Array with copy-on-write semantics.
T * fortran_vec()
Size of the specified dimension.
int ndims() const
Size of the specified dimension.
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
const T * data() const
Size of the specified dimension.
bool is_shared() const
Size of the specified dimension.
const dim_vector & dims() const
Return a const-reference so that dims ()(i) works efficiently.
octave_idx_type numel() const
Number of elements in the array.
Template for N-dimensional array classes with like-type math operators.
void idx_min(const octave::idx_vector &idx, const MArray< T > &vals)
void idx_add_nd(const octave::idx_vector &idx, const MArray< T > &vals, int dim=-1)
void idx_add(const octave::idx_vector &idx, T val)
Performs indexed accumulative addition.
void idx_max(const octave::idx_vector &idx, const MArray< T > &vals)
Vector representing the dimensions (size) of an Array.
int first_non_singleton(int def=0) const
dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
octave::idx_vector idx_vector
void mx_inline_div2(std::size_t n, R *r, const X *x)
void mx_inline_sub2(std::size_t n, R *r, const X *x)
void mx_inline_add2(std::size_t n, R *r, const X *x)
void mx_inline_sub(std::size_t n, R *r, const X *x, const Y *y)
void mx_inline_uminus(std::size_t n, R *r, const X *x)
void mx_inline_uminus2(std::size_t n, R *r)
void mx_inline_div(std::size_t n, R *r, const X *x, const Y *y)
void mx_inline_add(std::size_t n, R *r, const X *x, const Y *y)
void mx_inline_mul2(std::size_t n, R *r, const X *x)
void mx_inline_mul(std::size_t n, R *r, const X *x, const Y *y)
void get_extent_triplet(const dim_vector &dims, int &dim, octave_idx_type &l, octave_idx_type &n, octave_idx_type &u)
T::size_type numel(const T &str)