GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MatrixType.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2006-2015 David Bateman
4 Copyright (C) 2006 Andy Adler
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if !defined (octave_MatrixType_h)
25 #define octave_MatrixType_h
26 
27 class Matrix;
28 class ComplexMatrix;
29 class FloatMatrix;
30 class FloatComplexMatrix;
31 class SparseMatrix;
33 
34 class
35 OCTAVE_API
37 {
38 public:
40  {
41  Unknown = 0,
54  Rectangular
55  };
56 
57  MatrixType (void);
58 
59  MatrixType (const MatrixType &a);
60 
61  MatrixType (const Matrix &a);
62 
63  MatrixType (const ComplexMatrix &a);
64 
65  MatrixType (const FloatMatrix &a);
66 
67  MatrixType (const FloatComplexMatrix &a);
68 
69  MatrixType (const SparseMatrix &a);
70 
72 
73  MatrixType (const matrix_type t, bool _full = false);
74 
75  MatrixType (const matrix_type t, const octave_idx_type np,
76  const octave_idx_type *p, bool _full = false);
77 
78  MatrixType (const matrix_type t, const octave_idx_type ku,
79  const octave_idx_type kl, bool _full = false);
80 
81  ~MatrixType (void);
82 
84 
85  int type (bool quiet = true);
86 
87  int type (const Matrix &a);
88 
89  int type (const ComplexMatrix &a);
90 
91  int type (const FloatMatrix &a);
92 
93  int type (const FloatComplexMatrix &a);
94 
95  int type (const SparseMatrix &a);
96 
97  int type (const SparseComplexMatrix &a);
98 
99  double band_density (void) const { return bandden; }
100 
101  int nupper (void) const { return upper_band; }
102 
103  int nlower (void) const { return lower_band; }
104 
105  bool is_dense (void) const { return dense; }
106 
107  bool is_diagonal (void) const
108  { return (typ == Diagonal || typ == Permuted_Diagonal); }
109 
110  bool is_upper_triangular (void) const
111  { return (typ == Upper || typ == Permuted_Upper); }
112 
113  bool is_lower_triangular (void) const
114  { return (typ == Lower || typ == Permuted_Lower); }
115 
116  bool is_banded (void)
117  { return (typ == Banded || typ == Banded_Hermitian); }
118 
119  bool is_tridiagonal (void) const
120  { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); }
121 
122  bool is_hermitian (void) const
123  {
124  return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian
125  || typ == Hermitian);
126  }
127 
128  bool is_rectangular (void) const { return (typ == Rectangular); }
129 
130  bool is_known (void) const { return (typ != Unknown); }
131 
132  bool is_unknown (void) const { return (typ == Unknown); }
133 
134  void info (void) const;
135 
136  octave_idx_type * triangular_perm (void) const { return perm; }
137 
138  void invalidate_type (void) { typ = Unknown; }
139 
140  void mark_as_diagonal (void) { typ = Diagonal; }
141 
142  void mark_as_permuted_diagonal (void) { typ = Permuted_Diagonal; }
143 
144  void mark_as_upper_triangular (void) { typ = Upper; }
145 
146  void mark_as_lower_triangular (void) { typ = Lower; }
147 
148  void mark_as_tridiagonal (void) {typ = Tridiagonal; }
149 
151  { typ = Banded; upper_band = ku; lower_band = kl; }
152 
153  void mark_as_full (void) { typ = Full; }
154 
155  void mark_as_rectangular (void) { typ = Rectangular; }
156 
157  void mark_as_dense (void) { dense = true; }
158 
159  void mark_as_not_dense (void) { dense = false; }
160 
161  void mark_as_symmetric (void);
162 
163  void mark_as_unsymmetric (void);
164 
165  void mark_as_permuted (const octave_idx_type np, const octave_idx_type *p);
166 
167  void mark_as_unpermuted (void);
168 
169  MatrixType transpose (void) const;
170 
171 private:
172  void type (int new_typ) { typ = static_cast<matrix_type>(new_typ); }
173 
175  double sp_bandden;
176  double bandden;
179  bool dense;
180  bool full;
183 };
184 
185 #endif
void mark_as_lower_triangular(void)
Definition: MatrixType.h:146
void mark_as_diagonal(void)
Definition: MatrixType.h:140
bool is_banded(void)
Definition: MatrixType.h:116
bool is_unknown(void) const
Definition: MatrixType.h:132
bool is_lower_triangular(void) const
Definition: MatrixType.h:113
bool is_tridiagonal(void) const
Definition: MatrixType.h:119
int nupper(void) const
Definition: MatrixType.h:101
double sp_bandden
Definition: MatrixType.h:175
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:382
void mark_as_permuted_diagonal(void)
Definition: MatrixType.h:142
bool is_hermitian(void) const
Definition: MatrixType.h:122
bool is_dense(void) const
Definition: MatrixType.h:105
void mark_as_full(void)
Definition: MatrixType.h:153
bool is_known(void) const
Definition: MatrixType.h:130
bool dense
Definition: MatrixType.h:179
octave_idx_type * triangular_perm(void) const
Definition: MatrixType.h:136
octave_idx_type lower_band
Definition: MatrixType.h:178
void type(int new_typ)
Definition: MatrixType.h:172
octave_idx_type upper_band
Definition: MatrixType.h:177
octave_idx_type nperm
Definition: MatrixType.h:181
void mark_as_upper_triangular(void)
Definition: MatrixType.h:144
void mark_as_dense(void)
Definition: MatrixType.h:157
int nlower(void) const
Definition: MatrixType.h:103
Definition: dMatrix.h:35
matrix_type typ
Definition: MatrixType.h:174
void mark_as_rectangular(void)
Definition: MatrixType.h:155
void invalidate_type(void)
Definition: MatrixType.h:138
octave_idx_type * perm
Definition: MatrixType.h:182
bool is_rectangular(void) const
Definition: MatrixType.h:128
void mark_as_not_dense(void)
Definition: MatrixType.h:159
void mark_as_tridiagonal(void)
Definition: MatrixType.h:148
bool is_diagonal(void) const
Definition: MatrixType.h:107
void mark_as_banded(const octave_idx_type ku, const octave_idx_type kl)
Definition: MatrixType.h:150
double band_density(void) const
Definition: MatrixType.h:99
bool is_upper_triangular(void) const
Definition: MatrixType.h:110
double bandden
Definition: MatrixType.h:176
SparseComplexMatrix & operator=(const SparseComplexMatrix &a)
Definition: CSparse.h:104