GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
MatrixType.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2006-2022 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
35class
37{
38public:
40 {
41 Unknown = 0,
54 Rectangular
55 };
56
58
60
61 OCTAVE_API MatrixType (const Matrix& a);
62
64
66
68
69 template <typename T>
72
73 OCTAVE_API MatrixType (const matrix_type t, bool _full = false);
74
76 const octave_idx_type *p, bool _full = false);
77
79 const octave_idx_type kl, bool _full = false);
80
82
83 OCTAVE_API MatrixType& operator = (const MatrixType& a);
84
85 OCTAVE_API int type (bool quiet = true);
86
87 OCTAVE_API int type (const Matrix& a);
88
89 OCTAVE_API int type (const ComplexMatrix& a);
90
91 OCTAVE_API int type (const FloatMatrix& a);
92
93 OCTAVE_API int type (const FloatComplexMatrix& a);
94
95 OCTAVE_API int type (const SparseMatrix& a);
96
97 OCTAVE_API int type (const SparseComplexMatrix& a);
98
99 double band_density (void) const { return m_bandden; }
100
101 int nupper (void) const { return m_upper_band; }
102
103 int nlower (void) const { return m_lower_band; }
104
105 bool is_dense (void) const { return m_dense; }
106
107 bool isdiag (void) const
108 { return (m_type == Diagonal || m_type == Permuted_Diagonal); }
109
110 bool istriu (void) const
111 { return (m_type == Upper || m_type == Permuted_Upper); }
112
113 bool istril (void) const
114 { return (m_type == Lower || m_type == Permuted_Lower); }
115
116 bool isbanded (void) const
117 { return (m_type == Banded || m_type == Banded_Hermitian); }
118
119 bool is_tridiagonal (void) const
120 { return (m_type == Tridiagonal || m_type == Tridiagonal_Hermitian); }
121
122 bool ishermitian (void) const
123 {
124 return (m_type == Banded_Hermitian || m_type == Tridiagonal_Hermitian
125 || m_type == Hermitian);
126 }
127
128 bool is_rectangular (void) const { return (m_type == Rectangular); }
129
130 bool is_known (void) const { return (m_type != Unknown); }
131
132 bool is_unknown (void) const { return (m_type == Unknown); }
133
134 OCTAVE_API void info (void) const;
135
136 octave_idx_type * triangular_perm (void) const { return m_perm; }
137
138 void invalidate_type (void) { m_type = Unknown; }
139
140 void mark_as_diagonal (void) { m_type = Diagonal; }
141
142 void mark_as_permuted_diagonal (void) { m_type = Permuted_Diagonal; }
143
144 void mark_as_upper_triangular (void) { m_type = Upper; }
145
146 void mark_as_lower_triangular (void) { m_type = Lower; }
147
148 void mark_as_tridiagonal (void) {m_type = Tridiagonal; }
149
151 { m_type = Banded; m_upper_band = ku; m_lower_band = kl; }
152
153 void mark_as_full (void) { m_type = Full; }
154
155 void mark_as_rectangular (void) { m_type = Rectangular; }
156
157 void mark_as_dense (void) { m_dense = true; }
158
159 void mark_as_not_dense (void) { m_dense = false; }
160
161 OCTAVE_API void mark_as_symmetric (void);
162
163 OCTAVE_API void mark_as_unsymmetric (void);
164
165 OCTAVE_API void mark_as_permuted (const octave_idx_type np, const octave_idx_type *p);
166
167 OCTAVE_API void mark_as_unpermuted (void);
168
169 OCTAVE_API MatrixType transpose (void) const;
170
171private:
172 void type (int new_typ) { m_type = static_cast<matrix_type> (new_typ); }
173
176 double m_bandden;
180 bool m_full;
183};
184
185#endif
double band_density(void) const
Definition: MatrixType.h:99
void mark_as_not_dense(void)
Definition: MatrixType.h:159
void mark_as_full(void)
Definition: MatrixType.h:153
void invalidate_type(void)
Definition: MatrixType.h:138
octave_idx_type m_lower_band
Definition: MatrixType.h:178
void mark_as_permuted_diagonal(void)
Definition: MatrixType.h:142
bool isdiag(void) const
Definition: MatrixType.h:107
bool ishermitian(void) const
Definition: MatrixType.h:122
void mark_as_rectangular(void)
Definition: MatrixType.h:155
bool is_dense(void) const
Definition: MatrixType.h:105
@ Tridiagonal_Hermitian
Definition: MatrixType.h:53
@ Permuted_Lower
Definition: MatrixType.h:48
@ Banded_Hermitian
Definition: MatrixType.h:51
@ Permuted_Diagonal
Definition: MatrixType.h:44
@ Permuted_Upper
Definition: MatrixType.h:47
octave_idx_type * triangular_perm(void) const
Definition: MatrixType.h:136
bool is_unknown(void) const
Definition: MatrixType.h:132
double m_sp_bandden
Definition: MatrixType.h:175
void mark_as_dense(void)
Definition: MatrixType.h:157
void mark_as_upper_triangular(void)
Definition: MatrixType.h:144
bool is_rectangular(void) const
Definition: MatrixType.h:128
matrix_type m_type
Definition: MatrixType.h:174
void mark_as_banded(const octave_idx_type ku, const octave_idx_type kl)
Definition: MatrixType.h:150
int nupper(void) const
Definition: MatrixType.h:101
int nlower(void) const
Definition: MatrixType.h:103
double m_bandden
Definition: MatrixType.h:176
bool m_dense
Definition: MatrixType.h:179
bool istriu(void) const
Definition: MatrixType.h:110
void mark_as_lower_triangular(void)
Definition: MatrixType.h:146
bool is_tridiagonal(void) const
Definition: MatrixType.h:119
void mark_as_tridiagonal(void)
Definition: MatrixType.h:148
bool isbanded(void) const
Definition: MatrixType.h:116
octave_idx_type m_nperm
Definition: MatrixType.h:181
OCTAVE_API MatrixType(const MSparse< T > &a)
bool m_full
Definition: MatrixType.h:180
void type(int new_typ)
Definition: MatrixType.h:172
bool istril(void) const
Definition: MatrixType.h:113
bool is_known(void) const
Definition: MatrixType.h:130
octave_idx_type m_upper_band
Definition: MatrixType.h:177
void mark_as_diagonal(void)
Definition: MatrixType.h:140
octave_idx_type * m_perm
Definition: MatrixType.h:182
Definition: dMatrix.h:42
#define OCTAVE_API
Definition: main.in.cc:55
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
Definition: symrcm.cc:391