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