Mercurial > hg > octave-nkf
annotate liboctave/array/MatrixType.h @ 20071:17d647821d61
maint: More cleanup of C++ code to follow Octave coding conventions.
* gl-select.cc, betainc.cc, bitfcns.cc, bsxfun.cc, gl-render.cc,
graphics.cc, load-save.cc, ls-mat-ascii.cc, ls-mat5.cc, lu.cc,
oct-stream.cc, symtab.cc, variables.cc, __eigs__.cc,
__magick_read__.cc, chol.cc, ov-base-sparse.cc, ov-class.cc,
ov-classdef.cc, ov-fcn-inline.cc, ov-perm.cc, ov.cc, CMatrix.cc,
CSparse.cc, MSparse.cc, MatrixType.cc, MatrixType.h, dMatrix.cc,
dSparse.cc, fCMatrix.cc, fMatrix.cc, eigs-base.cc, lo-sysdep.cc,
kpse.cc: Break long lines before && and ||.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 26 Feb 2015 13:07:04 -0500 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
5785 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
3 Copyright (C) 2006-2015 David Bateman |
5785 | 4 Copyright (C) 2006 Andy Adler |
5 | |
7016 | 6 This file is part of Octave. |
7 | |
5785 | 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
5785 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5785 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_MatrixType_h) | |
25 #define octave_MatrixType_h | |
26 | |
27 class Matrix; | |
28 class ComplexMatrix; | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
29 class FloatMatrix; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
30 class FloatComplexMatrix; |
5785 | 31 class SparseMatrix; |
32 class SparseComplexMatrix; | |
33 | |
34 class | |
6108 | 35 OCTAVE_API |
5785 | 36 MatrixType |
37 { | |
38 public: | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
39 enum matrix_type |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
40 { |
5785 | 41 Unknown = 0, |
42 Full, | |
43 Diagonal, | |
44 Permuted_Diagonal, | |
45 Upper, | |
46 Lower, | |
47 Permuted_Upper, | |
48 Permuted_Lower, | |
49 Banded, | |
50 Hermitian, | |
51 Banded_Hermitian, | |
52 Tridiagonal, | |
53 Tridiagonal_Hermitian, | |
54 Rectangular | |
55 }; | |
56 | |
57 MatrixType (void); | |
6376 | 58 |
5785 | 59 MatrixType (const MatrixType &a); |
60 | |
61 MatrixType (const Matrix &a); | |
62 | |
63 MatrixType (const ComplexMatrix &a); | |
64 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
65 MatrixType (const FloatMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
66 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
67 MatrixType (const FloatComplexMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
68 |
5785 | 69 MatrixType (const SparseMatrix &a); |
70 | |
71 MatrixType (const SparseComplexMatrix &a); | |
72 | |
73 MatrixType (const matrix_type t, bool _full = false); | |
74 | |
75 MatrixType (const matrix_type t, const octave_idx_type np, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
76 const octave_idx_type *p, bool _full = false); |
5785 | 77 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
78 MatrixType (const matrix_type t, const octave_idx_type ku, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
79 const octave_idx_type kl, bool _full = false); |
5785 | 80 |
81 ~MatrixType (void); | |
82 | |
83 MatrixType& operator = (const MatrixType& a); | |
84 | |
85 int type (bool quiet = true); | |
86 | |
87 int type (const Matrix &a); | |
88 | |
89 int type (const ComplexMatrix &a); | |
90 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
91 int type (const FloatMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
92 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
93 int type (const FloatComplexMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
94 |
5785 | 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 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
107 bool is_diagonal (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
108 { return (typ == Diagonal || typ == Permuted_Diagonal); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
109 |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
110 bool is_upper_triangular (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
111 { return (typ == Upper || typ == Permuted_Upper); } |
5785 | 112 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
113 bool is_lower_triangular (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
114 { return (typ == Lower || typ == Permuted_Lower); } |
5785 | 115 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
116 bool is_banded (void) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
117 { return (typ == Banded || typ == Banded_Hermitian); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
118 |
5785 | 119 bool is_tridiagonal (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
121 |
5785 | 122 bool is_hermitian (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
123 { |
20071
17d647821d61
maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents:
19898
diff
changeset
|
124 return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian |
17d647821d61
maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents:
19898
diff
changeset
|
125 || typ == Hermitian); |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 } |
5785 | 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 | |
150 void mark_as_banded (const octave_idx_type ku, const octave_idx_type kl) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
151 { typ = Banded; upper_band = ku; lower_band = kl; } |
5785 | 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 | |
174 matrix_type typ; | |
175 double sp_bandden; | |
176 double bandden; | |
177 octave_idx_type upper_band; | |
178 octave_idx_type lower_band; | |
179 bool dense; | |
180 bool full; | |
181 octave_idx_type nperm; | |
182 octave_idx_type *perm; | |
183 }; | |
184 | |
185 #endif |