26 #if ! defined (octave_MDiagArray2_h)
27 #define octave_MDiagArray2_h 1
29 #include "octave-config.h"
93 const T *
d = this->
data ();
97 static constexpr T zero = T ();
99 return std::count_if (
d,
d + nel,
100 [] (T
elem) {
return elem != zero; });
132 #define MDIAGARRAY2_FORWARD_DEFS(B, R, T) \
134 operator + (const R& x) \
136 return R (operator + (dynamic_cast<const B<T>&> (x))); \
139 operator - (const R& x) \
141 return R (operator - (dynamic_cast<const B<T>&> (x))); \
144 operator * (const R& x, const T& y) \
146 return R (operator * (dynamic_cast<const B<T>&> (x), (y))); \
149 operator / (const R& x, const T& y) \
151 return R (operator / (dynamic_cast<const B<T>&> (x), (y))); \
154 operator * (const T& x, const R& y) \
156 return R (operator * ( (x), dynamic_cast<const B<T>&> (y))); \
159 operator + (const R& x, const R& y) \
161 return R (operator + (dynamic_cast<const B<T>&> (x), \
162 dynamic_cast<const B<T>&> (y))); \
165 operator - (const R& x, const R& y) \
167 return R (operator - (dynamic_cast<const B<T>&> (x), \
168 dynamic_cast<const B<T>&> (y))); \
171 product (const R& x, const R& y) \
173 return R (product (dynamic_cast<const B<T>&> (x), \
174 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 > &)
OCTAVE_API Array< T > extract_diag(octave_idx_type k=0) const
DiagArray2< T > & operator=(const DiagArray2< T > &a)
const T * data(void) const
OCTAVE_API DiagArray2< T > hermitian(T(*fcn)(const T &)=nullptr) const
octave_idx_type length(void) const
OCTAVE_API Array< T > array_value(void) const
OCTAVE_API 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
OCTAVE_API 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