Mercurial > hg > octave-lyh
annotate liboctave/dMatrix.h @ 11498:367bfee35ba0
data member initialization fixes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Jan 2011 02:37:45 -0500 |
parents | 96ed7c629bbd |
children | fd0a3ac60b0e |
rev | line source |
---|---|
458 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, |
8920 | 4 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton |
458 | 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
458 | 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/>. | |
458 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_Matrix_int_h) | |
25 #define octave_Matrix_int_h 1 | |
26 | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
27 #include "MArray.h" |
1989 | 28 #include "MDiagArray2.h" |
5785 | 29 #include "MatrixType.h" |
458 | 30 |
31 #include "mx-defs.h" | |
8774
b756ce0002db
split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents:
8650
diff
changeset
|
32 #include "mx-op-decl.h" |
8335 | 33 #include "DET.h" |
458 | 34 |
3585 | 35 class |
6108 | 36 OCTAVE_API |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
37 Matrix : public MArray<double> |
458 | 38 { |
39 public: | |
40 | |
9656
b29504415a2e
provide NDArray->Matrix->Vector typedef mappers
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
41 typedef ColumnVector column_vector_type; |
b29504415a2e
provide NDArray->Matrix->Vector typedef mappers
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
42 typedef RowVector row_vector_type; |
b29504415a2e
provide NDArray->Matrix->Vector typedef mappers
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
43 |
7788 | 44 typedef void (*solve_singularity_handler) (double rcon); |
3480 | 45 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
46 Matrix (void) : MArray<double> () { } |
3585 | 47 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
48 Matrix (octave_idx_type r, octave_idx_type c) : MArray<double> (r, c) { } |
3585 | 49 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
50 Matrix (octave_idx_type r, octave_idx_type c, double val) : MArray<double> (r, c, val) { } |
3585 | 51 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
52 Matrix (const dim_vector& dv) : MArray<double> (dv.redim (2)) { } |
6979 | 53 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
54 Matrix (const dim_vector& dv, double val) : MArray<double> (dv.redim (2), val) { } |
6979 | 55 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
56 Matrix (const Matrix& a) : MArray<double> (a) { } |
3585 | 57 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7788
diff
changeset
|
58 template <class U> |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
59 Matrix (const MArray<U>& a) : MArray<double> (a.as_matrix ()) { } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7788
diff
changeset
|
60 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7788
diff
changeset
|
61 template <class U> |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
62 Matrix (const Array<U>& a) : MArray<double> (a.as_matrix ()) { } |
10301
9e0ec19df4bc
commit accidentally omitted parts of previous change
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
63 |
3585 | 64 explicit Matrix (const RowVector& rv); |
458 | 65 |
3585 | 66 explicit Matrix (const ColumnVector& cv); |
67 | |
68 explicit Matrix (const DiagMatrix& a); | |
69 | |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8336
diff
changeset
|
70 explicit Matrix (const PermMatrix& a); |
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8336
diff
changeset
|
71 |
3585 | 72 explicit Matrix (const boolMatrix& a); |
73 | |
74 explicit Matrix (const charMatrix& a); | |
1574 | 75 |
458 | 76 Matrix& operator = (const Matrix& a) |
77 { | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
78 MArray<double>::operator = (a); |
458 | 79 return *this; |
80 } | |
81 | |
2385 | 82 bool operator == (const Matrix& a) const; |
83 bool operator != (const Matrix& a) const; | |
458 | 84 |
3354 | 85 bool is_symmetric (void) const; |
86 | |
1359 | 87 // destructive insert/delete/reorder operations |
458 | 88 |
5275 | 89 Matrix& insert (const Matrix& a, octave_idx_type r, octave_idx_type c); |
90 Matrix& insert (const RowVector& a, octave_idx_type r, octave_idx_type c); | |
91 Matrix& insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c); | |
92 Matrix& insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c); | |
458 | 93 |
94 Matrix& fill (double val); | |
5275 | 95 Matrix& fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); |
458 | 96 |
97 Matrix append (const Matrix& a) const; | |
98 Matrix append (const RowVector& a) const; | |
99 Matrix append (const ColumnVector& a) const; | |
100 Matrix append (const DiagMatrix& a) const; | |
101 | |
102 Matrix stack (const Matrix& a) const; | |
103 Matrix stack (const RowVector& a) const; | |
104 Matrix stack (const ColumnVector& a) const; | |
105 Matrix stack (const DiagMatrix& a) const; | |
106 | |
6108 | 107 friend OCTAVE_API Matrix real (const ComplexMatrix& a); |
108 friend OCTAVE_API Matrix imag (const ComplexMatrix& a); | |
1205 | 109 |
8650
a1ae2aae903e
abs,real,imag,conj: use code from mx-inlines rather than the generic map
Jaroslav Hajek <highegg@gmail.com>
parents:
8392
diff
changeset
|
110 friend class ComplexMatrix; |
a1ae2aae903e
abs,real,imag,conj: use code from mx-inlines rather than the generic map
Jaroslav Hajek <highegg@gmail.com>
parents:
8392
diff
changeset
|
111 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
112 Matrix transpose (void) const { return MArray<double>::transpose (); } |
3225 | 113 |
1359 | 114 // resize is the destructive equivalent for this one |
458 | 115 |
5275 | 116 Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
458 | 117 |
5275 | 118 Matrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const; |
4316 | 119 |
1359 | 120 // extract row or column i. |
458 | 121 |
5275 | 122 RowVector row (octave_idx_type i) const; |
458 | 123 |
5275 | 124 ColumnVector column (octave_idx_type i) const; |
458 | 125 |
6207 | 126 private: |
7788 | 127 Matrix tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
128 int force, int calc_cond) const; |
6207 | 129 |
7788 | 130 Matrix finverse (MatrixType &mattype, octave_idx_type& info, double& rcon, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
131 int force, int calc_cond) const; |
6207 | 132 |
133 public: | |
458 | 134 Matrix inverse (void) const; |
6479 | 135 Matrix inverse (octave_idx_type& info) const; |
7788 | 136 Matrix inverse (octave_idx_type& info, double& rcon, int force = 0, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
137 int calc_cond = 1) const; |
6479 | 138 |
6207 | 139 Matrix inverse (MatrixType &mattype) const; |
140 Matrix inverse (MatrixType &mattype, octave_idx_type& info) const; | |
7788 | 141 Matrix inverse (MatrixType &mattype, octave_idx_type& info, double& rcon, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
142 int force = 0, int calc_cond = 1) const; |
458 | 143 |
4384 | 144 Matrix pseudo_inverse (double tol = 0.0) const; |
740 | 145 |
458 | 146 ComplexMatrix fourier (void) const; |
147 ComplexMatrix ifourier (void) const; | |
148 | |
677 | 149 ComplexMatrix fourier2d (void) const; |
150 ComplexMatrix ifourier2d (void) const; | |
151 | |
458 | 152 DET determinant (void) const; |
5275 | 153 DET determinant (octave_idx_type& info) const; |
7788 | 154 DET determinant (octave_idx_type& info, double& rcon, int calc_cond = 1) const; |
8336
9813c07ca946
make det take advantage of matrix type
Jaroslav Hajek <highegg@gmail.com>
parents:
8335
diff
changeset
|
155 DET determinant (MatrixType &mattype, octave_idx_type& info, |
9813c07ca946
make det take advantage of matrix type
Jaroslav Hajek <highegg@gmail.com>
parents:
8335
diff
changeset
|
156 double& rcon, int calc_cond = 1) const; |
7788 | 157 |
158 double rcond (void) const; | |
159 double rcond (MatrixType &mattype) const; | |
458 | 160 |
5785 | 161 private: |
162 // Upper triangular matrix solvers | |
163 Matrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
164 double& rcon, solve_singularity_handler sing_handler, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
165 bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; |
5785 | 166 |
167 // Lower triangular matrix solvers | |
168 Matrix ltsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
169 double& rcon, solve_singularity_handler sing_handler, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
170 bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; |
5785 | 171 |
172 // Full matrix solvers (lu/cholesky) | |
173 Matrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
174 double& rcon, solve_singularity_handler sing_handler, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
175 bool calc_cond = false) const; |
5785 | 176 |
177 public: | |
178 // Generic interface to solver with no probing of type | |
179 Matrix solve (MatrixType &typ, const Matrix& b) const; | |
180 Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) const; | |
181 Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
182 double& rcon) const; |
5785 | 183 Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
184 double& rcon, solve_singularity_handler sing_handler, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
185 bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; |
5785 | 186 |
187 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; | |
188 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
189 octave_idx_type& info) const; |
5785 | 190 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
191 octave_idx_type& info, double& rcon) const; |
5785 | 192 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
193 octave_idx_type& info, double& rcon, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
194 solve_singularity_handler sing_handler, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
195 bool singular_fallback = true, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
196 blas_trans_type transt = blas_no_trans) const; |
5785 | 197 |
198 ColumnVector solve (MatrixType &typ, const ColumnVector& b) const; | |
199 ColumnVector solve (MatrixType &typ, const ColumnVector& b, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
200 octave_idx_type& info) const; |
5785 | 201 ColumnVector solve (MatrixType &typ, const ColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
202 octave_idx_type& info, double& rcon) const; |
5785 | 203 ColumnVector solve (MatrixType &typ, const ColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
204 octave_idx_type& info, double& rcon, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
205 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
206 blas_trans_type transt = blas_no_trans) const; |
5785 | 207 |
208 ComplexColumnVector solve (MatrixType &typ, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
209 const ComplexColumnVector& b) const; |
5785 | 210 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
211 octave_idx_type& info) const; |
5785 | 212 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
213 octave_idx_type& info, double& rcon) const; |
5785 | 214 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
215 octave_idx_type& info, double& rcon, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
216 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
217 blas_trans_type transt = blas_no_trans) const; |
5785 | 218 |
219 // Generic interface to solver with probing of type | |
458 | 220 Matrix solve (const Matrix& b) const; |
5275 | 221 Matrix solve (const Matrix& b, octave_idx_type& info) const; |
7788 | 222 Matrix solve (const Matrix& b, octave_idx_type& info, double& rcon) const; |
223 Matrix solve (const Matrix& b, octave_idx_type& info, double& rcon, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
224 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
225 blas_trans_type transt = blas_no_trans) const; |
458 | 226 |
227 ComplexMatrix solve (const ComplexMatrix& b) const; | |
5275 | 228 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; |
7788 | 229 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon) const; |
230 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
231 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
232 blas_trans_type transt = blas_no_trans) const; |
458 | 233 |
234 ColumnVector solve (const ColumnVector& b) const; | |
5275 | 235 ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; |
7788 | 236 ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon) const; |
237 ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
238 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
239 blas_trans_type transt = blas_no_trans) const; |
458 | 240 |
241 ComplexColumnVector solve (const ComplexColumnVector& b) const; | |
5275 | 242 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; |
243 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
244 double& rcon) const; |
5275 | 245 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
246 double& rcon, solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
247 blas_trans_type transt = blas_no_trans) const; |
458 | 248 |
5785 | 249 // Singular solvers |
458 | 250 Matrix lssolve (const Matrix& b) const; |
5275 | 251 Matrix lssolve (const Matrix& b, octave_idx_type& info) const; |
7076 | 252 Matrix lssolve (const Matrix& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
253 octave_idx_type& rank) const; |
7076 | 254 Matrix lssolve (const Matrix& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
255 octave_idx_type& rank, double& rcon) const; |
458 | 256 |
257 ComplexMatrix lssolve (const ComplexMatrix& b) const; | |
5275 | 258 ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info) const; |
259 ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
260 octave_idx_type& rank) const; |
7076 | 261 ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
262 octave_idx_type& rank, double &rcon) const; |
458 | 263 |
264 ColumnVector lssolve (const ColumnVector& b) const; | |
5275 | 265 ColumnVector lssolve (const ColumnVector& b, octave_idx_type& info) const; |
7076 | 266 ColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
267 octave_idx_type& rank) const; |
7076 | 268 ColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
269 octave_idx_type& rank, double& rcon) const; |
458 | 270 |
271 ComplexColumnVector lssolve (const ComplexColumnVector& b) const; | |
7076 | 272 ComplexColumnVector lssolve (const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
273 octave_idx_type& info) const; |
7076 | 274 ComplexColumnVector lssolve (const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
275 octave_idx_type& info, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
276 octave_idx_type& rank) const; |
7076 | 277 ComplexColumnVector lssolve (const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
278 octave_idx_type& info, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
279 octave_idx_type& rank, double& rcon) const; |
458 | 280 |
281 Matrix& operator += (const DiagMatrix& a); | |
282 Matrix& operator -= (const DiagMatrix& a); | |
283 | |
1359 | 284 // unary operations |
458 | 285 |
2964 | 286 boolMatrix operator ! (void) const; |
458 | 287 |
1359 | 288 // other operations |
458 | 289 |
4431 | 290 bool any_element_is_negative (bool = false) const; |
7922
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7800
diff
changeset
|
291 bool any_element_is_nan (void) const; |
2385 | 292 bool any_element_is_inf_or_nan (void) const; |
5943 | 293 bool any_element_not_one_or_zero (void) const; |
2385 | 294 bool all_elements_are_int_or_inf_or_nan (void) const; |
295 bool all_integers (double& max_val, double& min_val) const; | |
296 bool too_large_for_float (void) const; | |
1963 | 297 |
4017 | 298 boolMatrix all (int dim = -1) const; |
299 boolMatrix any (int dim = -1) const; | |
458 | 300 |
4017 | 301 Matrix cumprod (int dim = -1) const; |
302 Matrix cumsum (int dim = -1) const; | |
303 Matrix prod (int dim = -1) const; | |
304 Matrix sum (int dim = -1) const; | |
305 Matrix sumsq (int dim = -1) const; | |
2385 | 306 Matrix abs (void) const; |
458 | 307 |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
308 Matrix diag (octave_idx_type k = 0) const; |
458 | 309 |
310 ColumnVector row_min (void) const; | |
2354 | 311 ColumnVector row_max (void) const; |
458 | 312 |
5275 | 313 ColumnVector row_min (Array<octave_idx_type>& index) const; |
314 ColumnVector row_max (Array<octave_idx_type>& index) const; | |
458 | 315 |
316 RowVector column_min (void) const; | |
2354 | 317 RowVector column_max (void) const; |
458 | 318 |
5275 | 319 RowVector column_min (Array<octave_idx_type>& index) const; |
320 RowVector column_max (Array<octave_idx_type>& index) const; | |
458 | 321 |
1359 | 322 // i/o |
458 | 323 |
6108 | 324 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Matrix& a); |
325 friend OCTAVE_API std::istream& operator >> (std::istream& is, Matrix& a); | |
458 | 326 |
3933 | 327 static double resize_fill_value (void) { return 0; } |
328 | |
458 | 329 }; |
330 | |
5508 | 331 // Publish externally used friend functions. |
332 | |
6108 | 333 extern OCTAVE_API Matrix real (const ComplexMatrix& a); |
334 extern OCTAVE_API Matrix imag (const ComplexMatrix& a); | |
5508 | 335 |
336 // column vector by row vector -> matrix operations | |
337 | |
6108 | 338 extern OCTAVE_API Matrix operator * (const ColumnVector& a, const RowVector& b); |
5508 | 339 |
340 // Other functions. | |
341 | |
6108 | 342 extern OCTAVE_API Matrix Givens (double, double); |
1819 | 343 |
6108 | 344 extern OCTAVE_API Matrix Sylvester (const Matrix&, const Matrix&, const Matrix&); |
1959 | 345 |
9665
1dba57e9d08d
use blas_trans_type for xgemm
Jaroslav Hajek <highegg@gmail.com>
parents:
9661
diff
changeset
|
346 extern OCTAVE_API Matrix xgemm (const Matrix& a, const Matrix& b, |
1dba57e9d08d
use blas_trans_type for xgemm
Jaroslav Hajek <highegg@gmail.com>
parents:
9661
diff
changeset
|
347 blas_trans_type transa = blas_no_trans, |
1dba57e9d08d
use blas_trans_type for xgemm
Jaroslav Hajek <highegg@gmail.com>
parents:
9661
diff
changeset
|
348 blas_trans_type transb = blas_no_trans); |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
349 |
6108 | 350 extern OCTAVE_API Matrix operator * (const Matrix& a, const Matrix& b); |
2828 | 351 |
6108 | 352 extern OCTAVE_API Matrix min (double d, const Matrix& m); |
353 extern OCTAVE_API Matrix min (const Matrix& m, double d); | |
354 extern OCTAVE_API Matrix min (const Matrix& a, const Matrix& b); | |
4309 | 355 |
6108 | 356 extern OCTAVE_API Matrix max (double d, const Matrix& m); |
357 extern OCTAVE_API Matrix max (const Matrix& m, double d); | |
358 extern OCTAVE_API Matrix max (const Matrix& a, const Matrix& b); | |
4309 | 359 |
9653
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
360 extern OCTAVE_API Matrix linspace (const ColumnVector& x1, |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
361 const ColumnVector& x2, |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
362 octave_idx_type n); |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
363 |
6708 | 364 MS_CMP_OP_DECLS (Matrix, double, OCTAVE_API) |
365 MS_BOOL_OP_DECLS (Matrix, double, OCTAVE_API) | |
2870 | 366 |
6708 | 367 SM_CMP_OP_DECLS (double, Matrix, OCTAVE_API) |
368 SM_BOOL_OP_DECLS (double, Matrix, OCTAVE_API) | |
2870 | 369 |
6708 | 370 MM_CMP_OP_DECLS (Matrix, Matrix, OCTAVE_API) |
371 MM_BOOL_OP_DECLS (Matrix, Matrix, OCTAVE_API) | |
2870 | 372 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
373 MARRAY_FORWARD_DEFS (MArray, Matrix, double) |
3573 | 374 |
3689 | 375 template <class T> |
376 void read_int (std::istream& is, bool swap_bytes, T& val); | |
377 | |
458 | 378 #endif |