5785
|
1 /* |
|
2 |
|
3 Copyright (C) 2006 David Bateman |
|
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; |
|
29 class SparseMatrix; |
|
30 class SparseComplexMatrix; |
|
31 |
|
32 class |
6108
|
33 OCTAVE_API |
5785
|
34 MatrixType |
|
35 { |
|
36 public: |
|
37 enum matrix_type { |
|
38 Unknown = 0, |
|
39 Full, |
|
40 Diagonal, |
|
41 Permuted_Diagonal, |
|
42 Upper, |
|
43 Lower, |
|
44 Permuted_Upper, |
|
45 Permuted_Lower, |
|
46 Banded, |
|
47 Hermitian, |
|
48 Banded_Hermitian, |
|
49 Tridiagonal, |
|
50 Tridiagonal_Hermitian, |
|
51 Rectangular |
|
52 }; |
|
53 |
|
54 MatrixType (void); |
6376
|
55 |
5785
|
56 MatrixType (const MatrixType &a); |
|
57 |
|
58 MatrixType (const Matrix &a); |
|
59 |
|
60 MatrixType (const ComplexMatrix &a); |
|
61 |
|
62 MatrixType (const SparseMatrix &a); |
|
63 |
|
64 MatrixType (const SparseComplexMatrix &a); |
|
65 |
|
66 MatrixType (const matrix_type t, bool _full = false); |
|
67 |
|
68 MatrixType (const matrix_type t, const octave_idx_type np, |
|
69 const octave_idx_type *p, bool _full = false); |
|
70 |
|
71 MatrixType (const matrix_type t, const octave_idx_type ku, |
|
72 const octave_idx_type kl, bool _full = false); |
|
73 |
|
74 ~MatrixType (void); |
|
75 |
|
76 MatrixType& operator = (const MatrixType& a); |
|
77 |
|
78 int type (bool quiet = true); |
|
79 |
|
80 int type (const Matrix &a); |
|
81 |
|
82 int type (const ComplexMatrix &a); |
|
83 |
|
84 int type (const SparseMatrix &a); |
|
85 |
|
86 int type (const SparseComplexMatrix &a); |
|
87 |
|
88 double band_density (void) const { return bandden; } |
|
89 |
|
90 int nupper (void) const { return upper_band; } |
|
91 |
|
92 int nlower (void) const { return lower_band; } |
|
93 |
|
94 bool is_dense (void) const { return dense; } |
|
95 |
|
96 bool is_diagonal (void) const |
|
97 { return (typ == Diagonal || typ == Permuted_Diagonal); } |
|
98 |
|
99 bool is_upper_triangular (void) const |
|
100 { return (typ == Upper || typ == Permuted_Upper); } |
|
101 |
|
102 bool is_lower_triangular (void) const |
|
103 { return (typ == Lower || typ == Permuted_Lower); } |
|
104 |
|
105 bool is_banded (void) |
|
106 { return (typ == Banded || typ == Banded_Hermitian); } |
|
107 |
|
108 bool is_tridiagonal (void) const |
|
109 { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } |
|
110 |
|
111 bool is_hermitian (void) const |
|
112 { return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian || |
|
113 typ == Hermitian); } |
|
114 |
|
115 bool is_rectangular (void) const { return (typ == Rectangular); } |
|
116 |
|
117 bool is_known (void) const { return (typ != Unknown); } |
|
118 |
|
119 bool is_unknown (void) const { return (typ == Unknown); } |
|
120 |
|
121 void info (void) const; |
|
122 |
|
123 octave_idx_type * triangular_perm (void) const { return perm; } |
|
124 |
|
125 void invalidate_type (void) { typ = Unknown; } |
|
126 |
|
127 void mark_as_diagonal (void) { typ = Diagonal; } |
|
128 |
|
129 void mark_as_permuted_diagonal (void) { typ = Permuted_Diagonal; } |
|
130 |
|
131 void mark_as_upper_triangular (void) { typ = Upper; } |
|
132 |
|
133 void mark_as_lower_triangular (void) { typ = Lower; } |
|
134 |
|
135 void mark_as_tridiagonal (void) {typ = Tridiagonal; } |
|
136 |
|
137 void mark_as_banded (const octave_idx_type ku, const octave_idx_type kl) |
|
138 { typ = Banded; upper_band = ku; lower_band = kl; } |
|
139 |
|
140 void mark_as_full (void) { typ = Full; } |
|
141 |
|
142 void mark_as_rectangular (void) { typ = Rectangular; } |
|
143 |
|
144 void mark_as_dense (void) { dense = true; } |
|
145 |
|
146 void mark_as_not_dense (void) { dense = false; } |
|
147 |
|
148 void mark_as_symmetric (void); |
|
149 |
|
150 void mark_as_unsymmetric (void); |
|
151 |
|
152 void mark_as_permuted (const octave_idx_type np, const octave_idx_type *p); |
|
153 |
|
154 void mark_as_unpermuted (void); |
|
155 |
|
156 MatrixType transpose (void) const; |
|
157 |
|
158 private: |
|
159 void type (int new_typ) { typ = static_cast<matrix_type>(new_typ); } |
|
160 |
|
161 matrix_type typ; |
|
162 double sp_bandden; |
|
163 double bandden; |
|
164 octave_idx_type upper_band; |
|
165 octave_idx_type lower_band; |
|
166 bool dense; |
|
167 bool full; |
|
168 octave_idx_type nperm; |
|
169 octave_idx_type *perm; |
|
170 }; |
|
171 |
|
172 #endif |
|
173 |
|
174 /* |
|
175 ;;; Local Variables: *** |
|
176 ;;; mode: C++ *** |
|
177 ;;; End: *** |
|
178 */ |