Mercurial > hg > octave-lyh
annotate liboctave/CMatrix.h @ 9663:7e5b4de5fbfe
improve mixed real x complex ops
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 23 Sep 2009 12:13:50 +0200 |
parents | afcf852256d2 |
children | 1dba57e9d08d |
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_ComplexMatrix_h) | |
25 #define octave_ComplexMatrix_h 1 | |
26 | |
1989 | 27 #include "MArray2.h" |
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" |
1650 | 33 #include "oct-cmplx.h" |
8335 | 34 #include "DET.h" |
458 | 35 |
3585 | 36 class |
6108 | 37 OCTAVE_API |
3585 | 38 ComplexMatrix : public MArray2<Complex> |
458 | 39 { |
40 public: | |
41 | |
9656
b29504415a2e
provide NDArray->Matrix->Vector typedef mappers
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
42 typedef ComplexColumnVector column_vector_type; |
b29504415a2e
provide NDArray->Matrix->Vector typedef mappers
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
43 typedef ComplexRowVector row_vector_type; |
b29504415a2e
provide NDArray->Matrix->Vector typedef mappers
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
44 |
7788 | 45 typedef void (*solve_singularity_handler) (double rcon); |
3480 | 46 |
1214 | 47 ComplexMatrix (void) : MArray2<Complex> () { } |
3585 | 48 |
5275 | 49 ComplexMatrix (octave_idx_type r, octave_idx_type c) : MArray2<Complex> (r, c) { } |
3585 | 50 |
5275 | 51 ComplexMatrix (octave_idx_type r, octave_idx_type c, const Complex& val) |
1214 | 52 : MArray2<Complex> (r, c, val) { } |
3585 | 53 |
6979 | 54 ComplexMatrix (const dim_vector& dv) : MArray2<Complex> (dv) { } |
55 | |
56 ComplexMatrix (const dim_vector& dv, const Complex& val) | |
57 : MArray2<Complex> (dv, val) { } | |
58 | |
1214 | 59 ComplexMatrix (const ComplexMatrix& a) : MArray2<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> |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7788
diff
changeset
|
62 ComplexMatrix (const MArray2<U>& a) : MArray2<Complex> (a) { } |
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> |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7788
diff
changeset
|
65 ComplexMatrix (const Array2<U>& a) : MArray2<Complex> (a) { } |
3585 | 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 { | |
1214 | 89 MArray2<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 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7788
diff
changeset
|
136 { return MArray2<Complex>::hermitian (std::conj); } |
3225 | 137 ComplexMatrix transpose (void) const |
138 { return MArray2<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 |
6207 | 154 private: |
155 ComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, | |
7788 | 156 double& rcon, int force, int calc_cond) const; |
6207 | 157 |
158 ComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info, | |
7788 | 159 double& rcon, int force, int calc_cond) const; |
6207 | 160 |
161 public: | |
458 | 162 ComplexMatrix inverse (void) const; |
6479 | 163 ComplexMatrix inverse (octave_idx_type& info) const; |
7788 | 164 ComplexMatrix inverse (octave_idx_type& info, double& rcon, int force = 0, |
6479 | 165 int calc_cond = 1) const; |
166 | |
6207 | 167 ComplexMatrix inverse (MatrixType &mattype) const; |
168 ComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; | |
169 ComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info, | |
7788 | 170 double& rcon, int force = 0, |
4329 | 171 int calc_cond = 1) const; |
458 | 172 |
4384 | 173 ComplexMatrix pseudo_inverse (double tol = 0.0) const; |
740 | 174 |
458 | 175 ComplexMatrix fourier (void) const; |
176 ComplexMatrix ifourier (void) const; | |
177 | |
677 | 178 ComplexMatrix fourier2d (void) const; |
179 ComplexMatrix ifourier2d (void) const; | |
180 | |
458 | 181 ComplexDET determinant (void) const; |
5275 | 182 ComplexDET determinant (octave_idx_type& info) const; |
7788 | 183 ComplexDET 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
|
184 ComplexDET determinant (MatrixType &mattype, octave_idx_type& info, |
9813c07ca946
make det take advantage of matrix type
Jaroslav Hajek <highegg@gmail.com>
parents:
8335
diff
changeset
|
185 double& rcon, int calc_cond = 1) const; |
7788 | 186 |
187 double rcond (void) const; | |
188 double rcond (MatrixType &mattype) const; | |
458 | 189 |
5785 | 190 private: |
191 // Upper triangular matrix solvers | |
192 ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, | |
7788 | 193 octave_idx_type& info, double& rcon, |
5785 | 194 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
195 bool calc_cond = false, |
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 // Lower triangular matrix solvers | |
199 ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, | |
7788 | 200 octave_idx_type& info, double& rcon, |
5785 | 201 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
202 bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; |
5785 | 203 |
204 // Full matrix solvers (umfpack/cholesky) | |
205 ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, | |
7788 | 206 octave_idx_type& info, double& rcon, |
5785 | 207 solve_singularity_handler sing_handler, |
208 bool calc_cond = false) const; | |
209 | |
210 public: | |
211 // Generic interface to solver with no probing of type | |
212 ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; | |
213 ComplexMatrix solve (MatrixType &typ, const Matrix& b, | |
214 octave_idx_type& info) const; | |
215 ComplexMatrix solve (MatrixType &typ, const Matrix& b, | |
7788 | 216 octave_idx_type& info, double& rcon) const; |
5785 | 217 ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
7788 | 218 double& rcon, solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
219 bool singular_fallback = true, |
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
220 blas_trans_type transt = blas_no_trans) const; |
5785 | 221 |
222 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; | |
223 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | |
224 octave_idx_type& info) const; | |
225 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | |
7788 | 226 octave_idx_type& info, double& rcon) const; |
5785 | 227 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
7788 | 228 octave_idx_type& info, double& rcon, |
5785 | 229 solve_singularity_handler sing_handler, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
230 bool singular_fallback = true, |
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
231 blas_trans_type transt = blas_no_trans) const; |
5785 | 232 |
233 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b) const; | |
234 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, | |
235 octave_idx_type& info) const; | |
236 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, | |
7788 | 237 octave_idx_type& info, double& rcon) const; |
5785 | 238 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, |
7788 | 239 octave_idx_type& info, double& rcon, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
240 solve_singularity_handler sing_handler, |
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
241 blas_trans_type transt = blas_no_trans) const; |
5785 | 242 |
243 ComplexColumnVector solve (MatrixType &typ, | |
244 const ComplexColumnVector& b) const; | |
245 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, | |
246 octave_idx_type& info) const; | |
247 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, | |
7788 | 248 octave_idx_type& info, double& rcon) const; |
5785 | 249 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
7788 | 250 octave_idx_type& info, double& rcon, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
251 solve_singularity_handler sing_handler, |
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
252 blas_trans_type transt = blas_no_trans) const; |
5785 | 253 |
254 // Generic interface to solver with probing of type | |
458 | 255 ComplexMatrix solve (const Matrix& b) const; |
5275 | 256 ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; |
7788 | 257 ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon) const; |
258 ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon, | |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
259 solve_singularity_handler sing_handler, |
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
260 blas_trans_type transt = blas_no_trans) const; |
458 | 261 |
262 ComplexMatrix solve (const ComplexMatrix& b) const; | |
5275 | 263 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; |
7788 | 264 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon) const; |
265 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon, | |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
266 solve_singularity_handler sing_handler, |
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
267 blas_trans_type transt = blas_no_trans) const; |
458 | 268 |
3585 | 269 ComplexColumnVector solve (const ColumnVector& b) const; |
5275 | 270 ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; |
271 ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |
7788 | 272 double& rcon) const; |
273 ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon, | |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
274 solve_singularity_handler sing_handler, |
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
275 blas_trans_type transt = blas_no_trans) const; |
3585 | 276 |
458 | 277 ComplexColumnVector solve (const ComplexColumnVector& b) const; |
5275 | 278 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; |
279 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, | |
7788 | 280 double& rcon) const; |
5275 | 281 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
282 double& rcon, solve_singularity_handler sing_handler, |
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9656
diff
changeset
|
283 blas_trans_type transt = blas_no_trans) const; |
458 | 284 |
3585 | 285 ComplexMatrix lssolve (const Matrix& b) const; |
5275 | 286 ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info) const; |
7076 | 287 ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, |
288 octave_idx_type& rank) const; | |
289 ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, | |
7788 | 290 octave_idx_type& rank, double& rcon) const; |
3585 | 291 |
458 | 292 ComplexMatrix lssolve (const ComplexMatrix& b) const; |
5275 | 293 ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info) const; |
294 ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info, | |
295 octave_idx_type& rank) const; | |
7076 | 296 ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info, |
7788 | 297 octave_idx_type& rank, double& rcon) const; |
458 | 298 |
3585 | 299 ComplexColumnVector lssolve (const ColumnVector& b) const; |
7076 | 300 ComplexColumnVector lssolve (const ColumnVector& b, |
301 octave_idx_type& info) const; | |
5275 | 302 ComplexColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, |
303 octave_idx_type& rank) const; | |
7076 | 304 ComplexColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, |
7788 | 305 octave_idx_type& rank, double& rcon) const; |
3585 | 306 |
458 | 307 ComplexColumnVector lssolve (const ComplexColumnVector& b) const; |
7076 | 308 ComplexColumnVector lssolve (const ComplexColumnVector& b, |
309 octave_idx_type& info) const; | |
310 ComplexColumnVector lssolve (const ComplexColumnVector& b, | |
311 octave_idx_type& info, | |
5275 | 312 octave_idx_type& rank) const; |
7076 | 313 ComplexColumnVector lssolve (const ComplexColumnVector& b, |
314 octave_idx_type& info, | |
7788 | 315 octave_idx_type& rank, double& rcon) const; |
458 | 316 |
1359 | 317 // matrix by diagonal matrix -> matrix operations |
458 | 318 |
319 ComplexMatrix& operator += (const DiagMatrix& a); | |
320 ComplexMatrix& operator -= (const DiagMatrix& a); | |
321 | |
322 ComplexMatrix& operator += (const ComplexDiagMatrix& a); | |
323 ComplexMatrix& operator -= (const ComplexDiagMatrix& a); | |
324 | |
1359 | 325 // matrix by matrix -> matrix operations |
458 | 326 |
327 ComplexMatrix& operator += (const Matrix& a); | |
328 ComplexMatrix& operator -= (const Matrix& a); | |
329 | |
1359 | 330 // unary operations |
458 | 331 |
2964 | 332 boolMatrix operator ! (void) const; |
458 | 333 |
1359 | 334 // other operations |
458 | 335 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7076
diff
changeset
|
336 typedef double (*dmapper) (const Complex&); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7076
diff
changeset
|
337 typedef Complex (*cmapper) (const Complex&); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7076
diff
changeset
|
338 typedef bool (*bmapper) (const Complex&); |
2676 | 339 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7076
diff
changeset
|
340 Matrix map (dmapper fcn) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7076
diff
changeset
|
341 ComplexMatrix map (cmapper fcn) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7076
diff
changeset
|
342 boolMatrix map (bmapper fcn) const; |
458 | 343 |
7922
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7800
diff
changeset
|
344 bool any_element_is_nan (void) const; |
2384 | 345 bool any_element_is_inf_or_nan (void) const; |
2408 | 346 bool all_elements_are_real (void) const; |
2384 | 347 bool all_integers (double& max_val, double& min_val) const; |
348 bool too_large_for_float (void) const; | |
1963 | 349 |
4017 | 350 boolMatrix all (int dim = -1) const; |
351 boolMatrix any (int dim = -1) const; | |
458 | 352 |
4017 | 353 ComplexMatrix cumprod (int dim = -1) const; |
354 ComplexMatrix cumsum (int dim = -1) const; | |
355 ComplexMatrix prod (int dim = -1) const; | |
356 ComplexMatrix sum (int dim = -1) const; | |
357 ComplexMatrix sumsq (int dim = -1) const; | |
4329 | 358 Matrix abs (void) const; |
458 | 359 |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
360 ComplexMatrix diag (octave_idx_type k = 0) const; |
458 | 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 |
5275 | 368 ComplexColumnVector row_min (Array<octave_idx_type>& index) const; |
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 |
3933 | 382 static Complex resize_fill_value (void) { return Complex (0.0, 0.0); } |
383 | |
458 | 384 private: |
385 | |
5275 | 386 ComplexMatrix (Complex *d, octave_idx_type r, octave_idx_type c) : MArray2<Complex> (d, r, c) { } |
458 | 387 }; |
388 | |
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
|
389 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
|
390 |
5508 | 391 // column vector by row vector -> matrix operations |
392 | |
6108 | 393 extern OCTAVE_API ComplexMatrix |
5508 | 394 operator * (const ColumnVector& a, const ComplexRowVector& b); |
395 | |
6108 | 396 extern OCTAVE_API ComplexMatrix |
5508 | 397 operator * (const ComplexColumnVector& a, const RowVector& b); |
1819 | 398 |
6108 | 399 extern OCTAVE_API ComplexMatrix |
5508 | 400 operator * (const ComplexColumnVector& a, const ComplexRowVector& b); |
401 | |
6108 | 402 extern OCTAVE_API ComplexMatrix |
5508 | 403 Givens (const Complex&, const Complex&); |
404 | |
6108 | 405 extern OCTAVE_API ComplexMatrix |
5508 | 406 Sylvester (const ComplexMatrix&, const ComplexMatrix&, const ComplexMatrix&); |
1819 | 407 |
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
|
408 extern OCTAVE_API ComplexMatrix |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
409 xgemm (bool transa, bool conja, const ComplexMatrix& a, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
410 bool transb, bool conjb, const ComplexMatrix& b); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
411 |
6108 | 412 extern OCTAVE_API ComplexMatrix operator * (const Matrix&, const ComplexMatrix&); |
413 extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const Matrix&); | |
414 extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const ComplexMatrix&); | |
2828 | 415 |
6108 | 416 extern OCTAVE_API ComplexMatrix min (const Complex& c, const ComplexMatrix& m); |
417 extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& m, const Complex& c); | |
418 extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& a, const ComplexMatrix& b); | |
4309 | 419 |
6108 | 420 extern OCTAVE_API ComplexMatrix max (const Complex& c, const ComplexMatrix& m); |
421 extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& m, const Complex& c); | |
422 extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& a, const ComplexMatrix& b); | |
4309 | 423 |
9653
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9237
diff
changeset
|
424 extern OCTAVE_API ComplexMatrix linspace (const ComplexColumnVector& x1, |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9237
diff
changeset
|
425 const ComplexColumnVector& x2, |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9237
diff
changeset
|
426 octave_idx_type n); |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9237
diff
changeset
|
427 |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9237
diff
changeset
|
428 |
6708 | 429 MS_CMP_OP_DECLS (ComplexMatrix, Complex, OCTAVE_API) |
430 MS_BOOL_OP_DECLS (ComplexMatrix, Complex, OCTAVE_API) | |
2870 | 431 |
6708 | 432 SM_CMP_OP_DECLS (Complex, ComplexMatrix, OCTAVE_API) |
433 SM_BOOL_OP_DECLS (Complex, ComplexMatrix, OCTAVE_API) | |
2870 | 434 |
6708 | 435 MM_CMP_OP_DECLS (ComplexMatrix, ComplexMatrix, OCTAVE_API) |
436 MM_BOOL_OP_DECLS (ComplexMatrix, ComplexMatrix, OCTAVE_API) | |
2870 | 437 |
3573 | 438 MARRAY_FORWARD_DEFS (MArray2, ComplexMatrix, Complex) |
439 | |
458 | 440 #endif |
441 | |
442 /* | |
443 ;;; Local Variables: *** | |
444 ;;; mode: C++ *** | |
445 ;;; End: *** | |
446 */ |