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