65 if (beg < 0 || end >=
length () || end < beg)
67 (*current_liboctave_error_handler) (
"range error for fill");
83 (*current_liboctave_error_handler) (
"range error for fill");
99 (*current_liboctave_error_handler) (
"range error for fill");
113 if (beg < 0 || beg + a_len >=
length ())
115 (*current_liboctave_error_handler) (
"range error for fill");
129 if (beg < 0 || beg + a_len >=
length ())
131 (*current_liboctave_error_handler) (
"range error for fill");
163 if (r1 > r2) { std::swap (r1, r2); }
164 if (c1 > c2) { std::swap (c1, c2); }
169 Matrix result (new_r, new_c);
173 result.
elem (i, j) =
elem (r1+i, c1+j);
187 (*current_liboctave_error_handler) (
"invalid row selection");
192 if (r <= c || (r > c && i < c))
203 (*current_liboctave_error_handler) (
"invalid row selection");
208 if (c ==
'f' || c ==
'F')
209 return row (static_cast<octave_idx_type>(0));
210 else if (c ==
'l' || c ==
'L')
214 (*current_liboctave_error_handler) (
"invalid row selection");
226 (*current_liboctave_error_handler) (
"invalid column selection");
231 if (r >= c || (r < c && i < r))
242 (*current_liboctave_error_handler) (
"invalid column selection");
247 if (c ==
'f' || c ==
'F')
248 return column (static_cast<octave_idx_type>(0));
249 else if (c ==
'l' || c ==
'L')
253 (*current_liboctave_error_handler) (
"invalid column selection");
273 (*current_liboctave_error_handler) (
"inverse requires square matrix");
282 if (
elem (i, i) == 0.0)
288 retval.
elem (i, i) = 1.0 /
elem (i, i);
306 if (val < tol || val == 0.0)
307 retval.
elem (i, i) = 0.0;
309 retval.
elem (i, i) = 1.0 /
elem (i, i);
352 (*current_liboctave_error_handler) (
"determinant requires square matrix");
369 double amx = av.
max ();
370 double amn = av.
min ();
371 return amx == 0 ? 0.0 : amn / amx;
384 os <<
" " << a.
elem (i, i);
void gripe_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
RowVector row(octave_idx_type i) const
double elem(octave_idx_type r, octave_idx_type c) const
ColumnVector column(octave_idx_type i) const
ComplexColumnVector extract_diag(octave_idx_type k=0) const
DiagMatrix & fill(double val)
octave_idx_type rows(void) const
DET determinant(void) const
const double * data(void) const
DiagMatrix pseudo_inverse(double tol=0.0) const
T & elem(octave_idx_type n)
DiagMatrix inverse(void) const
Matrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
ColumnVector extract_diag(octave_idx_type k=0) const
DiagMatrix operator*(const DiagMatrix &a, const DiagMatrix &b)
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type r2
T dgelem(octave_idx_type i) const
DiagMatrix imag(const ComplexDiagMatrix &a)
Array< U > map(F fcn) const
Apply function fcn to each element of the Array.
DiagMatrix real(const ComplexDiagMatrix &a)
T & dgxelem(octave_idx_type i)
octave_idx_type cols(void) const
octave_idx_type length(void) const
Number of elements in the array.
octave_idx_type columns(void) const
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
DiagMatrix abs(void) const
bool operator!=(const DiagMatrix &a) const
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type r1
std::ostream & operator<<(std::ostream &os, const DiagMatrix &a)
bool mx_inline_equal(size_t n, const T1 *x, const T2 *y)
octave_idx_type length(void) const
bool operator==(const DiagMatrix &a) const