26 #if defined (HAVE_CONFIG_H)
46 (*current_liboctave_warning_with_id_handler)
47 (
"Octave:matrix-type-info",
"using cached matrix type");
53 (*current_liboctave_warning_with_id_handler)
54 (
"Octave:matrix-type-info",
"invalid matrix type");
60 (*current_liboctave_warning_with_id_handler)
61 (
"Octave:matrix-type-info",
"calculating sparse matrix type");
69 bandden (0), upper_band (0),
70 lower_band (0), dense (false), full (false), nperm (0), perm (nullptr) { }
73 : typ (a.typ), sp_bandden (a.sp_bandden), bandden (a.bandden),
74 upper_band (a.upper_band), lower_band (a.lower_band),
75 dense (a.dense), full (a.full), nperm (a.nperm), perm (nullptr)
99 bool hermitian =
true;
105 j < ncols && upper; j++)
108 upper = upper && (
d != zero);
109 lower = lower && (
d != zero);
110 hermitian = hermitian && (
d > zero);
115 j < ncols && (upper || lower || hermitian); j++)
119 double aij = a.
elem (i,j);
120 double aji = a.
elem (j,i);
121 lower = lower && (aij == zero);
122 upper = upper && (aji == zero);
123 hermitian = hermitian && (aij == aji
124 && aij*aij < diag[i]*diag[j]);
143 template <
typename T>
158 bool hermitian =
true;
164 j < ncols && upper; j++)
166 std::complex<T>
d = a.elem (j,j);
167 upper = upper && (
d != zero);
168 lower = lower && (
d != zero);
169 hermitian = hermitian && (
d.real () > zero &&
d.imag () == zero);
174 j < ncols && (upper || lower || hermitian); j++)
178 std::complex<T> aij = a.elem (i,j);
179 std::complex<T> aji = a.elem (j,i);
180 lower = lower && (aij == zero);
181 upper = upper && (aji == zero);
204 sp_bandden (0), bandden (0), upper_band (0), lower_band (0),
205 dense (false), full (true), nperm (0), perm (nullptr)
212 sp_bandden (0), bandden (0), upper_band (0), lower_band (0),
213 dense (false), full (true), nperm (0), perm (nullptr)
220 sp_bandden (0), bandden (0), upper_band (0), lower_band (0),
221 dense (false), full (true), nperm (0), perm (nullptr)
228 sp_bandden (0), bandden (0), upper_band (0), lower_band (0),
229 dense (false), full (true), nperm (0), perm (nullptr)
235 template <
typename T>
238 sp_bandden (0), bandden (0), upper_band (0), lower_band (0),
239 dense (false), full (false), nperm (0), perm (nullptr)
250 bool maybe_hermitian =
false;
258 for (i = 0; i < nm; i++)
274 std::vector<bool> found (nrows);
284 || ((a.
cidx (j+1) == a.
cidx (j) + 1) && found[a.
ridx (j)]))
289 found[a.
ridx (j)] =
true;
298 bool singular =
false;
303 bool zero_on_diagonal =
false;
306 zero_on_diagonal =
true;
310 zero_on_diagonal =
false;
315 if (zero_on_diagonal)
354 if (nnz_in_band == nnz)
367 maybe_hermitian =
true;
414 else if (a.
cidx (nm) == a.
cidx (ncols))
539 is_herm = a.
data (l) ==
d;
563 bandden (0), upper_band (0), lower_band (0),
564 dense (false), full (_full), nperm (0), perm (nullptr)
580 bandden (0), upper_band (0), lower_band (0),
581 dense (false), full (_full), nperm (0), perm (nullptr)
584 && np > 0 && p !=
nullptr)
600 bandden (0), upper_band (0), lower_band (0),
601 dense (false), full (_full), nperm (0), perm (nullptr)
666 (*current_liboctave_warning_with_id_handler)
667 (
"Octave:matrix-type-info",
"invalidating matrix type");
848 (*current_liboctave_warning_with_id_handler)
849 (
"Octave:matrix-type-info",
"unknown matrix type");
851 (*current_liboctave_warning_with_id_handler)
852 (
"Octave:matrix-type-info",
"diagonal sparse matrix");
854 (*current_liboctave_warning_with_id_handler)
855 (
"Octave:matrix-type-info",
"permuted diagonal sparse matrix");
857 (*current_liboctave_warning_with_id_handler)
858 (
"Octave:matrix-type-info",
"upper triangular matrix");
860 (*current_liboctave_warning_with_id_handler)
861 (
"Octave:matrix-type-info",
"lower triangular matrix");
863 (*current_liboctave_warning_with_id_handler)
864 (
"Octave:matrix-type-info",
"permuted upper triangular matrix");
866 (*current_liboctave_warning_with_id_handler)
867 (
"Octave:matrix-type-info",
"permuted lower triangular Matrix");
869 (*current_liboctave_warning_with_id_handler)
870 (
"Octave:matrix-type-info",
871 "banded sparse matrix %" OCTAVE_IDX_TYPE_FORMAT
"-1-"
872 "%" OCTAVE_IDX_TYPE_FORMAT
" (density %f)",
875 (*current_liboctave_warning_with_id_handler)
876 (
"Octave:matrix-type-info",
877 "banded hermitian/symmetric sparse matrix %" OCTAVE_IDX_TYPE_FORMAT
878 "-1-%" OCTAVE_IDX_TYPE_FORMAT
" (density %f)",
881 (*current_liboctave_warning_with_id_handler)
882 (
"Octave:matrix-type-info",
"hermitian/symmetric matrix");
884 (*current_liboctave_warning_with_id_handler)
885 (
"Octave:matrix-type-info",
"tridiagonal sparse matrix");
887 (*current_liboctave_warning_with_id_handler)
888 (
"Octave:matrix-type-info",
889 "hermitian/symmetric tridiagonal sparse matrix");
891 (*current_liboctave_warning_with_id_handler)
892 (
"Octave:matrix-type-info",
"rectangular/singular matrix");
894 (*current_liboctave_warning_with_id_handler)
895 (
"Octave:matrix-type-info",
"full matrix");
912 (
"Can not mark current matrix type as symmetric");
945 (
"Can not mark current matrix type as symmetric");
static void warn_calculating_sparse_type(void)
static void warn_invalid(void)
MatrixType::matrix_type matrix_real_probe(const MArray< T > &a)
MatrixType::matrix_type matrix_complex_probe(const MArray< std::complex< T >> &a)
static void warn_cached(void)
T & elem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type cols(void) const
octave_idx_type rows(void) const
Template for N-dimensional array classes with like-type math operators.
MatrixType transpose(void) const
void mark_as_unsymmetric(void)
void mark_as_permuted(const octave_idx_type np, const octave_idx_type *p)
MatrixType & operator=(const MatrixType &a)
octave_idx_type lower_band
octave_idx_type upper_band
int type(bool quiet=true)
void mark_as_symmetric(void)
void mark_as_unpermuted(void)
octave_idx_type cols(void) const
octave_idx_type * cidx(void)
octave_idx_type nnz(void) const
Actual number of nonzero terms.
octave_idx_type rows(void) const
octave_idx_type * ridx(void)
static double get_bandden(void)
static double get_key(const std::string &key)
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
double norm(const ColumnVector &v)
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
octave_value::octave_value(const Array< char > &chm, char type) return retval