Mercurial > octave-nkf
comparison liboctave/array/CSparse.cc @ 19898:17d647821d61
maint: More cleanup of C++ code to follow Octave coding conventions.
* gl-select.cc, betainc.cc, bitfcns.cc, bsxfun.cc, gl-render.cc,
graphics.cc, load-save.cc, ls-mat-ascii.cc, ls-mat5.cc, lu.cc,
oct-stream.cc, symtab.cc, variables.cc, __eigs__.cc,
__magick_read__.cc, chol.cc, ov-base-sparse.cc, ov-class.cc,
ov-classdef.cc, ov-fcn-inline.cc, ov-perm.cc, ov.cc, CMatrix.cc,
CSparse.cc, MSparse.cc, MatrixType.cc, MatrixType.h, dMatrix.cc,
dSparse.cc, fCMatrix.cc, fMatrix.cc, eigs-base.cc, lo-sysdep.cc,
kpse.cc: Break long lines before && and ||.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 26 Feb 2015 13:07:04 -0500 |
parents | 4197fc428c7d |
children |
comparison
equal
deleted
inserted
replaced
19897:09ed6f7538dd | 19898:17d647821d61 |
---|---|
770 { | 770 { |
771 // Print spparms("spumoni") info if requested | 771 // Print spparms("spumoni") info if requested |
772 int typ = mattyp.type (); | 772 int typ = mattyp.type (); |
773 mattyp.info (); | 773 mattyp.info (); |
774 | 774 |
775 if (typ == MatrixType::Diagonal || | 775 if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) |
776 typ == MatrixType::Permuted_Diagonal) | |
777 { | 776 { |
778 if (typ == MatrixType::Permuted_Diagonal) | 777 if (typ == MatrixType::Permuted_Diagonal) |
779 retval = transpose (); | 778 retval = transpose (); |
780 else | 779 else |
781 retval = *this; | 780 retval = *this; |
825 { | 824 { |
826 // Print spparms("spumoni") info if requested | 825 // Print spparms("spumoni") info if requested |
827 int typ = mattyp.type (); | 826 int typ = mattyp.type (); |
828 mattyp.info (); | 827 mattyp.info (); |
829 | 828 |
830 if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper || | 829 if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper |
831 typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) | 830 || typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) |
832 { | 831 { |
833 double anorm = 0.; | 832 double anorm = 0.; |
834 double ainvnorm = 0.; | 833 double ainvnorm = 0.; |
835 | 834 |
836 if (calccond) | 835 if (calccond) |
900 { | 899 { |
901 v -= retval.xdata (colXp) * data (colUp); | 900 v -= retval.xdata (colXp) * data (colUp); |
902 colXp++; | 901 colXp++; |
903 colUp++; | 902 colUp++; |
904 } | 903 } |
905 } while ((rpX<j) && (rpU<j) && | 904 } |
906 (colXp<cx) && (colUp<nz)); | 905 while (rpX < j && rpU < j && colXp < cx && colUp < nz); |
907 | 906 |
908 | 907 |
909 // get A(m,m) | 908 // get A(m,m) |
910 if (typ == MatrixType::Upper) | 909 if (typ == MatrixType::Upper) |
911 colUp = cidx (j+1) - 1; | 910 colUp = cidx (j+1) - 1; |
1311 { | 1310 { |
1312 // Print spparms("spumoni") info if requested | 1311 // Print spparms("spumoni") info if requested |
1313 int typ = mattype.type (); | 1312 int typ = mattype.type (); |
1314 mattype.info (); | 1313 mattype.info (); |
1315 | 1314 |
1316 if (typ == MatrixType::Diagonal || | 1315 if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) |
1317 typ == MatrixType::Permuted_Diagonal) | |
1318 { | 1316 { |
1319 retval.resize (nc, b.cols (), Complex (0.,0.)); | 1317 retval.resize (nc, b.cols (), Complex (0.,0.)); |
1320 if (typ == MatrixType::Diagonal) | 1318 if (typ == MatrixType::Diagonal) |
1321 for (octave_idx_type j = 0; j < b.cols (); j++) | 1319 for (octave_idx_type j = 0; j < b.cols (); j++) |
1322 for (octave_idx_type i = 0; i < nm; i++) | 1320 for (octave_idx_type i = 0; i < nm; i++) |
1373 { | 1371 { |
1374 // Print spparms("spumoni") info if requested | 1372 // Print spparms("spumoni") info if requested |
1375 int typ = mattype.type (); | 1373 int typ = mattype.type (); |
1376 mattype.info (); | 1374 mattype.info (); |
1377 | 1375 |
1378 if (typ == MatrixType::Diagonal || | 1376 if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) |
1379 typ == MatrixType::Permuted_Diagonal) | |
1380 { | 1377 { |
1381 octave_idx_type b_nc = b.cols (); | 1378 octave_idx_type b_nc = b.cols (); |
1382 octave_idx_type b_nz = b.nnz (); | 1379 octave_idx_type b_nz = b.nnz (); |
1383 retval = SparseComplexMatrix (nc, b_nc, b_nz); | 1380 retval = SparseComplexMatrix (nc, b_nc, b_nz); |
1384 | 1381 |
1465 { | 1462 { |
1466 // Print spparms("spumoni") info if requested | 1463 // Print spparms("spumoni") info if requested |
1467 int typ = mattype.type (); | 1464 int typ = mattype.type (); |
1468 mattype.info (); | 1465 mattype.info (); |
1469 | 1466 |
1470 if (typ == MatrixType::Diagonal || | 1467 if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) |
1471 typ == MatrixType::Permuted_Diagonal) | |
1472 { | 1468 { |
1473 retval.resize (nc, b.cols (), Complex (0.,0.)); | 1469 retval.resize (nc, b.cols (), Complex (0.,0.)); |
1474 if (typ == MatrixType::Diagonal) | 1470 if (typ == MatrixType::Diagonal) |
1475 for (octave_idx_type j = 0; j < b.cols (); j++) | 1471 for (octave_idx_type j = 0; j < b.cols (); j++) |
1476 for (octave_idx_type i = 0; i < nm; i++) | 1472 for (octave_idx_type i = 0; i < nm; i++) |
1527 { | 1523 { |
1528 // Print spparms("spumoni") info if requested | 1524 // Print spparms("spumoni") info if requested |
1529 int typ = mattype.type (); | 1525 int typ = mattype.type (); |
1530 mattype.info (); | 1526 mattype.info (); |
1531 | 1527 |
1532 if (typ == MatrixType::Diagonal || | 1528 if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) |
1533 typ == MatrixType::Permuted_Diagonal) | |
1534 { | 1529 { |
1535 octave_idx_type b_nc = b.cols (); | 1530 octave_idx_type b_nc = b.cols (); |
1536 octave_idx_type b_nz = b.nnz (); | 1531 octave_idx_type b_nz = b.nnz (); |
1537 retval = SparseComplexMatrix (nc, b_nc, b_nz); | 1532 retval = SparseComplexMatrix (nc, b_nc, b_nz); |
1538 | 1533 |
1619 { | 1614 { |
1620 // Print spparms("spumoni") info if requested | 1615 // Print spparms("spumoni") info if requested |
1621 int typ = mattype.type (); | 1616 int typ = mattype.type (); |
1622 mattype.info (); | 1617 mattype.info (); |
1623 | 1618 |
1624 if (typ == MatrixType::Permuted_Upper || | 1619 if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) |
1625 typ == MatrixType::Upper) | |
1626 { | 1620 { |
1627 double anorm = 0.; | 1621 double anorm = 0.; |
1628 double ainvnorm = 0.; | 1622 double ainvnorm = 0.; |
1629 octave_idx_type b_nc = b.cols (); | 1623 octave_idx_type b_nc = b.cols (); |
1630 rcond = 1.; | 1624 rcond = 1.; |
1659 { | 1653 { |
1660 octave_idx_type kidx = perm[k]; | 1654 octave_idx_type kidx = perm[k]; |
1661 | 1655 |
1662 if (work[k] != 0.) | 1656 if (work[k] != 0.) |
1663 { | 1657 { |
1664 if (ridx (cidx (kidx+1)-1) != k || | 1658 if (ridx (cidx (kidx+1)-1) != k |
1665 data (cidx (kidx+1)-1) == 0.) | 1659 || data (cidx (kidx+1)-1) == 0.) |
1666 { | 1660 { |
1667 err = -2; | 1661 err = -2; |
1668 goto triangular_error; | 1662 goto triangular_error; |
1669 } | 1663 } |
1670 | 1664 |
1735 | 1729 |
1736 for (octave_idx_type k = nc-1; k >= 0; k--) | 1730 for (octave_idx_type k = nc-1; k >= 0; k--) |
1737 { | 1731 { |
1738 if (work[k] != 0.) | 1732 if (work[k] != 0.) |
1739 { | 1733 { |
1740 if (ridx (cidx (k+1)-1) != k || | 1734 if (ridx (cidx (k+1)-1) != k |
1741 data (cidx (k+1)-1) == 0.) | 1735 || data (cidx (k+1)-1) == 0.) |
1742 { | 1736 { |
1743 err = -2; | 1737 err = -2; |
1744 goto triangular_error; | 1738 goto triangular_error; |
1745 } | 1739 } |
1746 | 1740 |
1851 { | 1845 { |
1852 // Print spparms("spumoni") info if requested | 1846 // Print spparms("spumoni") info if requested |
1853 int typ = mattype.type (); | 1847 int typ = mattype.type (); |
1854 mattype.info (); | 1848 mattype.info (); |
1855 | 1849 |
1856 if (typ == MatrixType::Permuted_Upper || | 1850 if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) |
1857 typ == MatrixType::Upper) | |
1858 { | 1851 { |
1859 double anorm = 0.; | 1852 double anorm = 0.; |
1860 double ainvnorm = 0.; | 1853 double ainvnorm = 0.; |
1861 rcond = 1.; | 1854 rcond = 1.; |
1862 | 1855 |
1900 { | 1893 { |
1901 octave_idx_type kidx = perm[k]; | 1894 octave_idx_type kidx = perm[k]; |
1902 | 1895 |
1903 if (work[k] != 0.) | 1896 if (work[k] != 0.) |
1904 { | 1897 { |
1905 if (ridx (cidx (kidx+1)-1) != k || | 1898 if (ridx (cidx (kidx+1)-1) != k |
1906 data (cidx (kidx+1)-1) == 0.) | 1899 || data (cidx (kidx+1)-1) == 0.) |
1907 { | 1900 { |
1908 err = -2; | 1901 err = -2; |
1909 goto triangular_error; | 1902 goto triangular_error; |
1910 } | 1903 } |
1911 | 1904 |
1997 | 1990 |
1998 for (octave_idx_type k = nc-1; k >= 0; k--) | 1991 for (octave_idx_type k = nc-1; k >= 0; k--) |
1999 { | 1992 { |
2000 if (work[k] != 0.) | 1993 if (work[k] != 0.) |
2001 { | 1994 { |
2002 if (ridx (cidx (k+1)-1) != k || | 1995 if (ridx (cidx (k+1)-1) != k |
2003 data (cidx (k+1)-1) == 0.) | 1996 || data (cidx (k+1)-1) == 0.) |
2004 { | 1997 { |
2005 err = -2; | 1998 err = -2; |
2006 goto triangular_error; | 1999 goto triangular_error; |
2007 } | 2000 } |
2008 | 2001 |
2134 { | 2127 { |
2135 // Print spparms("spumoni") info if requested | 2128 // Print spparms("spumoni") info if requested |
2136 int typ = mattype.type (); | 2129 int typ = mattype.type (); |
2137 mattype.info (); | 2130 mattype.info (); |
2138 | 2131 |
2139 if (typ == MatrixType::Permuted_Upper || | 2132 if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) |
2140 typ == MatrixType::Upper) | |
2141 { | 2133 { |
2142 double anorm = 0.; | 2134 double anorm = 0.; |
2143 double ainvnorm = 0.; | 2135 double ainvnorm = 0.; |
2144 octave_idx_type b_nc = b.cols (); | 2136 octave_idx_type b_nc = b.cols (); |
2145 rcond = 1.; | 2137 rcond = 1.; |
2174 { | 2166 { |
2175 octave_idx_type kidx = perm[k]; | 2167 octave_idx_type kidx = perm[k]; |
2176 | 2168 |
2177 if (work[k] != 0.) | 2169 if (work[k] != 0.) |
2178 { | 2170 { |
2179 if (ridx (cidx (kidx+1)-1) != k || | 2171 if (ridx (cidx (kidx+1)-1) != k |
2180 data (cidx (kidx+1)-1) == 0.) | 2172 || data (cidx (kidx+1)-1) == 0.) |
2181 { | 2173 { |
2182 err = -2; | 2174 err = -2; |
2183 goto triangular_error; | 2175 goto triangular_error; |
2184 } | 2176 } |
2185 | 2177 |
2250 | 2242 |
2251 for (octave_idx_type k = nc-1; k >= 0; k--) | 2243 for (octave_idx_type k = nc-1; k >= 0; k--) |
2252 { | 2244 { |
2253 if (work[k] != 0.) | 2245 if (work[k] != 0.) |
2254 { | 2246 { |
2255 if (ridx (cidx (k+1)-1) != k || | 2247 if (ridx (cidx (k+1)-1) != k |
2256 data (cidx (k+1)-1) == 0.) | 2248 || data (cidx (k+1)-1) == 0.) |
2257 { | 2249 { |
2258 err = -2; | 2250 err = -2; |
2259 goto triangular_error; | 2251 goto triangular_error; |
2260 } | 2252 } |
2261 | 2253 |
2366 { | 2358 { |
2367 // Print spparms("spumoni") info if requested | 2359 // Print spparms("spumoni") info if requested |
2368 int typ = mattype.type (); | 2360 int typ = mattype.type (); |
2369 mattype.info (); | 2361 mattype.info (); |
2370 | 2362 |
2371 if (typ == MatrixType::Permuted_Upper || | 2363 if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) |
2372 typ == MatrixType::Upper) | |
2373 { | 2364 { |
2374 double anorm = 0.; | 2365 double anorm = 0.; |
2375 double ainvnorm = 0.; | 2366 double ainvnorm = 0.; |
2376 rcond = 1.; | 2367 rcond = 1.; |
2377 | 2368 |
2415 { | 2406 { |
2416 octave_idx_type kidx = perm[k]; | 2407 octave_idx_type kidx = perm[k]; |
2417 | 2408 |
2418 if (work[k] != 0.) | 2409 if (work[k] != 0.) |
2419 { | 2410 { |
2420 if (ridx (cidx (kidx+1)-1) != k || | 2411 if (ridx (cidx (kidx+1)-1) != k |
2421 data (cidx (kidx+1)-1) == 0.) | 2412 || data (cidx (kidx+1)-1) == 0.) |
2422 { | 2413 { |
2423 err = -2; | 2414 err = -2; |
2424 goto triangular_error; | 2415 goto triangular_error; |
2425 } | 2416 } |
2426 | 2417 |
2512 | 2503 |
2513 for (octave_idx_type k = nr-1; k >= 0; k--) | 2504 for (octave_idx_type k = nr-1; k >= 0; k--) |
2514 { | 2505 { |
2515 if (work[k] != 0.) | 2506 if (work[k] != 0.) |
2516 { | 2507 { |
2517 if (ridx (cidx (k+1)-1) != k || | 2508 if (ridx (cidx (k+1)-1) != k |
2518 data (cidx (k+1)-1) == 0.) | 2509 || data (cidx (k+1)-1) == 0.) |
2519 { | 2510 { |
2520 err = -2; | 2511 err = -2; |
2521 goto triangular_error; | 2512 goto triangular_error; |
2522 } | 2513 } |
2523 | 2514 |
2650 { | 2641 { |
2651 // Print spparms("spumoni") info if requested | 2642 // Print spparms("spumoni") info if requested |
2652 int typ = mattype.type (); | 2643 int typ = mattype.type (); |
2653 mattype.info (); | 2644 mattype.info (); |
2654 | 2645 |
2655 if (typ == MatrixType::Permuted_Lower || | 2646 if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) |
2656 typ == MatrixType::Lower) | |
2657 { | 2647 { |
2658 double anorm = 0.; | 2648 double anorm = 0.; |
2659 double ainvnorm = 0.; | 2649 double ainvnorm = 0.; |
2660 octave_idx_type b_nc = b.cols (); | 2650 octave_idx_type b_nc = b.cols (); |
2661 rcond = 1.; | 2651 rcond = 1.; |
2787 work[i] = 0.; | 2777 work[i] = 0.; |
2788 for (octave_idx_type k = 0; k < nc; k++) | 2778 for (octave_idx_type k = 0; k < nc; k++) |
2789 { | 2779 { |
2790 if (work[k] != 0.) | 2780 if (work[k] != 0.) |
2791 { | 2781 { |
2792 if (ridx (cidx (k)) != k || | 2782 if (ridx (cidx (k)) != k || data (cidx (k)) == 0.) |
2793 data (cidx (k)) == 0.) | |
2794 { | 2783 { |
2795 err = -2; | 2784 err = -2; |
2796 goto triangular_error; | 2785 goto triangular_error; |
2797 } | 2786 } |
2798 | 2787 |
2903 { | 2892 { |
2904 // Print spparms("spumoni") info if requested | 2893 // Print spparms("spumoni") info if requested |
2905 int typ = mattype.type (); | 2894 int typ = mattype.type (); |
2906 mattype.info (); | 2895 mattype.info (); |
2907 | 2896 |
2908 if (typ == MatrixType::Permuted_Lower || | 2897 if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) |
2909 typ == MatrixType::Lower) | |
2910 { | 2898 { |
2911 double anorm = 0.; | 2899 double anorm = 0.; |
2912 double ainvnorm = 0.; | 2900 double ainvnorm = 0.; |
2913 rcond = 1.; | 2901 rcond = 1.; |
2914 | 2902 |
3067 | 3055 |
3068 for (octave_idx_type k = 0; k < nc; k++) | 3056 for (octave_idx_type k = 0; k < nc; k++) |
3069 { | 3057 { |
3070 if (work[k] != 0.) | 3058 if (work[k] != 0.) |
3071 { | 3059 { |
3072 if (ridx (cidx (k)) != k || | 3060 if (ridx (cidx (k)) != k || data (cidx (k)) == 0.) |
3073 data (cidx (k)) == 0.) | |
3074 { | 3061 { |
3075 err = -2; | 3062 err = -2; |
3076 goto triangular_error; | 3063 goto triangular_error; |
3077 } | 3064 } |
3078 | 3065 |
3206 { | 3193 { |
3207 // Print spparms("spumoni") info if requested | 3194 // Print spparms("spumoni") info if requested |
3208 int typ = mattype.type (); | 3195 int typ = mattype.type (); |
3209 mattype.info (); | 3196 mattype.info (); |
3210 | 3197 |
3211 if (typ == MatrixType::Permuted_Lower || | 3198 if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) |
3212 typ == MatrixType::Lower) | |
3213 { | 3199 { |
3214 double anorm = 0.; | 3200 double anorm = 0.; |
3215 double ainvnorm = 0.; | 3201 double ainvnorm = 0.; |
3216 octave_idx_type b_nc = b.cols (); | 3202 octave_idx_type b_nc = b.cols (); |
3217 rcond = 1.; | 3203 rcond = 1.; |
3345 | 3331 |
3346 for (octave_idx_type k = 0; k < nc; k++) | 3332 for (octave_idx_type k = 0; k < nc; k++) |
3347 { | 3333 { |
3348 if (work[k] != 0.) | 3334 if (work[k] != 0.) |
3349 { | 3335 { |
3350 if (ridx (cidx (k)) != k || | 3336 if (ridx (cidx (k)) != k || data (cidx (k)) == 0.) |
3351 data (cidx (k)) == 0.) | |
3352 { | 3337 { |
3353 err = -2; | 3338 err = -2; |
3354 goto triangular_error; | 3339 goto triangular_error; |
3355 } | 3340 } |
3356 | 3341 |
3462 { | 3447 { |
3463 // Print spparms("spumoni") info if requested | 3448 // Print spparms("spumoni") info if requested |
3464 int typ = mattype.type (); | 3449 int typ = mattype.type (); |
3465 mattype.info (); | 3450 mattype.info (); |
3466 | 3451 |
3467 if (typ == MatrixType::Permuted_Lower || | 3452 if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) |
3468 typ == MatrixType::Lower) | |
3469 { | 3453 { |
3470 double anorm = 0.; | 3454 double anorm = 0.; |
3471 double ainvnorm = 0.; | 3455 double ainvnorm = 0.; |
3472 rcond = 1.; | 3456 rcond = 1.; |
3473 | 3457 |
3626 | 3610 |
3627 for (octave_idx_type k = 0; k < nc; k++) | 3611 for (octave_idx_type k = 0; k < nc; k++) |
3628 { | 3612 { |
3629 if (work[k] != 0.) | 3613 if (work[k] != 0.) |
3630 { | 3614 { |
3631 if (ridx (cidx (k)) != k || | 3615 if (ridx (cidx (k)) != k || data (cidx (k)) == 0.) |
3632 data (cidx (k)) == 0.) | |
3633 { | 3616 { |
3634 err = -2; | 3617 err = -2; |
3635 goto triangular_error; | 3618 goto triangular_error; |
3636 } | 3619 } |
3637 | 3620 |
3918 // Print spparms("spumoni") info if requested | 3901 // Print spparms("spumoni") info if requested |
3919 int typ = mattype.type (); | 3902 int typ = mattype.type (); |
3920 mattype.info (); | 3903 mattype.info (); |
3921 | 3904 |
3922 // Note can't treat symmetric case as there is no dpttrf function | 3905 // Note can't treat symmetric case as there is no dpttrf function |
3923 if (typ == MatrixType::Tridiagonal || | 3906 if (typ == MatrixType::Tridiagonal |
3924 typ == MatrixType::Tridiagonal_Hermitian) | 3907 || typ == MatrixType::Tridiagonal_Hermitian) |
3925 { | 3908 { |
3926 OCTAVE_LOCAL_BUFFER (Complex, DU2, nr - 2); | 3909 OCTAVE_LOCAL_BUFFER (Complex, DU2, nr - 2); |
3927 OCTAVE_LOCAL_BUFFER (Complex, DU, nr - 1); | 3910 OCTAVE_LOCAL_BUFFER (Complex, DU, nr - 1); |
3928 OCTAVE_LOCAL_BUFFER (Complex, D, nr); | 3911 OCTAVE_LOCAL_BUFFER (Complex, D, nr); |
3929 OCTAVE_LOCAL_BUFFER (Complex, DL, nr - 1); | 3912 OCTAVE_LOCAL_BUFFER (Complex, DL, nr - 1); |
4215 // Print spparms("spumoni") info if requested | 4198 // Print spparms("spumoni") info if requested |
4216 int typ = mattype.type (); | 4199 int typ = mattype.type (); |
4217 mattype.info (); | 4200 mattype.info (); |
4218 | 4201 |
4219 // Note can't treat symmetric case as there is no dpttrf function | 4202 // Note can't treat symmetric case as there is no dpttrf function |
4220 if (typ == MatrixType::Tridiagonal || | 4203 if (typ == MatrixType::Tridiagonal |
4221 typ == MatrixType::Tridiagonal_Hermitian) | 4204 || typ == MatrixType::Tridiagonal_Hermitian) |
4222 { | 4205 { |
4223 OCTAVE_LOCAL_BUFFER (Complex, DU2, nr - 2); | 4206 OCTAVE_LOCAL_BUFFER (Complex, DU2, nr - 2); |
4224 OCTAVE_LOCAL_BUFFER (Complex, DU, nr - 1); | 4207 OCTAVE_LOCAL_BUFFER (Complex, DU, nr - 1); |
4225 OCTAVE_LOCAL_BUFFER (Complex, D, nr); | 4208 OCTAVE_LOCAL_BUFFER (Complex, D, nr); |
4226 OCTAVE_LOCAL_BUFFER (Complex, DL, nr - 1); | 4209 OCTAVE_LOCAL_BUFFER (Complex, DL, nr - 1); |
5538 rcond = Info (UMFPACK_RCOND); | 5521 rcond = Info (UMFPACK_RCOND); |
5539 else | 5522 else |
5540 rcond = 1.; | 5523 rcond = 1.; |
5541 volatile double rcond_plus_one = rcond + 1.0; | 5524 volatile double rcond_plus_one = rcond + 1.0; |
5542 | 5525 |
5543 if (status == UMFPACK_WARNING_singular_matrix || | 5526 if (status == UMFPACK_WARNING_singular_matrix |
5544 rcond_plus_one == 1.0 || xisnan (rcond)) | 5527 || rcond_plus_one == 1.0 || xisnan (rcond)) |
5545 { | 5528 { |
5546 UMFPACK_ZNAME (report_numeric) (Numeric, control); | 5529 UMFPACK_ZNAME (report_numeric) (Numeric, control); |
5547 | 5530 |
5548 err = -2; | 5531 err = -2; |
5549 | 5532 |
6577 retval.maybe_compress (); | 6560 retval.maybe_compress (); |
6578 | 6561 |
6579 rcond = Info (UMFPACK_RCOND); | 6562 rcond = Info (UMFPACK_RCOND); |
6580 volatile double rcond_plus_one = rcond + 1.0; | 6563 volatile double rcond_plus_one = rcond + 1.0; |
6581 | 6564 |
6582 if (status == UMFPACK_WARNING_singular_matrix || | 6565 if (status == UMFPACK_WARNING_singular_matrix |
6583 rcond_plus_one == 1.0 || xisnan (rcond)) | 6566 || rcond_plus_one == 1.0 || xisnan (rcond)) |
6584 { | 6567 { |
6585 err = -2; | 6568 err = -2; |
6586 | 6569 |
6587 if (sing_handler) | 6570 if (sing_handler) |
6588 sing_handler (rcond); | 6571 sing_handler (rcond); |
6649 retval = utsolve (mattype, b, err, rcond, sing_handler, false); | 6632 retval = utsolve (mattype, b, err, rcond, sing_handler, false); |
6650 else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) | 6633 else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) |
6651 retval = ltsolve (mattype, b, err, rcond, sing_handler, false); | 6634 retval = ltsolve (mattype, b, err, rcond, sing_handler, false); |
6652 else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) | 6635 else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) |
6653 retval = bsolve (mattype, b, err, rcond, sing_handler, false); | 6636 retval = bsolve (mattype, b, err, rcond, sing_handler, false); |
6654 else if (typ == MatrixType::Tridiagonal || | 6637 else if (typ == MatrixType::Tridiagonal |
6655 typ == MatrixType::Tridiagonal_Hermitian) | 6638 || typ == MatrixType::Tridiagonal_Hermitian) |
6656 retval = trisolve (mattype, b, err, rcond, sing_handler, false); | 6639 retval = trisolve (mattype, b, err, rcond, sing_handler, false); |
6657 else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) | 6640 else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) |
6658 retval = fsolve (mattype, b, err, rcond, sing_handler, true); | 6641 retval = fsolve (mattype, b, err, rcond, sing_handler, true); |
6659 else if (typ != MatrixType::Rectangular) | 6642 else if (typ != MatrixType::Rectangular) |
6660 { | 6643 { |
6717 retval = utsolve (mattype, b, err, rcond, sing_handler, false); | 6700 retval = utsolve (mattype, b, err, rcond, sing_handler, false); |
6718 else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) | 6701 else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) |
6719 retval = ltsolve (mattype, b, err, rcond, sing_handler, false); | 6702 retval = ltsolve (mattype, b, err, rcond, sing_handler, false); |
6720 else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) | 6703 else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) |
6721 retval = bsolve (mattype, b, err, rcond, sing_handler, false); | 6704 retval = bsolve (mattype, b, err, rcond, sing_handler, false); |
6722 else if (typ == MatrixType::Tridiagonal || | 6705 else if (typ == MatrixType::Tridiagonal |
6723 typ == MatrixType::Tridiagonal_Hermitian) | 6706 || typ == MatrixType::Tridiagonal_Hermitian) |
6724 retval = trisolve (mattype, b, err, rcond, sing_handler, false); | 6707 retval = trisolve (mattype, b, err, rcond, sing_handler, false); |
6725 else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) | 6708 else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) |
6726 retval = fsolve (mattype, b, err, rcond, sing_handler, true); | 6709 retval = fsolve (mattype, b, err, rcond, sing_handler, true); |
6727 else if (typ != MatrixType::Rectangular) | 6710 else if (typ != MatrixType::Rectangular) |
6728 { | 6711 { |
6785 retval = utsolve (mattype, b, err, rcond, sing_handler, false); | 6768 retval = utsolve (mattype, b, err, rcond, sing_handler, false); |
6786 else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) | 6769 else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) |
6787 retval = ltsolve (mattype, b, err, rcond, sing_handler, false); | 6770 retval = ltsolve (mattype, b, err, rcond, sing_handler, false); |
6788 else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) | 6771 else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) |
6789 retval = bsolve (mattype, b, err, rcond, sing_handler, false); | 6772 retval = bsolve (mattype, b, err, rcond, sing_handler, false); |
6790 else if (typ == MatrixType::Tridiagonal || | 6773 else if (typ == MatrixType::Tridiagonal |
6791 typ == MatrixType::Tridiagonal_Hermitian) | 6774 || typ == MatrixType::Tridiagonal_Hermitian) |
6792 retval = trisolve (mattype, b, err, rcond, sing_handler, false); | 6775 retval = trisolve (mattype, b, err, rcond, sing_handler, false); |
6793 else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) | 6776 else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) |
6794 retval = fsolve (mattype, b, err, rcond, sing_handler, true); | 6777 retval = fsolve (mattype, b, err, rcond, sing_handler, true); |
6795 else if (typ != MatrixType::Rectangular) | 6778 else if (typ != MatrixType::Rectangular) |
6796 { | 6779 { |
6854 retval = utsolve (mattype, b, err, rcond, sing_handler, false); | 6837 retval = utsolve (mattype, b, err, rcond, sing_handler, false); |
6855 else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) | 6838 else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) |
6856 retval = ltsolve (mattype, b, err, rcond, sing_handler, false); | 6839 retval = ltsolve (mattype, b, err, rcond, sing_handler, false); |
6857 else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) | 6840 else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) |
6858 retval = bsolve (mattype, b, err, rcond, sing_handler, false); | 6841 retval = bsolve (mattype, b, err, rcond, sing_handler, false); |
6859 else if (typ == MatrixType::Tridiagonal || | 6842 else if (typ == MatrixType::Tridiagonal |
6860 typ == MatrixType::Tridiagonal_Hermitian) | 6843 || typ == MatrixType::Tridiagonal_Hermitian) |
6861 retval = trisolve (mattype, b, err, rcond, sing_handler, false); | 6844 retval = trisolve (mattype, b, err, rcond, sing_handler, false); |
6862 else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) | 6845 else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) |
6863 retval = fsolve (mattype, b, err, rcond, sing_handler, true); | 6846 retval = fsolve (mattype, b, err, rcond, sing_handler, true); |
6864 else if (typ != MatrixType::Rectangular) | 6847 else if (typ != MatrixType::Rectangular) |
6865 { | 6848 { |
7643 bool jb_lt_max = jb < jb_max; | 7626 bool jb_lt_max = jb < jb_max; |
7644 | 7627 |
7645 while (ja_lt_max || jb_lt_max) | 7628 while (ja_lt_max || jb_lt_max) |
7646 { | 7629 { |
7647 octave_quit (); | 7630 octave_quit (); |
7648 if ((! jb_lt_max) || | 7631 if ((! jb_lt_max) || (ja_lt_max && (a.ridx (ja) < b.ridx (jb)))) |
7649 (ja_lt_max && (a.ridx (ja) < b.ridx (jb)))) | |
7650 { | 7632 { |
7651 Complex tmp = xmin (a.data (ja), 0.); | 7633 Complex tmp = xmin (a.data (ja), 0.); |
7652 if (tmp != 0.) | 7634 if (tmp != 0.) |
7653 { | 7635 { |
7654 r.ridx (jx) = a.ridx (ja); | 7636 r.ridx (jx) = a.ridx (ja); |
7656 jx++; | 7638 jx++; |
7657 } | 7639 } |
7658 ja++; | 7640 ja++; |
7659 ja_lt_max= ja < ja_max; | 7641 ja_lt_max= ja < ja_max; |
7660 } | 7642 } |
7661 else if ((! ja_lt_max) || | 7643 else if ((! ja_lt_max) |
7662 (jb_lt_max && (b.ridx (jb) < a.ridx (ja)))) | 7644 || (jb_lt_max && (b.ridx (jb) < a.ridx (ja)))) |
7663 { | 7645 { |
7664 Complex tmp = xmin (0., b.data (jb)); | 7646 Complex tmp = xmin (0., b.data (jb)); |
7665 if (tmp != 0.) | 7647 if (tmp != 0.) |
7666 { | 7648 { |
7667 r.ridx (jx) = b.ridx (jb); | 7649 r.ridx (jx) = b.ridx (jb); |
7761 bool jb_lt_max = jb < jb_max; | 7743 bool jb_lt_max = jb < jb_max; |
7762 | 7744 |
7763 while (ja_lt_max || jb_lt_max) | 7745 while (ja_lt_max || jb_lt_max) |
7764 { | 7746 { |
7765 octave_quit (); | 7747 octave_quit (); |
7766 if ((! jb_lt_max) || | 7748 if ((! jb_lt_max) || (ja_lt_max && (a.ridx (ja) < b.ridx (jb)))) |
7767 (ja_lt_max && (a.ridx (ja) < b.ridx (jb)))) | |
7768 { | 7749 { |
7769 Complex tmp = xmax (a.data (ja), 0.); | 7750 Complex tmp = xmax (a.data (ja), 0.); |
7770 if (tmp != 0.) | 7751 if (tmp != 0.) |
7771 { | 7752 { |
7772 r.ridx (jx) = a.ridx (ja); | 7753 r.ridx (jx) = a.ridx (ja); |
7774 jx++; | 7755 jx++; |
7775 } | 7756 } |
7776 ja++; | 7757 ja++; |
7777 ja_lt_max= ja < ja_max; | 7758 ja_lt_max= ja < ja_max; |
7778 } | 7759 } |
7779 else if ((! ja_lt_max) || | 7760 else if ((! ja_lt_max) |
7780 (jb_lt_max && (b.ridx (jb) < a.ridx (ja)))) | 7761 || (jb_lt_max && (b.ridx (jb) < a.ridx (ja)))) |
7781 { | 7762 { |
7782 Complex tmp = xmax (0., b.data (jb)); | 7763 Complex tmp = xmax (0., b.data (jb)); |
7783 if (tmp != 0.) | 7764 if (tmp != 0.) |
7784 { | 7765 { |
7785 r.ridx (jx) = b.ridx (jb); | 7766 r.ridx (jx) = b.ridx (jb); |