26 #if defined (HAVE_CONFIG_H)
61 #if ! defined (USE_QRSOLVE)
66 :
MSparse<double> (a.rows (), a.cols (), a.nnz ())
110 if (nr != nr_a || nc != nc_a || nz != nz_a)
127 return !(*
this == a);
136 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 ())
223 if (
ridx (i) != idx_j)
234 double tmp =
data (i);
254 result.
xcidx (0) = 0;
257 double tmp =
elem (idx_arg(j), j);
260 result.
xdata (ii) = tmp;
261 result.
xridx (ii++) = 0;
263 result.
xcidx (j+1) = ii;
271 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
281 if (found[
ridx (i)] == -j)
282 found[
ridx (i)] = -j - 1;
285 if (found[i] > -nc && found[i] < 0)
286 idx_arg.
elem (i) = -found[i];
294 double tmp =
data (i);
298 else if (ix == -1 || tmp >
elem (ir, ix))
299 idx_arg.
elem (ir) = j;
305 if (idx_arg.
elem (j) == -1 ||
elem (j, idx_arg.
elem (j)) != 0.)
311 result.
xcidx (0) = 0;
312 result.
xcidx (1) = nel;
315 if (idx_arg(j) == -1)
319 result.
xridx (ii++) = j;
323 double tmp =
elem (j, idx_arg(j));
326 result.
xdata (ii) = tmp;
327 result.
xridx (ii++) = j;
340 return min (dummy_idx, dim);
351 if (dim >= dv.
ndims ())
364 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
374 if (
ridx (i) != idx_j)
385 double tmp =
data (i);
405 result.
xcidx (0) = 0;
408 double tmp =
elem (idx_arg(j), j);
411 result.
xdata (ii) = tmp;
412 result.
xridx (ii++) = 0;
414 result.
xcidx (j+1) = ii;
422 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
432 if (found[
ridx (i)] == -j)
433 found[
ridx (i)] = -j - 1;
436 if (found[i] > -nc && found[i] < 0)
437 idx_arg.
elem (i) = -found[i];
445 double tmp =
data (i);
449 else if (ix == -1 || tmp <
elem (ir, ix))
450 idx_arg.
elem (ir) = j;
456 if (idx_arg.
elem (j) == -1 ||
elem (j, idx_arg.
elem (j)) != 0.)
462 result.
xcidx (0) = 0;
463 result.
xcidx (1) = nel;
466 if (idx_arg(j) == -1)
470 result.
xridx (ii++) = j;
474 double tmp =
elem (j, idx_arg(j));
477 result.
xdata (ii) = tmp;
478 result.
xridx (ii++) = j;
538 if (rb.
rows () > 0 && rb.
cols () > 0)
548 if (rb.
rows () > 0 && rb.
cols () > 0)
562 r.cidx (i) = a.
cidx (i);
567 r.ridx (i) = a.
ridx (i);
570 r.maybe_compress (
true);
583 r.cidx (i) = a.
cidx (i);
588 r.ridx (i) = a.
ridx (i);
591 r.maybe_compress (
true);
608 return inverse (mattype, info, rcond, 0, 0);
616 return inverse (mattype, info, rcond, 0, 0);
623 return inverse (mattype, info, rcond, 0, 0);
628 double& rcond,
const bool,
629 const bool calccond)
const
637 if (nr == 0 || nc == 0 || nr != nc)
638 (*current_liboctave_error_handler) (
"inverse requires square matrix");
641 int typ = mattype.
type ();
645 (*current_liboctave_error_handler) (
"incorrect matrix type");
661 double tmp = fabs (v[i]);
678 double& rcond,
const bool,
679 const bool calccond)
const
687 if (nr == 0 || nc == 0 || nr != nc)
688 (*current_liboctave_error_handler) (
"inverse requires square matrix");
691 int typ = mattype.
type ();
696 (*current_liboctave_error_handler) (
"incorrect matrix type");
699 double ainvnorm = 0.;
708 atmp += fabs (
data (i));
730 retval.change_capacity (nz2);
748 (*current_liboctave_error_handler) (
"division by zero");
753 rpX =
retval.xridx (colXp);
767 while (rpX < j && rpU < j && colXp < cx && colUp < nz);
771 colUp =
cidx (j+1) - 1;
774 double pivot =
data (colUp);
775 if (pivot == 0. ||
ridx (colUp) != j)
776 (*current_liboctave_error_handler) (
"division by zero");
783 retval.change_capacity (nz2);
787 retval.xdata (cx) = v / pivot;
795 colUp =
cidx (i+1) - 1;
798 double pivot =
data (colUp);
799 if (pivot == 0. ||
ridx (colUp) != i)
800 (*current_liboctave_error_handler) (
"division by zero");
804 retval.xdata (j) /= pivot;
851 k <
cidx (jidx+1); k++)
864 (*current_liboctave_error_handler) (
"division by zero");
872 colUp =
cidx (perm[iidx]+1) - 1;
874 colUp =
cidx (perm[iidx]);
876 double pivot =
data (colUp);
878 (*current_liboctave_error_handler) (
"division by zero");
891 nz2 = (2*nz2 < new_cx ? new_cx : 2*nz2);
892 retval.change_capacity (nz2);
900 retval.xdata (cx++) = work[j];
915 i <
retval.cidx (j+1); i++)
921 rcond = 1. / ainvnorm / anorm;
929 double& rcond,
bool,
bool calc_cond)
const
933 (*current_liboctave_error_handler)
934 (
"inverse of the null matrix not defined");
937 int typ = mattype.
type (
false);
941 typ = mattype.
type (*
this);
944 ret =
dinverse (mattype, info, rcond,
true, calc_cond);
958 rcond = fact.
rcond ();
963 SparseMatrix InvL = fact.
L ().transpose ().tinverse (tmp_typ,
964 info, rcond2,
true,
false);
965 ret =
Q * InvL.
transpose () * InvL *
Q.transpose ();
985 rcond = fact.
rcond ();
1000 SparseMatrix InvL = fact.
L ().transpose ().tinverse (tmp_typ,
1001 info, rcond2,
true,
false);
1002 SparseMatrix InvU = fact.
U ().tinverse (tmp_typ, info, rcond2,
1003 true,
false).transpose ();
1031 #if defined (HAVE_UMFPACK)
1036 if (nr == 0 || nc == 0 || nr != nc)
1045 Matrix Control (UMFPACK_CONTROL, 1);
1051 Control (UMFPACK_PRL) = tmp;
1056 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp;
1057 Control (UMFPACK_PIVOT_TOLERANCE) = tmp;
1063 Control (UMFPACK_FIXQ) = tmp;
1066 Control (UMFPACK_SCALE) = UMFPACK_SCALE_NONE;
1072 const double *Ax =
data ();
1080 Matrix Info (1, UMFPACK_INFO);
1085 Ax,
nullptr, &Symbolic, control, info);
1094 (*current_liboctave_error_handler)
1095 (
"SparseMatrix::determinant symbolic factorization failed");
1105 &Numeric, control, info);
1108 rcond = Info (UMFPACK_RCOND);
1116 (*current_liboctave_error_handler)
1117 (
"SparseMatrix::determinant numeric factorization failed");
1125 status =
UMFPACK_DNAME (get_determinant) (&c10, &e10, Numeric,
1133 (*current_liboctave_error_handler)
1134 (
"SparseMatrix::determinant error calculating determinant");
1146 octave_unused_parameter (err);
1147 octave_unused_parameter (rcond);
1149 (*current_liboctave_error_handler)
1150 (
"support for UMFPACK was unavailable or disabled "
1151 "when liboctave was built");
1161 double& rcond, solve_singularity_handler,
1162 bool calc_cond)
const
1171 if (nr != b.
rows ())
1173 (
"matrix dimension mismatch solution of linear equations");
1175 if (nr == 0 || nc == 0 || b.
cols () == 0)
1180 int typ = mattype.
type ();
1184 (*current_liboctave_error_handler) (
"incorrect matrix type");
1203 double tmp = fabs (
data (i));
1209 rcond = dmin / dmax;
1221 solve_singularity_handler,
bool calc_cond)
const
1230 if (nr != b.
rows ())
1232 (
"matrix dimension mismatch solution of linear equations");
1234 if (nr == 0 || nc == 0 || b.
cols () == 0)
1239 int typ = mattype.
type ();
1243 (*current_liboctave_error_handler) (
"incorrect matrix type");
1256 if (b.
ridx (i) >= nm)
1271 for (k = b.
cidx (j); k < b.
cidx (j+1); k++)
1292 double tmp = fabs (
data (i));
1298 rcond = dmin / dmax;
1310 solve_singularity_handler,
bool calc_cond)
const
1319 if (nr != b.
rows ())
1321 (
"matrix dimension mismatch solution of linear equations");
1323 if (nr == 0 || nc == 0 || b.
cols () == 0)
1328 int typ = mattype.
type ();
1332 (*current_liboctave_error_handler) (
"incorrect matrix type");
1351 double tmp = fabs (
data (i));
1357 rcond = dmin / dmax;
1369 solve_singularity_handler,
bool calc_cond)
const
1378 if (nr != b.
rows ())
1380 (
"matrix dimension mismatch solution of linear equations");
1382 if (nr == 0 || nc == 0 || b.
cols () == 0)
1387 int typ = mattype.
type ();
1391 (*current_liboctave_error_handler) (
"incorrect matrix type");
1404 if (b.
ridx (i) >= nm)
1419 for (k = b.
cidx (j); k < b.
cidx (j+1); k++)
1440 double tmp = fabs (
data (i));
1446 rcond = dmin / dmax;
1458 solve_singularity_handler sing_handler,
1459 bool calc_cond)
const
1468 if (nr != b.
rows ())
1470 (
"matrix dimension mismatch solution of linear equations");
1472 if (nr == 0 || nc == 0 || b.
cols () == 0)
1477 int typ = mattype.
type ();
1481 (*current_liboctave_error_handler) (
"incorrect matrix type");
1484 double ainvnorm = 0.;
1495 atmp += fabs (
data (i));
1524 goto triangular_error;
1527 double tmp = work[k] /
data (
cidx (kidx+1)-1);
1530 i <
cidx (kidx+1)-1; i++)
1533 work[iidx] = work[iidx] - tmp *
data (i);
1558 double tmp = work[k] /
data (
cidx (iidx+1)-1);
1561 i <
cidx (iidx+1)-1; i++)
1564 work[idx2] = work[idx2] - tmp *
data (i);
1571 atmp += fabs (work[i]);
1574 if (atmp > ainvnorm)
1577 rcond = 1. / ainvnorm / anorm;
1600 goto triangular_error;
1603 double tmp = work[k] /
data (
cidx (k+1)-1);
1608 work[iidx] = work[iidx] - tmp *
data (i);
1631 double tmp = work[k] /
data (
cidx (k+1)-1);
1636 work[iidx] = work[iidx] - tmp *
data (i);
1643 atmp += fabs (work[i]);
1646 if (atmp > ainvnorm)
1649 rcond = 1. / ainvnorm / anorm;
1658 sing_handler (rcond);
1665 volatile double rcond_plus_one = rcond + 1.0;
1673 sing_handler (rcond);
1687 solve_singularity_handler sing_handler,
1688 bool calc_cond)
const
1697 if (nr != b.
rows ())
1699 (
"matrix dimension mismatch solution of linear equations");
1701 if (nr == 0 || nc == 0 || b.
cols () == 0)
1706 int typ = mattype.
type ();
1710 (*current_liboctave_error_handler) (
"incorrect matrix type");
1713 double ainvnorm = 0.;
1723 atmp += fabs (
data (i));
1762 goto triangular_error;
1765 double tmp = work[k] /
data (
cidx (kidx+1)-1);
1768 i <
cidx (kidx+1)-1; i++)
1771 work[iidx] = work[iidx] - tmp *
data (i);
1783 if (ii + new_nnz > x_nz)
1787 retval.change_capacity (sz);
1792 if (work[rperm[i]] != 0.)
1795 retval.xdata (ii++) = work[rperm[i]];
1800 retval.maybe_compress ();
1818 double tmp = work[k] /
data (
cidx (iidx+1)-1);
1821 i <
cidx (iidx+1)-1; i++)
1824 work[idx2] = work[idx2] - tmp *
data (i);
1831 atmp += fabs (work[i]);
1834 if (atmp > ainvnorm)
1837 rcond = 1. / ainvnorm / anorm;
1859 goto triangular_error;
1862 double tmp = work[k] /
data (
cidx (k+1)-1);
1867 work[iidx] = work[iidx] - tmp *
data (i);
1879 if (ii + new_nnz > x_nz)
1883 retval.change_capacity (sz);
1891 retval.xdata (ii++) = work[i];
1896 retval.maybe_compress ();
1912 double tmp = work[k] /
data (
cidx (k+1)-1);
1915 i <
cidx (k+1)-1; i++)
1918 work[iidx] = work[iidx] - tmp *
data (i);
1925 atmp += fabs (work[i]);
1928 if (atmp > ainvnorm)
1931 rcond = 1. / ainvnorm / anorm;
1940 sing_handler (rcond);
1947 volatile double rcond_plus_one = rcond + 1.0;
1955 sing_handler (rcond);
1968 solve_singularity_handler sing_handler,
1969 bool calc_cond)
const
1978 if (nr != b.
rows ())
1980 (
"matrix dimension mismatch solution of linear equations");
1982 if (nr == 0 || nc == 0 || b.
cols () == 0)
1987 int typ = mattype.
type ();
1991 (*current_liboctave_error_handler) (
"incorrect matrix type");
1994 double ainvnorm = 0.;
2005 atmp += fabs (
data (i));
2034 goto triangular_error;
2040 i <
cidx (kidx+1)-1; i++)
2043 cwork[iidx] = cwork[iidx] - tmp *
data (i);
2069 double tmp = work[k] /
data (
cidx (iidx+1)-1);
2072 i <
cidx (iidx+1)-1; i++)
2075 work[idx2] = work[idx2] - tmp *
data (i);
2082 atmp += fabs (work[i]);
2085 if (atmp > ainvnorm)
2088 rcond = 1. / ainvnorm / anorm;
2111 goto triangular_error;
2119 cwork[iidx] = cwork[iidx] - tmp *
data (i);
2143 double tmp = work[k] /
data (
cidx (k+1)-1);
2146 i <
cidx (k+1)-1; i++)
2149 work[iidx] = work[iidx] - tmp *
data (i);
2156 atmp += fabs (work[i]);
2159 if (atmp > ainvnorm)
2162 rcond = 1. / ainvnorm / anorm;
2171 sing_handler (rcond);
2178 volatile double rcond_plus_one = rcond + 1.0;
2186 sing_handler (rcond);
2200 solve_singularity_handler sing_handler,
2201 bool calc_cond)
const
2210 if (nr != b.
rows ())
2212 (
"matrix dimension mismatch solution of linear equations");
2214 if (nr == 0 || nc == 0 || b.
cols () == 0)
2219 int typ = mattype.
type ();
2223 (*current_liboctave_error_handler) (
"incorrect matrix type");
2226 double ainvnorm = 0.;
2236 atmp += fabs (
data (i));
2275 goto triangular_error;
2281 i <
cidx (kidx+1)-1; i++)
2284 cwork[iidx] = cwork[iidx] - tmp *
data (i);
2296 if (ii + new_nnz > x_nz)
2300 retval.change_capacity (sz);
2305 if (cwork[rperm[i]] != 0.)
2308 retval.xdata (ii++) = cwork[rperm[i]];
2313 retval.maybe_compress ();
2332 double tmp = work[k] /
data (
cidx (iidx+1)-1);
2335 i <
cidx (iidx+1)-1; i++)
2338 work[idx2] = work[idx2] - tmp *
data (i);
2345 atmp += fabs (work[i]);
2348 if (atmp > ainvnorm)
2351 rcond = 1. / ainvnorm / anorm;
2373 goto triangular_error;
2381 cwork[iidx] = cwork[iidx] - tmp *
data (i);
2393 if (ii + new_nnz > x_nz)
2397 retval.change_capacity (sz);
2405 retval.xdata (ii++) = cwork[i];
2410 retval.maybe_compress ();
2427 double tmp = work[k] /
data (
cidx (k+1)-1);
2430 i <
cidx (k+1)-1; i++)
2433 work[iidx] = work[iidx] - tmp *
data (i);
2440 atmp += fabs (work[i]);
2443 if (atmp > ainvnorm)
2446 rcond = 1. / ainvnorm / anorm;
2455 sing_handler (rcond);
2462 volatile double rcond_plus_one = rcond + 1.0;
2470 sing_handler (rcond);
2484 solve_singularity_handler sing_handler,
2485 bool calc_cond)
const
2494 if (nr != b.
rows ())
2496 (
"matrix dimension mismatch solution of linear equations");
2498 if (nr == 0 || nc == 0 || b.
cols () == 0)
2503 int typ = mattype.
type ();
2507 (*current_liboctave_error_handler) (
"incorrect matrix type");
2510 double ainvnorm = 0.;
2521 atmp += fabs (
data (i));
2539 work[perm[i]] = b(i,j);
2549 if (perm[
ridx (i)] < minr)
2551 minr = perm[
ridx (i)];
2555 if (minr != k ||
data (mini) == 0)
2558 goto triangular_error;
2561 double tmp = work[k] /
data (mini);
2569 work[iidx] = work[iidx] - tmp *
data (i);
2596 i <
cidx (k+1); i++)
2597 if (perm[
ridx (i)] < minr)
2599 minr = perm[
ridx (i)];
2603 double tmp = work[k] /
data (mini);
2606 i <
cidx (k+1); i++)
2612 work[iidx] = work[iidx] - tmp *
data (i);
2620 atmp += fabs (work[i]);
2623 if (atmp > ainvnorm)
2626 rcond = 1. / ainvnorm / anorm;
2647 goto triangular_error;
2650 double tmp = work[k] /
data (
cidx (k));
2653 i <
cidx (k+1); i++)
2656 work[iidx] = work[iidx] - tmp *
data (i);
2680 double tmp = work[k] /
data (
cidx (k));
2683 i <
cidx (k+1); i++)
2686 work[iidx] = work[iidx] - tmp *
data (i);
2693 atmp += fabs (work[i]);
2696 if (atmp > ainvnorm)
2699 rcond = 1. / ainvnorm / anorm;
2708 sing_handler (rcond);
2715 volatile double rcond_plus_one = rcond + 1.0;
2723 sing_handler (rcond);
2737 solve_singularity_handler sing_handler,
2738 bool calc_cond)
const
2747 if (nr != b.
rows ())
2749 (
"matrix dimension mismatch solution of linear equations");
2751 if (nr == 0 || nc == 0 || b.
cols () == 0)
2756 int typ = mattype.
type ();
2760 (*current_liboctave_error_handler) (
"incorrect matrix type");
2763 double ainvnorm = 0.;
2773 atmp += fabs (
data (i));
2796 work[perm[b.
ridx (i)]] = b.
data (i);
2806 if (perm[
ridx (i)] < minr)
2808 minr = perm[
ridx (i)];
2812 if (minr != k ||
data (mini) == 0)
2815 goto triangular_error;
2818 double tmp = work[k] /
data (mini);
2826 work[iidx] = work[iidx] - tmp *
data (i);
2838 if (ii + new_nnz > x_nz)
2842 retval.change_capacity (sz);
2850 retval.xdata (ii++) = work[i];
2855 retval.maybe_compress ();
2875 i <
cidx (k+1); i++)
2876 if (perm[
ridx (i)] < minr)
2878 minr = perm[
ridx (i)];
2882 double tmp = work[k] /
data (mini);
2885 i <
cidx (k+1); i++)
2891 work[iidx] = work[iidx] - tmp *
data (i);
2899 atmp += fabs (work[i]);
2902 if (atmp > ainvnorm)
2905 rcond = 1. / ainvnorm / anorm;
2926 goto triangular_error;
2929 double tmp = work[k] /
data (
cidx (k));
2934 work[iidx] = work[iidx] - tmp *
data (i);
2946 if (ii + new_nnz > x_nz)
2950 retval.change_capacity (sz);
2958 retval.xdata (ii++) = work[i];
2963 retval.maybe_compress ();
2980 double tmp = work[k] /
data (
cidx (k));
2983 i <
cidx (k+1); i++)
2986 work[iidx] = work[iidx] - tmp *
data (i);
2993 atmp += fabs (work[i]);
2996 if (atmp > ainvnorm)
2999 rcond = 1. / ainvnorm / anorm;
3008 sing_handler (rcond);
3015 volatile double rcond_plus_one = rcond + 1.0;
3023 sing_handler (rcond);
3037 solve_singularity_handler sing_handler,
3038 bool calc_cond)
const
3047 if (nr != b.
rows ())
3049 (
"matrix dimension mismatch solution of linear equations");
3051 if (nr == 0 || nc == 0 || b.
cols () == 0)
3056 int typ = mattype.
type ();
3060 (*current_liboctave_error_handler) (
"incorrect matrix type");
3063 double ainvnorm = 0.;
3074 atmp += fabs (
data (i));
3091 cwork[perm[i]] = b(i,j);
3101 if (perm[
ridx (i)] < minr)
3103 minr = perm[
ridx (i)];
3107 if (minr != k ||
data (mini) == 0)
3110 goto triangular_error;
3121 cwork[iidx] = cwork[iidx] - tmp *
data (i);
3149 i <
cidx (k+1); i++)
3150 if (perm[
ridx (i)] < minr)
3152 minr = perm[
ridx (i)];
3156 double tmp = work[k] /
data (mini);
3159 i <
cidx (k+1); i++)
3165 work[iidx] = work[iidx] - tmp *
data (i);
3173 atmp += fabs (work[i]);
3176 if (atmp > ainvnorm)
3179 rcond = 1. / ainvnorm / anorm;
3201 goto triangular_error;
3209 cwork[iidx] = cwork[iidx] - tmp *
data (i);
3234 double tmp = work[k] /
data (
cidx (k));
3237 i <
cidx (k+1); i++)
3240 work[iidx] = work[iidx] - tmp *
data (i);
3247 atmp += fabs (work[i]);
3250 if (atmp > ainvnorm)
3253 rcond = 1. / ainvnorm / anorm;
3262 sing_handler (rcond);
3269 volatile double rcond_plus_one = rcond + 1.0;
3277 sing_handler (rcond);
3291 solve_singularity_handler sing_handler,
3292 bool calc_cond)
const
3301 if (nr != b.
rows ())
3303 (
"matrix dimension mismatch solution of linear equations");
3305 if (nr == 0 || nc == 0 || b.
cols () == 0)
3310 int typ = mattype.
type ();
3314 (*current_liboctave_error_handler) (
"incorrect matrix type");
3317 double ainvnorm = 0.;
3327 atmp += fabs (
data (i));
3350 cwork[perm[b.
ridx (i)]] = b.
data (i);
3360 if (perm[
ridx (i)] < minr)
3362 minr = perm[
ridx (i)];
3366 if (minr != k ||
data (mini) == 0)
3369 goto triangular_error;
3380 cwork[iidx] = cwork[iidx] - tmp *
data (i);
3392 if (ii + new_nnz > x_nz)
3396 retval.change_capacity (sz);
3404 retval.xdata (ii++) = cwork[i];
3409 retval.maybe_compress ();
3430 i <
cidx (k+1); i++)
3431 if (perm[
ridx (i)] < minr)
3433 minr = perm[
ridx (i)];
3437 double tmp = work[k] /
data (mini);
3440 i <
cidx (k+1); i++)
3446 work[iidx] = work[iidx] - tmp *
data (i);
3454 atmp += fabs (work[i]);
3457 if (atmp > ainvnorm)
3460 rcond = 1. / ainvnorm / anorm;
3481 goto triangular_error;
3489 cwork[iidx] = cwork[iidx] - tmp *
data (i);
3501 if (ii + new_nnz > x_nz)
3505 retval.change_capacity (sz);
3513 retval.xdata (ii++) = cwork[i];
3518 retval.maybe_compress ();
3536 double tmp = work[k] /
data (
cidx (k));
3539 i <
cidx (k+1); i++)
3542 work[iidx] = work[iidx] - tmp *
data (i);
3549 atmp += fabs (work[i]);
3552 if (atmp > ainvnorm)
3555 rcond = 1. / ainvnorm / anorm;
3564 sing_handler (rcond);
3571 volatile double rcond_plus_one = rcond + 1.0;
3579 sing_handler (rcond);
3593 solve_singularity_handler sing_handler,
3594 bool calc_cond)
const
3602 if (nr != nc || nr != b.
rows ())
3603 (*current_liboctave_error_handler)
3604 (
"matrix dimension mismatch solution of linear equations");
3606 if (nr == 0 || b.
cols () == 0)
3609 (*current_liboctave_error_handler)
3610 (
"calculation of condition number not implemented");
3614 volatile int typ = mattype.
type ();
3632 D[nc-1] =
data (ii);
3648 else if (
ridx (i) == j + 1)
3653 F77_INT tmp_nr = octave::to_f77_int (nr);
3663 F77_XFCN (dptsv, DPTSV, (tmp_nr, b_nc, D, DL, result,
3691 DL[j] =
data (ii++);
3692 DU[j] =
data (ii++);
3694 D[nc-1] =
data (ii);
3711 else if (
ridx (i) == j + 1)
3713 else if (
ridx (i) == j - 1)
3718 F77_INT tmp_nr = octave::to_f77_int (nr);
3728 F77_XFCN (dgtsv, DGTSV, (tmp_nr, b_nc, DL, D, DU, result,
3740 sing_handler (rcond);
3750 (*current_liboctave_error_handler) (
"incorrect matrix type");
3759 solve_singularity_handler sing_handler,
3760 bool calc_cond)
const
3768 if (nr != nc || nr != b.
rows ())
3769 (*current_liboctave_error_handler)
3770 (
"matrix dimension mismatch solution of linear equations");
3772 if (nr == 0 || b.
cols () == 0)
3775 (*current_liboctave_error_handler)
3776 (
"calculation of condition number not implemented");
3780 int typ = mattype.
type ();
3801 DL[j] =
data (ii++);
3802 DU[j] =
data (ii++);
3804 D[nc-1] =
data (ii);
3821 else if (
ridx (i) == j + 1)
3823 else if (
ridx (i) == j - 1)
3828 F77_INT tmp_nr = octave::to_f77_int (nr);
3832 F77_XFCN (dgttrf, DGTTRF, (tmp_nr, DL, D, DU, DU2, pipvt, tmp_err));
3841 sing_handler (rcond);
3869 (F77_CONST_CHAR_ARG2 (&job, 1),
3870 tmp_nr, 1, DL, D, DU, DU2, pipvt,
3872 F77_CHAR_ARG_LEN (1)));
3883 if (ii + new_nnz > x_nz)
3887 retval.change_capacity (sz);
3895 retval.xdata (ii++) = work[i];
3900 retval.maybe_compress ();
3904 (*current_liboctave_error_handler) (
"incorrect matrix type");
3913 solve_singularity_handler sing_handler,
3914 bool calc_cond)
const
3922 if (nr != nc || nr != b.
rows ())
3923 (*current_liboctave_error_handler)
3924 (
"matrix dimension mismatch solution of linear equations");
3926 if (nr == 0 || b.
cols () == 0)
3929 (*current_liboctave_error_handler)
3930 (
"calculation of condition number not implemented");
3934 volatile int typ = mattype.
type ();
3952 D[nc-1] =
data (ii);
3968 else if (
ridx (i) == j + 1)
3973 F77_INT tmp_nr = octave::to_f77_int (nr);
4012 DL[j] =
data (ii++);
4013 DU[j] =
data (ii++);
4015 D[nc-1] =
data (ii);
4032 else if (
ridx (i) == j + 1)
4034 else if (
ridx (i) == j - 1)
4039 F77_INT tmp_nr = octave::to_f77_int (nr);
4066 sing_handler (rcond);
4074 (*current_liboctave_error_handler) (
"incorrect matrix type");
4083 solve_singularity_handler sing_handler,
4084 bool calc_cond)
const
4092 if (nr != nc || nr != b.
rows ())
4093 (*current_liboctave_error_handler)
4094 (
"matrix dimension mismatch solution of linear equations");
4096 if (nr == 0 || b.
cols () == 0)
4099 (*current_liboctave_error_handler)
4100 (
"calculation of condition number not implemented");
4104 int typ = mattype.
type ();
4125 DL[j] =
data (ii++);
4126 DU[j] =
data (ii++);
4128 D[nc-1] =
data (ii);
4145 else if (
ridx (i) == j + 1)
4147 else if (
ridx (i) == j - 1)
4152 F77_INT tmp_nr = octave::to_f77_int (nr);
4156 F77_XFCN (dgttrf, DGTTRF, (tmp_nr, DL, D, DU, DU2, pipvt, tmp_err));
4167 sing_handler (rcond);
4192 for (
F77_INT i = 0; i < b_nr; i++)
4200 (F77_CONST_CHAR_ARG2 (&job, 1),
4201 tmp_nr, 1, DL, D, DU, DU2, pipvt,
4203 F77_CHAR_ARG_LEN (1)));
4210 (*current_liboctave_error_handler)
4211 (
"SparseMatrix::solve solve failed");
4218 (F77_CONST_CHAR_ARG2 (&job, 1),
4219 tmp_nr, 1, DL, D, DU, DU2, pipvt,
4221 F77_CHAR_ARG_LEN (1)));
4228 (*current_liboctave_error_handler)
4229 (
"SparseMatrix::solve solve failed");
4239 if (Bx[i] != 0. || Bz[i] != 0.)
4242 if (ii + new_nnz > x_nz)
4246 retval.change_capacity (sz);
4251 if (Bx[i] != 0. || Bz[i] != 0.)
4260 retval.maybe_compress ();
4264 (*current_liboctave_error_handler) (
"incorrect matrix type");
4273 solve_singularity_handler sing_handler,
4274 bool calc_cond)
const
4282 if (nr != nc || nr != b.
rows ())
4283 (*current_liboctave_error_handler)
4284 (
"matrix dimension mismatch solution of linear equations");
4286 if (nr == 0 || b.
cols () == 0)
4291 volatile int typ = mattype.
type ();
4307 tmp_data[ii++] = 0.;
4315 m_band(ri - j, j) =
data (i);
4323 F77_INT tmp_nr = octave::to_f77_int (nr);
4328 F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
4329 tmp_nr, n_lower, tmp_data, ldm, tmp_err
4330 F77_CHAR_ARG_LEN (1)));
4353 (F77_CONST_CHAR_ARG2 (&job, 1),
4354 tmp_nr, n_lower, tmp_data, ldm,
4355 anorm, rcond, pz, piz, tmp_err
4356 F77_CHAR_ARG_LEN (1)));
4363 volatile double rcond_plus_one = rcond + 1.0;
4371 sing_handler (rcond);
4390 (F77_CONST_CHAR_ARG2 (&job, 1),
4391 tmp_nr, n_lower, b_nc, tmp_data,
4392 ldm, result, b_nr, tmp_err
4393 F77_CHAR_ARG_LEN (1)));
4400 (*current_liboctave_error_handler)
4401 (
"SparseMatrix::solve solve failed");
4413 F77_INT ldm = n_upper + 2 * n_lower + 1;
4422 for (
F77_INT j = 0; j < ldm; j++)
4424 tmp_data[ii++] = 0.;
4429 m_band(
ridx (i) - j + n_lower + n_upper, j) =
data (i);
4439 atmp += fabs (
data (i));
4445 F77_INT tmp_nr = octave::to_f77_int (nr);
4452 F77_XFCN (dgbtrf, DGBTRF, (tmp_nr, tmp_nr, n_lower, n_upper,
4453 tmp_data, ldm, pipvt, tmp_err));
4466 sing_handler (rcond);
4482 F77_INT tmp_nc = octave::to_f77_int (nc);
4485 (F77_CONST_CHAR_ARG2 (&job, 1),
4486 tmp_nc, n_lower, n_upper, tmp_data, ldm, pipvt,
4487 anorm, rcond, pz, piz, tmp_err
4488 F77_CHAR_ARG_LEN (1)));
4495 volatile double rcond_plus_one = rcond + 1.0;
4503 sing_handler (rcond);
4523 (F77_CONST_CHAR_ARG2 (&job, 1),
4524 tmp_nr, n_lower, n_upper, b_nc, tmp_data,
4525 ldm, pipvt, result, b_nr, tmp_err
4526 F77_CHAR_ARG_LEN (1)));
4533 (*current_liboctave_error_handler) (
"incorrect matrix type");
4542 solve_singularity_handler sing_handler,
4543 bool calc_cond)
const
4551 if (nr != nc || nr != b.
rows ())
4552 (*current_liboctave_error_handler)
4553 (
"matrix dimension mismatch solution of linear equations");
4555 if (nr == 0 || b.
cols () == 0)
4560 volatile int typ = mattype.
type ();
4566 F77_INT ldm = octave::to_f77_int (n_lower + 1);
4575 for (
F77_INT j = 0; j < ldm; j++)
4577 tmp_data[ii++] = 0.;
4585 m_band(ri - j, j) =
data (i);
4593 F77_INT tmp_nr = octave::to_f77_int (nr);
4598 F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
4599 tmp_nr, n_lower, tmp_data, ldm, tmp_err
4600 F77_CHAR_ARG_LEN (1)));
4621 (F77_CONST_CHAR_ARG2 (&job, 1),
4622 tmp_nr, n_lower, tmp_data, ldm,
4623 anorm, rcond, pz, piz, tmp_err
4624 F77_CHAR_ARG_LEN (1)));
4631 volatile double rcond_plus_one = rcond + 1.0;
4639 sing_handler (rcond);
4664 for (
F77_INT i = 0; i < b_nr; i++)
4665 Bx[i] = b.
elem (i, j);
4668 (F77_CONST_CHAR_ARG2 (&job, 1),
4669 tmp_nr, n_lower, 1, tmp_data,
4670 ldm, Bx, b_nr, tmp_err
4671 F77_CHAR_ARG_LEN (1)));
4678 (*current_liboctave_error_handler)
4679 (
"SparseMatrix::solve solve failed");
4684 for (
F77_INT i = 0; i < b_nr; i++)
4693 sz = (
static_cast<double> (b_nc) - j) / b_nc
4695 sz = x_nz + (sz > 100 ? sz : 100);
4696 retval.change_capacity (sz);
4706 retval.maybe_compress ();
4716 F77_INT ldm = octave::to_f77_int (n_upper + 2 * n_lower + 1);
4727 tmp_data[ii++] = 0.;
4732 m_band(
ridx (i) - j + n_lower + n_upper, j) =
data (i);
4743 atmp += fabs (
data (i));
4749 F77_INT tmp_nr = octave::to_f77_int (nr);
4756 F77_XFCN (dgbtrf, DGBTRF, (tmp_nr, tmp_nr, n_lower, n_upper,
4757 tmp_data, ldm, pipvt, tmp_err));
4768 sing_handler (rcond);
4784 F77_INT tmp_nc = octave::to_f77_int (nc);
4787 (F77_CONST_CHAR_ARG2 (&job, 1),
4788 tmp_nc, n_lower, n_upper, tmp_data, ldm, pipvt,
4789 anorm, rcond, pz, piz, tmp_err
4790 F77_CHAR_ARG_LEN (1)));
4797 volatile double rcond_plus_one = rcond + 1.0;
4805 sing_handler (rcond);
4831 i < b.
cidx (j+1); i++)
4837 (F77_CONST_CHAR_ARG2 (&job, 1),
4838 tmp_nr, n_lower, n_upper, 1, tmp_data,
4839 ldm, pipvt, work, b_nr, tmp_err
4840 F77_CHAR_ARG_LEN (1)));
4851 if (ii + new_nnz > x_nz)
4855 retval.change_capacity (sz);
4863 retval.xdata (ii++) = work[i];
4868 retval.maybe_compress ();
4873 (*current_liboctave_error_handler) (
"incorrect matrix type");
4882 solve_singularity_handler sing_handler,
4883 bool calc_cond)
const
4891 if (nr != nc || nr != b.
rows ())
4892 (*current_liboctave_error_handler)
4893 (
"matrix dimension mismatch solution of linear equations");
4895 if (nr == 0 || b.
cols () == 0)
4900 volatile int typ = mattype.
type ();
4915 for (
F77_INT j = 0; j < ldm; j++)
4917 tmp_data[ii++] = 0.;
4925 m_band(ri - j, j) =
data (i);
4933 F77_INT tmp_nr = octave::to_f77_int (nr);
4938 F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
4939 tmp_nr, n_lower, tmp_data, ldm, tmp_err
4940 F77_CHAR_ARG_LEN (1)));
4963 (F77_CONST_CHAR_ARG2 (&job, 1),
4964 tmp_nr, n_lower, tmp_data, ldm,
4965 anorm, rcond, pz, piz, tmp_err
4966 F77_CHAR_ARG_LEN (1)));
4973 volatile double rcond_plus_one = rcond + 1.0;
4981 sing_handler (rcond);
5003 for (
F77_INT i = 0; i < b_nr; i++)
5011 (F77_CONST_CHAR_ARG2 (&job, 1),
5012 tmp_nr, n_lower, 1, tmp_data,
5013 ldm, Bx, b_nr, tmp_err
5014 F77_CHAR_ARG_LEN (1)));
5021 (*current_liboctave_error_handler)
5022 (
"SparseMatrix::solve solve failed");
5028 (F77_CONST_CHAR_ARG2 (&job, 1),
5029 tmp_nr, n_lower, 1, tmp_data,
5030 ldm, Bz, b_nr, tmp_err
5031 F77_CHAR_ARG_LEN (1)));
5038 (*current_liboctave_error_handler)
5039 (
"SparseMatrix::solve solve failed");
5056 F77_INT ldm = n_upper + 2 * n_lower + 1;
5065 for (
F77_INT j = 0; j < ldm; j++)
5067 tmp_data[ii++] = 0.;
5072 m_band(
ridx (i) - j + n_lower + n_upper, j) =
data (i);
5083 atmp += fabs (
data (i));
5089 F77_INT tmp_nr = octave::to_f77_int (nr);
5096 F77_XFCN (dgbtrf, DGBTRF, (tmp_nr, tmp_nr, n_lower, n_upper,
5097 tmp_data, ldm, pipvt, tmp_err));
5108 sing_handler (rcond);
5124 F77_INT tmp_nc = octave::to_f77_int (nc);
5127 (F77_CONST_CHAR_ARG2 (&job, 1),
5128 tmp_nc, n_lower, n_upper, tmp_data, ldm, pipvt,
5129 anorm, rcond, pz, piz, tmp_err
5130 F77_CHAR_ARG_LEN (1)));
5137 volatile double rcond_plus_one = rcond + 1.0;
5145 sing_handler (rcond);
5175 (F77_CONST_CHAR_ARG2 (&job, 1),
5176 tmp_nr, n_lower, n_upper, 1, tmp_data,
5177 ldm, pipvt, Bx, b_nr, tmp_err
5178 F77_CHAR_ARG_LEN (1)));
5183 (F77_CONST_CHAR_ARG2 (&job, 1),
5184 tmp_nr, n_lower, n_upper, 1, tmp_data,
5185 ldm, pipvt, Bz, b_nr, tmp_err
5186 F77_CHAR_ARG_LEN (1)));
5197 (*current_liboctave_error_handler) (
"incorrect matrix type");
5206 solve_singularity_handler sing_handler,
5207 bool calc_cond)
const
5215 if (nr != nc || nr != b.
rows ())
5216 (*current_liboctave_error_handler)
5217 (
"matrix dimension mismatch solution of linear equations");
5219 if (nr == 0 || b.
cols () == 0)
5224 volatile int typ = mattype.
type ();
5239 for (
F77_INT j = 0; j < ldm; j++)
5241 tmp_data[ii++] = 0.;
5249 m_band(ri - j, j) =
data (i);
5257 F77_INT tmp_nr = octave::to_f77_int (nr);
5262 F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
5263 tmp_nr, n_lower, tmp_data, ldm, tmp_err
5264 F77_CHAR_ARG_LEN (1)));
5288 (F77_CONST_CHAR_ARG2 (&job, 1),
5289 tmp_nr, n_lower, tmp_data, ldm,
5290 anorm, rcond, pz, piz, tmp_err
5291 F77_CHAR_ARG_LEN (1)));
5298 volatile double rcond_plus_one = rcond + 1.0;
5306 sing_handler (rcond);
5333 for (
F77_INT i = 0; i < b_nr; i++)
5341 (F77_CONST_CHAR_ARG2 (&job, 1),
5342 tmp_nr, n_lower, 1, tmp_data,
5343 ldm, Bx, b_nr, tmp_err
5344 F77_CHAR_ARG_LEN (1)));
5351 (*current_liboctave_error_handler)
5352 (
"SparseMatrix::solve solve failed");
5358 (F77_CONST_CHAR_ARG2 (&job, 1),
5359 tmp_nr, n_lower, 1, tmp_data,
5360 ldm, Bz, b_nr, tmp_err
5361 F77_CHAR_ARG_LEN (1)));
5368 (*current_liboctave_error_handler)
5369 (
"SparseMatrix::solve solve failed");
5379 if (Bx[i] != 0. || Bz[i] != 0.)
5382 if (ii + new_nnz > x_nz)
5386 retval.change_capacity (sz);
5391 if (Bx[i] != 0. || Bz[i] != 0.)
5400 retval.maybe_compress ();
5410 F77_INT ldm = n_upper + 2 * n_lower + 1;
5419 for (
F77_INT j = 0; j < ldm; j++)
5421 tmp_data[ii++] = 0.;
5426 m_band(
ridx (i) - j + n_lower + n_upper, j) =
data (i);
5437 atmp += fabs (
data (i));
5443 F77_INT tmp_nr = octave::to_f77_int (nr);
5450 F77_XFCN (dgbtrf, DGBTRF, (tmp_nr, tmp_nr, n_lower, n_upper,
5451 tmp_data, ldm, pipvt, tmp_err));
5462 sing_handler (rcond);
5478 F77_INT tmp_nc = octave::to_f77_int (nc);
5481 (F77_CONST_CHAR_ARG2 (&job, 1),
5482 tmp_nc, n_lower, n_upper, tmp_data, ldm, pipvt,
5483 anorm, rcond, pz, piz, tmp_err
5484 F77_CHAR_ARG_LEN (1)));
5491 volatile double rcond_plus_one = rcond + 1.0;
5499 sing_handler (rcond);
5530 i < b.
cidx (j+1); i++)
5533 Bx[b.
ridx (i)] = c.real ();
5534 Bz[b.
ridx (i)] = c.imag ();
5538 (F77_CONST_CHAR_ARG2 (&job, 1),
5539 tmp_nr, n_lower, n_upper, 1, tmp_data,
5540 ldm, pipvt, Bx, b_nr, tmp_err
5541 F77_CHAR_ARG_LEN (1)));
5546 (F77_CONST_CHAR_ARG2 (&job, 1),
5547 tmp_nr, n_lower, n_upper, 1, tmp_data,
5548 ldm, pipvt, Bz, b_nr, tmp_err
5549 F77_CHAR_ARG_LEN (1)));
5557 if (Bx[i] != 0. || Bz[i] != 0.)
5560 if (ii + new_nnz > x_nz)
5564 retval.change_capacity (sz);
5569 if (Bx[i] != 0. || Bz[i] != 0.)
5577 retval.maybe_compress ();
5582 (*current_liboctave_error_handler) (
"incorrect matrix type");
5590 Matrix& Info, solve_singularity_handler sing_handler,
5591 bool calc_cond)
const
5594 void *Numeric =
nullptr;
5597 #if defined (HAVE_UMFPACK)
5600 Control =
Matrix (UMFPACK_CONTROL, 1);
5606 Control (UMFPACK_PRL) = tmp;
5610 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp;
5611 Control (UMFPACK_PIVOT_TOLERANCE) = tmp;
5617 Control (UMFPACK_FIXQ) = tmp;
5623 const double *Ax =
data ();
5633 Info =
Matrix (1, UMFPACK_INFO);
5638 Ax,
nullptr, &Symbolic, control, info);
5648 (*current_liboctave_error_handler)
5649 (
"SparseMatrix::solve symbolic factorization failed");
5658 Ax, Symbolic, &Numeric, control, info);
5662 rcond = Info (UMFPACK_RCOND);
5665 volatile double rcond_plus_one = rcond + 1.0;
5667 if (status == UMFPACK_WARNING_singular_matrix
5675 sing_handler (rcond);
5679 else if (status < 0)
5685 (*current_liboctave_error_handler)
5686 (
"SparseMatrix::solve numeric factorization failed");
5701 octave_unused_parameter (rcond);
5702 octave_unused_parameter (Control);
5703 octave_unused_parameter (Info);
5704 octave_unused_parameter (sing_handler);
5705 octave_unused_parameter (calc_cond);
5707 (*current_liboctave_error_handler)
5708 (
"support for UMFPACK was unavailable or disabled "
5709 "when liboctave was built");
5719 solve_singularity_handler sing_handler,
5720 bool calc_cond)
const
5728 if (nr != nc || nr != b.
rows ())
5729 (*current_liboctave_error_handler)
5730 (
"matrix dimension mismatch solution of linear equations");
5732 if (nr == 0 || b.
cols () == 0)
5737 volatile int typ = mattype.
type ();
5742 #if defined (HAVE_CHOLMOD)
5743 cholmod_common Common;
5744 cholmod_common *cm = &Common;
5748 cm->prefer_zomplex =
false;
5754 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function,
nullptr);
5758 cm->print =
static_cast<int> (spu) + 2;
5759 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
5763 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
5764 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
5766 cm->final_ll =
true;
5768 cholmod_sparse Astore;
5769 cholmod_sparse *
A = &Astore;
5779 #if defined (OCTAVE_ENABLE_64)
5780 A->itype = CHOLMOD_LONG;
5782 A->itype = CHOLMOD_INT;
5784 A->dtype = CHOLMOD_DOUBLE;
5786 A->xtype = CHOLMOD_REAL;
5790 cholmod_dense Bstore;
5791 cholmod_dense *
B = &Bstore;
5792 B->nrow = b.
rows ();
5793 B->ncol = b.
cols ();
5795 B->nzmax =
B->nrow *
B->ncol;
5796 B->dtype = CHOLMOD_DOUBLE;
5797 B->xtype = CHOLMOD_REAL;
5820 volatile double rcond_plus_one = rcond + 1.0;
5828 sing_handler (rcond);
5847 retval.
xelem (i,j) =
static_cast<double *
>(X->x)[jr + i];
5854 static char blank_name[] =
" ";
5859 (*current_liboctave_warning_with_id_handler)
5860 (
"Octave:missing-dependency",
5861 "support for CHOLMOD was unavailable or disabled "
5862 "when liboctave was built");
5871 #if defined (HAVE_UMFPACK)
5874 =
factorize (err, rcond, Control, Info, sing_handler, calc_cond);
5879 Control (UMFPACK_IRSTEP) = 1;
5890 const double *Ax =
data ();
5897 Ax, &result[iidx], &Bx[iidx],
5898 Numeric, control, info);
5904 (*current_liboctave_error_handler)
5905 (
"SparseMatrix::solve solve failed");
5920 octave_unused_parameter (rcond);
5921 octave_unused_parameter (sing_handler);
5922 octave_unused_parameter (calc_cond);
5924 (*current_liboctave_error_handler)
5925 (
"support for UMFPACK was unavailable or disabled "
5926 "when liboctave was built");
5930 (*current_liboctave_error_handler) (
"incorrect matrix type");
5939 solve_singularity_handler sing_handler,
5940 bool calc_cond)
const
5948 if (nr != nc || nr != b.
rows ())
5949 (*current_liboctave_error_handler)
5950 (
"matrix dimension mismatch solution of linear equations");
5952 if (nr == 0 || b.
cols () == 0)
5957 volatile int typ = mattype.
type ();
5962 #if defined (HAVE_CHOLMOD)
5963 cholmod_common Common;
5964 cholmod_common *cm = &Common;
5968 cm->prefer_zomplex =
false;
5974 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function,
nullptr);
5978 cm->print =
static_cast<int> (spu) + 2;
5979 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
5983 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
5984 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
5986 cm->final_ll =
true;
5988 cholmod_sparse Astore;
5989 cholmod_sparse *
A = &Astore;
5999 #if defined (OCTAVE_ENABLE_64)
6000 A->itype = CHOLMOD_LONG;
6002 A->itype = CHOLMOD_INT;
6004 A->dtype = CHOLMOD_DOUBLE;
6006 A->xtype = CHOLMOD_REAL;
6010 cholmod_sparse Bstore;
6011 cholmod_sparse *
B = &Bstore;
6012 B->nrow = b.
rows ();
6013 B->ncol = b.
cols ();
6016 B->nzmax = b.
nnz ();
6020 #if defined (OCTAVE_ENABLE_64)
6021 B->itype = CHOLMOD_LONG;
6023 B->itype = CHOLMOD_INT;
6025 B->dtype = CHOLMOD_DOUBLE;
6027 B->xtype = CHOLMOD_REAL;
6049 volatile double rcond_plus_one = rcond + 1.0;
6057 sing_handler (rcond);
6075 j <= static_cast<octave_idx_type> (X->ncol); j++)
6078 j < static_cast<octave_idx_type> (X->nzmax); j++)
6081 retval.xdata (j) =
static_cast<double *
>(X->x)[j];
6088 static char blank_name[] =
" ";
6093 (*current_liboctave_warning_with_id_handler)
6094 (
"Octave:missing-dependency",
6095 "support for CHOLMOD was unavailable or disabled "
6096 "when liboctave was built");
6105 #if defined (HAVE_UMFPACK)
6107 void *Numeric =
factorize (err, rcond, Control, Info,
6108 sing_handler, calc_cond);
6113 Control (UMFPACK_IRSTEP) = 1;
6121 const double *Ax =
data ();
6137 Bx[i] = b.
elem (i, j);
6142 Ax, Xx, Bx, Numeric,
6149 (*current_liboctave_error_handler)
6150 (
"SparseMatrix::solve solve failed");
6165 sz = (
static_cast<double> (b_nc) - j) / b_nc
6167 sz = x_nz + (sz > 100 ? sz : 100);
6168 retval.change_capacity (sz);
6178 retval.maybe_compress ();
6188 octave_unused_parameter (rcond);
6189 octave_unused_parameter (sing_handler);
6190 octave_unused_parameter (calc_cond);
6192 (*current_liboctave_error_handler)
6193 (
"support for UMFPACK was unavailable or disabled "
6194 "when liboctave was built");
6198 (*current_liboctave_error_handler) (
"incorrect matrix type");
6207 solve_singularity_handler sing_handler,
6208 bool calc_cond)
const
6216 if (nr != nc || nr != b.
rows ())
6217 (*current_liboctave_error_handler)
6218 (
"matrix dimension mismatch solution of linear equations");
6220 if (nr == 0 || b.
cols () == 0)
6225 volatile int typ = mattype.
type ();
6230 #if defined (HAVE_CHOLMOD)
6231 cholmod_common Common;
6232 cholmod_common *cm = &Common;
6236 cm->prefer_zomplex =
false;
6242 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function,
nullptr);
6246 cm->print =
static_cast<int> (spu) + 2;
6247 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
6251 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
6252 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
6254 cm->final_ll =
true;
6256 cholmod_sparse Astore;
6257 cholmod_sparse *
A = &Astore;
6267 #if defined (OCTAVE_ENABLE_64)
6268 A->itype = CHOLMOD_LONG;
6270 A->itype = CHOLMOD_INT;
6272 A->dtype = CHOLMOD_DOUBLE;
6274 A->xtype = CHOLMOD_REAL;
6278 cholmod_dense Bstore;
6279 cholmod_dense *
B = &Bstore;
6280 B->nrow = b.
rows ();
6281 B->ncol = b.
cols ();
6283 B->nzmax =
B->nrow *
B->ncol;
6284 B->dtype = CHOLMOD_DOUBLE;
6285 B->xtype = CHOLMOD_COMPLEX;
6307 volatile double rcond_plus_one = rcond + 1.0;
6315 sing_handler (rcond);
6341 static char blank_name[] =
" ";
6346 (*current_liboctave_warning_with_id_handler)
6347 (
"Octave:missing-dependency",
6348 "support for CHOLMOD was unavailable or disabled "
6349 "when liboctave was built");
6358 #if defined (HAVE_UMFPACK)
6360 void *Numeric =
factorize (err, rcond, Control, Info,
6361 sing_handler, calc_cond);
6366 Control (UMFPACK_IRSTEP) = 1;
6374 const double *Ax =
data ();
6396 Ax, Xx, Bx, Numeric,
6402 Numeric, control, info);
6404 if (status < 0 || status2 < 0)
6409 (*current_liboctave_error_handler)
6410 (
"SparseMatrix::solve solve failed");
6428 octave_unused_parameter (rcond);
6429 octave_unused_parameter (sing_handler);
6430 octave_unused_parameter (calc_cond);
6432 (*current_liboctave_error_handler)
6433 (
"support for UMFPACK was unavailable or disabled "
6434 "when liboctave was built");
6438 (*current_liboctave_error_handler) (
"incorrect matrix type");
6447 solve_singularity_handler sing_handler,
6448 bool calc_cond)
const
6456 if (nr != nc || nr != b.
rows ())
6457 (*current_liboctave_error_handler)
6458 (
"matrix dimension mismatch solution of linear equations");
6460 if (nr == 0 || b.
cols () == 0)
6465 volatile int typ = mattype.
type ();
6470 #if defined (HAVE_CHOLMOD)
6471 cholmod_common Common;
6472 cholmod_common *cm = &Common;
6476 cm->prefer_zomplex =
false;
6482 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function,
nullptr);
6486 cm->print =
static_cast<int> (spu) + 2;
6487 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
6491 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
6492 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
6494 cm->final_ll =
true;
6496 cholmod_sparse Astore;
6497 cholmod_sparse *
A = &Astore;
6507 #if defined (OCTAVE_ENABLE_64)
6508 A->itype = CHOLMOD_LONG;
6510 A->itype = CHOLMOD_INT;
6512 A->dtype = CHOLMOD_DOUBLE;
6514 A->xtype = CHOLMOD_REAL;
6518 cholmod_sparse Bstore;
6519 cholmod_sparse *
B = &Bstore;
6520 B->nrow = b.
rows ();
6521 B->ncol = b.
cols ();
6524 B->nzmax = b.
nnz ();
6528 #if defined (OCTAVE_ENABLE_64)
6529 B->itype = CHOLMOD_LONG;
6531 B->itype = CHOLMOD_INT;
6533 B->dtype = CHOLMOD_DOUBLE;
6535 B->xtype = CHOLMOD_COMPLEX;
6557 volatile double rcond_plus_one = rcond + 1.0;
6565 sing_handler (rcond);
6584 j <= static_cast<octave_idx_type> (X->ncol); j++)
6587 j < static_cast<octave_idx_type> (X->nzmax); j++)
6597 static char blank_name[] =
" ";
6602 (*current_liboctave_warning_with_id_handler)
6603 (
"Octave:missing-dependency",
6604 "support for CHOLMOD was unavailable or disabled "
6605 "when liboctave was built");
6614 #if defined (HAVE_UMFPACK)
6616 void *Numeric =
factorize (err, rcond, Control, Info,
6617 sing_handler, calc_cond);
6622 Control (UMFPACK_IRSTEP) = 1;
6630 const double *Ax =
data ();
6657 Ax, Xx, Bx, Numeric,
6663 Numeric, control, info);
6665 if (status < 0 || status2 < 0)
6670 (*current_liboctave_error_handler)
6671 (
"SparseMatrix::solve solve failed");
6686 sz = (
static_cast<double> (b_nc) - j) / b_nc
6688 sz = x_nz + (sz > 100 ? sz : 100);
6689 retval.change_capacity (sz);
6699 retval.maybe_compress ();
6708 octave_unused_parameter (rcond);
6709 octave_unused_parameter (sing_handler);
6710 octave_unused_parameter (calc_cond);
6712 (*current_liboctave_error_handler)
6713 (
"support for UMFPACK was unavailable or disabled "
6714 "when liboctave was built");
6718 (*current_liboctave_error_handler) (
"incorrect matrix type");
6729 return solve (mattype, b, info, rcond,
nullptr);
6737 return solve (mattype, b, info, rcond,
nullptr);
6744 return solve (mattype, b, info, rcond,
nullptr);
6749 double& rcond, solve_singularity_handler sing_handler,
6750 bool singular_fallback)
const
6753 int typ = mattype.
type (
false);
6756 typ = mattype.
type (*
this);
6760 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6762 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6764 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6766 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6771 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6773 (*current_liboctave_error_handler) (
"unknown matrix type");
6779 #if defined (USE_QRSOLVE)
6794 return solve (mattype, b, info, rcond,
nullptr);
6802 return solve (mattype, b, info, rcond,
nullptr);
6809 return solve (mattype, b, info, rcond,
nullptr);
6815 solve_singularity_handler sing_handler,
6816 bool singular_fallback)
const
6819 int typ = mattype.
type (
false);
6822 typ = mattype.
type (*
this);
6825 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6827 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6829 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6831 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6836 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6838 (*current_liboctave_error_handler) (
"unknown matrix type");
6843 #if defined (USE_QRSOLVE)
6859 return solve (mattype, b, info, rcond,
nullptr);
6867 return solve (mattype, b, info, rcond,
nullptr);
6874 return solve (mattype, b, info, rcond,
nullptr);
6880 solve_singularity_handler sing_handler,
6881 bool singular_fallback)
const
6884 int typ = mattype.
type (
false);
6887 typ = mattype.
type (*
this);
6890 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6892 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6894 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6896 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6901 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6903 (*current_liboctave_error_handler) (
"unknown matrix type");
6908 #if defined (USE_QRSOLVE)
6924 return solve (mattype, b, info, rcond,
nullptr);
6932 return solve (mattype, b, info, rcond,
nullptr);
6939 return solve (mattype, b, info, rcond,
nullptr);
6945 solve_singularity_handler sing_handler,
6946 bool singular_fallback)
const
6949 int typ = mattype.
type (
false);
6952 typ = mattype.
type (*
this);
6955 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6957 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6959 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6961 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6966 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6968 (*current_liboctave_error_handler) (
"unknown matrix type");
6973 #if defined (USE_QRSOLVE)
6988 return solve (mattype, b, info, rcond);
6996 return solve (mattype, b, info, rcond);
7003 return solve (mattype, b, info, rcond,
nullptr);
7009 solve_singularity_handler sing_handler)
const
7012 return solve (mattype, tmp, info, rcond,
7021 return solve (mattype, b, info, rcond,
nullptr);
7029 return solve (mattype, b, info, rcond,
nullptr);
7035 double& rcond)
const
7037 return solve (mattype, b, info, rcond,
nullptr);
7043 solve_singularity_handler sing_handler)
const
7046 return solve (mattype, tmp, info, rcond,
7055 return solve (b, info, rcond,
nullptr);
7062 return solve (b, info, rcond,
nullptr);
7067 double& rcond)
const
7069 return solve (b, info, rcond,
nullptr);
7074 solve_singularity_handler sing_handler)
const
7077 return solve (mattype, b, err, rcond, sing_handler);
7085 return solve (b, info, rcond,
nullptr);
7093 return solve (b, info, rcond,
nullptr);
7100 return solve (b, info, rcond,
nullptr);
7105 solve_singularity_handler sing_handler)
const
7108 return solve (mattype, b, err, rcond, sing_handler);
7115 return solve (b, info, rcond,
nullptr);
7120 double& rcond)
const
7122 return solve (b, info, rcond,
nullptr);
7128 solve_singularity_handler sing_handler)
const
7131 return solve (mattype, b, err, rcond, sing_handler);
7139 return solve (b, info, rcond,
nullptr);
7146 return solve (b, info, rcond,
nullptr);
7151 double& rcond)
const
7153 return solve (b, info, rcond,
nullptr);
7159 solve_singularity_handler sing_handler)
const
7162 return solve (mattype, b, err, rcond, sing_handler);
7169 return solve (b, info, rcond);
7176 return solve (b, info, rcond);
7181 double& rcond)
const
7183 return solve (b, info, rcond,
nullptr);
7189 solve_singularity_handler sing_handler)
const
7192 return solve (tmp, info, rcond,
7201 return solve (b, info, rcond,
nullptr);
7208 return solve (b, info, rcond,
nullptr);
7213 double& rcond)
const
7215 return solve (b, info, rcond,
nullptr);
7221 solve_singularity_handler sing_handler)
const
7224 return solve (tmp, info, rcond,
7258 double val =
data (i);
7273 double val =
data (i);
7288 double val =
data (i);
7289 if (val != 0.0 && val != 1.0)
7315 double val =
data (i);
7341 double val =
data (i);
7382 if (jj <
cidx (i+1) &&
ridx (jj) == j)
7425 if ((
rows () == 1 && dim == -1) || dim == 1)
7430 (
cidx (j+1) -
cidx (j) < nr ? 0.0 : 1.0), 1.0);
7444 double d = data (i); \
7445 tmp[ridx (i)] += d * d
7448 double d = data (i); \
7495 os << a.
ridx (i) + 1 <<
' ' << j + 1 <<
' ';
7509 return read_sparse_matrix<elt_type> (is, a, octave_read_value<double>);
7573 return do_mul_dm_sm<SparseMatrix> (
d, a);
7579 return do_mul_sm_dm<SparseMatrix> (a,
d);
7585 return do_add_dm_sm<SparseMatrix> (
d, a);
7591 return do_sub_dm_sm<SparseMatrix> (
d, a);
7597 return do_add_sm_dm<SparseMatrix> (a,
d);
7603 return do_sub_sm_dm<SparseMatrix> (a,
d);
7622 #define EMPTY_RETURN_CHECK(T) \
7623 if (nr == 0 || nc == 0) \
7647 result.
xdata (idx) = tmp;
7648 result.
xridx (idx) =
m.ridx (i);
7663 result.
xcidx (0) = 0;
7672 result.
xdata (ii) = tmp;
7673 result.
xridx (ii++) =
m.ridx (i);
7676 result.
xcidx (j+1) = ii;
7699 if (a_nr == b_nr && a_nc == b_nc)
7709 bool ja_lt_max = ja < ja_max;
7713 bool jb_lt_max = jb < jb_max;
7715 while (ja_lt_max || jb_lt_max)
7718 if ((! jb_lt_max) || (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
7723 r.ridx (jx) = a.
ridx (ja);
7728 ja_lt_max= ja < ja_max;
7730 else if ((! ja_lt_max)
7731 || (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja))))
7736 r.ridx (jx) = b.
ridx (jb);
7741 jb_lt_max= jb < jb_max;
7749 r.ridx (jx) = a.
ridx (ja);
7753 ja_lt_max= ja < ja_max;
7755 jb_lt_max= jb < jb_max;
7761 r.maybe_compress ();
7765 if (a_nr == 0 || a_nc == 0)
7766 r.resize (a_nr, a_nc);
7767 else if (b_nr == 0 || b_nc == 0)
7768 r.resize (b_nr, b_nc);
7798 result.
xdata (idx) = tmp;
7799 result.
xridx (idx) =
m.ridx (i);
7814 result.
xcidx (0) = 0;
7822 result.
xdata (ii) = tmp;
7823 result.
xridx (ii++) =
m.ridx (i);
7826 result.
xcidx (j+1) = ii;
7849 if (a_nr == b_nr && a_nc == b_nc)
7859 bool ja_lt_max = ja < ja_max;
7863 bool jb_lt_max = jb < jb_max;
7865 while (ja_lt_max || jb_lt_max)
7868 if ((! jb_lt_max) || (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
7873 r.ridx (jx) = a.
ridx (ja);
7878 ja_lt_max= ja < ja_max;
7880 else if ((! ja_lt_max)
7881 || (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja))))
7886 r.ridx (jx) = b.
ridx (jb);
7891 jb_lt_max= jb < jb_max;
7899 r.ridx (jx) = a.
ridx (ja);
7903 ja_lt_max= ja < ja_max;
7905 jb_lt_max= jb < jb_max;
7911 r.maybe_compress ();
7915 if (a_nr == 0 || a_nc == 0)
7916 r.resize (a_nr, a_nc);
7917 else if (b_nr == 0 || b_nc == 0)
7918 r.resize (b_nr, b_nc);
#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)
Array< T > & insert(const Array< T > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
T & xelem(octave_idx_type n)
Size of the specified dimension.
T & elem(octave_idx_type n)
Size of the specified dimension.
const T * data(void) const
Size of the specified dimension.
octave_idx_type cols(void) const
octave_idx_type rows(void) const
const T * fortran_vec(void) const
Size of the specified dimension.
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
MatrixType transpose(void) const
void mark_as_rectangular(void)
bool is_dense(void) const
void mark_as_unsymmetric(void)
octave_idx_type * triangular_perm(void) const
int type(bool quiet=true)
Matrix sum(int dim=-1) const
RowVector row(octave_idx_type i) const
ColumnVector column(octave_idx_type i) const
bool issymmetric(void) const
SparseMatrix dinverse(MatrixType &mattype, octave_idx_type &info, double &rcond, const bool force=false, const bool calccond=true) const
SparseMatrix & insert(const SparseMatrix &a, octave_idx_type r, octave_idx_type c)
bool any_element_is_inf_or_nan(void) const
Matrix ltsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
SparseMatrix reshape(const dim_vector &new_dims) const
SparseMatrix sum(int dim=-1) const
SparseBoolMatrix any(int dim=-1) const
Matrix utsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
Matrix fsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
bool all_integers(double &max_val, double &min_val) const
bool operator==(const SparseMatrix &a) const
SparseMatrix abs(void) const
bool operator!=(const SparseMatrix &a) const
RowVector row(octave_idx_type i) const
SparseMatrix cumprod(int dim=-1) const
SparseMatrix diag(octave_idx_type k=0) const
SparseMatrix prod(int dim=-1) const
SparseBoolMatrix all(int dim=-1) const
Matrix matrix_value(void) const
SparseMatrix min(int dim=-1) const
bool any_element_is_nan(void) const
SparseMatrix permute(const Array< octave_idx_type > &vec, bool inv=false) const
SparseMatrix cumsum(int dim=-1) const
Matrix trisolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
ColumnVector column(octave_idx_type i) const
SparseMatrix transpose(void) const
SparseMatrix inverse(void) const
SparseMatrix concat(const SparseMatrix &rb, const Array< octave_idx_type > &ra_idx)
bool too_large_for_float(void) const
SparseMatrix ipermute(const Array< octave_idx_type > &vec) const
bool any_element_not_one_or_zero(void) const
DET determinant(void) const
bool all_elements_are_zero(void) const
SparseMatrix tinverse(MatrixType &mattype, octave_idx_type &info, double &rcond, const bool force=false, const bool calccond=true) const
SparseMatrix sumsq(int dim=-1) const
SparseMatrix squeeze(void) const
Matrix solve(MatrixType &typ, const Matrix &b) const
Matrix bsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
bool all_elements_are_int_or_inf_or_nan(void) const
Matrix dsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
SparseBoolMatrix operator!(void) const
SparseMatrix max(int dim=-1) const
bool any_element_is_negative(bool=false) const
void * factorize(octave_idx_type &err, double &rcond, Matrix &Control, Matrix &Info, solve_singularity_handler sing_handler, bool calc_cond=false) const
Array< T > array_value(void) const
octave_idx_type cols(void) const
octave_idx_type * xridx(void)
bool test_any(F fcn) const
octave_idx_type * cidx(void)
octave_idx_type nnz(void) const
Actual number of nonzero terms.
octave_idx_type rows(void) const
octave_idx_type columns(void) const
dim_vector dims(void) const
octave_idx_type * xcidx(void)
T & elem(octave_idx_type n)
octave_idx_type * ridx(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.
SparseMatrix Q(void) const
SparseMatrix Pr(void) const
SparseMatrix Pc(void) const
static double get_key(const std::string &key)
Matrix trans_mul(const SparseMatrix &m, const Matrix &a)
SparseMatrix real(const SparseComplexMatrix &a)
#define EMPTY_RETURN_CHECK(T)
SparseMatrix min(double d, const SparseMatrix &m)
Matrix mul_trans(const Matrix &m, const SparseMatrix &a)
SparseMatrix operator-(const DiagMatrix &d, const SparseMatrix &a)
SparseMatrix max(double d, const SparseMatrix &m)
std::istream & operator>>(std::istream &is, SparseMatrix &a)
SparseMatrix operator*(const SparseMatrix &m, const SparseMatrix &a)
SparseMatrix imag(const SparseComplexMatrix &a)
SparseMatrix operator+(const DiagMatrix &d, const SparseMatrix &a)
std::ostream & operator<<(std::ostream &os, const SparseMatrix &a)
#define F77_DBLE_CMPLX_ARG(x)
#define F77_XFCN(f, F, args)
octave_f77_int_type F77_INT
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
#define lo_ieee_signbit(x)
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 xtoo_large_for_float(double x)
void octave_write_double(std::ostream &os, double d)
Matrix qrsolve(const SparseMatrix &a, const MArray< double > &b, octave_idx_type &info)
void err_nan_to_logical_conversion(void)
void warn_singular_matrix(double rcond)
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
suitesparse_integer * to_suitesparse_intptr(octave_idx_type *i)
std::complex< double > Complex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
#define CHOLMOD_NAME(name)
#define UMFPACK_DNAME(name)
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_value::octave_value(const Array< char > &chm, char type) return retval
#define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE
#define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE
template SparseMatrix dmsolve< SparseMatrix, SparseMatrix, SparseMatrix >(const SparseMatrix &, const SparseMatrix &, octave_idx_type &)
template Matrix dmsolve< Matrix, SparseMatrix, Matrix >(const SparseMatrix &, const Matrix &, octave_idx_type &)
template ComplexMatrix dmsolve< ComplexMatrix, SparseMatrix, ComplexMatrix >(const SparseMatrix &, const ComplexMatrix &, octave_idx_type &)
template SparseComplexMatrix dmsolve< SparseComplexMatrix, SparseMatrix, SparseComplexMatrix >(const SparseMatrix &, const SparseComplexMatrix &, octave_idx_type &)
void SparseCholError(int status, char *file, int line, char *message)
int SparseCholPrint(const char *fmt,...)