26 #if defined (HAVE_CONFIG_H)
43 #include "mx-fcm-fs.h"
45 #include "mx-fs-fcm.h"
69 #if ! defined (USE_QRSOLVE)
121 if (nr != nr_a || nc != nc_a || nz != nz_a)
138 return !(*
this == a);
147 if (nr == nc && nr > 0)
189 return max (dummy_idx, dim);
200 if (dim >= dv.
ndims ())
213 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
224 if (
ridx (i) != idx_j)
261 result.
xcidx (0) = 0;
267 result.
xdata (ii) = tmp;
268 result.
xridx (ii++) = 0;
270 result.
xcidx (j+1) = ii;
277 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
287 if (found[
ridx (i)] == -j)
288 found[
ridx (i)] = -j - 1;
291 if (found[i] > -nc && found[i] < 0)
292 idx_arg.
elem (i) = -found[i];
305 idx_arg.
elem (ir) = j;
311 if (idx_arg.
elem (j) == -1 ||
elem (j, idx_arg.
elem (j)) != 0.)
317 result.
xcidx (0) = 0;
318 result.
xcidx (1) = nel;
321 if (idx_arg(j) == -1)
325 result.
xridx (ii++) = j;
332 result.
xdata (ii) = tmp;
333 result.
xridx (ii++) = j;
346 return min (dummy_idx, dim);
357 if (dim >= dv.
ndims ())
370 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
381 if (
ridx (i) != idx_j)
418 result.
xcidx (0) = 0;
424 result.
xdata (ii) = tmp;
425 result.
xridx (ii++) = 0;
427 result.
xcidx (j+1) = ii;
434 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
444 if (found[
ridx (i)] == -j)
445 found[
ridx (i)] = -j - 1;
448 if (found[i] > -nc && found[i] < 0)
449 idx_arg.
elem (i) = -found[i];
462 idx_arg.
elem (ir) = j;
468 if (idx_arg.
elem (j) == -1 ||
elem (j, idx_arg.
elem (j)) != 0.)
474 result.
xcidx (0) = 0;
475 result.
xcidx (1) = nel;
478 if (idx_arg(j) == -1)
482 result.
xridx (ii++) = j;
489 result.
xdata (ii) = tmp;
490 result.
xridx (ii++) = j;
525 retval(j) =
data (k);
568 return insert (tmp , indx);
584 if (rb.
rows () > 0 && rb.
cols () > 0)
594 if (rb.
rows () > 0 && rb.
cols () > 0)
620 retval.
xcidx (i) = nz;
629 retval.
xridx (q) = j;
632 assert (
nnz () == retval.
xcidx (nr));
665 return inverse (mattype, info, rcond, 0, 0);
673 return inverse (mattype, info, rcond, 0, 0);
680 return inverse (mattype, info, rcond, 0, 0);
685 double& rcond,
const bool,
686 const bool calccond)
const
694 if (nr == 0 || nc == 0 || nr != nc)
695 (*current_liboctave_error_handler) (
"inverse requires square matrix");
698 int typ = mattype.
type ();
702 (*current_liboctave_error_handler) (
"incorrect matrix type");
735 double& rcond,
const bool,
736 const bool calccond)
const
744 if (nr == 0 || nc == 0 || nr != nc)
745 (*current_liboctave_error_handler) (
"inverse requires square matrix");
748 int typ = mattype.
type ();
753 (*current_liboctave_error_handler) (
"incorrect matrix type");
756 double ainvnorm = 0.;
790 retval.
xcidx (i) = cx;
791 retval.
xridx (cx) = i;
792 retval.
xdata (cx) = 1.0;
805 (*current_liboctave_error_handler) (
"division by zero");
810 rpX = retval.
xridx (colXp);
819 v -= retval.
xdata (colXp) *
data (colUp);
824 while (rpX < j && rpU < j && colXp < cx && colUp < nz);
828 colUp =
cidx (j+1) - 1;
832 if (pivot == 0. ||
ridx (colUp) != j)
833 (*current_liboctave_error_handler) (
"division by zero");
843 retval.
xridx (cx) = j;
844 retval.
xdata (cx) = v / pivot;
852 colUp =
cidx (i+1) - 1;
856 if (pivot == 0. ||
ridx (colUp) != i)
857 (*current_liboctave_error_handler) (
"division by zero");
861 retval.
xdata (j) /= pivot;
863 retval.
xcidx (nr) = cx;
908 k <
cidx (jidx+1); k++)
921 (*current_liboctave_error_handler) (
"division by zero");
929 colUp =
cidx (perm[iidx]+1) - 1;
931 colUp =
cidx (perm[iidx]);
935 (*current_liboctave_error_handler) (
"division by zero");
948 nz2 = (2*nz2 < new_cx ? new_cx : 2*nz2);
952 retval.
xcidx (i) = cx;
956 retval.
xridx (cx) = j;
957 retval.
xdata (cx++) = work[j];
961 retval.
xcidx (nr) = cx;
972 i < retval.
cidx (j+1); i++)
978 rcond = 1. / ainvnorm / anorm;
986 double& rcond,
bool,
bool calc_cond)
const
990 (*current_liboctave_error_handler)
991 (
"inverse of the null matrix not defined");
994 int typ = mattype.
type (
false);
998 typ = mattype.
type (*
this);
1001 ret =
dinverse (mattype, info, rcond,
true, calc_cond);
1014 octave::math::sparse_chol<SparseComplexMatrix> fact (*
this, info,
false);
1015 rcond = fact.rcond ();
1023 ret =
Q * InvL.
hermitian () * InvL *
Q.transpose ();
1043 rcond = fact.rcond ();
1051 std::copy_n (
ridx (), nz, ret.
xridx ());
1063 ret = fact.Pc ().
transpose () * InvU * InvL * fact.Pr ();
1091 #if defined (HAVE_UMFPACK)
1096 if (nr == 0 || nc == 0 || nr != nc)
1105 Matrix Control (UMFPACK_CONTROL, 1);
1109 double tmp = octave::sparse_params::get_key (
"spumoni");
1111 Control (UMFPACK_PRL) = tmp;
1113 tmp = octave::sparse_params::get_key (
"piv_tol");
1116 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp;
1117 Control (UMFPACK_PIVOT_TOLERANCE) = tmp;
1121 tmp = octave::sparse_params::get_key (
"autoamd");
1123 Control (UMFPACK_FIXQ) = tmp;
1126 Control (UMFPACK_SCALE) = UMFPACK_SCALE_NONE;
1137 reinterpret_cast<const double *
> (Ax),
1138 nullptr, 1, control);
1141 Matrix Info (1, UMFPACK_INFO);
1146 reinterpret_cast<const double *
> (Ax),
1147 nullptr,
nullptr, &Symbolic, control, info);
1156 (*current_liboctave_error_handler)
1157 (
"SparseComplexMatrix::determinant symbolic factorization failed");
1167 reinterpret_cast<const double *
> (Ax),
1168 nullptr, Symbolic, &Numeric, control, info);
1171 rcond = Info (UMFPACK_RCOND);
1180 (*current_liboctave_error_handler)
1181 (
"SparseComplexMatrix::determinant numeric factorization failed");
1189 status =
UMFPACK_ZNAME (get_determinant) (c10,
nullptr, &e10,
1197 (*current_liboctave_error_handler)
1198 (
"SparseComplexMatrix::determinant error calculating determinant");
1210 octave_unused_parameter (err);
1211 octave_unused_parameter (rcond);
1213 (*current_liboctave_error_handler)
1214 (
"support for UMFPACK was unavailable or disabled when liboctave was built");
1224 solve_singularity_handler,
bool calc_cond)
const
1233 if (nr != b.
rows ())
1235 (
"matrix dimension mismatch solution of linear equations");
1237 if (nr == 0 || nc == 0 || b.
cols () == 0)
1242 int typ = mattype.
type ();
1246 (*current_liboctave_error_handler) (
"incorrect matrix type");
1252 retval(i, j) = b(i, j) /
data (i);
1257 retval(k, j) = b(
ridx (i), j) /
data (i);
1271 rcond = dmin / dmax;
1283 solve_singularity_handler,
1284 bool calc_cond)
const
1293 if (nr != b.
rows ())
1295 (
"matrix dimension mismatch solution of linear equations");
1297 if (nr == 0 || nc == 0 || b.
cols () == 0)
1302 int typ = mattype.
type ();
1306 (*current_liboctave_error_handler) (
"incorrect matrix type");
1312 retval.
xcidx (0) = 0;
1319 if (b.
ridx (i) >= nm)
1324 retval.
xcidx (j+1) = ii;
1334 for (k = b.
cidx (j); k < b.
cidx (j+1); k++)
1342 retval.
xridx (ii) = l;
1346 retval.
xcidx (j+1) = ii;
1361 rcond = dmin / dmax;
1373 solve_singularity_handler,
1374 bool calc_cond)
const
1383 if (nr != b.
rows ())
1385 (
"matrix dimension mismatch solution of linear equations");
1387 if (nr == 0 || nc == 0 || b.
cols () == 0)
1392 int typ = mattype.
type ();
1396 (*current_liboctave_error_handler) (
"incorrect matrix type");
1402 retval(i, j) = b(i, j) /
data (i);
1407 retval(k, j) = b(
ridx (i), j) /
data (i);
1421 rcond = dmin / dmax;
1433 solve_singularity_handler,
1434 bool calc_cond)
const
1443 if (nr != b.
rows ())
1445 (
"matrix dimension mismatch solution of linear equations");
1447 if (nr == 0 || nc == 0 || b.
cols () == 0)
1452 int typ = mattype.
type ();
1456 (*current_liboctave_error_handler) (
"incorrect matrix type");
1462 retval.
xcidx (0) = 0;
1469 if (b.
ridx (i) >= nm)
1474 retval.
xcidx (j+1) = ii;
1484 for (k = b.
cidx (j); k < b.
cidx (j+1); k++)
1492 retval.
xridx (ii) = l;
1496 retval.
xcidx (j+1) = ii;
1511 rcond = dmin / dmax;
1523 solve_singularity_handler sing_handler,
1524 bool calc_cond)
const
1533 if (nr != b.
rows ())
1535 (
"matrix dimension mismatch solution of linear equations");
1537 if (nr == 0 || nc == 0 || b.
cols () == 0)
1542 int typ = mattype.
type ();
1546 (*current_liboctave_error_handler) (
"incorrect matrix type");
1549 double ainvnorm = 0.;
1568 retval.
resize (nc, b_nc);
1589 goto triangular_error;
1595 i <
cidx (kidx+1)-1; i++)
1598 work[iidx] = work[iidx] - tmp *
data (i);
1604 retval(perm[i], j) = work[i];
1626 i <
cidx (iidx+1)-1; i++)
1629 work[idx2] = work[idx2] - tmp *
data (i);
1639 if (atmp > ainvnorm)
1642 rcond = 1. / ainvnorm / anorm;
1648 retval.
resize (nc, b_nc);
1665 goto triangular_error;
1673 work[iidx] = work[iidx] - tmp *
data (i);
1679 retval.
xelem (i, j) = work[i];
1699 i <
cidx (k+1)-1; i++)
1702 work[iidx] = work[iidx] - tmp *
data (i);
1712 if (atmp > ainvnorm)
1715 rcond = 1. / ainvnorm / anorm;
1724 sing_handler (rcond);
1731 volatile double rcond_plus_one = rcond + 1.0;
1739 sing_handler (rcond);
1753 solve_singularity_handler sing_handler,
1754 bool calc_cond)
const
1763 if (nr != b.
rows ())
1765 (
"matrix dimension mismatch solution of linear equations");
1767 if (nr == 0 || nc == 0 || b.
cols () == 0)
1772 int typ = mattype.
type ();
1776 (*current_liboctave_error_handler) (
"incorrect matrix type");
1779 double ainvnorm = 0.;
1798 retval.
xcidx (0) = 0;
1828 goto triangular_error;
1834 i <
cidx (kidx+1)-1; i++)
1837 work[iidx] = work[iidx] - tmp *
data (i);
1849 if (ii + new_nnz > x_nz)
1858 if (work[rperm[i]] != 0.)
1860 retval.
xridx (ii) = i;
1861 retval.
xdata (ii++) = work[rperm[i]];
1863 retval.
xcidx (j+1) = ii;
1887 i <
cidx (iidx+1)-1; i++)
1890 work[idx2] = work[idx2] - tmp *
data (i);
1900 if (atmp > ainvnorm)
1903 rcond = 1. / ainvnorm / anorm;
1925 goto triangular_error;
1933 work[iidx] = work[iidx] - tmp *
data (i);
1945 if (ii + new_nnz > x_nz)
1956 retval.
xridx (ii) = i;
1957 retval.
xdata (ii++) = work[i];
1959 retval.
xcidx (j+1) = ii;
1981 i <
cidx (k+1)-1; i++)
1984 work[iidx] = work[iidx] - tmp *
data (i);
1994 if (atmp > ainvnorm)
1997 rcond = 1. / ainvnorm / anorm;
2006 sing_handler (rcond);
2013 volatile double rcond_plus_one = rcond + 1.0;
2021 sing_handler (rcond);
2034 solve_singularity_handler sing_handler,
2035 bool calc_cond)
const
2044 if (nr != b.
rows ())
2046 (
"matrix dimension mismatch solution of linear equations");
2048 if (nr == 0 || nc == 0 || b.
cols () == 0)
2053 int typ = mattype.
type ();
2057 (*current_liboctave_error_handler) (
"incorrect matrix type");
2060 double ainvnorm = 0.;
2079 retval.
resize (nc, b_nc);
2100 goto triangular_error;
2106 i <
cidx (kidx+1)-1; i++)
2109 work[iidx] = work[iidx] - tmp *
data (i);
2115 retval(perm[i], j) = work[i];
2137 i <
cidx (iidx+1)-1; i++)
2140 work[idx2] = work[idx2] - tmp *
data (i);
2150 if (atmp > ainvnorm)
2153 rcond = 1. / ainvnorm / anorm;
2159 retval.
resize (nc, b_nc);
2176 goto triangular_error;
2184 work[iidx] = work[iidx] - tmp *
data (i);
2190 retval.
xelem (i, j) = work[i];
2210 i <
cidx (k+1)-1; i++)
2213 work[iidx] = work[iidx] - tmp *
data (i);
2223 if (atmp > ainvnorm)
2226 rcond = 1. / ainvnorm / anorm;
2235 sing_handler (rcond);
2242 volatile double rcond_plus_one = rcond + 1.0;
2250 sing_handler (rcond);
2264 solve_singularity_handler sing_handler,
2265 bool calc_cond)
const
2274 if (nr != b.
rows ())
2276 (
"matrix dimension mismatch solution of linear equations");
2278 if (nr == 0 || nc == 0 || b.
cols () == 0)
2283 int typ = mattype.
type ();
2287 (*current_liboctave_error_handler) (
"incorrect matrix type");
2290 double ainvnorm = 0.;
2309 retval.
xcidx (0) = 0;
2339 goto triangular_error;
2345 i <
cidx (kidx+1)-1; i++)
2348 work[iidx] = work[iidx] - tmp *
data (i);
2360 if (ii + new_nnz > x_nz)
2369 if (work[rperm[i]] != 0.)
2371 retval.
xridx (ii) = i;
2372 retval.
xdata (ii++) = work[rperm[i]];
2374 retval.
xcidx (j+1) = ii;
2398 i <
cidx (iidx+1)-1; i++)
2401 work[idx2] = work[idx2] - tmp *
data (i);
2411 if (atmp > ainvnorm)
2414 rcond = 1. / ainvnorm / anorm;
2436 goto triangular_error;
2444 work[iidx] = work[iidx] - tmp *
data (i);
2456 if (ii + new_nnz > x_nz)
2467 retval.
xridx (ii) = i;
2468 retval.
xdata (ii++) = work[i];
2470 retval.
xcidx (j+1) = ii;
2492 i <
cidx (k+1)-1; i++)
2495 work[iidx] = work[iidx] - tmp *
data (i);
2505 if (atmp > ainvnorm)
2508 rcond = 1. / ainvnorm / anorm;
2517 sing_handler (rcond);
2524 volatile double rcond_plus_one = rcond + 1.0;
2532 sing_handler (rcond);
2546 solve_singularity_handler sing_handler,
2547 bool calc_cond)
const
2556 if (nr != b.
rows ())
2558 (
"matrix dimension mismatch solution of linear equations");
2560 if (nr == 0 || nc == 0 || b.
cols () == 0)
2565 int typ = mattype.
type ();
2569 (*current_liboctave_error_handler) (
"incorrect matrix type");
2572 double ainvnorm = 0.;
2591 retval.
resize (nc, b_nc);
2600 work[perm[i]] = b(i, j);
2610 if (perm[
ridx (i)] < minr)
2612 minr = perm[
ridx (i)];
2616 if (minr != k ||
data (mini) == 0.)
2619 goto triangular_error;
2630 work[iidx] = work[iidx] - tmp *
data (i);
2636 retval(i, j) = work[i];
2657 i <
cidx (k+1); i++)
2658 if (perm[
ridx (i)] < minr)
2660 minr = perm[
ridx (i)];
2667 i <
cidx (k+1); i++)
2673 work[iidx] = work[iidx] - tmp *
data (i);
2684 if (atmp > ainvnorm)
2687 rcond = 1. / ainvnorm / anorm;
2693 retval.
resize (nc, b_nc, 0.);
2708 goto triangular_error;
2716 work[iidx] = work[iidx] - tmp *
data (i);
2721 retval.
xelem (i, j) = work[i];
2742 i <
cidx (k+1); i++)
2745 work[iidx] = work[iidx] - tmp *
data (i);
2755 if (atmp > ainvnorm)
2758 rcond = 1. / ainvnorm / anorm;
2766 sing_handler (rcond);
2773 volatile double rcond_plus_one = rcond + 1.0;
2781 sing_handler (rcond);
2795 solve_singularity_handler sing_handler,
2796 bool calc_cond)
const
2806 if (nr != b.
rows ())
2808 (
"matrix dimension mismatch solution of linear equations");
2810 if (nr == 0 || nc == 0 || b.
cols () == 0)
2815 int typ = mattype.
type ();
2819 (*current_liboctave_error_handler) (
"incorrect matrix type");
2822 double ainvnorm = 0.;
2841 retval.
xcidx (0) = 0;
2855 work[perm[b.
ridx (i)]] = b.
data (i);
2865 if (perm[
ridx (i)] < minr)
2867 minr = perm[
ridx (i)];
2871 if (minr != k ||
data (mini) == 0.)
2874 goto triangular_error;
2885 work[iidx] = work[iidx] - tmp *
data (i);
2897 if (ii + new_nnz > x_nz)
2908 retval.
xridx (ii) = i;
2909 retval.
xdata (ii++) = work[i];
2911 retval.
xcidx (j+1) = ii;
2934 i <
cidx (k+1); i++)
2935 if (perm[
ridx (i)] < minr)
2937 minr = perm[
ridx (i)];
2944 i <
cidx (k+1); i++)
2950 work[iidx] = work[iidx] - tmp *
data (i);
2961 if (atmp > ainvnorm)
2964 rcond = 1. / ainvnorm / anorm;
2985 goto triangular_error;
2993 work[iidx] = work[iidx] - tmp *
data (i);
3005 if (ii + new_nnz > x_nz)
3016 retval.
xridx (ii) = i;
3017 retval.
xdata (ii++) = work[i];
3019 retval.
xcidx (j+1) = ii;
3042 i <
cidx (k+1); i++)
3045 work[iidx] = work[iidx] - tmp *
data (i);
3055 if (atmp > ainvnorm)
3058 rcond = 1. / ainvnorm / anorm;
3067 sing_handler (rcond);
3074 volatile double rcond_plus_one = rcond + 1.0;
3082 sing_handler (rcond);
3096 solve_singularity_handler sing_handler,
3097 bool calc_cond)
const
3106 if (nr != b.
rows ())
3108 (
"matrix dimension mismatch solution of linear equations");
3110 if (nr == 0 || nc == 0 || b.
cols () == 0)
3115 int typ = mattype.
type ();
3119 (*current_liboctave_error_handler) (
"incorrect matrix type");
3122 double ainvnorm = 0.;
3141 retval.
resize (nc, b_nc);
3150 work[perm[i]] = b(i, j);
3160 if (perm[
ridx (i)] < minr)
3162 minr = perm[
ridx (i)];
3166 if (minr != k ||
data (mini) == 0.)
3169 goto triangular_error;
3180 work[iidx] = work[iidx] - tmp *
data (i);
3186 retval(i, j) = work[i];
3207 i <
cidx (k+1); i++)
3208 if (perm[
ridx (i)] < minr)
3210 minr = perm[
ridx (i)];
3217 i <
cidx (k+1); i++)
3223 work[iidx] = work[iidx] - tmp *
data (i);
3234 if (atmp > ainvnorm)
3237 rcond = 1. / ainvnorm / anorm;
3243 retval.
resize (nc, b_nc, 0.);
3259 goto triangular_error;
3267 work[iidx] = work[iidx] - tmp *
data (i);
3273 retval.
xelem (i, j) = work[i];
3294 i <
cidx (k+1); i++)
3297 work[iidx] = work[iidx] - tmp *
data (i);
3307 if (atmp > ainvnorm)
3310 rcond = 1. / ainvnorm / anorm;
3319 sing_handler (rcond);
3326 volatile double rcond_plus_one = rcond + 1.0;
3334 sing_handler (rcond);
3348 solve_singularity_handler sing_handler,
3349 bool calc_cond)
const
3358 if (nr != b.
rows ())
3360 (
"matrix dimension mismatch solution of linear equations");
3362 if (nr == 0 || nc == 0 || b.
cols () == 0)
3367 int typ = mattype.
type ();
3371 (*current_liboctave_error_handler) (
"incorrect matrix type");
3374 double ainvnorm = 0.;
3393 retval.
xcidx (0) = 0;
3407 work[perm[b.
ridx (i)]] = b.
data (i);
3417 if (perm[
ridx (i)] < minr)
3419 minr = perm[
ridx (i)];
3423 if (minr != k ||
data (mini) == 0.)
3426 goto triangular_error;
3437 work[iidx] = work[iidx] - tmp *
data (i);
3449 if (ii + new_nnz > x_nz)
3460 retval.
xridx (ii) = i;
3461 retval.
xdata (ii++) = work[i];
3463 retval.
xcidx (j+1) = ii;
3486 i <
cidx (k+1); i++)
3487 if (perm[
ridx (i)] < minr)
3489 minr = perm[
ridx (i)];
3496 i <
cidx (k+1); i++)
3502 work[iidx] = work[iidx] - tmp *
data (i);
3513 if (atmp > ainvnorm)
3516 rcond = 1. / ainvnorm / anorm;
3537 goto triangular_error;
3545 work[iidx] = work[iidx] - tmp *
data (i);
3557 if (ii + new_nnz > x_nz)
3568 retval.
xridx (ii) = i;
3569 retval.
xdata (ii++) = work[i];
3571 retval.
xcidx (j+1) = ii;
3594 i <
cidx (k+1); i++)
3597 work[iidx] = work[iidx] - tmp *
data (i);
3607 if (atmp > ainvnorm)
3610 rcond = 1. / ainvnorm / anorm;
3619 sing_handler (rcond);
3626 volatile double rcond_plus_one = rcond + 1.0;
3634 sing_handler (rcond);
3648 solve_singularity_handler sing_handler,
3649 bool calc_cond)
const
3657 if (nr != nc || nr != b.
rows ())
3658 (*current_liboctave_error_handler)
3659 (
"matrix dimension mismatch solution of linear equations");
3661 if (nr == 0 || b.
cols () == 0)
3664 (*current_liboctave_error_handler)
3665 (
"calculation of condition number not implemented");
3669 volatile int typ = mattype.
type ();
3703 else if (
ridx (i) == j + 1)
3714 F77_INT tmp_nr = octave::to_f77_int (nr);
3747 DL[j] =
data (ii++);
3748 DU[j] =
data (ii++);
3750 D[nc-1] =
data (ii);
3767 else if (
ridx (i) == j + 1)
3769 else if (
ridx (i) == j - 1)
3780 F77_INT tmp_nr = octave::to_f77_int (nr);
3797 sing_handler (rcond);
3808 (*current_liboctave_error_handler) (
"incorrect matrix type");
3817 solve_singularity_handler sing_handler,
3818 bool calc_cond)
const
3826 if (nr != nc || nr != b.
rows ())
3827 (*current_liboctave_error_handler)
3828 (
"matrix dimension mismatch solution of linear equations");
3830 if (nr == 0 || b.
cols () == 0)
3833 (*current_liboctave_error_handler)
3834 (
"calculation of condition number not implemented");
3838 int typ = mattype.
type ();
3859 DL[j] =
data (ii++);
3860 DU[j] =
data (ii++);
3862 D[nc-1] =
data (ii);
3879 else if (
ridx (i) == j + 1)
3881 else if (
ridx (i) == j - 1)
3886 F77_INT tmp_nr = octave::to_f77_int (nr);
3905 sing_handler (rcond);
3918 retval.
xcidx (0) = 0;
3932 (F77_CONST_CHAR_ARG2 (&job, 1),
3938 F77_CHAR_ARG_LEN (1)));
3949 if (ii + new_nnz > x_nz)
3960 retval.
xridx (ii) = i;
3961 retval.
xdata (ii++) = work[i];
3963 retval.
xcidx (j+1) = ii;
3970 (*current_liboctave_error_handler) (
"incorrect matrix type");
3979 solve_singularity_handler sing_handler,
3980 bool calc_cond)
const
3988 if (nr != nc || nr != b.
rows ())
3989 (*current_liboctave_error_handler)
3990 (
"matrix dimension mismatch solution of linear equations");
3992 if (nr == 0 || b.
cols () == 0)
3995 (*current_liboctave_error_handler)
3996 (
"calculation of condition number not implemented");
4000 volatile int typ = mattype.
type ();
4034 else if (
ridx (i) == j + 1)
4047 F77_INT tmp_nr = octave::to_f77_int (nr);
4078 DL[j] =
data (ii++);
4079 DU[j] =
data (ii++);
4081 D[nc-1] =
data (ii);
4098 else if (
ridx (i) == j + 1)
4100 else if (
ridx (i) == j - 1)
4113 F77_INT tmp_nr = octave::to_f77_int (nr);
4130 sing_handler (rcond);
4138 (*current_liboctave_error_handler) (
"incorrect matrix type");
4148 solve_singularity_handler sing_handler,
4149 bool calc_cond)
const
4157 if (nr != nc || nr != b.
rows ())
4158 (*current_liboctave_error_handler)
4159 (
"matrix dimension mismatch solution of linear equations");
4161 if (nr == 0 || b.
cols () == 0)
4164 (*current_liboctave_error_handler)
4165 (
"calculation of condition number not implemented");
4169 int typ = mattype.
type ();
4190 DL[j] =
data (ii++);
4191 DU[j] =
data (ii++);
4193 D[nc-1] =
data (ii);
4210 else if (
ridx (i) == j + 1)
4212 else if (
ridx (i) == j - 1)
4217 F77_INT tmp_nr = octave::to_f77_int (nr);
4236 sing_handler (rcond);
4256 retval.
xcidx (0) = 0;
4260 for (
F77_INT i = 0; i < b_nr; i++)
4264 (F77_CONST_CHAR_ARG2 (&job, 1),
4270 F77_CHAR_ARG_LEN (1)));
4278 (*current_liboctave_error_handler)
4279 (
"SparseComplexMatrix::solve solve failed");
4292 if (ii + new_nnz > x_nz)
4303 retval.
xridx (ii) = i;
4304 retval.
xdata (ii++) = Bx[i];
4307 retval.
xcidx (j+1) = ii;
4314 (*current_liboctave_error_handler) (
"incorrect matrix type");
4323 solve_singularity_handler sing_handler,
4324 bool calc_cond)
const
4332 if (nr != nc || nr != b.
rows ())
4333 (*current_liboctave_error_handler)
4334 (
"matrix dimension mismatch solution of linear equations");
4336 if (nr == 0 || b.
cols () == 0)
4341 volatile int typ = mattype.
type ();
4355 for (
F77_INT j = 0; j < ldm; j++)
4357 tmp_data[ii++] = 0.;
4365 m_band(ri - j, j) =
data (i);
4373 F77_INT tmp_nr = octave::to_f77_int (nr);
4378 F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
4380 F77_CHAR_ARG_LEN (1)));
4403 (F77_CONST_CHAR_ARG2 (&job, 1),
4406 F77_CHAR_ARG_LEN (1)));
4413 volatile double rcond_plus_one = rcond + 1.0;
4421 sing_handler (rcond);
4440 (F77_CONST_CHAR_ARG2 (&job, 1),
4443 F77_CHAR_ARG_LEN (1)));
4450 (*current_liboctave_error_handler)
4451 (
"SparseMatrix::solve solve failed");
4463 F77_INT ldm = n_upper + 2 * n_lower + 1;
4472 for (
F77_INT j = 0; j < ldm; j++)
4474 tmp_data[ii++] = 0.;
4479 m_band(
ridx (i) - j + n_lower + n_upper, j) =
data (i);
4498 F77_INT tmp_nr = octave::to_f77_int (nr);
4502 F77_XFCN (zgbtrf, ZGBTRF, (tmp_nr, tmp_nr, n_lower, n_upper,
4504 ldm, pipvt, tmp_err));
4517 sing_handler (rcond);
4533 F77_INT tmp_nc = octave::to_f77_int (nc);
4536 (F77_CONST_CHAR_ARG2 (&job, 1),
4539 F77_CHAR_ARG_LEN (1)));
4546 volatile double rcond_plus_one = rcond + 1.0;
4554 sing_handler (rcond);
4574 (F77_CONST_CHAR_ARG2 (&job, 1),
4577 F77_CHAR_ARG_LEN (1)));
4584 (*current_liboctave_error_handler) (
"incorrect matrix type");
4593 solve_singularity_handler sing_handler,
4594 bool calc_cond)
const
4602 if (nr != nc || nr != b.
rows ())
4603 (*current_liboctave_error_handler)
4604 (
"matrix dimension mismatch solution of linear equations");
4606 if (nr == 0 || b.
cols () == 0)
4611 volatile int typ = mattype.
type ();
4626 for (
F77_INT j = 0; j < ldm; j++)
4628 tmp_data[ii++] = 0.;
4636 m_band(ri - j, j) =
data (i);
4644 F77_INT tmp_nr = octave::to_f77_int (nr);
4649 F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
4651 F77_CHAR_ARG_LEN (1)));
4672 (F77_CONST_CHAR_ARG2 (&job, 1),
4675 F77_CHAR_ARG_LEN (1)));
4682 volatile double rcond_plus_one = rcond + 1.0;
4690 sing_handler (rcond);
4712 retval.
xcidx (0) = 0;
4715 for (
F77_INT i = 0; i < b_nr; i++)
4716 Bx[i] = b.
elem (i, j);
4719 (F77_CONST_CHAR_ARG2 (&job, 1),
4722 F77_CHAR_ARG_LEN (1)));
4729 (*current_liboctave_error_handler)
4730 (
"SparseComplexMatrix::solve solve failed");
4744 sz = (
static_cast<double> (b_nc) - j) / b_nc
4746 sz = x_nz + (sz > 100 ? sz : 100);
4750 retval.
xdata (ii) = tmp;
4751 retval.
xridx (ii++) = i;
4754 retval.
xcidx (j+1) = ii;
4767 F77_INT ldm = n_upper + 2 * n_lower + 1;
4776 for (
F77_INT j = 0; j < ldm; j++)
4778 tmp_data[ii++] = 0.;
4783 m_band(
ridx (i) - j + n_lower + n_upper, j) =
data (i);
4802 F77_INT tmp_nr = octave::to_f77_int (nr);
4806 F77_XFCN (zgbtrf, ZGBTRF, (tmp_nr, tmp_nr, n_lower, n_upper,
4808 ldm, pipvt, tmp_err));
4819 sing_handler (rcond);
4835 F77_INT tmp_nc = octave::to_f77_int (nc);
4838 (F77_CONST_CHAR_ARG2 (&job, 1),
4841 F77_CHAR_ARG_LEN (1)));
4848 volatile double rcond_plus_one = rcond + 1.0;
4856 sing_handler (rcond);
4873 retval.
xcidx (0) = 0;
4883 i < b.
cidx (j+1); i++)
4887 (F77_CONST_CHAR_ARG2 (&job, 1),
4890 F77_CHAR_ARG_LEN (1)));
4901 if (ii + new_nnz > x_nz)
4912 retval.
xridx (ii) = i;
4913 retval.
xdata (ii++) = work[i];
4915 retval.
xcidx (j+1) = ii;
4923 (*current_liboctave_error_handler) (
"incorrect matrix type");
4932 solve_singularity_handler sing_handler,
4933 bool calc_cond)
const
4941 if (nr != nc || nr != b.
rows ())
4942 (*current_liboctave_error_handler)
4943 (
"matrix dimension mismatch solution of linear equations");
4945 if (nr == 0 || b.
cols () == 0)
4950 volatile int typ = mattype.
type ();
4965 for (
F77_INT j = 0; j < ldm; j++)
4967 tmp_data[ii++] = 0.;
4975 m_band(ri - j, j) =
data (i);
4983 F77_INT tmp_nr = octave::to_f77_int (nr);
4988 F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
4990 F77_CHAR_ARG_LEN (1)));
5013 (F77_CONST_CHAR_ARG2 (&job, 1),
5016 F77_CHAR_ARG_LEN (1)));
5023 volatile double rcond_plus_one = rcond + 1.0;
5031 sing_handler (rcond);
5049 (F77_CONST_CHAR_ARG2 (&job, 1),
5052 F77_CHAR_ARG_LEN (1)));
5059 (*current_liboctave_error_handler)
5060 (
"SparseComplexMatrix::solve solve failed");
5072 F77_INT ldm = n_upper + 2 * n_lower + 1;
5081 for (
F77_INT j = 0; j < ldm; j++)
5083 tmp_data[ii++] = 0.;
5088 m_band(
ridx (i) - j + n_lower + n_upper, j) =
data (i);
5107 F77_INT tmp_nr = octave::to_f77_int (nr);
5111 F77_XFCN (zgbtrf, ZGBTRF, (tmp_nr, tmp_nr, n_lower, n_upper,
5113 ldm, pipvt, tmp_err));
5124 sing_handler (rcond);
5140 F77_INT tmp_nc = octave::to_f77_int (nc);
5143 (F77_CONST_CHAR_ARG2 (&job, 1),
5146 F77_CHAR_ARG_LEN (1)));
5153 volatile double rcond_plus_one = rcond + 1.0;
5161 sing_handler (rcond);
5180 (F77_CONST_CHAR_ARG2 (&job, 1),
5183 F77_CHAR_ARG_LEN (1)));
5190 (*current_liboctave_error_handler) (
"incorrect matrix type");
5199 solve_singularity_handler sing_handler,
5200 bool calc_cond)
const
5208 if (nr != nc || nr != b.
rows ())
5209 (*current_liboctave_error_handler)
5210 (
"matrix dimension mismatch solution of linear equations");
5212 if (nr == 0 || b.
cols () == 0)
5217 volatile int typ = mattype.
type ();
5232 for (
F77_INT j = 0; j < ldm; j++)
5234 tmp_data[ii++] = 0.;
5242 m_band(ri - j, j) =
data (i);
5250 F77_INT tmp_nr = octave::to_f77_int (nr);
5255 F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
5257 F77_CHAR_ARG_LEN (1)));
5281 (F77_CONST_CHAR_ARG2 (&job, 1),
5284 F77_CHAR_ARG_LEN (1)));
5291 volatile double rcond_plus_one = rcond + 1.0;
5299 sing_handler (rcond);
5321 retval.
xcidx (0) = 0;
5325 for (
F77_INT i = 0; i < b_nr; i++)
5329 (F77_CONST_CHAR_ARG2 (&job, 1),
5332 F77_CHAR_ARG_LEN (1)));
5339 (*current_liboctave_error_handler)
5340 (
"SparseMatrix::solve solve failed");
5352 if (ii + new_nnz > x_nz)
5363 retval.
xridx (ii) = i;
5364 retval.
xdata (ii++) = Bx[i];
5367 retval.
xcidx (j+1) = ii;
5380 F77_INT ldm = n_upper + 2 * n_lower + 1;
5389 for (
F77_INT j = 0; j < ldm; j++)
5391 tmp_data[ii++] = 0.;
5396 m_band(
ridx (i) - j + n_lower + n_upper, j) =
data (i);
5415 F77_INT tmp_nr = octave::to_f77_int (nr);
5419 F77_XFCN (zgbtrf, ZGBTRF, (tmp_nr, tmp_nr, n_lower, n_upper,
5421 ldm, pipvt, tmp_err));
5432 sing_handler (rcond);
5448 F77_INT tmp_nc = octave::to_f77_int (nc);
5451 (F77_CONST_CHAR_ARG2 (&job, 1),
5454 F77_CHAR_ARG_LEN (1)));
5461 volatile double rcond_plus_one = rcond + 1.0;
5469 sing_handler (rcond);
5486 retval.
xcidx (0) = 0;
5497 i < b.
cidx (j+1); i++)
5501 (F77_CONST_CHAR_ARG2 (&job, 1),
5504 F77_CHAR_ARG_LEN (1)));
5515 if (ii + new_nnz > x_nz)
5526 retval.
xridx (ii) = i;
5527 retval.
xdata (ii++) = Bx[i];
5529 retval.
xcidx (j+1) = ii;
5537 (*current_liboctave_error_handler) (
"incorrect matrix type");
5546 solve_singularity_handler sing_handler,
5547 bool calc_cond)
const
5550 void *Numeric =
nullptr;
5553 #if defined (HAVE_UMFPACK)
5556 Control =
Matrix (UMFPACK_CONTROL, 1);
5560 double tmp = octave::sparse_params::get_key (
"spumoni");
5562 Control (UMFPACK_PRL) = tmp;
5563 tmp = octave::sparse_params::get_key (
"piv_tol");
5566 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp;
5567 Control (UMFPACK_PIVOT_TOLERANCE) = tmp;
5571 tmp = octave::sparse_params::get_key (
"autoamd");
5573 Control (UMFPACK_FIXQ) = tmp;
5586 reinterpret_cast<const double *
> (Ax),
5587 nullptr, 1, control);
5590 Info =
Matrix (1, UMFPACK_INFO);
5595 reinterpret_cast<const double *
> (Ax),
5596 nullptr,
nullptr, &Symbolic, control, info);
5606 (*current_liboctave_error_handler)
5607 (
"SparseComplexMatrix::solve symbolic factorization failed");
5616 reinterpret_cast<const double *
> (Ax),
5617 nullptr, Symbolic, &Numeric, control, info);
5621 rcond = Info (UMFPACK_RCOND);
5624 volatile double rcond_plus_one = rcond + 1.0;
5626 if (status == UMFPACK_WARNING_singular_matrix
5634 sing_handler (rcond);
5638 else if (status < 0)
5644 (*current_liboctave_error_handler)
5645 (
"SparseComplexMatrix::solve numeric factorization failed");
5660 octave_unused_parameter (rcond);
5661 octave_unused_parameter (Control);
5662 octave_unused_parameter (Info);
5663 octave_unused_parameter (sing_handler);
5664 octave_unused_parameter (calc_cond);
5666 (*current_liboctave_error_handler)
5667 (
"support for UMFPACK was unavailable or disabled when liboctave was built");
5677 solve_singularity_handler sing_handler,
5678 bool calc_cond)
const
5686 if (nr != nc || nr != b.
rows ())
5687 (*current_liboctave_error_handler)
5688 (
"matrix dimension mismatch solution of linear equations");
5690 if (nr == 0 || b.
cols () == 0)
5695 volatile int typ = mattype.
type ();
5700 #if defined (HAVE_CHOLMOD)
5701 cholmod_common Common;
5702 cholmod_common *cm = &Common;
5706 cm->prefer_zomplex =
false;
5708 double spu = octave::sparse_params::get_key (
"spumoni");
5712 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function,
nullptr);
5716 cm->print =
static_cast<int> (spu) + 2;
5717 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
5721 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
5722 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
5724 cm->final_ll =
true;
5726 cholmod_sparse Astore;
5727 cholmod_sparse *
A = &Astore;
5737 #if defined (OCTAVE_ENABLE_64)
5738 A->itype = CHOLMOD_LONG;
5740 A->itype = CHOLMOD_INT;
5742 A->dtype = CHOLMOD_DOUBLE;
5744 A->xtype = CHOLMOD_COMPLEX;
5748 cholmod_dense Bstore;
5749 cholmod_dense *
B = &Bstore;
5750 B->nrow = b.
rows ();
5751 B->ncol = b.
cols ();
5753 B->nzmax =
B->nrow *
B->ncol;
5754 B->dtype = CHOLMOD_DOUBLE;
5755 B->xtype = CHOLMOD_REAL;
5757 B->x =
const_cast<double *
> (b.
data ());
5774 volatile double rcond_plus_one = rcond + 1.0;
5782 sing_handler (rcond);
5798 retval.
xelem (i, j) =
static_cast<Complex *
>(X->x)[jr + i];
5804 static char blank_name[] =
" ";
5808 (*current_liboctave_warning_with_id_handler)
5809 (
"Octave:missing-dependency",
5810 "support for CHOLMOD was unavailable or disabled "
5811 "when liboctave was built");
5820 #if defined (HAVE_UMFPACK)
5822 void *Numeric =
factorize (err, rcond, Control, Info,
5823 sing_handler, calc_cond);
5828 Control (UMFPACK_IRSTEP) = 1;
5837 #if defined (UMFPACK_SEPARATE_SPLIT)
5838 const double *Bx = b.
data ();
5845 retval.
resize (b_nr, b_nc);
5850 #if defined (UMFPACK_SEPARATE_SPLIT)
5854 reinterpret_cast<const double *
> (Ax),
5856 reinterpret_cast<double *
> (&Xx[iidx]),
5858 &Bx[iidx], Bz, Numeric,
5862 Bz[i] = b.
elem (i, j);
5867 reinterpret_cast<const double *
> (Ax),
5869 reinterpret_cast<double *
> (&Xx[iidx]),
5871 reinterpret_cast<const double *
> (Bz),
5881 (*current_liboctave_error_handler)
5882 (
"SparseComplexMatrix::solve solve failed");
5897 octave_unused_parameter (rcond);
5898 octave_unused_parameter (sing_handler);
5899 octave_unused_parameter (calc_cond);
5901 (*current_liboctave_error_handler)
5902 (
"support for UMFPACK was unavailable or disabled "
5903 "when liboctave was built");
5907 (*current_liboctave_error_handler) (
"incorrect matrix type");
5916 solve_singularity_handler sing_handler,
5917 bool calc_cond)
const
5925 if (nr != nc || nr != b.
rows ())
5926 (*current_liboctave_error_handler)
5927 (
"matrix dimension mismatch solution of linear equations");
5929 if (nr == 0 || b.
cols () == 0)
5934 volatile int typ = mattype.
type ();
5939 #if defined (HAVE_CHOLMOD)
5940 cholmod_common Common;
5941 cholmod_common *cm = &Common;
5945 cm->prefer_zomplex =
false;
5947 double spu = octave::sparse_params::get_key (
"spumoni");
5951 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function,
nullptr);
5955 cm->print =
static_cast<int> (spu) + 2;
5956 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
5960 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
5961 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
5963 cm->final_ll =
true;
5965 cholmod_sparse Astore;
5966 cholmod_sparse *
A = &Astore;
5976 #if defined (OCTAVE_ENABLE_64)
5977 A->itype = CHOLMOD_LONG;
5979 A->itype = CHOLMOD_INT;
5981 A->dtype = CHOLMOD_DOUBLE;
5983 A->xtype = CHOLMOD_COMPLEX;
5987 cholmod_sparse Bstore;
5988 cholmod_sparse *
B = &Bstore;
5989 B->nrow = b.
rows ();
5990 B->ncol = b.
cols ();
5993 B->nzmax = b.
nnz ();
5997 #if defined (OCTAVE_ENABLE_64)
5998 B->itype = CHOLMOD_LONG;
6000 B->itype = CHOLMOD_INT;
6002 B->dtype = CHOLMOD_DOUBLE;
6004 B->xtype = CHOLMOD_REAL;
6023 volatile double rcond_plus_one = rcond + 1.0;
6031 sing_handler (rcond);
6040 cholmod_sparse *X =
CHOLMOD_NAME(spsolve) (CHOLMOD_A, L,
B, cm);
6047 j <= static_cast<octave_idx_type> (X->ncol); j++)
6050 j < static_cast<octave_idx_type> (X->nzmax); j++)
6059 static char blank_name[] =
" ";
6063 (*current_liboctave_warning_with_id_handler)
6064 (
"Octave:missing-dependency",
6065 "support for CHOLMOD was unavailable or disabled "
6066 "when liboctave was built");
6075 #if defined (HAVE_UMFPACK)
6077 void *Numeric =
factorize (err, rcond, Control, Info,
6078 sing_handler, calc_cond);
6083 Control (UMFPACK_IRSTEP) = 1;
6093 #if defined (UMFPACK_SEPARATE_SPLIT)
6110 retval.
xcidx (0) = 0;
6114 #if defined (UMFPACK_SEPARATE_SPLIT)
6116 Bx[i] = b.
elem (i, j);
6121 reinterpret_cast<const double *
> (Ax),
6123 reinterpret_cast<double *
> (Xx),
6125 Bx, Bz, Numeric, control,
6129 Bz[i] = b.
elem (i, j);
6134 reinterpret_cast<const double *
> (Ax),
6136 reinterpret_cast<double *
> (Xx),
6138 reinterpret_cast<double *
> (Bz),
6148 (*current_liboctave_error_handler)
6149 (
"SparseComplexMatrix::solve solve failed");
6164 sz = (
static_cast<double> (b_nc) - j) / b_nc
6166 sz = x_nz + (sz > 100 ? sz : 100);
6170 retval.
xdata (ii) = tmp;
6171 retval.
xridx (ii++) = i;
6174 retval.
xcidx (j+1) = ii;
6187 octave_unused_parameter (rcond);
6188 octave_unused_parameter (sing_handler);
6189 octave_unused_parameter (calc_cond);
6191 (*current_liboctave_error_handler)
6192 (
"support for UMFPACK was unavailable or disabled "
6193 "when liboctave was built");
6197 (*current_liboctave_error_handler) (
"incorrect matrix type");
6206 solve_singularity_handler sing_handler,
6207 bool calc_cond)
const
6215 if (nr != nc || nr != b.
rows ())
6216 (*current_liboctave_error_handler)
6217 (
"matrix dimension mismatch solution of linear equations");
6219 if (nr == 0 || b.
cols () == 0)
6224 volatile int typ = mattype.
type ();
6229 #if defined (HAVE_CHOLMOD)
6230 cholmod_common Common;
6231 cholmod_common *cm = &Common;
6235 cm->prefer_zomplex =
false;
6237 double spu = octave::sparse_params::get_key (
"spumoni");
6241 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function,
nullptr);
6245 cm->print =
static_cast<int> (spu) + 2;
6246 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
6250 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
6251 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
6253 cm->final_ll =
true;
6255 cholmod_sparse Astore;
6256 cholmod_sparse *
A = &Astore;
6266 #if defined (OCTAVE_ENABLE_64)
6267 A->itype = CHOLMOD_LONG;
6269 A->itype = CHOLMOD_INT;
6271 A->dtype = CHOLMOD_DOUBLE;
6273 A->xtype = CHOLMOD_COMPLEX;
6277 cholmod_dense Bstore;
6278 cholmod_dense *
B = &Bstore;
6279 B->nrow = b.
rows ();
6280 B->ncol = b.
cols ();
6282 B->nzmax =
B->nrow *
B->ncol;
6283 B->dtype = CHOLMOD_DOUBLE;
6284 B->xtype = CHOLMOD_COMPLEX;
6303 volatile double rcond_plus_one = rcond + 1.0;
6311 sing_handler (rcond);
6327 retval.
xelem (i, j) =
static_cast<Complex *
>(X->x)[jr + i];
6333 static char blank_name[] =
" ";
6337 (*current_liboctave_warning_with_id_handler)
6338 (
"Octave:missing-dependency",
6339 "support for CHOLMOD was unavailable or disabled "
6340 "when liboctave was built");
6349 #if defined (HAVE_UMFPACK)
6351 void *Numeric =
factorize (err, rcond, Control, Info,
6352 sing_handler, calc_cond);
6357 Control (UMFPACK_IRSTEP) = 1;
6368 retval.
resize (b_nr, b_nc);
6377 reinterpret_cast<const double *
> (Ax),
6379 reinterpret_cast<double *
> (&Xx[iidx]),
6381 reinterpret_cast<const double *
> (&Bx[iidx]),
6382 nullptr, Numeric, control, info);
6389 (*current_liboctave_error_handler)
6390 (
"SparseComplexMatrix::solve solve failed");
6405 octave_unused_parameter (rcond);
6406 octave_unused_parameter (sing_handler);
6407 octave_unused_parameter (calc_cond);
6409 (*current_liboctave_error_handler)
6410 (
"support for UMFPACK was unavailable or disabled "
6411 "when liboctave was built");
6415 (*current_liboctave_error_handler) (
"incorrect matrix type");
6424 solve_singularity_handler sing_handler,
6425 bool calc_cond)
const
6433 if (nr != nc || nr != b.
rows ())
6434 (*current_liboctave_error_handler)
6435 (
"matrix dimension mismatch solution of linear equations");
6437 if (nr == 0 || b.
cols () == 0)
6442 volatile int typ = mattype.
type ();
6447 #if defined (HAVE_CHOLMOD)
6448 cholmod_common Common;
6449 cholmod_common *cm = &Common;
6453 cm->prefer_zomplex =
false;
6455 double spu = octave::sparse_params::get_key (
"spumoni");
6459 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function,
nullptr);
6463 cm->print =
static_cast<int> (spu) + 2;
6464 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
6468 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
6469 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
6471 cm->final_ll =
true;
6473 cholmod_sparse Astore;
6474 cholmod_sparse *
A = &Astore;
6484 #if defined (OCTAVE_ENABLE_64)
6485 A->itype = CHOLMOD_LONG;
6487 A->itype = CHOLMOD_INT;
6489 A->dtype = CHOLMOD_DOUBLE;
6491 A->xtype = CHOLMOD_COMPLEX;
6495 cholmod_sparse Bstore;
6496 cholmod_sparse *
B = &Bstore;
6497 B->nrow = b.
rows ();
6498 B->ncol = b.
cols ();
6501 B->nzmax = b.
nnz ();
6505 #if defined (OCTAVE_ENABLE_64)
6506 B->itype = CHOLMOD_LONG;
6508 B->itype = CHOLMOD_INT;
6510 B->dtype = CHOLMOD_DOUBLE;
6512 B->xtype = CHOLMOD_COMPLEX;
6531 volatile double rcond_plus_one = rcond + 1.0;
6539 sing_handler (rcond);
6548 cholmod_sparse *X =
CHOLMOD_NAME(spsolve) (CHOLMOD_A, L,
B, cm);
6555 j <= static_cast<octave_idx_type> (X->ncol); j++)
6558 j < static_cast<octave_idx_type> (X->nzmax); j++)
6567 static char blank_name[] =
" ";
6571 (*current_liboctave_warning_with_id_handler)
6572 (
"Octave:missing-dependency",
6573 "support for CHOLMOD was unavailable or disabled "
6574 "when liboctave was built");
6583 #if defined (HAVE_UMFPACK)
6585 void *Numeric =
factorize (err, rcond, Control, Info,
6586 sing_handler, calc_cond);
6591 Control (UMFPACK_IRSTEP) = 1;
6611 retval.
xcidx (0) = 0;
6620 reinterpret_cast<const double *
> (Ax),
6622 reinterpret_cast<double *
> (Xx),
6624 reinterpret_cast<double *
> (Bx),
6625 nullptr, Numeric, control, info);
6632 (*current_liboctave_error_handler)
6633 (
"SparseComplexMatrix::solve solve failed");
6648 sz = (
static_cast<double> (b_nc) - j) / b_nc
6650 sz = x_nz + (sz > 100 ? sz : 100);
6654 retval.
xdata (ii) = tmp;
6655 retval.
xridx (ii++) = i;
6658 retval.
xcidx (j+1) = ii;
6663 rcond = Info (UMFPACK_RCOND);
6664 volatile double rcond_plus_one = rcond + 1.0;
6666 if (status == UMFPACK_WARNING_singular_matrix
6672 sing_handler (rcond);
6685 octave_unused_parameter (rcond);
6686 octave_unused_parameter (sing_handler);
6687 octave_unused_parameter (calc_cond);
6689 (*current_liboctave_error_handler)
6690 (
"support for UMFPACK was unavailable or disabled "
6691 "when liboctave was built");
6695 (*current_liboctave_error_handler) (
"incorrect matrix type");
6706 return solve (mattype, b, info, rcond,
nullptr);
6714 return solve (mattype, b, info, rcond,
nullptr);
6721 return solve (mattype, b, info, rcond,
nullptr);
6727 solve_singularity_handler sing_handler,
6728 bool singular_fallback)
const
6731 int typ = mattype.
type (
false);
6734 typ = mattype.
type (*
this);
6737 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6739 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6741 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6743 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6746 retval =
trisolve (mattype, b, err, rcond, sing_handler,
false);
6748 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6750 (*current_liboctave_error_handler) (
"unknown matrix type");
6755 #if defined (USE_QRSOLVE)
6756 retval =
qrsolve (*
this, b, err);
6771 return solve (mattype, b, info, rcond,
nullptr);
6779 return solve (mattype, b, info, rcond,
nullptr);
6786 return solve (mattype, b, info, rcond,
nullptr);
6792 solve_singularity_handler sing_handler,
6793 bool singular_fallback)
const
6796 int typ = mattype.
type (
false);
6799 typ = mattype.
type (*
this);
6802 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6804 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6806 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6808 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6811 retval =
trisolve (mattype, b, err, rcond, sing_handler,
false);
6813 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6815 (*current_liboctave_error_handler) (
"unknown matrix type");
6820 #if defined (USE_QRSOLVE)
6821 retval =
qrsolve (*
this, b, err);
6836 return solve (mattype, b, info, rcond,
nullptr);
6844 return solve (mattype, b, info, rcond,
nullptr);
6851 return solve (mattype, b, info, rcond,
nullptr);
6857 solve_singularity_handler sing_handler,
6858 bool singular_fallback)
const
6861 int typ = mattype.
type (
false);
6864 typ = mattype.
type (*
this);
6867 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6869 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6871 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6873 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6876 retval =
trisolve (mattype, b, err, rcond, sing_handler,
false);
6878 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6880 (*current_liboctave_error_handler) (
"unknown matrix type");
6885 #if defined (USE_QRSOLVE)
6886 retval =
qrsolve (*
this, b, err);
6902 return solve (mattype, b, info, rcond,
nullptr);
6910 return solve (mattype, b, info, rcond,
nullptr);
6917 return solve (mattype, b, info, rcond,
nullptr);
6923 solve_singularity_handler sing_handler,
6924 bool singular_fallback)
const
6927 int typ = mattype.
type (
false);
6930 typ = mattype.
type (*
this);
6933 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6935 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6937 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6939 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6942 retval =
trisolve (mattype, b, err, rcond, sing_handler,
false);
6944 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6946 (*current_liboctave_error_handler) (
"unknown matrix type");
6951 #if defined (USE_QRSOLVE)
6952 retval =
qrsolve (*
this, b, err);
6966 return solve (mattype, b, info, rcond);
6974 return solve (mattype, b, info, rcond);
6981 return solve (mattype, b, info, rcond,
nullptr);
6987 solve_singularity_handler sing_handler)
const
6990 return solve (mattype, tmp, info, rcond,
7000 return solve (mattype, b, info, rcond,
nullptr);
7008 return solve (mattype, b, info, rcond,
nullptr);
7015 return solve (mattype, b, info, rcond,
nullptr);
7021 solve_singularity_handler sing_handler)
const
7024 return solve (mattype, tmp, info, rcond,
7033 return solve (b, info, rcond,
nullptr);
7040 return solve (b, info, rcond,
nullptr);
7045 double& rcond)
const
7047 return solve (b, info, rcond,
nullptr);
7053 solve_singularity_handler sing_handler)
const
7056 return solve (mattype, b, err, rcond, sing_handler);
7064 return solve (b, info, rcond,
nullptr);
7072 return solve (b, info, rcond,
nullptr);
7079 return solve (b, info, rcond,
nullptr);
7085 solve_singularity_handler sing_handler)
const
7088 return solve (mattype, b, err, rcond, sing_handler);
7096 return solve (b, info, rcond,
nullptr);
7103 return solve (b, info, rcond,
nullptr);
7109 solve_singularity_handler sing_handler)
const
7112 return solve (mattype, b, err, rcond, sing_handler);
7120 return solve (b, info, rcond,
nullptr);
7128 return solve (b, info, rcond,
nullptr);
7135 return solve (b, info, rcond,
nullptr);
7141 solve_singularity_handler sing_handler)
const
7144 return solve (mattype, b, err, rcond, sing_handler);
7151 return solve (b, info, rcond);
7158 return solve (b, info, rcond);
7163 double& rcond)
const
7165 return solve (b, info, rcond,
nullptr);
7171 solve_singularity_handler sing_handler)
const
7174 return solve (tmp, info, rcond,
7183 return solve (b, info, rcond,
nullptr);
7191 return solve (b, info, rcond,
nullptr);
7196 double& rcond)
const
7198 return solve (b, info, rcond,
nullptr);
7204 solve_singularity_handler sing_handler)
const
7207 return solve (tmp, info, rcond,
7232 if (jj <
cidx (i+1) &&
ridx (jj) == j)
7329 double r_val = val.real ();
7330 double i_val = val.imag ();
7332 if (r_val > max_val)
7335 if (i_val > max_val)
7338 if (r_val < min_val)
7341 if (i_val < min_val)
7387 if ((
rows () == 1 && dim == -1) || dim == 1)
7392 (
cidx (j+1) -
cidx (j) < nr ? 0.0 : 1.0), 1.0);
7406 Complex d = data (i); \
7407 tmp[ridx (i)] += d * conj (d)
7410 Complex d = data (i); \
7411 tmp[j] += d * conj (d)
7457 os << a.
ridx (i) + 1 <<
' ' << j + 1 <<
' ';
7458 octave::write_value<Complex> (os, a.
data (i));
7471 return read_sparse_matrix<elt_type> (is, a, octave::read_value<Complex>);
7556 return do_mul_dm_sm<SparseComplexMatrix> (
d, a);
7561 return do_mul_sm_dm<SparseComplexMatrix> (a,
d);
7567 return do_mul_dm_sm<SparseComplexMatrix> (
d, a);
7572 return do_mul_sm_dm<SparseComplexMatrix> (a,
d);
7578 return do_mul_dm_sm<SparseComplexMatrix> (
d, a);
7583 return do_mul_sm_dm<SparseComplexMatrix> (a,
d);
7589 return do_add_dm_sm<SparseComplexMatrix> (
d, a);
7594 return do_add_dm_sm<SparseComplexMatrix> (
d, a);
7599 return do_add_dm_sm<SparseComplexMatrix> (
d, a);
7604 return do_add_sm_dm<SparseComplexMatrix> (a,
d);
7609 return do_add_sm_dm<SparseComplexMatrix> (a,
d);
7614 return do_add_sm_dm<SparseComplexMatrix> (a,
d);
7620 return do_sub_dm_sm<SparseComplexMatrix> (
d, a);
7625 return do_sub_dm_sm<SparseComplexMatrix> (
d, a);
7630 return do_sub_dm_sm<SparseComplexMatrix> (
d, a);
7635 return do_sub_sm_dm<SparseComplexMatrix> (a,
d);
7640 return do_sub_sm_dm<SparseComplexMatrix> (a,
d);
7645 return do_sub_sm_dm<SparseComplexMatrix> (a,
d);
7664 #define EMPTY_RETURN_CHECK(T) \
7665 if (nr == 0 || nc == 0) \
7708 if (a_nr == b_nr && a_nc == b_nc)
7718 bool ja_lt_max = ja < ja_max;
7722 bool jb_lt_max = jb < jb_max;
7724 while (ja_lt_max || jb_lt_max)
7727 if ((! jb_lt_max) || (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
7732 r.ridx (jx) = a.
ridx (ja);
7737 ja_lt_max= ja < ja_max;
7739 else if ((! ja_lt_max)
7740 || (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja))))
7745 r.ridx (jx) = b.
ridx (jb);
7750 jb_lt_max= jb < jb_max;
7758 r.ridx (jx) = a.
ridx (ja);
7762 ja_lt_max= ja < ja_max;
7764 jb_lt_max= jb < jb_max;
7770 r.maybe_compress ();
7774 if (a_nr == 0 || a_nc == 0)
7775 r.resize (a_nr, a_nc);
7776 else if (b_nr == 0 || b_nc == 0)
7777 r.resize (b_nr, b_nc);
7825 if (a_nr == b_nr && a_nc == b_nc)
7835 bool ja_lt_max = ja < ja_max;
7839 bool jb_lt_max = jb < jb_max;
7841 while (ja_lt_max || jb_lt_max)
7844 if ((! jb_lt_max) || (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
7849 r.ridx (jx) = a.
ridx (ja);
7854 ja_lt_max= ja < ja_max;
7856 else if ((! ja_lt_max)
7857 || (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja))))
7862 r.ridx (jx) = b.
ridx (jb);
7867 jb_lt_max= jb < jb_max;
7875 r.ridx (jx) = a.
ridx (ja);
7879 ja_lt_max= ja < ja_max;
7881 jb_lt_max= jb < jb_max;
7887 r.maybe_compress ();
7891 if (a_nr == 0 || a_nc == 0)
7892 r.resize (a_nr, a_nc);
7893 else if (b_nr == 0 || b_nc == 0)
7894 r.resize (b_nr, b_nc);
SparseComplexMatrix max(const Complex &c, const SparseComplexMatrix &m)
std::istream & operator>>(std::istream &is, SparseComplexMatrix &a)
std::ostream & operator<<(std::ostream &os, const SparseComplexMatrix &a)
SparseComplexMatrix operator-(const ComplexDiagMatrix &d, const SparseMatrix &a)
SparseComplexMatrix conj(const SparseComplexMatrix &a)
static const Complex Complex_NaN_result(octave::numeric_limits< double >::NaN(), octave::numeric_limits< double >::NaN())
ComplexMatrix mul_trans(const ComplexMatrix &m, const SparseComplexMatrix &a)
SparseComplexMatrix operator*(const SparseComplexMatrix &m, const SparseMatrix &a)
#define EMPTY_RETURN_CHECK(T)
ComplexMatrix mul_herm(const ComplexMatrix &m, const SparseComplexMatrix &a)
SparseComplexMatrix min(const Complex &c, const SparseComplexMatrix &m)
SparseComplexMatrix operator+(const ComplexDiagMatrix &d, const SparseMatrix &a)
ComplexMatrix trans_mul(const SparseComplexMatrix &m, const ComplexMatrix &a)
ComplexMatrix herm_mul(const SparseComplexMatrix &m, const ComplexMatrix &a)
base_det< Complex > ComplexDET
#define SPARSE_SSM_BOOL_OPS(S, M)
#define SPARSE_ANY_OP(DIM)
#define SPARSE_BASE_REDUCTION_OP(RET_TYPE, EL_TYPE, ROW_EXPR, COL_EXPR, INIT_VAL, MT_RESULT)
#define SPARSE_FULL_MUL(RET_TYPE, EL_TYPE)
#define FULL_SPARSE_MUL_TRANS(RET_TYPE, EL_TYPE, CONJ_OP)
#define SPARSE_SSM_CMP_OPS(S, M)
#define SPARSE_SMSM_CMP_OPS(M1, M2)
#define SPARSE_REDUCTION_OP(RET_TYPE, EL_TYPE, OP, INIT_VAL, MT_RESULT)
#define SPARSE_SMS_CMP_OPS(M, S)
#define SPARSE_SPARSE_MUL(RET_TYPE, RET_EL_TYPE, EL_TYPE)
#define SPARSE_CUMSUM(RET_TYPE, ELT_TYPE, FCN)
#define SPARSE_CUMPROD(RET_TYPE, ELT_TYPE, FCN)
#define SPARSE_FULL_TRANS_MUL(RET_TYPE, EL_TYPE, CONJ_OP)
#define FULL_SPARSE_MUL(RET_TYPE, EL_TYPE)
#define SPARSE_SMSM_BOOL_OPS(M1, M2)
#define SPARSE_SMS_BOOL_OPS(M, S)
#define SPARSE_ALL_OP(DIM)
SM octinternal_do_mul_pm_sm(const PermMatrix &p, const SM &a)
SM octinternal_do_mul_sm_pm(const SM &a, const PermMatrix &p)
OCTARRAY_OVERRIDABLE_FUNC_API const T * data(void) const
Size of the specified dimension.
OCTARRAY_API void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type rows(void) const
OCTARRAY_API T * fortran_vec(void)
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API T & elem(octave_idx_type n)
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type cols(void) const
OCTARRAY_OVERRIDABLE_FUNC_API T & xelem(octave_idx_type n)
Size of the specified dimension.
OCTAVE_API Matrix abs(void) const
void resize(octave_idx_type nr, octave_idx_type nc, const Complex &rfv=Complex(0))
OCTAVE_API ComplexColumnVector column(octave_idx_type i) const
octave_idx_type length(void) const
octave_idx_type cols(void) const
MSparse< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
MSparse< T > squeeze(void) const
MSparse< T > ipermute(const Array< octave_idx_type > &vec) const
MSparse< T > reshape(const dim_vector &new_dims) const
MSparse< T > & insert(const Sparse< T > &a, octave_idx_type r, octave_idx_type c)
MSparse< T > diag(octave_idx_type k=0) const
bool ishermitian(void) const
OCTAVE_API MatrixType transpose(void) const
void mark_as_rectangular(void)
bool is_dense(void) const
OCTAVE_API void mark_as_unsymmetric(void)
octave_idx_type * triangular_perm(void) const
OCTAVE_API void info(void) const
OCTAVE_API int type(bool quiet=true)
OCTAVE_API Matrix sum(int dim=-1) const
OCTAVE_API RowVector row(octave_idx_type i) const
OCTAVE_API double max(void) const
OCTAVE_API SparseComplexMatrix min(int dim=-1) const
OCTAVE_API ComplexRowVector row(octave_idx_type i) const
OCTAVE_API bool any_element_is_inf_or_nan(void) const
void * factorize(octave_idx_type &err, double &rcond, Matrix &Control, Matrix &Info, solve_singularity_handler sing_handler, bool calc_cond) const
OCTAVE_API bool any_element_is_nan(void) const
ComplexMatrix dsolve(MatrixType &mattype, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
OCTAVE_API SparseComplexMatrix sumsq(int dim=-1) const
OCTAVE_API SparseComplexMatrix diag(octave_idx_type k=0) const
SparseComplexMatrix dinverse(MatrixType &mattype, octave_idx_type &info, double &rcond, const bool force=false, const bool calccond=true) const
OCTAVE_API ComplexColumnVector column(octave_idx_type i) const
OCTAVE_API SparseBoolMatrix operator!(void) const
OCTAVE_API bool ishermitian(void) const
SparseComplexMatrix transpose(void) const
ComplexMatrix bsolve(MatrixType &mattype, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
SparseComplexMatrix(void)
OCTAVE_API SparseComplexMatrix & insert(const SparseComplexMatrix &a, octave_idx_type r, octave_idx_type c)
OCTAVE_API SparseComplexMatrix max(int dim=-1) const
OCTAVE_API bool all_elements_are_real(void) const
OCTAVE_API SparseComplexMatrix squeeze(void) const
OCTAVE_API bool all_integers(double &max_val, double &min_val) const
ComplexMatrix utsolve(MatrixType &mattype, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
OCTAVE_API SparseComplexMatrix reshape(const dim_vector &new_dims) const
OCTAVE_API SparseComplexMatrix permute(const Array< octave_idx_type > &vec, bool inv=false) const
OCTAVE_API bool operator!=(const SparseComplexMatrix &a) const
ComplexMatrix fsolve(MatrixType &mattype, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
OCTAVE_API SparseComplexMatrix inverse(void) const
OCTAVE_API SparseComplexMatrix hermitian(void) const
SparseComplexMatrix tinverse(MatrixType &mattype, octave_idx_type &info, double &rcond, const bool force=false, const bool calccond=true) const
OCTAVE_API SparseBoolMatrix any(int dim=-1) const
OCTAVE_API SparseComplexMatrix prod(int dim=-1) const
ComplexMatrix ltsolve(MatrixType &mattype, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
friend OCTAVE_API SparseComplexMatrix conj(const SparseComplexMatrix &a)
ComplexMatrix trisolve(MatrixType &mattype, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
OCTAVE_API SparseComplexMatrix sum(int dim=-1) const
OCTAVE_API ComplexDET determinant(void) const
OCTAVE_API SparseMatrix abs(void) const
OCTAVE_API SparseComplexMatrix ipermute(const Array< octave_idx_type > &vec) const
OCTAVE_API bool operator==(const SparseComplexMatrix &a) const
OCTAVE_API SparseComplexMatrix concat(const SparseComplexMatrix &rb, const Array< octave_idx_type > &ra_idx)
OCTAVE_API ComplexMatrix solve(MatrixType &mattype, const Matrix &b) const
OCTAVE_API SparseComplexMatrix cumsum(int dim=-1) const
OCTAVE_API SparseComplexMatrix cumprod(int dim=-1) const
OCTAVE_API bool too_large_for_float(void) const
OCTAVE_API SparseBoolMatrix all(int dim=-1) const
OCTAVE_API ComplexMatrix matrix_value(void) const
octave_idx_type rows(void) const
octave_idx_type * cidx(void)
octave_idx_type columns(void) const
octave_idx_type * ridx(void)
octave_idx_type nnz(void) const
Actual number of nonzero terms.
OCTAVE_API Array< T > array_value(void) const
dim_vector dims(void) const
bool test_any(F fcn) const
Sparse< T, Alloc > maybe_compress(bool remove_zeros=false)
T & elem(octave_idx_type n)
octave_idx_type cols(void) const
void change_capacity(octave_idx_type nz)
octave_idx_type * xcidx(void)
octave_idx_type * xridx(void)
Vector representing the dimensions (size) of an Array.
int first_non_singleton(int def=0) const
octave_idx_type ndims(void) const
Number of dimensions.
ColumnVector real(const ComplexColumnVector &a)
#define F77_DBLE_CMPLX_ARG(x)
#define F77_XFCN(f, F, args)
octave_f77_int_type F77_INT
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
void err_nan_to_logical_conversion(void)
void warn_singular_matrix(double rcond)
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
F77_RET_T const F77_INT F77_CMPLX const F77_INT F77_CMPLX * B
F77_RET_T const F77_INT const F77_INT const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE * Q
F77_RET_T const F77_INT F77_CMPLX * A
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
bool too_large_for_float(double x)
class OCTAVE_API ComplexMatrix
class OCTAVE_API SparseComplexMatrix
bool mx_inline_all_real(std::size_t n, const std::complex< T > *x)
std::complex< double > Complex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
suitesparse_integer * to_suitesparse_intptr(octave_idx_type *i)
#define UMFPACK_ZNAME(name)
#define CHOLMOD_NAME(name)
const octave_base_value const Array< octave_idx_type > & ra_idx
template OCTAVE_API SparseComplexMatrix dmsolve< SparseComplexMatrix, SparseComplexMatrix, SparseMatrix >(const SparseComplexMatrix &, const SparseMatrix &, octave_idx_type &)
template OCTAVE_API ComplexMatrix dmsolve< ComplexMatrix, SparseComplexMatrix, ComplexMatrix >(const SparseComplexMatrix &, const ComplexMatrix &, octave_idx_type &)
template OCTAVE_API ComplexMatrix dmsolve< ComplexMatrix, SparseComplexMatrix, Matrix >(const SparseComplexMatrix &, const Matrix &, octave_idx_type &)
RT dmsolve(const ST &a, const T &b, octave_idx_type &info)
template class OCTAVE_API sparse_lu< SparseComplexMatrix >
Matrix qrsolve(const SparseMatrix &a, const MArray< double > &b, octave_idx_type &info)
void SparseCholError(int status, char *file, int line, char *message)
int SparseCholPrint(const char *fmt,...)