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 m_bandden (0), m_upper_band (0), m_lower_band (0),
70 m_dense (false), m_full (false), m_nperm (0), m_perm (nullptr) { }
73 : m_type (a.m_type), m_sp_bandden (a.m_sp_bandden), m_bandden (a.m_bandden),
74 m_upper_band (a.m_upper_band), m_lower_band (a.m_lower_band),
75 m_dense (a.m_dense), m_full (a.m_full),
76 m_nperm (a.m_nperm), m_perm (nullptr)
100 bool hermitian =
true;
106 j < ncols && upper; j++)
109 upper = upper && (
d != zero);
110 lower = lower && (
d != zero);
111 hermitian = hermitian && (
d > zero);
116 j < ncols && (upper || lower || hermitian); j++)
120 T aij = a.
elem (i, j);
121 T aji = a.
elem (j, i);
122 lower = lower && (aij == zero);
123 upper = upper && (aji == zero);
124 hermitian = hermitian && (aij == aji
125 && aij*aij < diag[i]*diag[j]);
144 template <
typename T>
159 bool hermitian =
true;
165 j < ncols && upper; j++)
167 std::complex<T>
d = a.elem (j, j);
168 upper = upper && (
d != zero);
169 lower = lower && (
d != zero);
170 hermitian = hermitian && (
d.real () > zero &&
d.imag () == zero);
175 j < ncols && (upper || lower || hermitian); j++)
179 std::complex<T> aij = a.elem (i, j);
180 std::complex<T> aji = a.elem (j, i);
181 lower = lower && (aij == zero);
182 upper = upper && (aji == zero);
205 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
206 m_dense (false), m_full (true), m_nperm (0), m_perm (nullptr)
213 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
214 m_dense (false), m_full (true), m_nperm (0), m_perm (nullptr)
221 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
222 m_dense (false), m_full (true), m_nperm (0), m_perm (nullptr)
229 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
230 m_dense (false), m_full (true), m_nperm (0), m_perm (nullptr)
236 template <
typename T>
239 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
240 m_dense (false), m_full (false), m_nperm (0), m_perm (nullptr)
247 if (octave::sparse_params::get_key (
"spumoni") != 0.)
251 bool maybe_hermitian =
false;
259 for (i = 0; i < nm; i++)
275 std::vector<bool> found (nrows);
285 || ((a.
cidx (j+1) == a.
cidx (j) + 1) && found[a.
ridx (j)]))
290 found[a.
ridx (j)] =
true;
299 bool singular =
false;
304 bool zero_on_diagonal =
false;
307 zero_on_diagonal =
true;
311 zero_on_diagonal =
false;
316 if (zero_on_diagonal)
355 if (nnz_in_band == nnz)
368 maybe_hermitian =
true;
415 else if (a.
cidx (nm) == a.
cidx (ncols))
542 is_herm = a.
data (l) ==
d;
566 m_bandden (0), m_upper_band (0), m_lower_band (0),
567 m_dense (false), m_full (_full), m_nperm (0), m_perm (nullptr)
583 m_bandden (0), m_upper_band (0), m_lower_band (0),
584 m_dense (false), m_full (_full), m_nperm (0), m_perm (nullptr)
587 && np > 0 && p !=
nullptr)
603 m_bandden (0), m_upper_band (0), m_lower_band (0),
604 m_dense (false), m_full (_full), m_nperm (0), m_perm (nullptr)
661 if (! quiet && octave::sparse_params::get_key (
"spumoni") != 0.)
668 && octave::sparse_params::get_key (
"spumoni") != 0.)
669 (*current_liboctave_warning_with_id_handler)
670 (
"Octave:matrix-type-info",
"invalidating matrix type");
683 if (octave::sparse_params::get_key (
"spumoni") != 0.)
715 if (octave::sparse_params::get_key (
"spumoni") != 0.)
746 if (octave::sparse_params::get_key (
"spumoni") != 0.)
772 if (octave::sparse_params::get_key (
"spumoni") != 0.)
798 if (octave::sparse_params::get_key (
"spumoni") != 0.)
824 if (octave::sparse_params::get_key (
"spumoni") != 0.)
848 if (octave::sparse_params::get_key (
"spumoni") != 0.)
851 (*current_liboctave_warning_with_id_handler)
852 (
"Octave:matrix-type-info",
"unknown matrix type");
854 (*current_liboctave_warning_with_id_handler)
855 (
"Octave:matrix-type-info",
"diagonal sparse matrix");
857 (*current_liboctave_warning_with_id_handler)
858 (
"Octave:matrix-type-info",
"permuted diagonal sparse matrix");
860 (*current_liboctave_warning_with_id_handler)
861 (
"Octave:matrix-type-info",
"upper triangular matrix");
863 (*current_liboctave_warning_with_id_handler)
864 (
"Octave:matrix-type-info",
"lower triangular matrix");
866 (*current_liboctave_warning_with_id_handler)
867 (
"Octave:matrix-type-info",
"permuted upper triangular matrix");
869 (*current_liboctave_warning_with_id_handler)
870 (
"Octave:matrix-type-info",
"permuted lower triangular Matrix");
872 (*current_liboctave_warning_with_id_handler)
873 (
"Octave:matrix-type-info",
874 "banded sparse matrix %" OCTAVE_IDX_TYPE_FORMAT
"-1-"
875 "%" OCTAVE_IDX_TYPE_FORMAT
" (density %f)",
878 (*current_liboctave_warning_with_id_handler)
879 (
"Octave:matrix-type-info",
880 "banded hermitian/symmetric sparse matrix %" OCTAVE_IDX_TYPE_FORMAT
881 "-1-%" OCTAVE_IDX_TYPE_FORMAT
" (density %f)",
884 (*current_liboctave_warning_with_id_handler)
885 (
"Octave:matrix-type-info",
"hermitian/symmetric matrix");
887 (*current_liboctave_warning_with_id_handler)
888 (
"Octave:matrix-type-info",
"tridiagonal sparse matrix");
890 (*current_liboctave_warning_with_id_handler)
891 (
"Octave:matrix-type-info",
892 "hermitian/symmetric tridiagonal sparse matrix");
894 (*current_liboctave_warning_with_id_handler)
895 (
"Octave:matrix-type-info",
"rectangular/singular matrix");
897 (*current_liboctave_warning_with_id_handler)
898 (
"Octave:matrix-type-info",
"m_full matrix");
916 (
"Can not mark current matrix type as symmetric");
951 (
"Can not mark current matrix type as symmetric");
ComplexColumnVector conj(const ComplexColumnVector &a)
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)
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type rows(void) const
OCTARRAY_OVERRIDABLE_FUNC_API T & elem(octave_idx_type n)
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type cols(void) const
Template for N-dimensional array classes with like-type math operators.
octave_idx_type m_lower_band
OCTAVE_API MatrixType(void)
OCTAVE_API MatrixType transpose(void) const
OCTAVE_API void mark_as_unsymmetric(void)
OCTAVE_API void mark_as_permuted(const octave_idx_type np, const octave_idx_type *p)
OCTAVE_API MatrixType & operator=(const MatrixType &a)
OCTAVE_API void info(void) const
OCTAVE_API ~MatrixType(void)
octave_idx_type m_upper_band
OCTAVE_API int type(bool quiet=true)
OCTAVE_API void mark_as_symmetric(void)
OCTAVE_API void mark_as_unpermuted(void)
octave_idx_type rows(void) const
octave_idx_type * cidx(void)
octave_idx_type * ridx(void)
octave_idx_type nnz(void) const
Actual number of nonzero terms.
octave_idx_type cols(void) const
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)