Mercurial > hg > octave-nkf
annotate liboctave/CSparse.h @ 8366:8b1a2555c4e2
implement diagonal matrix objects
* * *
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 03 Dec 2008 13:32:57 +0100 |
parents | 64cf956a109c |
children | eb63fbe60fab |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
7017 | 3 Copyright (C) 2004, 2005, 2006, 2007 David Bateman |
7016 | 4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler |
5 | |
6 This file is part of Octave. | |
5164 | 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. | |
5164 | 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/>. | |
5164 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_CSparse_h) | |
25 #define octave_CSparse_h 1 | |
26 | |
27 #include "dMatrix.h" | |
28 #include "dNDArray.h" | |
29 #include "CNDArray.h" | |
30 #include "dColVector.h" | |
31 #include "CColVector.h" | |
32 #include "oct-cmplx.h" | |
33 | |
8335 | 34 #include "DET.h" |
5164 | 35 #include "MSparse.h" |
36 #include "MSparse-defs.h" | |
37 #include "Sparse-op-defs.h" | |
5785 | 38 #include "MatrixType.h" |
5164 | 39 |
40 class SparseMatrix; | |
41 class SparseBoolMatrix; | |
42 | |
43 class | |
6108 | 44 OCTAVE_API |
5164 | 45 SparseComplexMatrix : public MSparse<Complex> |
46 { | |
47 public: | |
48 | |
49 typedef void (*solve_singularity_handler) (double rcond); | |
50 | |
51 SparseComplexMatrix (void) : MSparse<Complex> () { } | |
52 | |
5275 | 53 SparseComplexMatrix (octave_idx_type r, octave_idx_type c) : MSparse<Complex> (r, c) { } |
5164 | 54 |
6823 | 55 SparseComplexMatrix (const dim_vector& dv, octave_idx_type nz = 0) : |
56 MSparse<Complex> (dv, nz) { } | |
57 | |
5275 | 58 explicit SparseComplexMatrix (octave_idx_type r, octave_idx_type c, Complex val) |
5164 | 59 : MSparse<Complex> (r, c, val) { } |
60 | |
5275 | 61 SparseComplexMatrix (octave_idx_type r, octave_idx_type c, double val) |
5164 | 62 : MSparse<Complex> (r, c, Complex (val)) { } |
63 | |
64 SparseComplexMatrix (const SparseComplexMatrix& a) | |
65 : MSparse<Complex> (a) { } | |
66 | |
67 SparseComplexMatrix (const SparseComplexMatrix& a, const dim_vector& dv) | |
68 : MSparse<Complex> (a, dv) { } | |
69 | |
70 SparseComplexMatrix (const MSparse<Complex>& a) : MSparse<Complex> (a) { } | |
71 | |
72 explicit SparseComplexMatrix (const ComplexMatrix& a) | |
73 : MSparse<Complex> (a) { } | |
74 | |
75 explicit SparseComplexMatrix (const ComplexNDArray& a) | |
76 : MSparse<Complex> (a) { } | |
77 | |
5275 | 78 explicit SparseComplexMatrix (const Array<Complex> a, const Array<octave_idx_type>& r, |
79 const Array<octave_idx_type>& c, octave_idx_type nr = -1, | |
80 octave_idx_type nc = -1, bool sum_terms = true) | |
5164 | 81 : MSparse<Complex> (a, r, c, nr, nc, sum_terms) { } |
82 | |
83 explicit SparseComplexMatrix (const Array<Complex> a, | |
84 const Array<double>& r, | |
5275 | 85 const Array<double>& c, octave_idx_type nr = -1, |
86 octave_idx_type nc = -1, bool sum_terms = true) | |
5164 | 87 : MSparse<Complex> (a, r, c, nr, nc, sum_terms) { } |
88 | |
89 explicit SparseComplexMatrix (const SparseMatrix& a); | |
90 | |
91 explicit SparseComplexMatrix (const SparseBoolMatrix& a); | |
92 | |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8335
diff
changeset
|
93 explicit SparseComplexMatrix (const ComplexDiagMatrix& a); |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8335
diff
changeset
|
94 |
5275 | 95 SparseComplexMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) |
5164 | 96 : MSparse<Complex> (r, c, num_nz) { } |
97 | |
98 SparseComplexMatrix& operator = (const SparseComplexMatrix& a) | |
99 { | |
100 MSparse<Complex>::operator = (a); | |
101 return *this; | |
102 } | |
103 | |
104 bool operator == (const SparseComplexMatrix& a) const; | |
105 bool operator != (const SparseComplexMatrix& a) const; | |
106 | |
107 bool is_hermitian (void) const; | |
108 | |
109 SparseComplexMatrix max (int dim = 0) const; | |
5275 | 110 SparseComplexMatrix max (Array2<octave_idx_type>& index, int dim = 0) const; |
5164 | 111 SparseComplexMatrix min (int dim = 0) const; |
5275 | 112 SparseComplexMatrix min (Array2<octave_idx_type>& index, int dim = 0) const; |
5164 | 113 |
5275 | 114 SparseComplexMatrix& insert (const SparseComplexMatrix& a, octave_idx_type r, octave_idx_type c); |
115 SparseComplexMatrix& insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c); | |
6823 | 116 SparseComplexMatrix& insert (const SparseComplexMatrix& a, const Array<octave_idx_type>& indx); |
117 SparseComplexMatrix& insert (const SparseMatrix& a, const Array<octave_idx_type>& indx); | |
5164 | 118 |
119 SparseComplexMatrix concat (const SparseComplexMatrix& rb, | |
5275 | 120 const Array<octave_idx_type>& ra_idx); |
5164 | 121 SparseComplexMatrix concat (const SparseMatrix& rb, |
5275 | 122 const Array<octave_idx_type>& ra_idx); |
5164 | 123 |
124 ComplexMatrix matrix_value (void) const; | |
125 | |
126 SparseComplexMatrix hermitian (void) const; // complex conjugate transpose | |
127 SparseComplexMatrix transpose (void) const | |
128 { return MSparse<Complex>::transpose (); } | |
129 | |
130 friend SparseComplexMatrix conj (const SparseComplexMatrix& a); | |
131 | |
8303
b11c31849b44
improve norm computation capabilities
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
132 // extract row or column i. |
b11c31849b44
improve norm computation capabilities
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
133 |
b11c31849b44
improve norm computation capabilities
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
134 ComplexRowVector row (octave_idx_type i) const; |
b11c31849b44
improve norm computation capabilities
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
135 |
b11c31849b44
improve norm computation capabilities
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
136 ComplexColumnVector column (octave_idx_type i) const; |
b11c31849b44
improve norm computation capabilities
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
137 |
5506 | 138 private: |
5785 | 139 SparseComplexMatrix dinverse (MatrixType &mattyp, octave_idx_type& info, |
5506 | 140 double& rcond, const bool force = false, |
141 const bool calccond = true) const; | |
142 | |
5785 | 143 SparseComplexMatrix tinverse (MatrixType &mattyp, octave_idx_type& info, |
5506 | 144 double& rcond, const bool force = false, |
145 const bool calccond = true) const; | |
146 | |
147 public: | |
5164 | 148 SparseComplexMatrix inverse (void) const; |
5785 | 149 SparseComplexMatrix inverse (MatrixType& mattype) const; |
150 SparseComplexMatrix inverse (MatrixType& mattype, | |
5506 | 151 octave_idx_type& info) const; |
5785 | 152 SparseComplexMatrix inverse (MatrixType& mattype, octave_idx_type& info, |
5506 | 153 double& rcond, int force = 0, |
5164 | 154 int calc_cond = 1) const; |
155 | |
156 ComplexDET determinant (void) const; | |
5275 | 157 ComplexDET determinant (octave_idx_type& info) const; |
158 ComplexDET determinant (octave_idx_type& info, double& rcond, | |
5164 | 159 int calc_cond = 1) const; |
160 | |
161 private: | |
162 // Diagonal matrix solvers | |
5785 | 163 ComplexMatrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 164 double& rcond, solve_singularity_handler sing_handler, |
165 bool calc_cond = false) const; | |
5164 | 166 |
5785 | 167 ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 168 octave_idx_type& info, double& rcond, |
169 solve_singularity_handler sing_handler, | |
170 bool calc_cond = false) const; | |
5164 | 171 |
5785 | 172 SparseComplexMatrix dsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 173 octave_idx_type& info, double& rcond, |
174 solve_singularity_handler sing_handler, | |
175 bool calc_cond = false) const; | |
5164 | 176 |
5785 | 177 SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 178 octave_idx_type& info, double& rcond, |
5681 | 179 solve_singularity_handler sing_handler, |
180 bool calc_cond = false) const; | |
5164 | 181 |
182 // Upper triangular matrix solvers | |
5785 | 183 ComplexMatrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 184 double& rcond, solve_singularity_handler sing_handler, |
185 bool calc_cond = false) const; | |
5164 | 186 |
5785 | 187 ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 188 octave_idx_type& info, double& rcond, |
189 solve_singularity_handler sing_handler, | |
190 bool calc_cond = false) const; | |
5164 | 191 |
5785 | 192 SparseComplexMatrix utsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 193 octave_idx_type& info, double& rcond, |
194 solve_singularity_handler sing_handler, | |
195 bool calc_cond = false) const; | |
5164 | 196 |
5785 | 197 SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 198 octave_idx_type& info, double& rcond, |
5681 | 199 solve_singularity_handler sing_handler, |
200 bool calc_cond = false) const; | |
5164 | 201 |
202 // Lower triangular matrix solvers | |
5785 | 203 ComplexMatrix ltsolve (MatrixType &typ, const Matrix& b, |
5681 | 204 octave_idx_type& info, double& rcond, |
205 solve_singularity_handler sing_handler, | |
206 bool calc_cond = false) const; | |
5164 | 207 |
5785 | 208 ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 209 octave_idx_type& info, double& rcond, |
210 solve_singularity_handler sing_handler, | |
211 bool calc_cond = false) const; | |
5164 | 212 |
5785 | 213 SparseComplexMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 214 octave_idx_type& info, double& rcond, |
215 solve_singularity_handler sing_handler, | |
216 bool calc_cond = false) const; | |
5164 | 217 |
5785 | 218 SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 219 octave_idx_type& info, double& rcond, |
5681 | 220 solve_singularity_handler sing_handler, |
221 bool calc_cond = false) const; | |
5164 | 222 |
223 // Tridiagonal matrix solvers | |
5785 | 224 ComplexMatrix trisolve (MatrixType &typ, const Matrix& b, |
5681 | 225 octave_idx_type& info, double& rcond, |
226 solve_singularity_handler sing_handler, | |
227 bool calc_cond = false) const; | |
5164 | 228 |
5785 | 229 ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 230 octave_idx_type& info, double& rcond, |
231 solve_singularity_handler sing_handler, | |
232 bool calc_cond = false) const; | |
5164 | 233 |
5785 | 234 SparseComplexMatrix trisolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 235 octave_idx_type& info, double& rcond, |
236 solve_singularity_handler sing_handler, | |
237 bool calc_cond = false) const; | |
5164 | 238 |
5785 | 239 SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 240 octave_idx_type& info, double& rcond, |
5681 | 241 solve_singularity_handler sing_handler, |
242 bool calc_cond = false) const; | |
5164 | 243 |
244 // Banded matrix solvers (umfpack/cholesky) | |
5785 | 245 ComplexMatrix bsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 246 double& rcond, solve_singularity_handler sing_handler, |
247 bool calc_cond = false) const; | |
5164 | 248 |
5785 | 249 ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 250 octave_idx_type& info, double& rcond, |
251 solve_singularity_handler sing_handler, | |
252 bool calc_cond = false) const; | |
5164 | 253 |
5785 | 254 SparseComplexMatrix bsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 255 octave_idx_type& info, double& rcond, |
256 solve_singularity_handler sing_handler, | |
257 bool calc_cond = false) const; | |
5164 | 258 |
5785 | 259 SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 260 octave_idx_type& info, double& rcond, |
5681 | 261 solve_singularity_handler sing_handler, |
262 bool calc_cond = false) const; | |
5164 | 263 |
264 // Full matrix solvers (umfpack/cholesky) | |
5681 | 265 void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, |
266 Matrix &Info, solve_singularity_handler sing_handler, | |
267 bool calc_cond) const; | |
5164 | 268 |
5785 | 269 ComplexMatrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 270 double& rcond, solve_singularity_handler sing_handler, |
271 bool calc_cond = false) const; | |
5164 | 272 |
5785 | 273 ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 274 octave_idx_type& info, double& rcond, |
275 solve_singularity_handler sing_handler, | |
276 bool calc_cond = false) const; | |
5164 | 277 |
5785 | 278 SparseComplexMatrix fsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 279 octave_idx_type& info, double& rcond, |
280 solve_singularity_handler sing_handler, | |
281 bool calc_cond = false) const; | |
5164 | 282 |
5785 | 283 SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 284 octave_idx_type& info, double& rcond, |
5681 | 285 solve_singularity_handler sing_handler, |
286 bool calc_cond = false) const; | |
5164 | 287 |
288 public: | |
289 // Generic interface to solver with no probing of type | |
5785 | 290 ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; |
291 ComplexMatrix solve (MatrixType &typ, const Matrix& b, | |
5697 | 292 octave_idx_type& info) const; |
5785 | 293 ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5697 | 294 double& rcond) const; |
5785 | 295 ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5697 | 296 double& rcond, solve_singularity_handler sing_handler, |
297 bool singular_fallback = true) const; | |
5164 | 298 |
5785 | 299 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; |
300 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | |
5275 | 301 octave_idx_type& info) const; |
5785 | 302 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
5697 | 303 octave_idx_type& info, double& rcond) const; |
5785 | 304 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
5697 | 305 octave_idx_type& info, double& rcond, |
306 solve_singularity_handler sing_handler, | |
307 bool singular_fallback = true) const; | |
5164 | 308 |
5785 | 309 SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b) const; |
310 SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, | |
5697 | 311 octave_idx_type& info) const; |
5785 | 312 SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, |
5697 | 313 octave_idx_type& info, double& rcond) const; |
5785 | 314 SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, |
5697 | 315 octave_idx_type& info, double& rcond, |
316 solve_singularity_handler sing_handler, | |
317 bool singular_fallback = true) const; | |
5164 | 318 |
5785 | 319 SparseComplexMatrix solve (MatrixType &typ, |
5164 | 320 const SparseComplexMatrix& b) const; |
5785 | 321 SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 322 octave_idx_type& info) const; |
5785 | 323 SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 324 octave_idx_type& info, double& rcond) const; |
5785 | 325 SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, |
5697 | 326 octave_idx_type& info, double& rcond, |
327 solve_singularity_handler sing_handler, | |
328 bool singular_fallback = true) const; | |
5164 | 329 |
5785 | 330 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b) const; |
331 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, | |
5697 | 332 octave_idx_type& info) const; |
5785 | 333 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, |
5697 | 334 octave_idx_type& info, double& rcond) const; |
5785 | 335 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, |
5697 | 336 octave_idx_type& info, double& rcond, |
337 solve_singularity_handler sing_handler) const; | |
5164 | 338 |
5785 | 339 ComplexColumnVector solve (MatrixType &typ, |
5164 | 340 const ComplexColumnVector& b) const; |
5785 | 341 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
5697 | 342 octave_idx_type& info) const; |
5785 | 343 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
5275 | 344 octave_idx_type& info, double& rcond) const; |
5785 | 345 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
5275 | 346 octave_idx_type& info, double& rcond, |
5164 | 347 solve_singularity_handler sing_handler) const; |
348 | |
349 // Generic interface to solver with probing of type | |
350 ComplexMatrix solve (const Matrix& b) const; | |
5275 | 351 ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; |
5697 | 352 ComplexMatrix solve (const Matrix& b, octave_idx_type& info, |
353 double& rcond) const; | |
5275 | 354 ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcond, |
5164 | 355 solve_singularity_handler sing_handler) const; |
356 | |
357 ComplexMatrix solve (const ComplexMatrix& b) const; | |
5275 | 358 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; |
359 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |
5164 | 360 double& rcond) const; |
5697 | 361 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, |
362 double& rcond, solve_singularity_handler sing_handler) const; | |
5164 | 363 |
364 SparseComplexMatrix solve (const SparseMatrix& b) const; | |
5275 | 365 SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; |
366 SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, | |
5164 | 367 double& rcond) const; |
5275 | 368 SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, |
5164 | 369 double& rcond, |
5697 | 370 solve_singularity_handler sing_handler) const; |
5164 | 371 |
372 SparseComplexMatrix solve (const SparseComplexMatrix& b) const; | |
5697 | 373 SparseComplexMatrix solve (const SparseComplexMatrix& b, |
374 octave_idx_type& info) const; | |
375 SparseComplexMatrix solve (const SparseComplexMatrix& b, | |
376 octave_idx_type& info, double& rcond) const; | |
377 SparseComplexMatrix solve (const SparseComplexMatrix& b, | |
378 octave_idx_type& info, double& rcond, | |
5164 | 379 solve_singularity_handler sing_handler) const; |
380 | |
381 ComplexColumnVector solve (const ColumnVector& b) const; | |
5275 | 382 ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; |
383 ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |
5164 | 384 double& rcond) const; |
5697 | 385 ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, |
386 double& rcond, | |
5164 | 387 solve_singularity_handler sing_handler) const; |
388 | |
389 ComplexColumnVector solve (const ComplexColumnVector& b) const; | |
5697 | 390 ComplexColumnVector solve (const ComplexColumnVector& b, |
391 octave_idx_type& info) const; | |
5275 | 392 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, |
5164 | 393 double& rcond) const; |
5275 | 394 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, |
5164 | 395 double& rcond, |
396 solve_singularity_handler sing_handler) const; | |
397 | |
398 SparseComplexMatrix squeeze (void) const; | |
399 | |
400 SparseComplexMatrix index (idx_vector& i, int resize_ok) const; | |
401 | |
402 SparseComplexMatrix index (idx_vector& i, idx_vector& j, int resize_ok) const; | |
403 | |
404 SparseComplexMatrix index (Array<idx_vector>& ra_idx, int resize_ok) const; | |
405 | |
406 SparseComplexMatrix reshape (const dim_vector& new_dims) const; | |
407 | |
5697 | 408 SparseComplexMatrix permute (const Array<octave_idx_type>& vec, |
409 bool inv = false) const; | |
5164 | 410 |
5275 | 411 SparseComplexMatrix ipermute (const Array<octave_idx_type>& vec) const; |
5164 | 412 |
7922
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7802
diff
changeset
|
413 bool any_element_is_nan (void) const; |
5164 | 414 bool any_element_is_inf_or_nan (void) const; |
415 bool all_elements_are_real (void) const; | |
416 bool all_integers (double& max_val, double& min_val) const; | |
417 bool too_large_for_float (void) const; | |
418 | |
419 SparseBoolMatrix operator ! (void) const; | |
420 | |
421 SparseBoolMatrix all (int dim = -1) const; | |
422 SparseBoolMatrix any (int dim = -1) const; | |
423 | |
424 SparseComplexMatrix cumprod (int dim = -1) const; | |
425 SparseComplexMatrix cumsum (int dim = -1) const; | |
426 SparseComplexMatrix prod (int dim = -1) const; | |
427 SparseComplexMatrix sum (int dim = -1) const; | |
428 SparseComplexMatrix sumsq (int dim = -1) const; | |
429 SparseMatrix abs (void) const; | |
430 | |
5275 | 431 SparseComplexMatrix diag (octave_idx_type k = 0) const; |
5164 | 432 |
433 // i/o | |
6108 | 434 friend OCTAVE_API std::ostream& operator << (std::ostream& os, |
5164 | 435 const SparseComplexMatrix& a); |
6108 | 436 friend OCTAVE_API std::istream& operator >> (std::istream& is, |
5164 | 437 SparseComplexMatrix& a); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
438 |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
439 typedef double (*dmapper) (const Complex&); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
440 typedef Complex (*cmapper) (const Complex&); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
441 typedef bool (*bmapper) (const Complex&); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
442 SparseMatrix map (dmapper fcn) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
443 SparseComplexMatrix map (cmapper fcn) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
444 SparseBoolMatrix map (bmapper fcn) const; |
5164 | 445 }; |
446 | |
6108 | 447 extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, |
5164 | 448 const SparseComplexMatrix&); |
6108 | 449 extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, |
5164 | 450 const SparseMatrix&); |
6108 | 451 extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, |
5164 | 452 const SparseComplexMatrix&); |
453 | |
6108 | 454 extern OCTAVE_API ComplexMatrix operator * (const Matrix&, |
5429 | 455 const SparseComplexMatrix&); |
6108 | 456 extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, |
5429 | 457 const SparseMatrix&); |
6108 | 458 extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, |
5429 | 459 const SparseComplexMatrix&); |
7802
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
460 extern OCTAVE_API ComplexMatrix mul_trans (const ComplexMatrix&, |
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
461 const SparseComplexMatrix&); |
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
462 extern OCTAVE_API ComplexMatrix mul_herm (const ComplexMatrix&, |
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
463 const SparseComplexMatrix&); |
5429 | 464 |
6108 | 465 extern OCTAVE_API ComplexMatrix operator * (const SparseMatrix&, |
5429 | 466 const ComplexMatrix&); |
6108 | 467 extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, |
5429 | 468 const Matrix&); |
6108 | 469 extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, |
5429 | 470 const ComplexMatrix&); |
7802
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
471 extern OCTAVE_API ComplexMatrix trans_mul (const SparseComplexMatrix&, |
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
472 const ComplexMatrix&); |
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
473 extern OCTAVE_API ComplexMatrix herm_mul (const SparseComplexMatrix&, |
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
474 const ComplexMatrix&); |
5429 | 475 |
6108 | 476 extern OCTAVE_API SparseComplexMatrix min (const Complex& c, |
5164 | 477 const SparseComplexMatrix& m); |
6108 | 478 extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& m, |
5164 | 479 const Complex& c); |
6108 | 480 extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& a, |
5164 | 481 const SparseComplexMatrix& b); |
482 | |
6108 | 483 extern OCTAVE_API SparseComplexMatrix max (const Complex& c, |
5164 | 484 const SparseComplexMatrix& m); |
6108 | 485 extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& m, |
5164 | 486 const Complex& c); |
6108 | 487 extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& a, |
5164 | 488 const SparseComplexMatrix& b); |
489 | |
6708 | 490 SPARSE_SMS_CMP_OP_DECLS (SparseComplexMatrix, Complex, OCTAVE_API) |
491 SPARSE_SMS_BOOL_OP_DECLS (SparseComplexMatrix, Complex, OCTAVE_API) | |
5164 | 492 |
6708 | 493 SPARSE_SSM_CMP_OP_DECLS (Complex, SparseComplexMatrix, OCTAVE_API) |
494 SPARSE_SSM_BOOL_OP_DECLS (Complex, SparseComplexMatrix, OCTAVE_API) | |
5164 | 495 |
6708 | 496 SPARSE_SMSM_CMP_OP_DECLS (SparseComplexMatrix, SparseComplexMatrix, OCTAVE_API) |
497 SPARSE_SMSM_BOOL_OP_DECLS (SparseComplexMatrix, SparseComplexMatrix, OCTAVE_API) | |
5164 | 498 |
499 SPARSE_FORWARD_DEFS (MSparse, SparseComplexMatrix, ComplexMatrix, Complex) | |
500 | |
5351 | 501 #ifdef IDX_TYPE_LONG |
5322 | 502 #define UMFPACK_ZNAME(name) umfpack_zl_ ## name |
503 #else | |
504 #define UMFPACK_ZNAME(name) umfpack_zi_ ## name | |
505 #endif | |
506 | |
5164 | 507 #endif |
508 | |
509 /* | |
510 ;;; Local Variables: *** | |
511 ;;; mode: C++ *** | |
512 ;;; End: *** | |
513 */ |