Mercurial > hg > octave-lyh
comparison liboctave/CSparse.h @ 5785:6b9cec830d72
[project @ 2006-05-03 19:32:46 by dbateman]
author | dbateman |
---|---|
date | Wed, 03 May 2006 19:32:48 +0000 |
parents | 2fe20065a545 |
children | 143b556ce725 |
comparison
equal
deleted
inserted
replaced
5784:70f7659d0fb9 | 5785:6b9cec830d72 |
---|---|
32 | 32 |
33 #include "CmplxDET.h" | 33 #include "CmplxDET.h" |
34 #include "MSparse.h" | 34 #include "MSparse.h" |
35 #include "MSparse-defs.h" | 35 #include "MSparse-defs.h" |
36 #include "Sparse-op-defs.h" | 36 #include "Sparse-op-defs.h" |
37 #include "SparseType.h" | 37 #include "MatrixType.h" |
38 | 38 |
39 class SparseMatrix; | 39 class SparseMatrix; |
40 class SparseBoolMatrix; | 40 class SparseBoolMatrix; |
41 | 41 |
42 class | 42 class |
119 { return MSparse<Complex>::transpose (); } | 119 { return MSparse<Complex>::transpose (); } |
120 | 120 |
121 friend SparseComplexMatrix conj (const SparseComplexMatrix& a); | 121 friend SparseComplexMatrix conj (const SparseComplexMatrix& a); |
122 | 122 |
123 private: | 123 private: |
124 SparseComplexMatrix dinverse (SparseType &mattyp, octave_idx_type& info, | 124 SparseComplexMatrix dinverse (MatrixType &mattyp, octave_idx_type& info, |
125 double& rcond, const bool force = false, | 125 double& rcond, const bool force = false, |
126 const bool calccond = true) const; | 126 const bool calccond = true) const; |
127 | 127 |
128 SparseComplexMatrix tinverse (SparseType &mattyp, octave_idx_type& info, | 128 SparseComplexMatrix tinverse (MatrixType &mattyp, octave_idx_type& info, |
129 double& rcond, const bool force = false, | 129 double& rcond, const bool force = false, |
130 const bool calccond = true) const; | 130 const bool calccond = true) const; |
131 | 131 |
132 public: | 132 public: |
133 SparseComplexMatrix inverse (void) const; | 133 SparseComplexMatrix inverse (void) const; |
134 SparseComplexMatrix inverse (SparseType& mattype) const; | 134 SparseComplexMatrix inverse (MatrixType& mattype) const; |
135 SparseComplexMatrix inverse (SparseType& mattype, | 135 SparseComplexMatrix inverse (MatrixType& mattype, |
136 octave_idx_type& info) const; | 136 octave_idx_type& info) const; |
137 SparseComplexMatrix inverse (SparseType& mattype, octave_idx_type& info, | 137 SparseComplexMatrix inverse (MatrixType& mattype, octave_idx_type& info, |
138 double& rcond, int force = 0, | 138 double& rcond, int force = 0, |
139 int calc_cond = 1) const; | 139 int calc_cond = 1) const; |
140 | 140 |
141 ComplexDET determinant (void) const; | 141 ComplexDET determinant (void) const; |
142 ComplexDET determinant (octave_idx_type& info) const; | 142 ComplexDET determinant (octave_idx_type& info) const; |
143 ComplexDET determinant (octave_idx_type& info, double& rcond, | 143 ComplexDET determinant (octave_idx_type& info, double& rcond, |
144 int calc_cond = 1) const; | 144 int calc_cond = 1) const; |
145 | 145 |
146 private: | 146 private: |
147 // Diagonal matrix solvers | 147 // Diagonal matrix solvers |
148 ComplexMatrix dsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, | 148 ComplexMatrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
149 double& rcond, solve_singularity_handler sing_handler, | 149 double& rcond, solve_singularity_handler sing_handler, |
150 bool calc_cond = false) const; | 150 bool calc_cond = false) const; |
151 | 151 |
152 ComplexMatrix dsolve (SparseType &typ, const ComplexMatrix& b, | 152 ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, |
153 octave_idx_type& info, double& rcond, | 153 octave_idx_type& info, double& rcond, |
154 solve_singularity_handler sing_handler, | 154 solve_singularity_handler sing_handler, |
155 bool calc_cond = false) const; | 155 bool calc_cond = false) const; |
156 | 156 |
157 SparseComplexMatrix dsolve (SparseType &typ, const SparseMatrix& b, | 157 SparseComplexMatrix dsolve (MatrixType &typ, const SparseMatrix& b, |
158 octave_idx_type& info, double& rcond, | 158 octave_idx_type& info, double& rcond, |
159 solve_singularity_handler sing_handler, | 159 solve_singularity_handler sing_handler, |
160 bool calc_cond = false) const; | 160 bool calc_cond = false) const; |
161 | 161 |
162 SparseComplexMatrix dsolve (SparseType &typ, const SparseComplexMatrix& b, | 162 SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b, |
163 octave_idx_type& info, double& rcond, | 163 octave_idx_type& info, double& rcond, |
164 solve_singularity_handler sing_handler, | 164 solve_singularity_handler sing_handler, |
165 bool calc_cond = false) const; | 165 bool calc_cond = false) const; |
166 | 166 |
167 // Upper triangular matrix solvers | 167 // Upper triangular matrix solvers |
168 ComplexMatrix utsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, | 168 ComplexMatrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
169 double& rcond, solve_singularity_handler sing_handler, | 169 double& rcond, solve_singularity_handler sing_handler, |
170 bool calc_cond = false) const; | 170 bool calc_cond = false) const; |
171 | 171 |
172 ComplexMatrix utsolve (SparseType &typ, const ComplexMatrix& b, | 172 ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, |
173 octave_idx_type& info, double& rcond, | 173 octave_idx_type& info, double& rcond, |
174 solve_singularity_handler sing_handler, | 174 solve_singularity_handler sing_handler, |
175 bool calc_cond = false) const; | 175 bool calc_cond = false) const; |
176 | 176 |
177 SparseComplexMatrix utsolve (SparseType &typ, const SparseMatrix& b, | 177 SparseComplexMatrix utsolve (MatrixType &typ, const SparseMatrix& b, |
178 octave_idx_type& info, double& rcond, | 178 octave_idx_type& info, double& rcond, |
179 solve_singularity_handler sing_handler, | 179 solve_singularity_handler sing_handler, |
180 bool calc_cond = false) const; | 180 bool calc_cond = false) const; |
181 | 181 |
182 SparseComplexMatrix utsolve (SparseType &typ, const SparseComplexMatrix& b, | 182 SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, |
183 octave_idx_type& info, double& rcond, | 183 octave_idx_type& info, double& rcond, |
184 solve_singularity_handler sing_handler, | 184 solve_singularity_handler sing_handler, |
185 bool calc_cond = false) const; | 185 bool calc_cond = false) const; |
186 | 186 |
187 // Lower triangular matrix solvers | 187 // Lower triangular matrix solvers |
188 ComplexMatrix ltsolve (SparseType &typ, const Matrix& b, | 188 ComplexMatrix ltsolve (MatrixType &typ, const Matrix& b, |
189 octave_idx_type& info, double& rcond, | 189 octave_idx_type& info, double& rcond, |
190 solve_singularity_handler sing_handler, | 190 solve_singularity_handler sing_handler, |
191 bool calc_cond = false) const; | 191 bool calc_cond = false) const; |
192 | 192 |
193 ComplexMatrix ltsolve (SparseType &typ, const ComplexMatrix& b, | 193 ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, |
194 octave_idx_type& info, double& rcond, | 194 octave_idx_type& info, double& rcond, |
195 solve_singularity_handler sing_handler, | 195 solve_singularity_handler sing_handler, |
196 bool calc_cond = false) const; | 196 bool calc_cond = false) const; |
197 | 197 |
198 SparseComplexMatrix ltsolve (SparseType &typ, const SparseMatrix& b, | 198 SparseComplexMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, |
199 octave_idx_type& info, double& rcond, | 199 octave_idx_type& info, double& rcond, |
200 solve_singularity_handler sing_handler, | 200 solve_singularity_handler sing_handler, |
201 bool calc_cond = false) const; | 201 bool calc_cond = false) const; |
202 | 202 |
203 SparseComplexMatrix ltsolve (SparseType &typ, const SparseComplexMatrix& b, | 203 SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, |
204 octave_idx_type& info, double& rcond, | 204 octave_idx_type& info, double& rcond, |
205 solve_singularity_handler sing_handler, | 205 solve_singularity_handler sing_handler, |
206 bool calc_cond = false) const; | 206 bool calc_cond = false) const; |
207 | 207 |
208 // Tridiagonal matrix solvers | 208 // Tridiagonal matrix solvers |
209 ComplexMatrix trisolve (SparseType &typ, const Matrix& b, | 209 ComplexMatrix trisolve (MatrixType &typ, const Matrix& b, |
210 octave_idx_type& info, double& rcond, | 210 octave_idx_type& info, double& rcond, |
211 solve_singularity_handler sing_handler, | 211 solve_singularity_handler sing_handler, |
212 bool calc_cond = false) const; | 212 bool calc_cond = false) const; |
213 | 213 |
214 ComplexMatrix trisolve (SparseType &typ, const ComplexMatrix& b, | 214 ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, |
215 octave_idx_type& info, double& rcond, | 215 octave_idx_type& info, double& rcond, |
216 solve_singularity_handler sing_handler, | 216 solve_singularity_handler sing_handler, |
217 bool calc_cond = false) const; | 217 bool calc_cond = false) const; |
218 | 218 |
219 SparseComplexMatrix trisolve (SparseType &typ, const SparseMatrix& b, | 219 SparseComplexMatrix trisolve (MatrixType &typ, const SparseMatrix& b, |
220 octave_idx_type& info, double& rcond, | 220 octave_idx_type& info, double& rcond, |
221 solve_singularity_handler sing_handler, | 221 solve_singularity_handler sing_handler, |
222 bool calc_cond = false) const; | 222 bool calc_cond = false) const; |
223 | 223 |
224 SparseComplexMatrix trisolve (SparseType &typ, const SparseComplexMatrix& b, | 224 SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, |
225 octave_idx_type& info, double& rcond, | 225 octave_idx_type& info, double& rcond, |
226 solve_singularity_handler sing_handler, | 226 solve_singularity_handler sing_handler, |
227 bool calc_cond = false) const; | 227 bool calc_cond = false) const; |
228 | 228 |
229 // Banded matrix solvers (umfpack/cholesky) | 229 // Banded matrix solvers (umfpack/cholesky) |
230 ComplexMatrix bsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, | 230 ComplexMatrix bsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
231 double& rcond, solve_singularity_handler sing_handler, | 231 double& rcond, solve_singularity_handler sing_handler, |
232 bool calc_cond = false) const; | 232 bool calc_cond = false) const; |
233 | 233 |
234 ComplexMatrix bsolve (SparseType &typ, const ComplexMatrix& b, | 234 ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, |
235 octave_idx_type& info, double& rcond, | 235 octave_idx_type& info, double& rcond, |
236 solve_singularity_handler sing_handler, | 236 solve_singularity_handler sing_handler, |
237 bool calc_cond = false) const; | 237 bool calc_cond = false) const; |
238 | 238 |
239 SparseComplexMatrix bsolve (SparseType &typ, const SparseMatrix& b, | 239 SparseComplexMatrix bsolve (MatrixType &typ, const SparseMatrix& b, |
240 octave_idx_type& info, double& rcond, | 240 octave_idx_type& info, double& rcond, |
241 solve_singularity_handler sing_handler, | 241 solve_singularity_handler sing_handler, |
242 bool calc_cond = false) const; | 242 bool calc_cond = false) const; |
243 | 243 |
244 SparseComplexMatrix bsolve (SparseType &typ, const SparseComplexMatrix& b, | 244 SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b, |
245 octave_idx_type& info, double& rcond, | 245 octave_idx_type& info, double& rcond, |
246 solve_singularity_handler sing_handler, | 246 solve_singularity_handler sing_handler, |
247 bool calc_cond = false) const; | 247 bool calc_cond = false) const; |
248 | 248 |
249 // Full matrix solvers (umfpack/cholesky) | 249 // Full matrix solvers (umfpack/cholesky) |
250 void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, | 250 void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, |
251 Matrix &Info, solve_singularity_handler sing_handler, | 251 Matrix &Info, solve_singularity_handler sing_handler, |
252 bool calc_cond) const; | 252 bool calc_cond) const; |
253 | 253 |
254 ComplexMatrix fsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, | 254 ComplexMatrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
255 double& rcond, solve_singularity_handler sing_handler, | 255 double& rcond, solve_singularity_handler sing_handler, |
256 bool calc_cond = false) const; | 256 bool calc_cond = false) const; |
257 | 257 |
258 ComplexMatrix fsolve (SparseType &typ, const ComplexMatrix& b, | 258 ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, |
259 octave_idx_type& info, double& rcond, | 259 octave_idx_type& info, double& rcond, |
260 solve_singularity_handler sing_handler, | 260 solve_singularity_handler sing_handler, |
261 bool calc_cond = false) const; | 261 bool calc_cond = false) const; |
262 | 262 |
263 SparseComplexMatrix fsolve (SparseType &typ, const SparseMatrix& b, | 263 SparseComplexMatrix fsolve (MatrixType &typ, const SparseMatrix& b, |
264 octave_idx_type& info, double& rcond, | 264 octave_idx_type& info, double& rcond, |
265 solve_singularity_handler sing_handler, | 265 solve_singularity_handler sing_handler, |
266 bool calc_cond = false) const; | 266 bool calc_cond = false) const; |
267 | 267 |
268 SparseComplexMatrix fsolve (SparseType &typ, const SparseComplexMatrix& b, | 268 SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b, |
269 octave_idx_type& info, double& rcond, | 269 octave_idx_type& info, double& rcond, |
270 solve_singularity_handler sing_handler, | 270 solve_singularity_handler sing_handler, |
271 bool calc_cond = false) const; | 271 bool calc_cond = false) const; |
272 | 272 |
273 public: | 273 public: |
274 // Generic interface to solver with no probing of type | 274 // Generic interface to solver with no probing of type |
275 ComplexMatrix solve (SparseType &typ, const Matrix& b) const; | 275 ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; |
276 ComplexMatrix solve (SparseType &typ, const Matrix& b, | 276 ComplexMatrix solve (MatrixType &typ, const Matrix& b, |
277 octave_idx_type& info) const; | 277 octave_idx_type& info) const; |
278 ComplexMatrix solve (SparseType &typ, const Matrix& b, octave_idx_type& info, | 278 ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
279 double& rcond) const; | 279 double& rcond) const; |
280 ComplexMatrix solve (SparseType &typ, const Matrix& b, octave_idx_type& info, | 280 ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, |
281 double& rcond, solve_singularity_handler sing_handler, | 281 double& rcond, solve_singularity_handler sing_handler, |
282 bool singular_fallback = true) const; | 282 bool singular_fallback = true) const; |
283 | 283 |
284 ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b) const; | 284 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; |
285 ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, | 285 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
286 octave_idx_type& info) const; | 286 octave_idx_type& info) const; |
287 ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, | 287 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
288 octave_idx_type& info, double& rcond) const; | 288 octave_idx_type& info, double& rcond) const; |
289 ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, | 289 ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, |
290 octave_idx_type& info, double& rcond, | 290 octave_idx_type& info, double& rcond, |
291 solve_singularity_handler sing_handler, | 291 solve_singularity_handler sing_handler, |
292 bool singular_fallback = true) const; | 292 bool singular_fallback = true) const; |
293 | 293 |
294 SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b) const; | 294 SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b) const; |
295 SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b, | 295 SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, |
296 octave_idx_type& info) const; | 296 octave_idx_type& info) const; |
297 SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b, | 297 SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, |
298 octave_idx_type& info, double& rcond) const; | 298 octave_idx_type& info, double& rcond) const; |
299 SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b, | 299 SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, |
300 octave_idx_type& info, double& rcond, | 300 octave_idx_type& info, double& rcond, |
301 solve_singularity_handler sing_handler, | 301 solve_singularity_handler sing_handler, |
302 bool singular_fallback = true) const; | 302 bool singular_fallback = true) const; |
303 | 303 |
304 SparseComplexMatrix solve (SparseType &typ, | 304 SparseComplexMatrix solve (MatrixType &typ, |
305 const SparseComplexMatrix& b) const; | 305 const SparseComplexMatrix& b) const; |
306 SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, | 306 SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, |
307 octave_idx_type& info) const; | 307 octave_idx_type& info) const; |
308 SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, | 308 SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, |
309 octave_idx_type& info, double& rcond) const; | 309 octave_idx_type& info, double& rcond) const; |
310 SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, | 310 SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, |
311 octave_idx_type& info, double& rcond, | 311 octave_idx_type& info, double& rcond, |
312 solve_singularity_handler sing_handler, | 312 solve_singularity_handler sing_handler, |
313 bool singular_fallback = true) const; | 313 bool singular_fallback = true) const; |
314 | 314 |
315 ComplexColumnVector solve (SparseType &typ, const ColumnVector& b) const; | 315 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b) const; |
316 ComplexColumnVector solve (SparseType &typ, const ColumnVector& b, | 316 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, |
317 octave_idx_type& info) const; | 317 octave_idx_type& info) const; |
318 ComplexColumnVector solve (SparseType &typ, const ColumnVector& b, | 318 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, |
319 octave_idx_type& info, double& rcond) const; | 319 octave_idx_type& info, double& rcond) const; |
320 ComplexColumnVector solve (SparseType &typ, const ColumnVector& b, | 320 ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, |
321 octave_idx_type& info, double& rcond, | 321 octave_idx_type& info, double& rcond, |
322 solve_singularity_handler sing_handler) const; | 322 solve_singularity_handler sing_handler) const; |
323 | 323 |
324 ComplexColumnVector solve (SparseType &typ, | 324 ComplexColumnVector solve (MatrixType &typ, |
325 const ComplexColumnVector& b) const; | 325 const ComplexColumnVector& b) const; |
326 ComplexColumnVector solve (SparseType &typ, const ComplexColumnVector& b, | 326 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
327 octave_idx_type& info) const; | 327 octave_idx_type& info) const; |
328 ComplexColumnVector solve (SparseType &typ, const ComplexColumnVector& b, | 328 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
329 octave_idx_type& info, double& rcond) const; | 329 octave_idx_type& info, double& rcond) const; |
330 ComplexColumnVector solve (SparseType &typ, const ComplexColumnVector& b, | 330 ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, |
331 octave_idx_type& info, double& rcond, | 331 octave_idx_type& info, double& rcond, |
332 solve_singularity_handler sing_handler) const; | 332 solve_singularity_handler sing_handler) const; |
333 | 333 |
334 // Generic interface to solver with probing of type | 334 // Generic interface to solver with probing of type |
335 ComplexMatrix solve (const Matrix& b) const; | 335 ComplexMatrix solve (const Matrix& b) const; |