Mercurial > hg > octave-lyh
annotate liboctave/CMatrix.h @ 14813:2de56de8953a gui
* main-window: Fixed bug with command window not coming up on Ctrl+0.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Thu, 28 Jun 2012 12:21:58 +0200 |
parents | 13cc11418393 |
children |
rev | line source |
---|---|
458 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 1994-2012 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_ComplexMatrix_h) | |
24 #define octave_ComplexMatrix_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" |
1650 | 32 #include "oct-cmplx.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 ComplexMatrix : public MArray<Complex> |
458 | 38 { |
39 public: | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
40 |
9656
b29504415a2e
provide NDArray->Matrix->Vector typedef mappers
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
41 typedef ComplexColumnVector column_vector_type; |
b29504415a2e
provide NDArray->Matrix->Vector typedef mappers
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
42 typedef ComplexRowVector 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 ComplexMatrix (void) : MArray<Complex> () { } |
3585 | 47 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
48 ComplexMatrix (octave_idx_type r, octave_idx_type c) |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
49 : MArray<Complex> (dim_vector (r, c)) { } |
3585 | 50 |
5275 | 51 ComplexMatrix (octave_idx_type r, octave_idx_type c, const Complex& val) |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
52 : MArray<Complex> (dim_vector (r, c), val) { } |
3585 | 53 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
54 ComplexMatrix (const dim_vector& dv) : MArray<Complex> (dv.redim (2)) { } |
6979 | 55 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
56 ComplexMatrix (const dim_vector& dv, const Complex& val) |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
57 : MArray<Complex> (dv.redim (2), val) { } |
6979 | 58 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
59 ComplexMatrix (const ComplexMatrix& a) : MArray<Complex> (a) { } |
3585 | 60 |
7789
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 ComplexMatrix (const MArray<U>& a) : MArray<Complex> (a.as_matrix ()) { } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7788
diff
changeset
|
63 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7788
diff
changeset
|
64 template <class U> |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
65 ComplexMatrix (const Array<U>& a) : MArray<Complex> (a.as_matrix ()) { } |
10301
9e0ec19df4bc
commit accidentally omitted parts of previous change
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
66 |
9663
7e5b4de5fbfe
improve mixed real x complex ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9661
diff
changeset
|
67 ComplexMatrix (const Matrix& re, const Matrix& im); |
7e5b4de5fbfe
improve mixed real x complex ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9661
diff
changeset
|
68 |
3585 | 69 explicit ComplexMatrix (const Matrix& a); |
70 | |
71 explicit ComplexMatrix (const RowVector& rv); | |
72 | |
73 explicit ComplexMatrix (const ColumnVector& cv); | |
458 | 74 |
3585 | 75 explicit ComplexMatrix (const DiagMatrix& a); |
76 | |
77 explicit ComplexMatrix (const ComplexRowVector& rv); | |
78 | |
79 explicit ComplexMatrix (const ComplexColumnVector& cv); | |
80 | |
81 explicit ComplexMatrix (const ComplexDiagMatrix& a); | |
82 | |
83 explicit ComplexMatrix (const boolMatrix& a); | |
84 | |
85 explicit ComplexMatrix (const charMatrix& a); | |
1574 | 86 |
458 | 87 ComplexMatrix& operator = (const ComplexMatrix& a) |
88 { | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
89 MArray<Complex>::operator = (a); |
458 | 90 return *this; |
91 } | |
92 | |
2384 | 93 bool operator == (const ComplexMatrix& a) const; |
94 bool operator != (const ComplexMatrix& a) const; | |
458 | 95 |
2815 | 96 bool is_hermitian (void) const; |
97 | |
1359 | 98 // destructive insert/delete/reorder operations |
458 | 99 |
5275 | 100 ComplexMatrix& insert (const Matrix& a, octave_idx_type r, octave_idx_type c); |
101 ComplexMatrix& insert (const RowVector& a, octave_idx_type r, octave_idx_type c); | |
102 ComplexMatrix& insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c); | |
103 ComplexMatrix& insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c); | |
458 | 104 |
5275 | 105 ComplexMatrix& insert (const ComplexMatrix& a, octave_idx_type r, octave_idx_type c); |
106 ComplexMatrix& insert (const ComplexRowVector& a, octave_idx_type r, octave_idx_type c); | |
107 ComplexMatrix& insert (const ComplexColumnVector& a, octave_idx_type r, octave_idx_type c); | |
108 ComplexMatrix& insert (const ComplexDiagMatrix& a, octave_idx_type r, octave_idx_type c); | |
458 | 109 |
110 ComplexMatrix& fill (double val); | |
111 ComplexMatrix& fill (const Complex& val); | |
5275 | 112 ComplexMatrix& fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); |
113 ComplexMatrix& fill (const Complex& val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); | |
458 | 114 |
115 ComplexMatrix append (const Matrix& a) const; | |
116 ComplexMatrix append (const RowVector& a) const; | |
117 ComplexMatrix append (const ColumnVector& a) const; | |
118 ComplexMatrix append (const DiagMatrix& a) const; | |
119 | |
120 ComplexMatrix append (const ComplexMatrix& a) const; | |
121 ComplexMatrix append (const ComplexRowVector& a) const; | |
122 ComplexMatrix append (const ComplexColumnVector& a) const; | |
123 ComplexMatrix append (const ComplexDiagMatrix& a) const; | |
124 | |
125 ComplexMatrix stack (const Matrix& a) const; | |
126 ComplexMatrix stack (const RowVector& a) const; | |
127 ComplexMatrix stack (const ColumnVector& a) const; | |
128 ComplexMatrix stack (const DiagMatrix& a) const; | |
129 | |
130 ComplexMatrix stack (const ComplexMatrix& a) const; | |
131 ComplexMatrix stack (const ComplexRowVector& a) const; | |
132 ComplexMatrix stack (const ComplexColumnVector& a) const; | |
133 ComplexMatrix stack (const ComplexDiagMatrix& a) const; | |
134 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7788
diff
changeset
|
135 ComplexMatrix hermitian (void) const |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
136 { return MArray<Complex>::hermitian (std::conj); } |
3225 | 137 ComplexMatrix transpose (void) const |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
138 { return MArray<Complex>::transpose (); } |
458 | 139 |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
140 friend OCTAVE_API ComplexMatrix conj (const ComplexMatrix& a); |
458 | 141 |
1359 | 142 // resize is the destructive equivalent for this one |
458 | 143 |
5275 | 144 ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
458 | 145 |
5275 | 146 ComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const; |
4316 | 147 |
1359 | 148 // extract row or column i. |
458 | 149 |
5275 | 150 ComplexRowVector row (octave_idx_type i) const; |
458 | 151 |
5275 | 152 ComplexColumnVector column (octave_idx_type i) const; |
458 | 153 |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
154 void resize (octave_idx_type nr, octave_idx_type nc, |
14616
13cc11418393
improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents:
14557
diff
changeset
|
155 const Complex& rfv = Complex (0)) |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
156 { |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
157 MArray<Complex>::resize (dim_vector (nr, nc), rfv); |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
158 } |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
159 |
6207 | 160 private: |
161 ComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
162 double& rcon, int force, int calc_cond) const; |
6207 | 163 |
164 ComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
165 double& rcon, int force, int calc_cond) const; |
6207 | 166 |
167 public: | |
458 | 168 ComplexMatrix inverse (void) const; |
6479 | 169 ComplexMatrix inverse (octave_idx_type& info) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
170 ComplexMatrix 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
|
171 int calc_cond = 1) const; |
6479 | 172 |
6207 | 173 ComplexMatrix inverse (MatrixType &mattype) const; |
174 ComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; | |
175 ComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info, | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
176 double& rcon, int force = 0, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
177 int calc_cond = 1) const; |
458 | 178 |
4384 | 179 ComplexMatrix pseudo_inverse (double tol = 0.0) const; |
740 | 180 |
458 | 181 ComplexMatrix fourier (void) const; |
182 ComplexMatrix ifourier (void) const; | |
183 | |
677 | 184 ComplexMatrix fourier2d (void) const; |
185 ComplexMatrix ifourier2d (void) const; | |
186 | |
458 | 187 ComplexDET determinant (void) const; |
5275 | 188 ComplexDET determinant (octave_idx_type& info) const; |
7788 | 189 ComplexDET determinant (octave_idx_type& info, double& rcon, int calc_cond = 1) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
190 ComplexDET determinant (MatrixType &mattype, octave_idx_type& info, |
8336
9813c07ca946
make det take advantage of matrix type
Jaroslav Hajek <highegg@gmail.com>
parents:
8335
diff
changeset
|
191 double& rcon, int calc_cond = 1) const; |
7788 | 192 |
193 double rcond (void) const; | |
194 double rcond (MatrixType &mattype) const; | |
458 | 195 |
5785 | 196 private: |
197 // Upper triangular matrix solvers | |
198 ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
199 octave_idx_type& info, double& rcon, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
200 solve_singularity_handler sing_handler, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
201 bool calc_cond = false, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
202 blas_trans_type transt = blas_no_trans) const; |
5785 | 203 |
204 // Lower triangular matrix solvers | |
205 ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
206 octave_idx_type& info, double& rcon, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
207 solve_singularity_handler sing_handler, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
208 bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; |
5785 | 209 |
210 // Full matrix solvers (umfpack/cholesky) | |
211 ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
212 octave_idx_type& info, double& rcon, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
213 solve_singularity_handler sing_handler, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
214 bool calc_cond = false) const; |
5785 | 215 |
216 public: | |
217 // Generic interface to solver with no probing of type | |
218 ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
219 ComplexMatrix solve (MatrixType &typ, const Matrix& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
220 octave_idx_type& info) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
221 ComplexMatrix solve (MatrixType &typ, const Matrix& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
222 octave_idx_type& info, double& rcon) const; |
5785 | 223 ComplexMatrix 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
|
224 double& rcon, solve_singularity_handler sing_handler, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
225 bool singular_fallback = true, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
226 blas_trans_type transt = blas_no_trans) const; |
5785 | 227 |
228 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
229 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
230 octave_idx_type& info) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
231 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
232 octave_idx_type& info, double& rcon) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
233 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
234 octave_idx_type& info, double& rcon, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
235 solve_singularity_handler sing_handler, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
236 bool singular_fallback = true, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
237 blas_trans_type transt = blas_no_trans) const; |
5785 | 238 |
239 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b) const; | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
240 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
241 octave_idx_type& info) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
242 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
243 octave_idx_type& info, double& rcon) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
244 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
245 octave_idx_type& info, double& rcon, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
246 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; |
5785 | 248 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
249 ComplexColumnVector solve (MatrixType &typ, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
250 const ComplexColumnVector& b) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
251 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
252 octave_idx_type& info) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
253 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
254 octave_idx_type& info, double& rcon) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
255 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
256 octave_idx_type& info, double& rcon, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
257 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
258 blas_trans_type transt = blas_no_trans) const; |
5785 | 259 |
260 // Generic interface to solver with probing of type | |
458 | 261 ComplexMatrix solve (const Matrix& b) const; |
5275 | 262 ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; |
7788 | 263 ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon) const; |
264 ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon, | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
265 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
266 blas_trans_type transt = blas_no_trans) const; |
458 | 267 |
268 ComplexMatrix solve (const ComplexMatrix& b) const; | |
5275 | 269 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; |
7788 | 270 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon) const; |
271 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon, | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
272 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
273 blas_trans_type transt = blas_no_trans) const; |
458 | 274 |
3585 | 275 ComplexColumnVector solve (const ColumnVector& b) const; |
5275 | 276 ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; |
277 ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
278 double& rcon) const; |
7788 | 279 ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
280 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
281 blas_trans_type transt = blas_no_trans) const; |
3585 | 282 |
458 | 283 ComplexColumnVector solve (const ComplexColumnVector& b) const; |
5275 | 284 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; |
285 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
|
286 double& rcon) const; |
5275 | 287 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
288 double& rcon, solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
289 blas_trans_type transt = blas_no_trans) const; |
458 | 290 |
3585 | 291 ComplexMatrix lssolve (const Matrix& b) const; |
5275 | 292 ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
293 ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
294 octave_idx_type& rank) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
295 ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
296 octave_idx_type& rank, double& rcon) const; |
3585 | 297 |
458 | 298 ComplexMatrix lssolve (const ComplexMatrix& b) const; |
5275 | 299 ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info) const; |
300 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
|
301 octave_idx_type& rank) const; |
7076 | 302 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
|
303 octave_idx_type& rank, double& rcon) const; |
458 | 304 |
3585 | 305 ComplexColumnVector lssolve (const ColumnVector& b) const; |
7076 | 306 ComplexColumnVector lssolve (const ColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
307 octave_idx_type& info) const; |
5275 | 308 ComplexColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
309 octave_idx_type& rank) const; |
7076 | 310 ComplexColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
311 octave_idx_type& rank, double& rcon) const; |
3585 | 312 |
458 | 313 ComplexColumnVector lssolve (const ComplexColumnVector& b) const; |
7076 | 314 ComplexColumnVector lssolve (const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
315 octave_idx_type& info) const; |
7076 | 316 ComplexColumnVector lssolve (const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
317 octave_idx_type& info, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
318 octave_idx_type& rank) const; |
7076 | 319 ComplexColumnVector lssolve (const ComplexColumnVector& b, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
320 octave_idx_type& info, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10301
diff
changeset
|
321 octave_idx_type& rank, double& rcon) const; |
458 | 322 |
1359 | 323 // matrix by diagonal matrix -> matrix operations |
458 | 324 |
325 ComplexMatrix& operator += (const DiagMatrix& a); | |
326 ComplexMatrix& operator -= (const DiagMatrix& a); | |
327 | |
328 ComplexMatrix& operator += (const ComplexDiagMatrix& a); | |
329 ComplexMatrix& operator -= (const ComplexDiagMatrix& a); | |
330 | |
1359 | 331 // matrix by matrix -> matrix operations |
458 | 332 |
333 ComplexMatrix& operator += (const Matrix& a); | |
334 ComplexMatrix& operator -= (const Matrix& a); | |
335 | |
1359 | 336 // unary operations |
458 | 337 |
2964 | 338 boolMatrix operator ! (void) const; |
458 | 339 |
1359 | 340 // other operations |
458 | 341 |
7922
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7800
diff
changeset
|
342 bool any_element_is_nan (void) const; |
2384 | 343 bool any_element_is_inf_or_nan (void) const; |
2408 | 344 bool all_elements_are_real (void) const; |
2384 | 345 bool all_integers (double& max_val, double& min_val) const; |
346 bool too_large_for_float (void) const; | |
1963 | 347 |
4017 | 348 boolMatrix all (int dim = -1) const; |
349 boolMatrix any (int dim = -1) const; | |
458 | 350 |
4017 | 351 ComplexMatrix cumprod (int dim = -1) const; |
352 ComplexMatrix cumsum (int dim = -1) const; | |
353 ComplexMatrix prod (int dim = -1) const; | |
354 ComplexMatrix sum (int dim = -1) const; | |
355 ComplexMatrix sumsq (int dim = -1) const; | |
4329 | 356 Matrix abs (void) const; |
458 | 357 |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
358 ComplexMatrix diag (octave_idx_type k = 0) const; |
458 | 359 |
14557
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
360 ComplexDiagMatrix diag (octave_idx_type m, octave_idx_type n) const; |
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
361 |
5275 | 362 bool row_is_real_only (octave_idx_type) const; |
363 bool column_is_real_only (octave_idx_type) const; | |
458 | 364 |
2354 | 365 ComplexColumnVector row_min (void) const; |
458 | 366 ComplexColumnVector row_max (void) const; |
2354 | 367 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
368 ComplexColumnVector row_min (Array<octave_idx_type>& index) const; |
5275 | 369 ComplexColumnVector row_max (Array<octave_idx_type>& index) const; |
458 | 370 |
371 ComplexRowVector column_min (void) const; | |
2354 | 372 ComplexRowVector column_max (void) const; |
458 | 373 |
5275 | 374 ComplexRowVector column_min (Array<octave_idx_type>& index) const; |
375 ComplexRowVector column_max (Array<octave_idx_type>& index) const; | |
458 | 376 |
1359 | 377 // i/o |
458 | 378 |
6108 | 379 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexMatrix& a); |
380 friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexMatrix& a); | |
458 | 381 }; |
382 | |
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
|
383 extern OCTAVE_API ComplexMatrix conj (const ComplexMatrix& a); |
a1ae2aae903e
abs,real,imag,conj: use code from mx-inlines rather than the generic map
Jaroslav Hajek <highegg@gmail.com>
parents:
8392
diff
changeset
|
384 |
5508 | 385 // column vector by row vector -> matrix operations |
386 | |
6108 | 387 extern OCTAVE_API ComplexMatrix |
5508 | 388 operator * (const ColumnVector& a, const ComplexRowVector& b); |
389 | |
6108 | 390 extern OCTAVE_API ComplexMatrix |
5508 | 391 operator * (const ComplexColumnVector& a, const RowVector& b); |
1819 | 392 |
6108 | 393 extern OCTAVE_API ComplexMatrix |
5508 | 394 operator * (const ComplexColumnVector& a, const ComplexRowVector& b); |
395 | |
6108 | 396 extern OCTAVE_API ComplexMatrix |
5508 | 397 Givens (const Complex&, const Complex&); |
398 | |
6108 | 399 extern OCTAVE_API ComplexMatrix |
5508 | 400 Sylvester (const ComplexMatrix&, const ComplexMatrix&, const ComplexMatrix&); |
1819 | 401 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
402 extern OCTAVE_API ComplexMatrix |
9665
1dba57e9d08d
use blas_trans_type for xgemm
Jaroslav Hajek <highegg@gmail.com>
parents:
9663
diff
changeset
|
403 xgemm (const ComplexMatrix& a, const ComplexMatrix& b, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
404 blas_trans_type transa = blas_no_trans, |
9665
1dba57e9d08d
use blas_trans_type for xgemm
Jaroslav Hajek <highegg@gmail.com>
parents:
9663
diff
changeset
|
405 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
|
406 |
6108 | 407 extern OCTAVE_API ComplexMatrix operator * (const Matrix&, const ComplexMatrix&); |
408 extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const Matrix&); | |
409 extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const ComplexMatrix&); | |
2828 | 410 |
6108 | 411 extern OCTAVE_API ComplexMatrix min (const Complex& c, const ComplexMatrix& m); |
412 extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& m, const Complex& c); | |
413 extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& a, const ComplexMatrix& b); | |
4309 | 414 |
6108 | 415 extern OCTAVE_API ComplexMatrix max (const Complex& c, const ComplexMatrix& m); |
416 extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& m, const Complex& c); | |
417 extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& a, const ComplexMatrix& b); | |
4309 | 418 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
419 extern OCTAVE_API ComplexMatrix linspace (const ComplexColumnVector& x1, |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
420 const ComplexColumnVector& x2, |
9653
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9237
diff
changeset
|
421 octave_idx_type n); |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9237
diff
changeset
|
422 |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9237
diff
changeset
|
423 |
6708 | 424 MS_CMP_OP_DECLS (ComplexMatrix, Complex, OCTAVE_API) |
425 MS_BOOL_OP_DECLS (ComplexMatrix, Complex, OCTAVE_API) | |
2870 | 426 |
6708 | 427 SM_CMP_OP_DECLS (Complex, ComplexMatrix, OCTAVE_API) |
428 SM_BOOL_OP_DECLS (Complex, ComplexMatrix, OCTAVE_API) | |
2870 | 429 |
6708 | 430 MM_CMP_OP_DECLS (ComplexMatrix, ComplexMatrix, OCTAVE_API) |
431 MM_BOOL_OP_DECLS (ComplexMatrix, ComplexMatrix, OCTAVE_API) | |
2870 | 432 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10312
diff
changeset
|
433 MARRAY_FORWARD_DEFS (MArray, ComplexMatrix, Complex) |
3573 | 434 |
458 | 435 #endif |