GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
MatrixType.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2006-2025 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_MatrixType_h)
27#define octave_MatrixType_h 1
28
29#include "octave-config.h"
30
31#include "mx-fwd.h"
32
33#include "MSparse.h"
34
36{
37public:
55
57
59
60 OCTAVE_API MatrixType (const Matrix& a);
61
63
65
67
68 template <typename T>
70 MatrixType (const MSparse<T>& a);
71
72 OCTAVE_API MatrixType (const matrix_type t, bool _full = false);
73
75 const octave_idx_type *p, bool _full = false);
76
78 const octave_idx_type kl, bool _full = false);
79
81
83
84 OCTAVE_API int type (bool quiet = true);
85
86 OCTAVE_API int type (const Matrix& a);
87
88 OCTAVE_API int type (const ComplexMatrix& a);
89
90 OCTAVE_API int type (const FloatMatrix& a);
91
92 OCTAVE_API int type (const FloatComplexMatrix& a);
93
94 OCTAVE_API int type (const SparseMatrix& a);
95
96 OCTAVE_API int type (const SparseComplexMatrix& a);
97
98 double band_density () const { return m_bandden; }
99
100 int nupper () const { return m_upper_band; }
101
102 int nlower () const { return m_lower_band; }
103
104 bool is_dense () const { return m_dense; }
105
106 bool isdiag () const
107 { return (m_type == Diagonal || m_type == Permuted_Diagonal); }
108
109 bool istriu () const
110 { return (m_type == Upper || m_type == Permuted_Upper); }
111
112 bool istril () const
113 { return (m_type == Lower || m_type == Permuted_Lower); }
114
115 bool isbanded () const
116 { return (m_type == Banded || m_type == Banded_Hermitian); }
117
118 bool is_tridiagonal () const
119 { return (m_type == Tridiagonal || m_type == Tridiagonal_Hermitian); }
120
121 bool ishermitian () const
122 {
123 return (m_type == Banded_Hermitian || m_type == Tridiagonal_Hermitian
124 || m_type == Hermitian);
125 }
126
127 bool is_rectangular () const { return (m_type == Rectangular); }
128
129 bool is_known () const { return (m_type != Unknown); }
130
131 bool is_unknown () const { return (m_type == Unknown); }
132
133 OCTAVE_API void info () const;
134
135 octave_idx_type * triangular_perm () const { return m_perm; }
136
137 void invalidate_type () { m_type = Unknown; }
138
139 void mark_as_diagonal () { m_type = Diagonal; }
140
142
143 void mark_as_upper_triangular () { m_type = Upper; }
144
145 void mark_as_lower_triangular () { m_type = Lower; }
146
147 void mark_as_tridiagonal () {m_type = Tridiagonal; }
148
150 { m_type = Banded; m_upper_band = ku; m_lower_band = kl; }
151
152 void mark_as_full () { m_type = Full; }
153
154 void mark_as_rectangular () { m_type = Rectangular; }
155
156 void mark_as_dense () { m_dense = true; }
157
158 void mark_as_not_dense () { m_dense = false; }
159
161
163
165
167
169
170private:
171 void type (int new_typ) { m_type = static_cast<matrix_type> (new_typ); }
172
173 matrix_type m_type;
174 double m_sp_bandden;
175 double m_bandden;
176 octave_idx_type m_upper_band;
177 octave_idx_type m_lower_band;
178 bool m_dense;
179 bool m_full;
180 octave_idx_type m_nperm;
181 octave_idx_type *m_perm;
182};
183
184#endif
bool is_known() const
Definition MatrixType.h:129
bool ishermitian() const
Definition MatrixType.h:121
void mark_as_unsymmetric()
void mark_as_not_dense()
Definition MatrixType.h:158
void invalidate_type()
Definition MatrixType.h:137
bool istriu() const
Definition MatrixType.h:109
@ Tridiagonal_Hermitian
Definition MatrixType.h:52
@ Banded_Hermitian
Definition MatrixType.h:50
@ Permuted_Diagonal
Definition MatrixType.h:43
void mark_as_permuted(const octave_idx_type np, const octave_idx_type *p)
void mark_as_unpermuted()
double band_density() const
Definition MatrixType.h:98
void mark_as_tridiagonal()
Definition MatrixType.h:147
MatrixType & operator=(const MatrixType &a)
int nupper() const
Definition MatrixType.h:100
void mark_as_banded(const octave_idx_type ku, const octave_idx_type kl)
Definition MatrixType.h:149
bool isdiag() const
Definition MatrixType.h:106
void mark_as_symmetric()
bool is_unknown() const
Definition MatrixType.h:131
void mark_as_full()
Definition MatrixType.h:152
int nlower() const
Definition MatrixType.h:102
bool isbanded() const
Definition MatrixType.h:115
void info() const
void mark_as_dense()
Definition MatrixType.h:156
void mark_as_upper_triangular()
Definition MatrixType.h:143
octave_idx_type * triangular_perm() const
Definition MatrixType.h:135
void mark_as_permuted_diagonal()
Definition MatrixType.h:141
MatrixType transpose() const
void mark_as_lower_triangular()
Definition MatrixType.h:145
bool is_tridiagonal() const
Definition MatrixType.h:118
bool istril() const
Definition MatrixType.h:112
void mark_as_rectangular()
Definition MatrixType.h:154
void mark_as_diagonal()
Definition MatrixType.h:139
bool is_rectangular() const
Definition MatrixType.h:127
bool is_dense() const
Definition MatrixType.h:104
#define OCTAVE_API
Definition main.in.cc:55