26 #if ! defined (octave_MDiagArray2_h)
27 #define octave_MDiagArray2_h 1
29 #include "octave-config.h"
92 const T *
d = this->
data ();
96 static constexpr T zero = T ();
98 return std::count_if (
d,
d + nel,
99 [] (T
elem) {
return elem != zero; });
128 #define MDIAGARRAY2_FORWARD_DEFS(B, R, T) \
130 operator + (const R& x) \
132 return R (operator + (dynamic_cast<const B<T>&> (x))); \
135 operator - (const R& x) \
137 return R (operator - (dynamic_cast<const B<T>&> (x))); \
140 operator * (const R& x, const T& y) \
142 return R (operator * (dynamic_cast<const B<T>&> (x), (y))); \
145 operator / (const R& x, const T& y) \
147 return R (operator / (dynamic_cast<const B<T>&> (x), (y))); \
150 operator * (const T& x, const R& y) \
152 return R (operator * ( (x), dynamic_cast<const B<T>&> (y))); \
155 operator + (const R& x, const R& y) \
157 return R (operator + (dynamic_cast<const B<T>&> (x), \
158 dynamic_cast<const B<T>&> (y))); \
161 operator - (const R& x, const R& y) \
163 return R (operator - (dynamic_cast<const B<T>&> (x), \
164 dynamic_cast<const B<T>&> (y))); \
167 product (const R& x, const R& y) \
169 return R (product (dynamic_cast<const B<T>&> (x), \
170 dynamic_cast<const B<T>&> (y))); \
MDiagArray2< T > operator/(const MDiagArray2< T > &, const T &)
MDiagArray2< T > operator-(const MDiagArray2< T > &)
MDiagArray2< T > product(const MDiagArray2< T > &, const MDiagArray2< T > &)
MDiagArray2< T > operator*(const MDiagArray2< T > &, const T &)
MDiagArray2< T > operator+(const MDiagArray2< T > &)
N Dimensional Array with copy-on-write semantics.
Array< T > extract_diag(octave_idx_type k=0) const
DiagArray2< T > & operator=(const DiagArray2< T > &a)
const T * data(void) const
DiagArray2< T > hermitian(T(*fcn)(const T &)=nullptr) const
Array< T > array_value(void) const
DiagArray2< T > transpose(void) const
Template for N-dimensional array classes with like-type math operators.
Template for two dimensional diagonal array with math operators.
MDiagArray2(octave_idx_type r, octave_idx_type c)
MDiagArray2(const DiagArray2< U > &a)
octave_idx_type nnz(void) const
MDiagArray2< T > hermitian(T(*fcn)(const T &)=nullptr) const
~MDiagArray2(void)=default
bool is_multiple_of_identity(T val) const
MDiagArray2< T > & operator=(const MDiagArray2< T > &a)
MDiagArray2< T > transpose(void) const
MDiagArray2(const Array< T > &a)
MDiagArray2(const DiagArray2< T > &a)
MDiagArray2(const MDiagArray2< T > &a)
MDiagArray2(const Array< T > &a, octave_idx_type r, octave_idx_type c)
MArray< T > diag(octave_idx_type k=0) const
MArray< T > array_value() const
MDiagArray2(octave_idx_type r, octave_idx_type c, const T &val)
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d