Mercurial > hg > octave-lyh
annotate liboctave/dSparse.h @ 8015:30629059b72d
Update the manual to reflect the changes in error output
author | sh@sh-laptop |
---|---|
date | Wed, 06 Aug 2008 22:23:54 +0200 |
parents | 935be827eaf8 |
children | b11c31849b44 |
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 | |
33 #include "dbleDET.h" | |
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 |
5506 | 124 private: |
5785 | 125 SparseMatrix dinverse (MatrixType &mattyp, octave_idx_type& info, |
5506 | 126 double& rcond, const bool force = false, |
127 const bool calccond = true) const; | |
128 | |
5785 | 129 SparseMatrix tinverse (MatrixType &mattyp, octave_idx_type& info, |
5506 | 130 double& rcond, const bool force = false, |
131 const bool calccond = true) const; | |
132 | |
133 public: | |
5164 | 134 SparseMatrix inverse (void) const; |
5785 | 135 SparseMatrix inverse (MatrixType& mattype) const; |
136 SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info) const; | |
137 SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info, | |
5506 | 138 double& rcond, int force = 0, int calc_cond = 1) const; |
5164 | 139 |
140 DET determinant (void) const; | |
5275 | 141 DET determinant (octave_idx_type& info) const; |
142 DET determinant (octave_idx_type& info, double& rcond, int calc_cond = 1) const; | |
5164 | 143 |
144 private: | |
145 // Diagonal matrix solvers | |
5785 | 146 Matrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 147 double& rcond, solve_singularity_handler sing_handler, |
148 bool calc_cond = false) const; | |
5164 | 149 |
5785 | 150 ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 151 octave_idx_type& info, double& rcond, |
152 solve_singularity_handler sing_handler, | |
153 bool calc_cond = false) const; | |
5164 | 154 |
5785 | 155 SparseMatrix dsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 156 octave_idx_type& info, double& rcond, |
157 solve_singularity_handler sing_handler, | |
158 bool calc_cond = false) const; | |
5164 | 159 |
5785 | 160 SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 161 octave_idx_type& info, double& rcond, |
5681 | 162 solve_singularity_handler sing_handler, |
163 bool calc_cond = false) const; | |
5164 | 164 |
165 // Upper triangular matrix solvers | |
5785 | 166 Matrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 167 double& rcond, solve_singularity_handler sing_handler, |
168 bool calc_cond = false) const; | |
5164 | 169 |
5785 | 170 ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 171 octave_idx_type& info, double& rcond, |
172 solve_singularity_handler sing_handler, | |
173 bool calc_cond = false) const; | |
5164 | 174 |
5785 | 175 SparseMatrix utsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 176 octave_idx_type& info, double& rcond, |
177 solve_singularity_handler sing_handler, | |
178 bool calc_cond = false) const; | |
5164 | 179 |
5785 | 180 SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 181 octave_idx_type& info, double& rcond, |
5681 | 182 solve_singularity_handler sing_handler, |
183 bool calc_cond = false) const; | |
5164 | 184 |
185 // Lower triangular matrix solvers | |
5785 | 186 Matrix ltsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 187 double& rcond, solve_singularity_handler sing_handler, |
188 bool calc_cond = false) const; | |
5164 | 189 |
5785 | 190 ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 191 octave_idx_type& info, double& rcond, |
192 solve_singularity_handler sing_handler, | |
193 bool calc_cond = false) const; | |
5164 | 194 |
5785 | 195 SparseMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 196 octave_idx_type& info, double& rcond, |
197 solve_singularity_handler sing_handler, | |
198 bool calc_cond = false) const; | |
5164 | 199 |
5785 | 200 SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 201 octave_idx_type& info, double& rcond, |
5681 | 202 solve_singularity_handler sing_handler, |
203 bool calc_cond = false) const; | |
5164 | 204 |
205 // Tridiagonal matrix solvers | |
5785 | 206 Matrix trisolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 207 double& rcond, solve_singularity_handler sing_handler, |
208 bool calc_cond = false) const; | |
5164 | 209 |
5785 | 210 ComplexMatrix trisolve (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 SparseMatrix trisolve (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 trisolve (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 // Banded matrix solvers (umfpack/cholesky) | |
5785 | 226 Matrix bsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 227 double& rcond, solve_singularity_handler sing_handler, |
228 bool calc_cond = false) const; | |
5164 | 229 |
5785 | 230 ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, |
5681 | 231 octave_idx_type& info, double& rcond, |
232 solve_singularity_handler sing_handler, | |
233 bool calc_cond = false) const; | |
5164 | 234 |
5785 | 235 SparseMatrix bsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 236 octave_idx_type& info, double& rcond, |
237 solve_singularity_handler sing_handler, | |
238 bool calc_cond = false) const; | |
5164 | 239 |
5785 | 240 SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 241 octave_idx_type& info, double& rcond, |
5681 | 242 solve_singularity_handler sing_handler, |
243 bool calc_cond = false) const; | |
5164 | 244 |
245 // Full matrix solvers (umfpack/cholesky) | |
5681 | 246 void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, |
247 Matrix &Info, solve_singularity_handler sing_handler, | |
248 bool calc_cond = false) const; | |
5164 | 249 |
5785 | 250 Matrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5681 | 251 double& rcond, solve_singularity_handler sing_handler, |
252 bool calc_cond = false) const; | |
5164 | 253 |
5785 | 254 ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& 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 SparseMatrix fsolve (MatrixType &typ, const SparseMatrix& b, |
5681 | 260 octave_idx_type& info, double& rcond, |
261 solve_singularity_handler sing_handler, | |
262 bool calc_cond = false) const; | |
5164 | 263 |
5785 | 264 SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b, |
5681 | 265 octave_idx_type& info, double& rcond, |
266 solve_singularity_handler sing_handler, | |
267 bool calc_cond = false) const; | |
5164 | 268 |
269 public: | |
270 // Generic interface to solver with no probing of type | |
5785 | 271 Matrix solve (MatrixType &typ, const Matrix& b) const; |
272 Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) const; | |
273 Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |
5164 | 274 double& rcond) const; |
5785 | 275 Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
5697 | 276 double& rcond, solve_singularity_handler sing_handler, |
277 bool singular_fallback = true) const; | |
5164 | 278 |
5785 | 279 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; |
280 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | |
5275 | 281 octave_idx_type& info) const; |
5785 | 282 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
5697 | 283 octave_idx_type& info, double& rcond) const; |
5785 | 284 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
5697 | 285 octave_idx_type& info, double& rcond, |
286 solve_singularity_handler sing_handler, | |
287 bool singular_fallback = true) const; | |
5164 | 288 |
5785 | 289 SparseMatrix solve (MatrixType &typ, const SparseMatrix& b) const; |
290 SparseMatrix solve (MatrixType &typ, const SparseMatrix& b, | |
5275 | 291 octave_idx_type& info) const; |
5785 | 292 SparseMatrix solve (MatrixType &typ, const SparseMatrix& b, |
5697 | 293 octave_idx_type& info, double& rcond) const; |
5785 | 294 SparseMatrix solve (MatrixType &typ, const SparseMatrix& b, |
5697 | 295 octave_idx_type& info, double& rcond, |
296 solve_singularity_handler sing_handler, | |
297 bool singular_fallback = true) const; | |
5164 | 298 |
5785 | 299 SparseComplexMatrix solve (MatrixType &typ, |
5164 | 300 const SparseComplexMatrix& b) const; |
5785 | 301 SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 302 octave_idx_type& info) const; |
5785 | 303 SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, |
5275 | 304 octave_idx_type& info, double& rcond) const; |
5785 | 305 SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, |
5697 | 306 octave_idx_type& info, double& rcond, |
307 solve_singularity_handler sing_handler, | |
308 bool singular_fallabck = true) const; | |
5164 | 309 |
5785 | 310 ColumnVector solve (MatrixType &typ, const ColumnVector& b) const; |
311 ColumnVector solve (MatrixType &typ, const ColumnVector& b, | |
5275 | 312 octave_idx_type& info) const; |
5785 | 313 ColumnVector solve (MatrixType &typ, const ColumnVector& b, |
5275 | 314 octave_idx_type& info, double& rcond) const; |
5785 | 315 ColumnVector solve (MatrixType &typ, const ColumnVector& b, |
5697 | 316 octave_idx_type& info, double& rcond, |
317 solve_singularity_handler sing_handler) const; | |
5164 | 318 |
5785 | 319 ComplexColumnVector solve (MatrixType &typ, |
5164 | 320 const ComplexColumnVector& b) const; |
5785 | 321 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
5697 | 322 octave_idx_type& info) const; |
5785 | 323 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
5275 | 324 octave_idx_type& info, double& rcond) const; |
5785 | 325 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
5275 | 326 octave_idx_type& info, double& rcond, |
5164 | 327 solve_singularity_handler sing_handler) const; |
328 | |
329 // Generic interface to solver with probing of type | |
330 Matrix solve (const Matrix& b) const; | |
5275 | 331 Matrix solve (const Matrix& b, octave_idx_type& info) const; |
332 Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond) const; | |
333 Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond, | |
5164 | 334 solve_singularity_handler sing_handler) const; |
335 | |
336 ComplexMatrix solve (const ComplexMatrix& b) const; | |
5275 | 337 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; |
338 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |
5164 | 339 double& rcond) const; |
5275 | 340 ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond, |
5164 | 341 solve_singularity_handler sing_handler) const; |
342 | |
343 SparseMatrix solve (const SparseMatrix& b) const; | |
5275 | 344 SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; |
345 SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, | |
5164 | 346 double& rcond) const; |
5275 | 347 SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& rcond, |
5164 | 348 solve_singularity_handler sing_handler) const; |
349 | |
350 SparseComplexMatrix solve (const SparseComplexMatrix& b) const; | |
5275 | 351 SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info) const; |
352 SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, | |
5164 | 353 double& rcond) const; |
5275 | 354 SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, |
5164 | 355 double& rcond, |
356 solve_singularity_handler sing_handler) const; | |
357 | |
358 ColumnVector solve (const ColumnVector& b) const; | |
5275 | 359 ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; |
360 ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const; | |
361 ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond, | |
5164 | 362 solve_singularity_handler sing_handler) const; |
363 | |
364 ComplexColumnVector solve (const ComplexColumnVector& b) const; | |
5275 | 365 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; |
366 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, | |
5164 | 367 double& rcond) const; |
5275 | 368 ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, |
5164 | 369 double& rcond, |
370 solve_singularity_handler sing_handler) const; | |
371 | |
372 // other operations | |
373 | |
374 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
|
375 bool any_element_is_nan (void) const; |
5164 | 376 bool any_element_is_inf_or_nan (void) const; |
6989 | 377 bool all_elements_are_zero (void) const; |
5164 | 378 bool all_elements_are_int_or_inf_or_nan (void) const; |
379 bool all_integers (double& max_val, double& min_val) const; | |
380 bool too_large_for_float (void) const; | |
381 | |
382 SparseBoolMatrix operator ! (void) const; | |
383 | |
384 SparseBoolMatrix all (int dim = -1) const; | |
385 SparseBoolMatrix any (int dim = -1) const; | |
386 | |
387 SparseMatrix cumprod (int dim = -1) const; | |
388 SparseMatrix cumsum (int dim = -1) const; | |
389 SparseMatrix prod (int dim = -1) const; | |
390 SparseMatrix sum (int dim = -1) const; | |
391 SparseMatrix sumsq (int dim = -1) const; | |
392 SparseMatrix abs (void) const; | |
393 | |
5275 | 394 SparseMatrix diag (octave_idx_type k = 0) const; |
5164 | 395 |
396 Matrix matrix_value (void) const; | |
397 | |
398 SparseMatrix squeeze (void) const; | |
399 | |
400 SparseMatrix index (idx_vector& i, int resize_ok) const; | |
401 | |
402 SparseMatrix index (idx_vector& i, idx_vector& j, int resize_ok) const; | |
403 | |
404 SparseMatrix index (Array<idx_vector>& ra_idx, int resize_ok) const; | |
405 | |
406 SparseMatrix reshape (const dim_vector& new_dims) const; | |
407 | |
5275 | 408 SparseMatrix permute (const Array<octave_idx_type>& vec, bool inv = false) const; |
5164 | 409 |
5275 | 410 SparseMatrix ipermute (const Array<octave_idx_type>& vec) const; |
5164 | 411 |
412 // i/o | |
413 | |
6108 | 414 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const SparseMatrix& a); |
415 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
|
416 |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
417 typedef double (*dmapper) (double); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
418 typedef Complex (*cmapper) (const Complex&); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
419 typedef bool (*bmapper) (double); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
420 SparseMatrix map (dmapper fcn) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
421 SparseComplexMatrix map (cmapper fcn) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
422 SparseBoolMatrix map (bmapper fcn) const; |
5164 | 423 }; |
424 | |
5509 | 425 // Publish externally used friend functions. |
426 | |
6108 | 427 extern OCTAVE_API SparseMatrix real (const SparseComplexMatrix& a); |
428 extern OCTAVE_API SparseMatrix imag (const SparseComplexMatrix& a); | |
5509 | 429 |
430 // Other operators. | |
431 | |
6108 | 432 extern OCTAVE_API SparseMatrix operator * (const SparseMatrix& a, |
5164 | 433 const SparseMatrix& b); |
6108 | 434 extern OCTAVE_API Matrix operator * (const Matrix& a, |
5429 | 435 const SparseMatrix& b); |
7802
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
436 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
|
437 const SparseMatrix& b); |
6108 | 438 extern OCTAVE_API Matrix operator * (const SparseMatrix& a, |
5429 | 439 const Matrix& b); |
7802
1a446f28ce68
implement optimized sparse-dense transposed multiplication
Jaroslav Hajek <highegg@gmail.com>
parents:
7503
diff
changeset
|
440 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
|
441 const Matrix& b); |
5164 | 442 |
6108 | 443 extern OCTAVE_API SparseMatrix min (double d, const SparseMatrix& m); |
444 extern OCTAVE_API SparseMatrix min (const SparseMatrix& m, double d); | |
445 extern OCTAVE_API SparseMatrix min (const SparseMatrix& a, const SparseMatrix& b); | |
5164 | 446 |
6108 | 447 extern OCTAVE_API SparseMatrix max (double d, const SparseMatrix& m); |
448 extern OCTAVE_API SparseMatrix max (const SparseMatrix& m, double d); | |
449 extern OCTAVE_API SparseMatrix max (const SparseMatrix& a, const SparseMatrix& b); | |
5164 | 450 |
6708 | 451 SPARSE_SMS_CMP_OP_DECLS (SparseMatrix, double, OCTAVE_API) |
452 SPARSE_SMS_BOOL_OP_DECLS (SparseMatrix, double, OCTAVE_API) | |
5164 | 453 |
6708 | 454 SPARSE_SSM_CMP_OP_DECLS (double, SparseMatrix, OCTAVE_API) |
455 SPARSE_SSM_BOOL_OP_DECLS (double, SparseMatrix, OCTAVE_API) | |
5164 | 456 |
6708 | 457 SPARSE_SMSM_CMP_OP_DECLS (SparseMatrix, SparseMatrix, OCTAVE_API) |
458 SPARSE_SMSM_BOOL_OP_DECLS (SparseMatrix, SparseMatrix, OCTAVE_API) | |
5164 | 459 |
460 SPARSE_FORWARD_DEFS (MSparse, SparseMatrix, Matrix, double) | |
461 | |
5351 | 462 #ifdef IDX_TYPE_LONG |
5322 | 463 #define UMFPACK_DNAME(name) umfpack_dl_ ## name |
464 #else | |
465 #define UMFPACK_DNAME(name) umfpack_di_ ## name | |
466 #endif | |
467 | |
5164 | 468 #endif |
469 | |
470 /* | |
471 ;;; Local Variables: *** | |
472 ;;; mode: C++ *** | |
473 ;;; End: *** | |
474 */ |