26 #if defined (HAVE_CONFIG_H)
82 if (beg < 0 || end >=
length () || end < beg)
83 (*current_liboctave_error_handler) (
"range error for fill");
95 if (beg < 0 || end >=
length () || end < beg)
96 (*current_liboctave_error_handler) (
"range error for fill");
109 (*current_liboctave_error_handler) (
"range error for fill");
122 (*current_liboctave_error_handler) (
"range error for fill");
135 (*current_liboctave_error_handler) (
"range error for fill");
148 (*current_liboctave_error_handler) (
"range error for fill");
160 if (beg < 0 || beg + a_len >=
length ())
161 (*current_liboctave_error_handler) (
"range error for fill");
173 if (beg < 0 || beg + a_len >=
length ())
174 (*current_liboctave_error_handler) (
"range error for fill");
186 if (beg < 0 || beg + a_len >=
length ())
187 (*current_liboctave_error_handler) (
"range error for fill");
199 if (beg < 0 || beg + a_len >=
length ())
200 (*current_liboctave_error_handler) (
"range error for fill");
226 if (r1 > r2) { std::swap (r1, r2); }
227 if (c1 > c2) { std::swap (c1, c2); }
236 result.
elem (i, j) =
elem (r1+i, c1+j);
249 (*current_liboctave_error_handler) (
"invalid row selection");
262 (*current_liboctave_error_handler) (
"invalid row selection");
265 if (c ==
'f' || c ==
'F')
267 else if (c ==
'l' || c ==
'L')
279 (*current_liboctave_error_handler) (
"invalid column selection");
292 (*current_liboctave_error_handler) (
"invalid column selection");
295 if (c ==
'f' || c ==
'F')
297 else if (c ==
'l' || c ==
'L')
316 (*current_liboctave_error_handler) (
"inverse requires square matrix");
326 if (
xelem (i, i) == 0.0)
342 (*current_liboctave_error_handler)
343 (
"inverse of the null matrix not defined");
345 else if (z_count > 0)
367 if (val < tol || val == 0.0)
393 if (
r != a_nr || c != a_nc)
396 if (
r == 0 || c == 0)
442 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
451 double a_element = a.
elem (i, i);
454 c.
elem (i, i) = a_element * b_element;
472 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
484 c.
elem (i, i) = a_element * b_element;
497 (*current_liboctave_error_handler) (
"determinant requires square matrix");
510 double amx = av.
max ();
511 double amn = av.
min ();
512 return amx == 0 ? 0.0 : amn / amx;
527 os <<
' ' << a.
elem (i, i);
ComplexDiagMatrix operator*(const ComplexDiagMatrix &a, const DiagMatrix &b)
std::ostream & operator<<(std::ostream &os, const ComplexDiagMatrix &a)
ComplexDiagMatrix conj(const ComplexDiagMatrix &a)
Array< U > map(F fcn) const
Apply function fcn to each element of the Array<T>.
octave_idx_type numel(void) const
Number of elements in the array.
T & elem(octave_idx_type n)
Size of the specified dimension.
const T * fortran_vec(void) const
Size of the specified dimension.
ComplexDiagMatrix & fill(double val)
ComplexDiagMatrix inverse(void) const
DiagMatrix abs(void) const
ComplexRowVector row(octave_idx_type i) const
ComplexDiagMatrix & operator+=(const DiagMatrix &a)
bool operator==(const ComplexDiagMatrix &a) const
ComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
ComplexColumnVector column(octave_idx_type i) const
ComplexDiagMatrix(void)=default
ComplexDiagMatrix pseudo_inverse(double tol=0.0) const
ComplexDET determinant(void) const
bool operator!=(const ComplexDiagMatrix &a) const
ComplexColumnVector extract_diag(octave_idx_type k=0) const
bool all_elements_are_real(void) const
T dgelem(octave_idx_type i) const
T elem(octave_idx_type r, octave_idx_type c) const
const T * data(void) const
T & dgxelem(octave_idx_type i)
T xelem(octave_idx_type r, octave_idx_type c) const
octave_idx_type length(void) const
octave_idx_type cols(void) const
octave_idx_type columns(void) const
octave_idx_type rows(void) const
const T * fortran_vec(void) const
Template for two dimensional diagonal array with math operators.
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
void mx_inline_add2(size_t n, R *r, const X *x)
bool mx_inline_all_real(size_t n, const std::complex< T > *x)
bool mx_inline_equal(size_t n, const T1 *x, const T2 *y)
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
std::complex< double > Complex
octave_value::octave_value(const Array< char > &chm, char type) return retval