Mercurial > hg > octave-lyh
annotate liboctave/MatrixType.h @ 8920:eb63fbe60fab
update copyright notices
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 07 Mar 2009 10:41:27 -0500 |
parents | 72c332d2db3c |
children | 11844593875a |
rev | line source |
---|---|
5785 | 1 /* |
2 | |
8920 | 3 Copyright (C) 2006, 2007, 2008 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 | |
7894
72c332d2db3c
add missing include in MatrixType.h
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
27 #include "oct-types.h" |
72c332d2db3c
add missing include in MatrixType.h
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
28 |
5785 | 29 class Matrix; |
30 class ComplexMatrix; | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
31 class FloatMatrix; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
32 class FloatComplexMatrix; |
5785 | 33 class SparseMatrix; |
34 class SparseComplexMatrix; | |
35 | |
36 class | |
6108 | 37 OCTAVE_API |
5785 | 38 MatrixType |
39 { | |
40 public: | |
41 enum matrix_type { | |
42 Unknown = 0, | |
43 Full, | |
44 Diagonal, | |
45 Permuted_Diagonal, | |
46 Upper, | |
47 Lower, | |
48 Permuted_Upper, | |
49 Permuted_Lower, | |
50 Banded, | |
51 Hermitian, | |
52 Banded_Hermitian, | |
53 Tridiagonal, | |
54 Tridiagonal_Hermitian, | |
55 Rectangular | |
56 }; | |
57 | |
58 MatrixType (void); | |
6376 | 59 |
5785 | 60 MatrixType (const MatrixType &a); |
61 | |
62 MatrixType (const Matrix &a); | |
63 | |
64 MatrixType (const ComplexMatrix &a); | |
65 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
66 MatrixType (const FloatMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
67 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
68 MatrixType (const FloatComplexMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
69 |
5785 | 70 MatrixType (const SparseMatrix &a); |
71 | |
72 MatrixType (const SparseComplexMatrix &a); | |
73 | |
74 MatrixType (const matrix_type t, bool _full = false); | |
75 | |
76 MatrixType (const matrix_type t, const octave_idx_type np, | |
77 const octave_idx_type *p, bool _full = false); | |
78 | |
79 MatrixType (const matrix_type t, const octave_idx_type ku, | |
80 const octave_idx_type kl, bool _full = false); | |
81 | |
82 ~MatrixType (void); | |
83 | |
84 MatrixType& operator = (const MatrixType& a); | |
85 | |
86 int type (bool quiet = true); | |
87 | |
88 int type (const Matrix &a); | |
89 | |
90 int type (const ComplexMatrix &a); | |
91 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
92 int type (const FloatMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
93 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
94 int type (const FloatComplexMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
95 |
5785 | 96 int type (const SparseMatrix &a); |
97 | |
98 int type (const SparseComplexMatrix &a); | |
99 | |
100 double band_density (void) const { return bandden; } | |
101 | |
102 int nupper (void) const { return upper_band; } | |
103 | |
104 int nlower (void) const { return lower_band; } | |
105 | |
106 bool is_dense (void) const { return dense; } | |
107 | |
108 bool is_diagonal (void) const | |
109 { return (typ == Diagonal || typ == Permuted_Diagonal); } | |
110 | |
111 bool is_upper_triangular (void) const | |
112 { return (typ == Upper || typ == Permuted_Upper); } | |
113 | |
114 bool is_lower_triangular (void) const | |
115 { return (typ == Lower || typ == Permuted_Lower); } | |
116 | |
117 bool is_banded (void) | |
118 { return (typ == Banded || typ == Banded_Hermitian); } | |
119 | |
120 bool is_tridiagonal (void) const | |
121 { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } | |
122 | |
123 bool is_hermitian (void) const | |
124 { return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian || | |
125 typ == Hermitian); } | |
126 | |
127 bool is_rectangular (void) const { return (typ == Rectangular); } | |
128 | |
129 bool is_known (void) const { return (typ != Unknown); } | |
130 | |
131 bool is_unknown (void) const { return (typ == Unknown); } | |
132 | |
133 void info (void) const; | |
134 | |
135 octave_idx_type * triangular_perm (void) const { return perm; } | |
136 | |
137 void invalidate_type (void) { typ = Unknown; } | |
138 | |
139 void mark_as_diagonal (void) { typ = Diagonal; } | |
140 | |
141 void mark_as_permuted_diagonal (void) { typ = Permuted_Diagonal; } | |
142 | |
143 void mark_as_upper_triangular (void) { typ = Upper; } | |
144 | |
145 void mark_as_lower_triangular (void) { typ = Lower; } | |
146 | |
147 void mark_as_tridiagonal (void) {typ = Tridiagonal; } | |
148 | |
149 void mark_as_banded (const octave_idx_type ku, const octave_idx_type kl) | |
150 { typ = Banded; upper_band = ku; lower_band = kl; } | |
151 | |
152 void mark_as_full (void) { typ = Full; } | |
153 | |
154 void mark_as_rectangular (void) { typ = Rectangular; } | |
155 | |
156 void mark_as_dense (void) { dense = true; } | |
157 | |
158 void mark_as_not_dense (void) { dense = false; } | |
159 | |
160 void mark_as_symmetric (void); | |
161 | |
162 void mark_as_unsymmetric (void); | |
163 | |
164 void mark_as_permuted (const octave_idx_type np, const octave_idx_type *p); | |
165 | |
166 void mark_as_unpermuted (void); | |
167 | |
168 MatrixType transpose (void) const; | |
169 | |
170 private: | |
171 void type (int new_typ) { typ = static_cast<matrix_type>(new_typ); } | |
172 | |
173 matrix_type typ; | |
174 double sp_bandden; | |
175 double bandden; | |
176 octave_idx_type upper_band; | |
177 octave_idx_type lower_band; | |
178 bool dense; | |
179 bool full; | |
180 octave_idx_type nperm; | |
181 octave_idx_type *perm; | |
182 }; | |
183 | |
184 #endif | |
185 | |
186 /* | |
187 ;;; Local Variables: *** | |
188 ;;; mode: C++ *** | |
189 ;;; End: *** | |
190 */ |