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