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");
253 retval.elem (i) =
elem (i, i);
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");
283 retval.elem (i) =
elem (i, i);
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)
337 retval.elem (i, i) = 1.0 /
xelem (i, i);
342 (*current_liboctave_error_handler)
343 (
"inverse of the null matrix not defined");
345 else if (z_count > 0)
366 double val = std::abs (
elem (i, i));
367 if (val < tol || val == 0.0)
368 retval.
elem (i, i) = 0.0;
370 retval.
elem (i, i) = 1.0 /
elem (i, i);
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)
T & elem(octave_idx_type n)
Size of the specified dimension.
Array< U, A > map(F fcn) const
Apply function fcn to each element of the Array<T, Alloc>.
octave_idx_type numel() const
Number of elements in the array.
ComplexDET determinant() const
bool all_elements_are_real() const
ComplexDiagMatrix & fill(double val)
ComplexDiagMatrix()=default
ComplexRowVector row(octave_idx_type i) const
ComplexDiagMatrix & operator+=(const DiagMatrix &a)
ComplexDiagMatrix inverse() const
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 pseudo_inverse(double tol=0.0) const
bool operator!=(const ComplexDiagMatrix &a) const
ComplexColumnVector extract_diag(octave_idx_type k=0) const
octave_idx_type rows() const
T dgelem(octave_idx_type i) const
octave_idx_type length() const
T elem(octave_idx_type r, octave_idx_type c) const
T & dgxelem(octave_idx_type i)
T xelem(octave_idx_type r, octave_idx_type c) const
octave_idx_type columns() const
octave_idx_type cols() const
Template for two dimensional diagonal array with math operators.
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
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(std::size_t n, R *r, const X *x)
bool mx_inline_all_real(std::size_t n, const std::complex< T > *x)
bool mx_inline_equal(std::size_t n, const T1 *x, const T2 *y)
std::complex< double > Complex