5785
|
1 /* |
|
2 |
|
3 Copyright (C) 2006 David Bateman |
|
4 Copyright (C) 2006 Andy Adler |
|
5 |
|
6 Octave is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License as published by the |
|
8 Free Software Foundation; either version 2, or (at your option) any |
|
9 later version. |
|
10 |
|
11 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 for more details. |
|
15 |
|
16 You should have received a copy of the GNU General Public License |
|
17 along with this program; see the file COPYING. If not, write to the |
|
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 Boston, MA 02110-1301, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_MatrixType_h) |
|
24 #define octave_MatrixType_h |
|
25 |
|
26 class Matrix; |
|
27 class ComplexMatrix; |
|
28 class SparseMatrix; |
|
29 class SparseComplexMatrix; |
|
30 |
|
31 class |
6108
|
32 OCTAVE_API |
5785
|
33 MatrixType |
|
34 { |
|
35 public: |
|
36 enum matrix_type { |
|
37 Unknown = 0, |
|
38 Full, |
|
39 Diagonal, |
|
40 Permuted_Diagonal, |
|
41 Upper, |
|
42 Lower, |
|
43 Permuted_Upper, |
|
44 Permuted_Lower, |
|
45 Banded, |
|
46 Hermitian, |
|
47 Banded_Hermitian, |
|
48 Tridiagonal, |
|
49 Tridiagonal_Hermitian, |
|
50 Rectangular |
|
51 }; |
|
52 |
|
53 MatrixType (void); |
6376
|
54 |
5785
|
55 MatrixType (const MatrixType &a); |
|
56 |
|
57 MatrixType (const Matrix &a); |
|
58 |
|
59 MatrixType (const ComplexMatrix &a); |
|
60 |
|
61 MatrixType (const SparseMatrix &a); |
|
62 |
|
63 MatrixType (const SparseComplexMatrix &a); |
|
64 |
|
65 MatrixType (const matrix_type t, bool _full = false); |
|
66 |
|
67 MatrixType (const matrix_type t, const octave_idx_type np, |
|
68 const octave_idx_type *p, bool _full = false); |
|
69 |
|
70 MatrixType (const matrix_type t, const octave_idx_type ku, |
|
71 const octave_idx_type kl, bool _full = false); |
|
72 |
|
73 ~MatrixType (void); |
|
74 |
|
75 MatrixType& operator = (const MatrixType& a); |
|
76 |
|
77 int type (bool quiet = true); |
|
78 |
|
79 int type (const Matrix &a); |
|
80 |
|
81 int type (const ComplexMatrix &a); |
|
82 |
|
83 int type (const SparseMatrix &a); |
|
84 |
|
85 int type (const SparseComplexMatrix &a); |
|
86 |
|
87 double band_density (void) const { return bandden; } |
|
88 |
|
89 int nupper (void) const { return upper_band; } |
|
90 |
|
91 int nlower (void) const { return lower_band; } |
|
92 |
|
93 bool is_dense (void) const { return dense; } |
|
94 |
|
95 bool is_diagonal (void) const |
|
96 { return (typ == Diagonal || typ == Permuted_Diagonal); } |
|
97 |
|
98 bool is_upper_triangular (void) const |
|
99 { return (typ == Upper || typ == Permuted_Upper); } |
|
100 |
|
101 bool is_lower_triangular (void) const |
|
102 { return (typ == Lower || typ == Permuted_Lower); } |
|
103 |
|
104 bool is_banded (void) |
|
105 { return (typ == Banded || typ == Banded_Hermitian); } |
|
106 |
|
107 bool is_tridiagonal (void) const |
|
108 { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } |
|
109 |
|
110 bool is_hermitian (void) const |
|
111 { return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian || |
|
112 typ == Hermitian); } |
|
113 |
|
114 bool is_rectangular (void) const { return (typ == Rectangular); } |
|
115 |
|
116 bool is_known (void) const { return (typ != Unknown); } |
|
117 |
|
118 bool is_unknown (void) const { return (typ == Unknown); } |
|
119 |
|
120 void info (void) const; |
|
121 |
|
122 octave_idx_type * triangular_perm (void) const { return perm; } |
|
123 |
|
124 void invalidate_type (void) { typ = Unknown; } |
|
125 |
|
126 void mark_as_diagonal (void) { typ = Diagonal; } |
|
127 |
|
128 void mark_as_permuted_diagonal (void) { typ = Permuted_Diagonal; } |
|
129 |
|
130 void mark_as_upper_triangular (void) { typ = Upper; } |
|
131 |
|
132 void mark_as_lower_triangular (void) { typ = Lower; } |
|
133 |
|
134 void mark_as_tridiagonal (void) {typ = Tridiagonal; } |
|
135 |
|
136 void mark_as_banded (const octave_idx_type ku, const octave_idx_type kl) |
|
137 { typ = Banded; upper_band = ku; lower_band = kl; } |
|
138 |
|
139 void mark_as_full (void) { typ = Full; } |
|
140 |
|
141 void mark_as_rectangular (void) { typ = Rectangular; } |
|
142 |
|
143 void mark_as_dense (void) { dense = true; } |
|
144 |
|
145 void mark_as_not_dense (void) { dense = false; } |
|
146 |
|
147 void mark_as_symmetric (void); |
|
148 |
|
149 void mark_as_unsymmetric (void); |
|
150 |
|
151 void mark_as_permuted (const octave_idx_type np, const octave_idx_type *p); |
|
152 |
|
153 void mark_as_unpermuted (void); |
|
154 |
|
155 MatrixType transpose (void) const; |
|
156 |
|
157 private: |
|
158 void type (int new_typ) { typ = static_cast<matrix_type>(new_typ); } |
|
159 |
|
160 matrix_type typ; |
|
161 double sp_bandden; |
|
162 double bandden; |
|
163 octave_idx_type upper_band; |
|
164 octave_idx_type lower_band; |
|
165 bool dense; |
|
166 bool full; |
|
167 octave_idx_type nperm; |
|
168 octave_idx_type *perm; |
|
169 }; |
|
170 |
|
171 #endif |
|
172 |
|
173 /* |
|
174 ;;; Local Variables: *** |
|
175 ;;; mode: C++ *** |
|
176 ;;; End: *** |
|
177 */ |