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