5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
|
4 Copyright (C) 1998-2004 Andy Adler |
|
5 |
|
6 Octave is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License as published by the |
|
8 Free Software Foundation; either version 2, or (at your option) any |
|
9 later version. |
|
10 |
|
11 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 for more details. |
|
15 |
|
16 You should have received a copy of the GNU General Public License |
5307
|
17 along with this program; see the file COPYING. If not, write to the |
|
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 Boston, MA 02110-1301, USA. |
5164
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
|
27 #include <cassert> |
|
28 |
|
29 #include "Array-util.h" |
|
30 #include "oct-cmplx.h" |
|
31 #include "quit.h" |
|
32 #include "error.h" |
|
33 |
|
34 #include "dSparse.h" |
|
35 #include "CSparse.h" |
|
36 #include "oct-spparms.h" |
|
37 #include "sparse-xdiv.h" |
|
38 |
|
39 static inline bool |
5275
|
40 result_ok (octave_idx_type info) |
5164
|
41 { |
|
42 #ifdef HAVE_LSSOLVE |
|
43 return (info != -2 && info != -1); |
|
44 #else |
|
45 // If the matrix is singular, who cares as we don't have QR based solver yet |
|
46 return (info != -1); |
|
47 #endif |
|
48 } |
|
49 |
|
50 static void |
|
51 solve_singularity_warning (double rcond) |
|
52 { |
|
53 warning ("matrix singular to machine precision, rcond = %g", rcond); |
|
54 warning ("attempting to find minimum norm solution"); |
|
55 } |
|
56 |
|
57 template <class T1, class T2> |
|
58 bool |
|
59 mx_leftdiv_conform (const T1& a, const T2& b) |
|
60 { |
5275
|
61 octave_idx_type a_nr = a.rows (); |
|
62 octave_idx_type b_nr = b.rows (); |
5164
|
63 |
|
64 if (a_nr != b_nr) |
|
65 { |
5275
|
66 octave_idx_type a_nc = a.cols (); |
|
67 octave_idx_type b_nc = b.cols (); |
5164
|
68 |
|
69 gripe_nonconformant ("operator \\", a_nr, a_nc, b_nr, b_nc); |
|
70 return false; |
|
71 } |
|
72 |
|
73 return true; |
|
74 } |
|
75 |
|
76 #define INSTANTIATE_MX_LEFTDIV_CONFORM(T1, T2) \ |
|
77 template bool mx_leftdiv_conform (const T1&, const T2&) |
|
78 |
|
79 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseMatrix, SparseMatrix); |
|
80 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseMatrix, SparseComplexMatrix); |
|
81 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseComplexMatrix, SparseMatrix); |
|
82 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseComplexMatrix, SparseComplexMatrix); |
|
83 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseMatrix, Matrix); |
|
84 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseMatrix, ComplexMatrix); |
|
85 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseComplexMatrix, Matrix); |
|
86 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseComplexMatrix, ComplexMatrix); |
|
87 |
|
88 template <class T1, class T2> |
|
89 bool |
|
90 mx_div_conform (const T1& a, const T2& b) |
|
91 { |
5275
|
92 octave_idx_type a_nc = a.cols (); |
|
93 octave_idx_type b_nc = b.cols (); |
5164
|
94 |
|
95 if (a_nc != b_nc) |
|
96 { |
5275
|
97 octave_idx_type a_nr = a.rows (); |
|
98 octave_idx_type b_nr = b.rows (); |
5164
|
99 |
|
100 gripe_nonconformant ("operator /", a_nr, a_nc, b_nr, b_nc); |
|
101 return false; |
|
102 } |
|
103 |
|
104 return true; |
|
105 } |
|
106 |
|
107 #define INSTANTIATE_MX_DIV_CONFORM(T1, T2) \ |
|
108 template bool mx_div_conform (const T1&, const T2&) |
|
109 |
|
110 INSTANTIATE_MX_DIV_CONFORM (SparseMatrix, SparseMatrix); |
|
111 INSTANTIATE_MX_DIV_CONFORM (SparseMatrix, SparseComplexMatrix); |
|
112 INSTANTIATE_MX_DIV_CONFORM (SparseComplexMatrix, SparseMatrix); |
|
113 INSTANTIATE_MX_DIV_CONFORM (SparseComplexMatrix, SparseComplexMatrix); |
|
114 INSTANTIATE_MX_DIV_CONFORM (Matrix, SparseMatrix); |
|
115 INSTANTIATE_MX_DIV_CONFORM (Matrix, SparseComplexMatrix); |
|
116 INSTANTIATE_MX_DIV_CONFORM (ComplexMatrix, SparseMatrix); |
|
117 INSTANTIATE_MX_DIV_CONFORM (ComplexMatrix, SparseComplexMatrix); |
|
118 |
|
119 // Right division functions. |
|
120 // |
|
121 // op2 / op1: m cm sm scm |
|
122 // +-- +---+----+----+----+ |
|
123 // sparse matrix | 1 | 3 | 5 | 7 | |
|
124 // +---+----+----+----+ |
|
125 // sparse complex_matrix | 2 | 4 | 6 | 8 | |
|
126 // +---+----+----+----+ |
|
127 |
|
128 // -*- 1 -*- |
|
129 Matrix |
|
130 xdiv (const Matrix& a, const SparseMatrix& b) |
|
131 { |
|
132 if (! mx_div_conform (a, b)) |
|
133 return Matrix (); |
|
134 |
|
135 Matrix atmp = a.transpose (); |
|
136 SparseMatrix btmp = b.transpose (); |
|
137 |
5275
|
138 octave_idx_type info; |
5164
|
139 if (btmp.rows () == btmp.columns ()) |
|
140 { |
|
141 double rcond = 0.0; |
|
142 |
|
143 Matrix result = btmp.solve (atmp, info, rcond, |
|
144 solve_singularity_warning); |
|
145 |
|
146 if (result_ok (info)) |
|
147 return Matrix (result.transpose ()); |
|
148 } |
|
149 |
5275
|
150 octave_idx_type rank; |
5164
|
151 Matrix result = btmp.lssolve (atmp, info, rank); |
|
152 |
|
153 return result.transpose (); |
|
154 } |
|
155 |
|
156 // -*- 2 -*- |
|
157 ComplexMatrix |
|
158 xdiv (const Matrix& a, const SparseComplexMatrix& b) |
|
159 { |
|
160 if (! mx_div_conform (a, b)) |
|
161 return ComplexMatrix (); |
|
162 |
|
163 Matrix atmp = a.transpose (); |
|
164 SparseComplexMatrix btmp = b.hermitian (); |
|
165 |
5275
|
166 octave_idx_type info; |
5164
|
167 if (btmp.rows () == btmp.columns ()) |
|
168 { |
|
169 double rcond = 0.0; |
|
170 |
|
171 ComplexMatrix result |
|
172 = btmp.solve (atmp, info, rcond, solve_singularity_warning); |
|
173 |
|
174 if (result_ok (info)) |
|
175 return result.hermitian (); |
|
176 } |
|
177 |
5275
|
178 octave_idx_type rank; |
5164
|
179 ComplexMatrix result = btmp.lssolve (atmp, info, rank); |
|
180 |
|
181 return result.hermitian (); |
|
182 } |
|
183 |
|
184 // -*- 3 -*- |
|
185 ComplexMatrix |
|
186 xdiv (const ComplexMatrix& a, const SparseMatrix& b) |
|
187 { |
|
188 if (! mx_div_conform (a, b)) |
|
189 return ComplexMatrix (); |
|
190 |
|
191 ComplexMatrix atmp = a.hermitian (); |
|
192 SparseMatrix btmp = b.transpose (); |
|
193 |
5275
|
194 octave_idx_type info; |
5164
|
195 if (btmp.rows () == btmp.columns ()) |
|
196 { |
|
197 double rcond = 0.0; |
|
198 |
|
199 ComplexMatrix result |
|
200 = btmp.solve (atmp, info, rcond, solve_singularity_warning); |
|
201 |
|
202 if (result_ok (info)) |
|
203 return result.hermitian (); |
|
204 } |
|
205 |
5275
|
206 octave_idx_type rank; |
5164
|
207 ComplexMatrix result = btmp.lssolve (atmp, info, rank); |
|
208 |
|
209 return result.hermitian (); |
|
210 } |
|
211 |
|
212 // -*- 4 -*- |
|
213 ComplexMatrix |
|
214 xdiv (const ComplexMatrix& a, const SparseComplexMatrix& b) |
|
215 { |
|
216 if (! mx_div_conform (a, b)) |
|
217 return ComplexMatrix (); |
|
218 |
|
219 ComplexMatrix atmp = a.hermitian (); |
|
220 SparseComplexMatrix btmp = b.hermitian (); |
|
221 |
5275
|
222 octave_idx_type info; |
5164
|
223 if (btmp.rows () == btmp.columns ()) |
|
224 { |
|
225 double rcond = 0.0; |
|
226 |
|
227 ComplexMatrix result |
|
228 = btmp.solve (atmp, info, rcond, solve_singularity_warning); |
|
229 |
|
230 if (result_ok (info)) |
|
231 return result.hermitian (); |
|
232 } |
|
233 |
5275
|
234 octave_idx_type rank; |
5164
|
235 ComplexMatrix result = btmp.lssolve (atmp, info, rank); |
|
236 |
|
237 return result.hermitian (); |
|
238 } |
|
239 |
|
240 // -*- 5 -*- |
|
241 SparseMatrix |
|
242 xdiv (const SparseMatrix& a, const SparseMatrix& b) |
|
243 { |
|
244 if (! mx_div_conform (a, b)) |
|
245 return SparseMatrix (); |
|
246 |
|
247 SparseMatrix atmp = a.transpose (); |
|
248 SparseMatrix btmp = b.transpose (); |
|
249 |
5275
|
250 octave_idx_type info; |
5164
|
251 if (btmp.rows () == btmp.columns ()) |
|
252 { |
|
253 double rcond = 0.0; |
|
254 |
|
255 SparseMatrix result = btmp.solve (atmp, info, rcond, |
|
256 solve_singularity_warning); |
|
257 |
|
258 if (result_ok (info)) |
|
259 return SparseMatrix (result.transpose ()); |
|
260 } |
|
261 |
5275
|
262 octave_idx_type rank; |
5164
|
263 SparseMatrix result = btmp.lssolve (atmp, info, rank); |
|
264 |
|
265 return result.transpose (); |
|
266 } |
|
267 |
|
268 // -*- 6 -*- |
|
269 SparseComplexMatrix |
|
270 xdiv (const SparseMatrix& a, const SparseComplexMatrix& b) |
|
271 { |
|
272 if (! mx_div_conform (a, b)) |
|
273 return SparseComplexMatrix (); |
|
274 |
|
275 SparseMatrix atmp = a.transpose (); |
|
276 SparseComplexMatrix btmp = b.hermitian (); |
|
277 |
5275
|
278 octave_idx_type info; |
5164
|
279 if (btmp.rows () == btmp.columns ()) |
|
280 { |
|
281 double rcond = 0.0; |
|
282 |
|
283 SparseComplexMatrix result |
|
284 = btmp.solve (atmp, info, rcond, solve_singularity_warning); |
|
285 |
|
286 if (result_ok (info)) |
|
287 return result.hermitian (); |
|
288 } |
|
289 |
5275
|
290 octave_idx_type rank; |
5164
|
291 SparseComplexMatrix result = btmp.lssolve (atmp, info, rank); |
|
292 |
|
293 return result.hermitian (); |
|
294 } |
|
295 |
|
296 // -*- 7 -*- |
|
297 SparseComplexMatrix |
|
298 xdiv (const SparseComplexMatrix& a, const SparseMatrix& b) |
|
299 { |
|
300 if (! mx_div_conform (a, b)) |
|
301 return SparseComplexMatrix (); |
|
302 |
|
303 SparseComplexMatrix atmp = a.hermitian (); |
|
304 SparseMatrix btmp = b.transpose (); |
|
305 |
5275
|
306 octave_idx_type info; |
5164
|
307 if (btmp.rows () == btmp.columns ()) |
|
308 { |
|
309 double rcond = 0.0; |
|
310 |
|
311 SparseComplexMatrix result |
|
312 = btmp.solve (atmp, info, rcond, solve_singularity_warning); |
|
313 |
|
314 if (result_ok (info)) |
|
315 return result.hermitian (); |
|
316 } |
|
317 |
5275
|
318 octave_idx_type rank; |
5164
|
319 SparseComplexMatrix result = btmp.lssolve (atmp, info, rank); |
|
320 |
|
321 return result.hermitian (); |
|
322 } |
|
323 |
|
324 // -*- 8 -*- |
|
325 SparseComplexMatrix |
|
326 xdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b) |
|
327 { |
|
328 if (! mx_div_conform (a, b)) |
|
329 return SparseComplexMatrix (); |
|
330 |
|
331 SparseComplexMatrix atmp = a.hermitian (); |
|
332 SparseComplexMatrix btmp = b.hermitian (); |
|
333 |
5275
|
334 octave_idx_type info; |
5164
|
335 if (btmp.rows () == btmp.columns ()) |
|
336 { |
|
337 double rcond = 0.0; |
|
338 |
|
339 SparseComplexMatrix result |
|
340 = btmp.solve (atmp, info, rcond, solve_singularity_warning); |
|
341 |
|
342 if (result_ok (info)) |
|
343 return result.hermitian (); |
|
344 } |
|
345 |
5275
|
346 octave_idx_type rank; |
5164
|
347 SparseComplexMatrix result = btmp.lssolve (atmp, info, rank); |
|
348 |
|
349 return result.hermitian (); |
|
350 } |
|
351 |
|
352 // Funny element by element division operations. |
|
353 // |
|
354 // op2 \ op1: s cs |
|
355 // +-- +---+----+ |
|
356 // matrix | 1 | 3 | |
|
357 // +---+----+ |
|
358 // complex_matrix | 2 | 4 | |
|
359 // +---+----+ |
|
360 |
|
361 Matrix |
|
362 x_el_div (double a, const SparseMatrix& b) |
|
363 { |
5275
|
364 octave_idx_type nr = b.rows (); |
|
365 octave_idx_type nc = b.cols (); |
5164
|
366 |
|
367 Matrix result; |
|
368 if (a == 0.) |
|
369 result = Matrix (nr, nc, octave_NaN); |
|
370 else if (a > 0.) |
|
371 result = Matrix (nr, nc, octave_Inf); |
|
372 else |
|
373 result = Matrix (nr, nc, -octave_Inf); |
|
374 |
|
375 |
5275
|
376 for (octave_idx_type j = 0; j < nc; j++) |
|
377 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) |
5164
|
378 { |
|
379 OCTAVE_QUIT; |
|
380 result.elem (b.ridx(i), j) = a / b.data (i); |
|
381 } |
|
382 |
|
383 return result; |
|
384 } |
|
385 |
|
386 ComplexMatrix |
|
387 x_el_div (double a, const SparseComplexMatrix& b) |
|
388 { |
5275
|
389 octave_idx_type nr = b.rows (); |
|
390 octave_idx_type nc = b.cols (); |
5164
|
391 |
|
392 ComplexMatrix result (nr, nc, Complex(octave_NaN, octave_NaN)); |
|
393 |
5275
|
394 for (octave_idx_type j = 0; j < nc; j++) |
|
395 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) |
5164
|
396 { |
|
397 OCTAVE_QUIT; |
|
398 result.elem (b.ridx(i), j) = a / b.data (i); |
|
399 } |
|
400 |
|
401 return result; |
|
402 } |
|
403 |
|
404 ComplexMatrix |
|
405 x_el_div (const Complex a, const SparseMatrix& b) |
|
406 { |
5275
|
407 octave_idx_type nr = b.rows (); |
|
408 octave_idx_type nc = b.cols (); |
5164
|
409 |
|
410 ComplexMatrix result (nr, nc, (a / 0.0)); |
|
411 |
5275
|
412 for (octave_idx_type j = 0; j < nc; j++) |
|
413 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) |
5164
|
414 { |
|
415 OCTAVE_QUIT; |
|
416 result.elem (b.ridx(i), j) = a / b.data (i); |
|
417 } |
|
418 |
|
419 return result; |
|
420 } |
|
421 |
|
422 ComplexMatrix |
|
423 x_el_div (const Complex a, const SparseComplexMatrix& b) |
|
424 { |
5275
|
425 octave_idx_type nr = b.rows (); |
|
426 octave_idx_type nc = b.cols (); |
5164
|
427 |
|
428 ComplexMatrix result (nr, nc, (a / 0.0)); |
|
429 |
5275
|
430 for (octave_idx_type j = 0; j < nc; j++) |
|
431 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) |
5164
|
432 { |
|
433 OCTAVE_QUIT; |
|
434 result.elem (b.ridx(i), j) = a / b.data (i); |
|
435 } |
|
436 |
|
437 return result; |
|
438 } |
|
439 |
|
440 // Left division functions. |
|
441 // |
|
442 // op2 \ op1: m cm |
|
443 // +-- +---+----+ |
|
444 // matrix | 1 | 5 | |
|
445 // +---+----+ |
|
446 // complex_matrix | 2 | 6 | |
|
447 // +---+----+ |
|
448 // sparse matrix | 3 | 7 | |
|
449 // +---+----+ |
|
450 // sparse complex_matrix | 4 | 8 | |
|
451 // +---+----+ |
|
452 |
|
453 // -*- 1 -*- |
|
454 Matrix |
|
455 xleftdiv (const SparseMatrix& a, const Matrix& b) |
|
456 { |
|
457 if (! mx_leftdiv_conform (a, b)) |
|
458 return Matrix (); |
|
459 |
5275
|
460 octave_idx_type info; |
5164
|
461 if (a.rows () == a.columns ()) |
|
462 { |
|
463 double rcond = 0.0; |
|
464 |
|
465 Matrix result |
|
466 = a.solve (b, info, rcond, solve_singularity_warning); |
|
467 |
|
468 if (result_ok (info)) |
|
469 return result; |
|
470 } |
|
471 |
5275
|
472 octave_idx_type rank; |
5164
|
473 return a.lssolve (b, info, rank); |
|
474 } |
|
475 |
|
476 // -*- 2 -*- |
|
477 ComplexMatrix |
|
478 xleftdiv (const SparseMatrix& a, const ComplexMatrix& b) |
|
479 { |
|
480 if (! mx_leftdiv_conform (a, b)) |
|
481 return ComplexMatrix (); |
|
482 |
5275
|
483 octave_idx_type info; |
5164
|
484 if (a.rows () == a.columns ()) |
|
485 { |
|
486 double rcond = 0.0; |
|
487 |
|
488 ComplexMatrix result |
|
489 = a.solve (b, info, rcond, solve_singularity_warning); |
|
490 |
|
491 if (result_ok (info)) |
|
492 return result; |
|
493 } |
|
494 |
5275
|
495 octave_idx_type rank; |
5164
|
496 return a.lssolve (b, info, rank); |
|
497 } |
|
498 |
|
499 // -*- 3 -*- |
|
500 SparseMatrix |
|
501 xleftdiv (const SparseMatrix& a, const SparseMatrix& b) |
|
502 { |
|
503 if (! mx_leftdiv_conform (a, b)) |
|
504 return SparseMatrix (); |
|
505 |
5275
|
506 octave_idx_type info; |
5164
|
507 if (a.rows () == a.columns ()) |
|
508 { |
|
509 double rcond = 0.0; |
|
510 |
|
511 SparseMatrix result |
|
512 = a.solve (b, info, rcond, solve_singularity_warning); |
|
513 |
|
514 if (result_ok (info)) |
|
515 return result; |
|
516 } |
|
517 |
5275
|
518 octave_idx_type rank; |
5164
|
519 return a.lssolve (b, info, rank); |
|
520 } |
|
521 |
|
522 // -*- 4 -*- |
|
523 SparseComplexMatrix |
|
524 xleftdiv (const SparseMatrix& a, const SparseComplexMatrix& b) |
|
525 { |
|
526 if (! mx_leftdiv_conform (a, b)) |
|
527 return SparseComplexMatrix (); |
|
528 |
5275
|
529 octave_idx_type info; |
5164
|
530 if (a.rows () == a.columns ()) |
|
531 { |
|
532 double rcond = 0.0; |
|
533 |
|
534 SparseComplexMatrix result |
|
535 = a.solve (b, info, rcond, solve_singularity_warning); |
|
536 |
|
537 if (result_ok (info)) |
|
538 return result; |
|
539 } |
|
540 |
5275
|
541 octave_idx_type rank; |
5164
|
542 return a.lssolve (b, info, rank); |
|
543 } |
|
544 |
|
545 // -*- 5 -*- |
|
546 ComplexMatrix |
|
547 xleftdiv (const SparseComplexMatrix& a, const Matrix& b) |
|
548 { |
|
549 if (! mx_leftdiv_conform (a, b)) |
|
550 return ComplexMatrix (); |
|
551 |
5275
|
552 octave_idx_type info; |
5164
|
553 if (a.rows () == a.columns ()) |
|
554 { |
|
555 double rcond = 0.0; |
|
556 |
|
557 ComplexMatrix result |
|
558 = a.solve (b, info, rcond, solve_singularity_warning); |
|
559 |
|
560 if (result_ok (info)) |
|
561 return result; |
|
562 } |
|
563 |
5275
|
564 octave_idx_type rank; |
5164
|
565 return a.lssolve (b, info, rank); |
|
566 } |
|
567 |
|
568 // -*- 6 -*- |
|
569 ComplexMatrix |
|
570 xleftdiv (const SparseComplexMatrix& a, const ComplexMatrix& b) |
|
571 { |
|
572 if (! mx_leftdiv_conform (a, b)) |
|
573 return ComplexMatrix (); |
|
574 |
5275
|
575 octave_idx_type info; |
5164
|
576 if (a.rows () == a.columns ()) |
|
577 { |
|
578 double rcond = 0.0; |
|
579 |
|
580 ComplexMatrix result |
|
581 = a.solve (b, info, rcond, solve_singularity_warning); |
|
582 |
|
583 if (result_ok (info)) |
|
584 return result; |
|
585 } |
|
586 |
5275
|
587 octave_idx_type rank; |
5164
|
588 return a.lssolve (b, info, rank); |
|
589 } |
|
590 |
|
591 // -*- 7 -*- |
|
592 SparseComplexMatrix |
|
593 xleftdiv (const SparseComplexMatrix& a, const SparseMatrix& b) |
|
594 { |
|
595 if (! mx_leftdiv_conform (a, b)) |
|
596 return SparseComplexMatrix (); |
|
597 |
5275
|
598 octave_idx_type info; |
5164
|
599 if (a.rows () == a.columns ()) |
|
600 { |
|
601 double rcond = 0.0; |
|
602 |
|
603 SparseComplexMatrix result |
|
604 = a.solve (b, info, rcond, solve_singularity_warning); |
|
605 |
|
606 if (result_ok (info)) |
|
607 return result; |
|
608 } |
|
609 |
5275
|
610 octave_idx_type rank; |
5164
|
611 return a.lssolve (b, info, rank); |
|
612 } |
|
613 |
|
614 // -*- 8 -*- |
|
615 SparseComplexMatrix |
|
616 xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b) |
|
617 { |
|
618 if (! mx_leftdiv_conform (a, b)) |
|
619 return SparseComplexMatrix (); |
|
620 |
5275
|
621 octave_idx_type info; |
5164
|
622 if (a.rows () == a.columns ()) |
|
623 { |
|
624 double rcond = 0.0; |
|
625 |
|
626 SparseComplexMatrix result |
|
627 = a.solve (b, info, rcond, solve_singularity_warning); |
|
628 |
|
629 if (result_ok (info)) |
|
630 return result; |
|
631 } |
|
632 |
5275
|
633 octave_idx_type rank; |
5164
|
634 return a.lssolve (b, info, rank); |
|
635 } |
|
636 |
|
637 /* |
|
638 ;;; Local Variables: *** |
|
639 ;;; mode: C++ *** |
|
640 ;;; End: *** |
|
641 */ |