25 #if defined (HAVE_CONFIG_H)
64 #if ! defined (USE_QRSOLVE)
113 if (nr != nr_a || nc != nc_a || nz != nz_a)
130 return !(*
this ==
a);
139 if (nr == nc && nr > 0)
192 return max (dummy_idx, dim);
203 if (dim >= dv.
ndims ())
216 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
226 if (
ridx (
i) != idx_j)
257 result.
xcidx (0) = 0;
260 double tmp =
elem (idx_arg(j), j);
264 result.
xridx (ii++) = 0;
266 result.
xcidx (j+1) = ii;
274 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
301 else if (ix == -1 || tmp >
elem (ir, ix))
302 idx_arg.
elem (ir) = j;
308 if (idx_arg.
elem (j) == -1 ||
elem (j, idx_arg.
elem (j)) != 0.)
314 result.
xcidx (0) = 0;
315 result.
xcidx (1) = nel;
318 if (idx_arg(j) == -1)
322 result.
xridx (ii++) = j;
326 double tmp =
elem (j, idx_arg(j));
330 result.
xridx (ii++) = j;
343 return min (dummy_idx, dim);
354 if (dim >= dv.
ndims ())
367 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
377 if (
ridx (
i) != idx_j)
408 result.
xcidx (0) = 0;
411 double tmp =
elem (idx_arg(j), j);
415 result.
xridx (ii++) = 0;
417 result.
xcidx (j+1) = ii;
425 if (nr == 0 || nc == 0 || dim >= dv.
ndims ())
452 else if (ix == -1 || tmp <
elem (ir, ix))
453 idx_arg.
elem (ir) = j;
459 if (idx_arg.
elem (j) == -1 ||
elem (j, idx_arg.
elem (j)) != 0.)
465 result.
xcidx (0) = 0;
466 result.
xcidx (1) = nel;
469 if (idx_arg(j) == -1)
473 result.
xridx (ii++) = j;
477 double tmp =
elem (j, idx_arg(j));
481 result.
xridx (ii++) = j;
541 if (rb.
rows () > 0 && rb.
cols () > 0)
551 if (rb.
rows () > 0 && rb.
cols () > 0)
637 retval.
xcidx (0) = 0;
672 (*current_liboctave_error_handler) (
"matrix size mismatch");
680 if (x_nr != y_nr || x_nc != y_nc)
693 bool ja_lt_max = ja < ja_max;
697 bool jb_lt_max = jb < jb_max;
699 while (ja_lt_max || jb_lt_max)
703 || (ja_lt_max && (x.
ridx (ja) < y.
ridx (jb))))
709 ja_lt_max= ja < ja_max;
711 else if ((! ja_lt_max)
712 || (jb_lt_max && (y.
ridx (jb) < x.
ridx (ja))))
715 jb_lt_max= jb < jb_max;
727 ja_lt_max= ja < ja_max;
729 jb_lt_max= jb < jb_max;
746 return inverse (mattype, info, rcond, 0, 0);
754 return inverse (mattype, info, rcond, 0, 0);
761 return inverse (mattype, info, rcond, 0, 0);
766 double& rcond,
const bool,
767 const bool calccond)
const
775 if (nr == 0 || nc == 0 || nr != nc)
776 (*current_liboctave_error_handler) (
"inverse requires square matrix");
779 int typ = mattyp.
type ();
783 (*current_liboctave_error_handler) (
"incorrect matrix type");
791 double *v = retval.
data ();
799 double tmp = fabs (v[
i]);
816 double& rcond,
const bool,
817 const bool calccond)
const
825 if (nr == 0 || nc == 0 || nr != nc)
826 (*current_liboctave_error_handler) (
"inverse requires square matrix");
829 int typ = mattyp.
type ();
834 (*current_liboctave_error_handler) (
"incorrect matrix type");
837 double ainvnorm = 0.;
846 atmp += fabs (
data (
i));
873 retval.
xdata (cx) = 1.0;
886 (*current_liboctave_error_handler) (
"division by zero");
891 rpX = retval.
xridx (colXp);
900 v -= retval.
xdata (colXp) *
data (colUp);
905 while (rpX < j && rpU < j && colXp < cx && colUp < nz);
909 colUp =
cidx (j+1) - 1;
912 double pivot =
data (colUp);
913 if (pivot == 0. ||
ridx (colUp) != j)
914 (*current_liboctave_error_handler) (
"division by zero");
924 retval.
xridx (cx) = j;
925 retval.
xdata (cx) = v / pivot;
933 colUp =
cidx (
i+1) - 1;
936 double pivot =
data (colUp);
937 if (pivot == 0. ||
ridx (colUp) !=
i)
938 (*current_liboctave_error_handler) (
"division by zero");
942 retval.
xdata (j) /= pivot;
944 retval.
xcidx (nr) = cx;
998 pivot =
data (cidx (jidx+1) - 1);
1000 pivot =
data (cidx (jidx));
1002 (*current_liboctave_error_handler) (
"division by zero");
1004 work[j] = v / pivot;
1010 colUp =
cidx (perm[iidx]+1) - 1;
1012 colUp =
cidx (perm[iidx]);
1014 double pivot =
data (colUp);
1016 (*current_liboctave_error_handler) (
"division by zero");
1029 nz2 = (2*nz2 < new_cx ? new_cx : 2*nz2);
1037 retval.
xridx (cx) = j;
1038 retval.
xdata (cx++) = work[j];
1042 retval.
xcidx (nr) = cx;
1053 i < retval.
cidx (j+1);
i++)
1054 atmp += fabs (retval.
data (
i));
1055 if (atmp > ainvnorm)
1059 rcond = 1. / ainvnorm / anorm;
1067 double& rcond,
bool,
bool calc_cond)
const
1069 int typ = mattype.
type (
false);
1073 typ = mattype.
type (*
this);
1076 ret =
dinverse (mattype, info, rcond,
true, calc_cond);
1090 rcond = fact.
rcond ();
1096 info, rcond2,
true,
false);
1117 rcond = fact.
rcond ();
1120 info, rcond2,
true,
false);
1150 #if defined (HAVE_UMFPACK)
1155 if (nr == 0 || nc == 0 || nr != nc)
1164 Matrix Control (UMFPACK_CONTROL, 1);
1170 Control (UMFPACK_PRL) =
tmp;
1175 Control (UMFPACK_SYM_PIVOT_TOLERANCE) =
tmp;
1176 Control (UMFPACK_PIVOT_TOLERANCE) =
tmp;
1182 Control (UMFPACK_FIXQ) =
tmp;
1185 Control (UMFPACK_SCALE) = UMFPACK_SCALE_NONE;
1191 const double *Ax =
data ();
1193 UMFPACK_DNAME (report_matrix) (nr, nc, Ap, Ai, Ax, 1, control);
1196 Matrix Info (1, UMFPACK_INFO);
1199 Ax, 0, &Symbolic, control, info);
1208 (*current_liboctave_error_handler)
1209 (
"SparseMatrix::determinant symbolic factorization failed");
1217 &Numeric, control, info);
1220 rcond = Info (UMFPACK_RCOND);
1228 (*current_liboctave_error_handler)
1229 (
"SparseMatrix::determinant numeric factorization failed");
1237 status =
UMFPACK_DNAME (get_determinant) (&c10, &e10, Numeric,
1245 (*current_liboctave_error_handler)
1246 (
"SparseMatrix::determinant error calculating determinant");
1249 retval =
DET (c10, e10, 10);
1258 octave_unused_parameter (err);
1259 octave_unused_parameter (rcond);
1261 (*current_liboctave_error_handler)
1262 (
"support for UMFPACK was unavailable or disabled "
1263 "when liboctave was built");
1273 double& rcond, solve_singularity_handler,
1274 bool calc_cond)
const
1283 if (nr != b.
rows ())
1285 (
"matrix dimension mismatch solution of linear equations");
1287 if (nr == 0 || nc == 0 || b.
cols () == 0)
1292 int typ = mattype.
type ();
1296 (*current_liboctave_error_handler) (
"incorrect matrix type");
1321 rcond = dmin / dmax;
1333 solve_singularity_handler,
bool calc_cond)
const
1342 if (nr != b.
rows ())
1344 (
"matrix dimension mismatch solution of linear equations");
1346 if (nr == 0 || nc == 0 || b.
cols () == 0)
1351 int typ = mattype.
type ();
1355 (*current_liboctave_error_handler) (
"incorrect matrix type");
1361 retval.
xcidx (0) = 0;
1373 retval.
xcidx (j+1) = ii;
1383 for (k = b.
cidx (j); k < b.
cidx (j+1); k++)
1391 retval.
xridx (ii) = l;
1395 retval.
xcidx (j+1) = ii;
1410 rcond = dmin / dmax;
1422 solve_singularity_handler,
bool calc_cond)
const
1431 if (nr != b.
rows ())
1433 (
"matrix dimension mismatch solution of linear equations");
1435 if (nr == 0 || nc == 0 || b.
cols () == 0)
1440 int typ = mattype.
type ();
1444 (*current_liboctave_error_handler) (
"incorrect matrix type");
1469 rcond = dmin / dmax;
1481 solve_singularity_handler,
bool calc_cond)
const
1490 if (nr != b.
rows ())
1492 (
"matrix dimension mismatch solution of linear equations");
1494 if (nr == 0 || nc == 0 || b.
cols () == 0)
1499 int typ = mattype.
type ();
1503 (*current_liboctave_error_handler) (
"incorrect matrix type");
1509 retval.
xcidx (0) = 0;
1521 retval.
xcidx (j+1) = ii;
1531 for (k = b.
cidx (j); k < b.
cidx (j+1); k++)
1539 retval.
xridx (ii) = l;
1543 retval.
xcidx (j+1) = ii;
1558 rcond = dmin / dmax;
1570 solve_singularity_handler sing_handler,
1571 bool calc_cond)
const
1580 if (nr != b.
rows ())
1582 (
"matrix dimension mismatch solution of linear equations");
1584 if (nr == 0 || nc == 0 || b.
cols () == 0)
1589 int typ = mattype.
type ();
1593 (*current_liboctave_error_handler) (
"incorrect matrix type");
1596 double ainvnorm = 0.;
1607 atmp += fabs (
data (
i));
1615 retval.
resize (nc, b_nc);
1636 goto triangular_error;
1642 i <
cidx (kidx+1)-1;
i++)
1645 work[iidx] = work[iidx] - tmp *
data (
i);
1651 retval.
xelem (perm[
i], j) = work[
i];
1673 i <
cidx (iidx+1)-1;
i++)
1676 work[idx2] = work[idx2] - tmp *
data (
i);
1683 atmp += fabs (work[
i]);
1686 if (atmp > ainvnorm)
1689 rcond = 1. / ainvnorm / anorm;
1695 retval.
resize (nc, b_nc);
1712 goto triangular_error;
1720 work[iidx] = work[iidx] - tmp *
data (
i);
1726 retval.
xelem (
i, j) = work[
i];
1748 work[iidx] = work[iidx] - tmp *
data (
i);
1755 atmp += fabs (work[
i]);
1758 if (atmp > ainvnorm)
1761 rcond = 1. / ainvnorm / anorm;
1770 sing_handler (rcond);
1777 volatile double rcond_plus_one = rcond + 1.0;
1785 sing_handler (rcond);
1799 solve_singularity_handler sing_handler,
1800 bool calc_cond)
const
1809 if (nr != b.
rows ())
1811 (
"matrix dimension mismatch solution of linear equations");
1813 if (nr == 0 || nc == 0 || b.
cols () == 0)
1818 int typ = mattype.
type ();
1822 (*current_liboctave_error_handler) (
"incorrect matrix type");
1825 double ainvnorm = 0.;
1835 atmp += fabs (
data (
i));
1844 retval.
xcidx (0) = 0;
1874 goto triangular_error;
1880 i <
cidx (kidx+1)-1;
i++)
1883 work[iidx] = work[iidx] - tmp *
data (
i);
1895 if (ii + new_nnz > x_nz)
1904 if (work[rperm[
i]] != 0.)
1907 retval.
xdata (ii++) = work[rperm[
i]];
1909 retval.
xcidx (j+1) = ii;
1933 i <
cidx (iidx+1)-1;
i++)
1936 work[idx2] = work[idx2] - tmp *
data (
i);
1943 atmp += fabs (work[
i]);
1946 if (atmp > ainvnorm)
1949 rcond = 1. / ainvnorm / anorm;
1971 goto triangular_error;
1979 work[iidx] = work[iidx] - tmp *
data (
i);
1991 if (ii + new_nnz > x_nz)
2003 retval.
xdata (ii++) = work[
i];
2005 retval.
xcidx (j+1) = ii;
2030 work[iidx] = work[iidx] - tmp *
data (
i);
2037 atmp += fabs (work[
i]);
2040 if (atmp > ainvnorm)
2043 rcond = 1. / ainvnorm / anorm;
2052 sing_handler (rcond);
2059 volatile double rcond_plus_one = rcond + 1.0;
2067 sing_handler (rcond);
2080 solve_singularity_handler sing_handler,
2081 bool calc_cond)
const
2090 if (nr != b.
rows ())
2092 (
"matrix dimension mismatch solution of linear equations");
2094 if (nr == 0 || nc == 0 || b.
cols () == 0)
2099 int typ = mattype.
type ();
2103 (*current_liboctave_error_handler) (
"incorrect matrix type");
2106 double ainvnorm = 0.;
2117 atmp += fabs (
data (
i));
2125 retval.
resize (nc, b_nc);
2146 goto triangular_error;
2152 i <
cidx (kidx+1)-1;
i++)
2155 cwork[iidx] = cwork[iidx] - tmp *
data (
i);
2161 retval.
xelem (perm[
i], j) = cwork[
i];
2184 i <
cidx (iidx+1)-1;
i++)
2187 work[idx2] = work[idx2] - tmp *
data (
i);
2194 atmp += fabs (work[
i]);
2197 if (atmp > ainvnorm)
2200 rcond = 1. / ainvnorm / anorm;
2206 retval.
resize (nc, b_nc);
2223 goto triangular_error;
2231 cwork[iidx] = cwork[iidx] - tmp *
data (
i);
2237 retval.
xelem (
i, j) = cwork[
i];
2261 work[iidx] = work[iidx] - tmp *
data (
i);
2268 atmp += fabs (work[
i]);
2271 if (atmp > ainvnorm)
2274 rcond = 1. / ainvnorm / anorm;
2283 sing_handler (rcond);
2290 volatile double rcond_plus_one = rcond + 1.0;
2298 sing_handler (rcond);
2312 solve_singularity_handler sing_handler,
2313 bool calc_cond)
const
2322 if (nr != b.
rows ())
2324 (
"matrix dimension mismatch solution of linear equations");
2326 if (nr == 0 || nc == 0 || b.
cols () == 0)
2331 int typ = mattype.
type ();
2335 (*current_liboctave_error_handler) (
"incorrect matrix type");
2338 double ainvnorm = 0.;
2348 atmp += fabs (
data (
i));
2357 retval.
xcidx (0) = 0;
2387 goto triangular_error;
2393 i <
cidx (kidx+1)-1;
i++)
2396 cwork[iidx] = cwork[iidx] - tmp *
data (
i);
2408 if (ii + new_nnz > x_nz)
2417 if (cwork[rperm[
i]] != 0.)
2420 retval.
xdata (ii++) = cwork[rperm[
i]];
2422 retval.
xcidx (j+1) = ii;
2447 i <
cidx (iidx+1)-1;
i++)
2450 work[idx2] = work[idx2] - tmp *
data (
i);
2457 atmp += fabs (work[
i]);
2460 if (atmp > ainvnorm)
2463 rcond = 1. / ainvnorm / anorm;
2485 goto triangular_error;
2493 cwork[iidx] = cwork[iidx] - tmp *
data (
i);
2505 if (ii + new_nnz > x_nz)
2517 retval.
xdata (ii++) = cwork[
i];
2519 retval.
xcidx (j+1) = ii;
2545 work[iidx] = work[iidx] - tmp *
data (
i);
2552 atmp += fabs (work[
i]);
2555 if (atmp > ainvnorm)
2558 rcond = 1. / ainvnorm / anorm;
2567 sing_handler (rcond);
2574 volatile double rcond_plus_one = rcond + 1.0;
2582 sing_handler (rcond);
2596 solve_singularity_handler sing_handler,
2597 bool calc_cond)
const
2606 if (nr != b.
rows ())
2608 (
"matrix dimension mismatch solution of linear equations");
2610 if (nr == 0 || nc == 0 || b.
cols () == 0)
2615 int typ = mattype.
type ();
2619 (*current_liboctave_error_handler) (
"incorrect matrix type");
2622 double ainvnorm = 0.;
2633 atmp += fabs (
data (
i));
2641 retval.
resize (nc, b_nc);
2651 work[perm[
i]] =
b(
i,j);
2661 if (perm[
ridx (
i)] < minr)
2663 minr = perm[
ridx (
i)];
2667 if (minr !=
k ||
data (mini) == 0)
2670 goto triangular_error;
2673 double tmp = work[
k] /
data (mini);
2681 work[iidx] = work[iidx] - tmp *
data (
i);
2709 if (perm[
ridx (
i)] < minr)
2711 minr = perm[
ridx (
i)];
2715 double tmp = work[
k] /
data (mini);
2724 work[iidx] = work[iidx] - tmp *
data (
i);
2732 atmp += fabs (work[
i]);
2735 if (atmp > ainvnorm)
2738 rcond = 1. / ainvnorm / anorm;
2744 retval.
resize (nc, b_nc, 0.);
2759 goto triangular_error;
2768 work[iidx] = work[iidx] - tmp *
data (
i);
2774 retval.
xelem (
i, j) = work[
i];
2798 work[iidx] = work[iidx] - tmp *
data (
i);
2805 atmp += fabs (work[
i]);
2808 if (atmp > ainvnorm)
2811 rcond = 1. / ainvnorm / anorm;
2820 sing_handler (rcond);
2827 volatile double rcond_plus_one = rcond + 1.0;
2835 sing_handler (rcond);
2849 solve_singularity_handler sing_handler,
2850 bool calc_cond)
const
2859 if (nr != b.
rows ())
2861 (
"matrix dimension mismatch solution of linear equations");
2863 if (nr == 0 || nc == 0 || b.
cols () == 0)
2868 int typ = mattype.
type ();
2872 (*current_liboctave_error_handler) (
"incorrect matrix type");
2875 double ainvnorm = 0.;
2885 atmp += fabs (
data (
i));
2894 retval.
xcidx (0) = 0;
2918 if (perm[
ridx (
i)] < minr)
2920 minr = perm[
ridx (
i)];
2924 if (minr !=
k ||
data (mini) == 0)
2927 goto triangular_error;
2930 double tmp = work[
k] /
data (mini);
2938 work[iidx] = work[iidx] - tmp *
data (
i);
2950 if (ii + new_nnz > x_nz)
2962 retval.
xdata (ii++) = work[
i];
2964 retval.
xcidx (j+1) = ii;
2988 if (perm[
ridx (
i)] < minr)
2990 minr = perm[
ridx (
i)];
2994 double tmp = work[
k] /
data (mini);
3003 work[iidx] = work[iidx] - tmp *
data (
i);
3011 atmp += fabs (work[
i]);
3014 if (atmp > ainvnorm)
3017 rcond = 1. / ainvnorm / anorm;
3038 goto triangular_error;
3046 work[iidx] = work[iidx] - tmp *
data (
i);
3058 if (ii + new_nnz > x_nz)
3070 retval.
xdata (ii++) = work[
i];
3072 retval.
xcidx (j+1) = ii;
3098 work[iidx] = work[iidx] - tmp *
data (
i);
3105 atmp += fabs (work[
i]);
3108 if (atmp > ainvnorm)
3111 rcond = 1. / ainvnorm / anorm;
3120 sing_handler (rcond);
3127 volatile double rcond_plus_one = rcond + 1.0;
3135 sing_handler (rcond);
3149 solve_singularity_handler sing_handler,
3150 bool calc_cond)
const
3159 if (nr != b.
rows ())
3161 (
"matrix dimension mismatch solution of linear equations");
3163 if (nr == 0 || nc == 0 || b.
cols () == 0)
3168 int typ = mattype.
type ();
3172 (*current_liboctave_error_handler) (
"incorrect matrix type");
3175 double ainvnorm = 0.;
3186 atmp += fabs (
data (
i));
3194 retval.
resize (nc, b_nc);
3203 cwork[perm[
i]] =
b(
i,j);
3213 if (perm[
ridx (
i)] < minr)
3215 minr = perm[
ridx (
i)];
3219 if (minr !=
k ||
data (mini) == 0)
3222 goto triangular_error;
3233 cwork[iidx] = cwork[iidx] - tmp *
data (
i);
3262 if (perm[
ridx (
i)] < minr)
3264 minr = perm[
ridx (
i)];
3268 double tmp = work[
k] /
data (mini);
3277 work[iidx] = work[iidx] - tmp *
data (
i);
3285 atmp += fabs (work[
i]);
3288 if (atmp > ainvnorm)
3291 rcond = 1. / ainvnorm / anorm;
3297 retval.
resize (nc, b_nc, 0.);
3313 goto triangular_error;
3321 cwork[iidx] = cwork[iidx] - tmp *
data (
i);
3327 retval.
xelem (
i, j) = cwork[
i];
3352 work[iidx] = work[iidx] - tmp *
data (
i);
3359 atmp += fabs (work[
i]);
3362 if (atmp > ainvnorm)
3365 rcond = 1. / ainvnorm / anorm;
3374 sing_handler (rcond);
3381 volatile double rcond_plus_one = rcond + 1.0;
3389 sing_handler (rcond);
3403 solve_singularity_handler sing_handler,
3404 bool calc_cond)
const
3413 if (nr != b.
rows ())
3415 (
"matrix dimension mismatch solution of linear equations");
3417 if (nr == 0 || nc == 0 || b.
cols () == 0)
3422 int typ = mattype.
type ();
3426 (*current_liboctave_error_handler) (
"incorrect matrix type");
3429 double ainvnorm = 0.;
3439 atmp += fabs (
data (
i));
3448 retval.
xcidx (0) = 0;
3472 if (perm[
ridx (
i)] < minr)
3474 minr = perm[
ridx (
i)];
3478 if (minr !=
k ||
data (mini) == 0)
3481 goto triangular_error;
3492 cwork[iidx] = cwork[iidx] - tmp *
data (
i);
3504 if (ii + new_nnz > x_nz)
3516 retval.
xdata (ii++) = cwork[
i];
3518 retval.
xcidx (j+1) = ii;
3543 if (perm[
ridx (
i)] < minr)
3545 minr = perm[
ridx (
i)];
3549 double tmp = work[
k] /
data (mini);
3558 work[iidx] = work[iidx] - tmp *
data (
i);
3566 atmp += fabs (work[
i]);
3569 if (atmp > ainvnorm)
3572 rcond = 1. / ainvnorm / anorm;
3593 goto triangular_error;
3601 cwork[iidx] = cwork[iidx] - tmp *
data (
i);
3613 if (ii + new_nnz > x_nz)
3625 retval.
xdata (ii++) = cwork[
i];
3627 retval.
xcidx (j+1) = ii;
3654 work[iidx] = work[iidx] - tmp *
data (
i);
3661 atmp += fabs (work[
i]);
3664 if (atmp > ainvnorm)
3667 rcond = 1. / ainvnorm / anorm;
3676 sing_handler (rcond);
3683 volatile double rcond_plus_one = rcond + 1.0;
3691 sing_handler (rcond);
3705 solve_singularity_handler sing_handler,
3706 bool calc_cond)
const
3714 if (nr != nc || nr != b.
rows ())
3716 (
"matrix dimension mismatch solution of linear equations");
3718 if (nr == 0 || b.
cols () == 0)
3721 (*current_liboctave_error_handler)
3722 (
"calculation of condition number not implemented");
3726 volatile int typ = mattype.
type ();
3744 D[nc-1] =
data (ii);
3760 else if (
ridx (
i) == j + 1)
3769 F77_XFCN (dptsv, DPTSV, (nr, b_nc, D, DL, result,
3795 DL[j] =
data (ii++);
3796 DU[j] =
data (ii++);
3798 D[nc-1] =
data (ii);
3815 else if (
ridx (
i) == j + 1)
3817 else if (
ridx (
i) == j - 1)
3826 F77_XFCN (dgtsv, DGTSV, (nr, b_nc, DL, D, DU, result,
3836 sing_handler (rcond);
3846 (*current_liboctave_error_handler) (
"incorrect matrix type");
3855 solve_singularity_handler sing_handler,
3856 bool calc_cond)
const
3864 if (nr != nc || nr != b.
rows ())
3866 (
"matrix dimension mismatch solution of linear equations");
3868 if (nr == 0 || b.
cols () == 0)
3871 (*current_liboctave_error_handler)
3872 (
"calculation of condition number not implemented");
3876 int typ = mattype.
type ();
3897 DL[j] =
data (ii++);
3898 DU[j] =
data (ii++);
3900 D[nc-1] =
data (ii);
3917 else if (
ridx (
i) == j + 1)
3919 else if (
ridx (
i) == j - 1)
3924 F77_XFCN (dgttrf, DGTTRF, (nr, DL, D, DU, DU2, pipvt, err));
3933 sing_handler (rcond);
3946 retval.
xcidx (0) = 0;
3959 (F77_CONST_CHAR_ARG2 (&job, 1),
3960 nr, 1, DL, D, DU, DU2, pipvt,
3961 work, b.
rows (), err
3962 F77_CHAR_ARG_LEN (1)));
3971 if (ii + new_nnz > x_nz)
3983 retval.
xdata (ii++) = work[
i];
3985 retval.
xcidx (j+1) = ii;
3992 (*current_liboctave_error_handler) (
"incorrect matrix type");
4001 solve_singularity_handler sing_handler,
4002 bool calc_cond)
const
4010 if (nr != nc || nr != b.
rows ())
4012 (
"matrix dimension mismatch solution of linear equations");
4014 if (nr == 0 || b.
cols () == 0)
4017 (*current_liboctave_error_handler)
4018 (
"calculation of condition number not implemented");
4022 volatile int typ = mattype.
type ();
4040 D[nc-1] =
data (ii);
4056 else if (
ridx (
i) == j + 1)
4093 DL[j] =
data (ii++);
4094 DU[j] =
data (ii++);
4096 D[nc-1] =
data (ii);
4113 else if (
ridx (
i) == j + 1)
4115 else if (
ridx (
i) == j - 1)
4138 sing_handler (rcond);
4146 (*current_liboctave_error_handler) (
"incorrect matrix type");
4155 solve_singularity_handler sing_handler,
4156 bool calc_cond)
const
4164 if (nr != nc || nr != b.
rows ())
4166 (
"matrix dimension mismatch solution of linear equations");
4168 if (nr == 0 || b.
cols () == 0)
4171 (*current_liboctave_error_handler)
4172 (
"calculation of condition number not implemented");
4176 int typ = mattype.
type ();
4197 DL[j] =
data (ii++);
4198 DU[j] =
data (ii++);
4200 D[nc-1] =
data (ii);
4217 else if (
ridx (
i) == j + 1)
4219 else if (
ridx (
i) == j - 1)
4224 F77_XFCN (dgttrf, DGTTRF, (nr, DL, D, DU, DU2, pipvt, err));
4233 sing_handler (rcond);
4254 retval.
xcidx (0) = 0;
4266 (F77_CONST_CHAR_ARG2 (&job, 1),
4267 nr, 1, DL, D, DU, DU2, pipvt,
4269 F77_CHAR_ARG_LEN (1)));
4274 (*current_liboctave_error_handler)
4275 (
"SparseMatrix::solve solve failed");
4282 (F77_CONST_CHAR_ARG2 (&job, 1),
4283 nr, 1, DL, D, DU, DU2, pipvt,
4285 F77_CHAR_ARG_LEN (1)));
4290 (*current_liboctave_error_handler)
4291 (
"SparseMatrix::solve solve failed");
4301 if (Bx[
i] != 0. || Bz[
i] != 0.)
4304 if (ii + new_nnz > x_nz)
4313 if (Bx[
i] != 0. || Bz[
i] != 0.)
4316 retval.
xdata (ii++) =
4320 retval.
xcidx (j+1) = ii;
4327 (*current_liboctave_error_handler) (
"incorrect matrix type");
4336 solve_singularity_handler sing_handler,
4337 bool calc_cond)
const
4345 if (nr != nc || nr != b.
rows ())
4347 (
"matrix dimension mismatch solution of linear equations");
4349 if (nr == 0 || b.
cols () == 0)
4354 volatile int typ = mattype.
type ();
4370 tmp_data[ii++] = 0.;
4378 m_band(ri - j, j) =
data (
i);
4387 F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
4388 nr, n_lower, tmp_data, ldm, err
4389 F77_CHAR_ARG_LEN (1)));
4410 (F77_CONST_CHAR_ARG2 (&job, 1),
4411 nr, n_lower, tmp_data, ldm,
4412 anorm, rcond, pz, piz, err
4413 F77_CHAR_ARG_LEN (1)));
4418 volatile double rcond_plus_one = rcond + 1.0;
4426 sing_handler (rcond);
4444 (F77_CONST_CHAR_ARG2 (&job, 1),
4445 nr, n_lower, b_nc, tmp_data,
4446 ldm, result, b.
rows (), err
4447 F77_CHAR_ARG_LEN (1)));
4452 (*current_liboctave_error_handler)
4453 (
"SparseMatrix::solve solve failed");
4476 tmp_data[ii++] = 0.;
4481 m_band(
ridx (
i) - j + n_lower + n_upper, j) =
data (
i);
4491 atmp += fabs (
data (
i));
4500 F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data,
4512 sing_handler (rcond);
4529 (F77_CONST_CHAR_ARG2 (&job, 1),
4530 nc, n_lower, n_upper, tmp_data, ldm, pipvt,
4531 anorm, rcond, pz, piz, err
4532 F77_CHAR_ARG_LEN (1)));
4537 volatile double rcond_plus_one = rcond + 1.0;
4545 sing_handler (rcond);
4564 (F77_CONST_CHAR_ARG2 (&job, 1),
4565 nr, n_lower, n_upper, b_nc, tmp_data,
4566 ldm, pipvt, result, b.
rows (), err
4567 F77_CHAR_ARG_LEN (1)));
4572 (*current_liboctave_error_handler) (
"incorrect matrix type");
4581 solve_singularity_handler sing_handler,
4582 bool calc_cond)
const
4590 if (nr != nc || nr != b.
rows ())
4592 (
"matrix dimension mismatch solution of linear equations");
4594 if (nr == 0 || b.
cols () == 0)
4599 volatile int typ = mattype.
type ();
4616 tmp_data[ii++] = 0.;
4624 m_band(ri - j, j) =
data (
i);
4633 F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
4634 nr, n_lower, tmp_data, ldm, err
4635 F77_CHAR_ARG_LEN (1)));
4654 (F77_CONST_CHAR_ARG2 (&job, 1),
4655 nr, n_lower, tmp_data, ldm,
4656 anorm, rcond, pz, piz, err
4657 F77_CHAR_ARG_LEN (1)));
4662 volatile double rcond_plus_one = rcond + 1.0;
4670 sing_handler (rcond);
4692 retval.
xcidx (0) = 0;
4699 (F77_CONST_CHAR_ARG2 (&job, 1),
4700 nr, n_lower, 1, tmp_data,
4702 F77_CHAR_ARG_LEN (1)));
4707 (*current_liboctave_error_handler)
4708 (
"SparseMatrix::solve solve failed");
4723 sz = (sz > 10 ? sz : 10) + x_nz;
4731 retval.
xcidx (j+1) = ii;
4755 tmp_data[ii++] = 0.;
4760 m_band(
ridx (
i) - j + n_lower + n_upper, j) =
data (
i);
4770 atmp += fabs (
data (
i));
4779 F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data,
4789 sing_handler (rcond);
4806 (F77_CONST_CHAR_ARG2 (&job, 1),
4807 nc, n_lower, n_upper, tmp_data, ldm, pipvt,
4808 anorm, rcond, pz, piz, err
4809 F77_CHAR_ARG_LEN (1)));
4814 volatile double rcond_plus_one = rcond + 1.0;
4822 sing_handler (rcond);
4838 retval.
xcidx (0) = 0;
4852 (F77_CONST_CHAR_ARG2 (&job, 1),
4853 nr, n_lower, n_upper, 1, tmp_data,
4854 ldm, pipvt, work, b.
rows (), err
4855 F77_CHAR_ARG_LEN (1)));
4864 if (ii + new_nnz > x_nz)
4876 retval.
xdata (ii++) = work[
i];
4878 retval.
xcidx (j+1) = ii;
4886 (*current_liboctave_error_handler) (
"incorrect matrix type");
4895 solve_singularity_handler sing_handler,
4896 bool calc_cond)
const
4904 if (nr != nc || nr != b.
rows ())
4906 (
"matrix dimension mismatch solution of linear equations");
4908 if (nr == 0 || b.
cols () == 0)
4913 volatile int typ = mattype.
type ();
4930 tmp_data[ii++] = 0.;
4938 m_band(ri - j, j) =
data (
i);
4947 F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
4948 nr, n_lower, tmp_data, ldm, err
4949 F77_CHAR_ARG_LEN (1)));
4970 (F77_CONST_CHAR_ARG2 (&job, 1),
4971 nr, n_lower, tmp_data, ldm,
4972 anorm, rcond, pz, piz, err
4973 F77_CHAR_ARG_LEN (1)));
4978 volatile double rcond_plus_one = rcond + 1.0;
4986 sing_handler (rcond);
5004 retval.
resize (b_nr, b_nc);
5016 (F77_CONST_CHAR_ARG2 (&job, 1),
5017 nr, n_lower, 1, tmp_data,
5019 F77_CHAR_ARG_LEN (1)));
5024 (*current_liboctave_error_handler)
5025 (
"SparseMatrix::solve solve failed");
5031 (F77_CONST_CHAR_ARG2 (&job, 1),
5032 nr, n_lower, 1, tmp_data,
5033 ldm, Bz, b.
rows (), err
5034 F77_CHAR_ARG_LEN (1)));
5039 (*current_liboctave_error_handler)
5040 (
"SparseMatrix::solve solve failed");
5068 tmp_data[ii++] = 0.;
5073 m_band(
ridx (
i) - j + n_lower + n_upper, j) =
data (
i);
5083 atmp += fabs (
data (
i));
5092 F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data,
5102 sing_handler (rcond);
5119 (F77_CONST_CHAR_ARG2 (&job, 1),
5120 nc, n_lower, n_upper, tmp_data, ldm, pipvt,
5121 anorm, rcond, pz, piz, err
5122 F77_CHAR_ARG_LEN (1)));
5127 volatile double rcond_plus_one = rcond + 1.0;
5135 sing_handler (rcond);
5164 (F77_CONST_CHAR_ARG2 (&job, 1),
5165 nr, n_lower, n_upper, 1, tmp_data,
5166 ldm, pipvt, Bx, b.
rows (), err
5167 F77_CHAR_ARG_LEN (1)));
5170 (F77_CONST_CHAR_ARG2 (&job, 1),
5171 nr, n_lower, n_upper, 1, tmp_data,
5172 ldm, pipvt, Bz, b.
rows (), err
5173 F77_CHAR_ARG_LEN (1)));
5182 (*current_liboctave_error_handler) (
"incorrect matrix type");
5191 solve_singularity_handler sing_handler,
5192 bool calc_cond)
const
5200 if (nr != nc || nr != b.
rows ())
5202 (
"matrix dimension mismatch solution of linear equations");
5204 if (nr == 0 || b.
cols () == 0)
5209 volatile int typ = mattype.
type ();
5226 tmp_data[ii++] = 0.;
5234 m_band(ri - j, j) =
data (
i);
5243 F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
5244 nr, n_lower, tmp_data, ldm, err
5245 F77_CHAR_ARG_LEN (1)));
5267 (F77_CONST_CHAR_ARG2 (&job, 1),
5268 nr, n_lower, tmp_data, ldm,
5269 anorm, rcond, pz, piz, err
5270 F77_CHAR_ARG_LEN (1)));
5275 volatile double rcond_plus_one = rcond + 1.0;
5283 sing_handler (rcond);
5306 retval.
xcidx (0) = 0;
5318 (F77_CONST_CHAR_ARG2 (&job, 1),
5319 nr, n_lower, 1, tmp_data,
5321 F77_CHAR_ARG_LEN (1)));
5326 (*current_liboctave_error_handler)
5327 (
"SparseMatrix::solve solve failed");
5333 (F77_CONST_CHAR_ARG2 (&job, 1),
5334 nr, n_lower, 1, tmp_data,
5336 F77_CHAR_ARG_LEN (1)));
5341 (*current_liboctave_error_handler)
5342 (
"SparseMatrix::solve solve failed");
5352 if (Bx[
i] != 0. || Bz[
i] != 0.)
5355 if (ii + new_nnz > x_nz)
5364 if (Bx[
i] != 0. || Bz[
i] != 0.)
5367 retval.
xdata (ii++) =
5371 retval.
xcidx (j+1) = ii;
5395 tmp_data[ii++] = 0.;
5400 m_band(
ridx (
i) - j + n_lower + n_upper, j) =
data (
i);
5410 atmp += fabs (
data (
i));
5419 F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data,
5429 sing_handler (rcond);
5446 (F77_CONST_CHAR_ARG2 (&job, 1),
5447 nc, n_lower, n_upper, tmp_data, ldm, pipvt,
5448 anorm, rcond, pz, piz, err
5449 F77_CHAR_ARG_LEN (1)));
5454 volatile double rcond_plus_one = rcond + 1.0;
5462 sing_handler (rcond);
5478 retval.
xcidx (0) = 0;
5495 Bx[b.
ridx (
i)] = c.real ();
5496 Bz[b.
ridx (
i)] = c.imag ();
5500 (F77_CONST_CHAR_ARG2 (&job, 1),
5501 nr, n_lower, n_upper, 1, tmp_data,
5502 ldm, pipvt, Bx, b.
rows (), err
5503 F77_CHAR_ARG_LEN (1)));
5506 (F77_CONST_CHAR_ARG2 (&job, 1),
5507 nr, n_lower, n_upper, 1, tmp_data,
5508 ldm, pipvt, Bz, b.
rows (), err
5509 F77_CHAR_ARG_LEN (1)));
5515 if (Bx[
i] != 0. || Bz[
i] != 0.)
5518 if (ii + new_nnz > x_nz)
5527 if (Bx[
i] != 0. || Bz[
i] != 0.)
5530 retval.
xdata (ii++) =
5533 retval.
xcidx (j+1) = ii;
5541 (*current_liboctave_error_handler) (
"incorrect matrix type");
5549 Matrix &Info, solve_singularity_handler sing_handler,
5550 bool calc_cond)
const
5556 #if defined (HAVE_UMFPACK)
5559 Control =
Matrix (UMFPACK_CONTROL, 1);
5565 Control (UMFPACK_PRL) =
tmp;
5569 Control (UMFPACK_SYM_PIVOT_TOLERANCE) =
tmp;
5570 Control (UMFPACK_PIVOT_TOLERANCE) =
tmp;
5576 Control (UMFPACK_FIXQ) =
tmp;
5582 const double *Ax =
data ();
5586 UMFPACK_DNAME (report_matrix) (nr, nc, Ap, Ai, Ax, 1, control);
5589 Info =
Matrix (1, UMFPACK_INFO);
5591 int status =
UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, Ax, 0,
5592 &Symbolic, control, info);
5602 (*current_liboctave_error_handler)
5603 (
"SparseMatrix::solve symbolic factorization failed");
5611 &Numeric, control, info);
5615 rcond = Info (UMFPACK_RCOND);
5618 volatile double rcond_plus_one = rcond + 1.0;
5620 if (status == UMFPACK_WARNING_singular_matrix
5628 sing_handler (rcond);
5632 else if (status < 0)
5638 (*current_liboctave_error_handler)
5639 (
"SparseMatrix::solve numeric factorization failed");
5654 octave_unused_parameter (rcond);
5655 octave_unused_parameter (Control);
5656 octave_unused_parameter (Info);
5657 octave_unused_parameter (sing_handler);
5658 octave_unused_parameter (calc_cond);
5660 (*current_liboctave_error_handler)
5661 (
"support for UMFPACK was unavailable or disabled "
5662 "when liboctave was built");
5672 solve_singularity_handler sing_handler,
5673 bool calc_cond)
const
5681 if (nr != nc || nr != b.
rows ())
5683 (
"matrix dimension mismatch solution of linear equations");
5685 if (nr == 0 || b.
cols () == 0)
5690 volatile int typ = mattype.
type ();
5695 #if defined (HAVE_CHOLMOD)
5696 cholmod_common Common;
5697 cholmod_common *cm = &Common;
5700 CHOLMOD_NAME(
start) (cm);
5701 cm->prefer_zomplex =
false;
5707 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, 0);
5711 cm->print =
static_cast<int> (spu) + 2;
5712 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
5716 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
5717 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
5719 cm->final_ll =
true;
5721 cholmod_sparse Astore;
5722 cholmod_sparse *
A = &Astore;
5733 #if defined (OCTAVE_ENABLE_64)
5734 A->itype = CHOLMOD_LONG;
5736 A->itype = CHOLMOD_INT;
5738 A->dtype = CHOLMOD_DOUBLE;
5740 A->xtype = CHOLMOD_REAL;
5747 cholmod_dense Bstore;
5748 cholmod_dense *
B = &Bstore;
5749 B->nrow = b.
rows ();
5750 B->ncol = b.
cols ();
5752 B->nzmax = B->nrow * B->ncol;
5753 B->dtype = CHOLMOD_DOUBLE;
5754 B->xtype = CHOLMOD_REAL;
5755 if (nc < 1 || b.
cols () < 1)
5763 L = CHOLMOD_NAME(analyze) (
A, cm);
5766 rcond = CHOLMOD_NAME(rcond)(L, cm);
5780 volatile double rcond_plus_one = rcond + 1.0;
5788 sing_handler (rcond);
5799 X = CHOLMOD_NAME(
solve) (CHOLMOD_A, L,
B, cm);
5807 retval.
xelem (
i,j) =
static_cast<double *
>(X->x)[jr +
i];
5811 CHOLMOD_NAME(free_dense) (&X, cm);
5812 CHOLMOD_NAME(free_factor) (&L, cm);
5813 CHOLMOD_NAME(finish) (cm);
5814 static char tmp[] =
" ";
5815 CHOLMOD_NAME(print_common) (
tmp, cm);
5819 (*current_liboctave_warning_with_id_handler)
5820 (
"Octave:missing-dependency",
5821 "support for CHOLMOD was unavailable or disabled "
5822 "when liboctave was built");
5831 #if defined (HAVE_UMFPACK)
5834 factorize (err, rcond, Control, Info, sing_handler, calc_cond);
5848 const double *Ax =
data ();
5853 Ai, Ax, &result[iidx],
5854 &Bx[iidx], Numeric, control,
5861 (*current_liboctave_error_handler)
5862 (
"SparseMatrix::solve solve failed");
5877 octave_unused_parameter (rcond);
5878 octave_unused_parameter (sing_handler);
5879 octave_unused_parameter (calc_cond);
5881 (*current_liboctave_error_handler)
5882 (
"support for UMFPACK was unavailable or disabled "
5883 "when liboctave was built");
5887 (*current_liboctave_error_handler) (
"incorrect matrix type");
5896 solve_singularity_handler sing_handler,
5897 bool calc_cond)
const
5905 if (nr != nc || nr != b.
rows ())
5907 (
"matrix dimension mismatch solution of linear equations");
5909 if (nr == 0 || b.
cols () == 0)
5914 volatile int typ = mattype.
type ();
5919 #if defined (HAVE_CHOLMOD)
5920 cholmod_common Common;
5921 cholmod_common *cm = &Common;
5924 CHOLMOD_NAME(
start) (cm);
5925 cm->prefer_zomplex =
false;
5931 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, 0);
5935 cm->print =
static_cast<int> (spu) + 2;
5936 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
5940 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
5941 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
5943 cm->final_ll =
true;
5945 cholmod_sparse Astore;
5946 cholmod_sparse *
A = &Astore;
5957 #if defined (OCTAVE_ENABLE_64)
5958 A->itype = CHOLMOD_LONG;
5960 A->itype = CHOLMOD_INT;
5962 A->dtype = CHOLMOD_DOUBLE;
5964 A->xtype = CHOLMOD_REAL;
5971 cholmod_sparse Bstore;
5972 cholmod_sparse *
B = &Bstore;
5973 B->nrow = b.
rows ();
5974 B->ncol = b.
cols ();
5977 B->nzmax = b.
nnz ();
5981 #if defined (OCTAVE_ENABLE_64)
5982 B->itype = CHOLMOD_LONG;
5984 B->itype = CHOLMOD_INT;
5986 B->dtype = CHOLMOD_DOUBLE;
5988 B->xtype = CHOLMOD_REAL;
5990 if (b.
rows () < 1 || b.
cols () < 1)
5997 L = CHOLMOD_NAME(analyze) (
A, cm);
6000 rcond = CHOLMOD_NAME(rcond)(L, cm);
6013 volatile double rcond_plus_one = rcond + 1.0;
6021 sing_handler (rcond);
6032 X = CHOLMOD_NAME(spsolve) (CHOLMOD_A, L,
B, cm);
6035 retval =
SparseMatrix (static_cast<octave_idx_type>(X->nrow),
6036 static_cast<octave_idx_type>(X->ncol),
6037 static_cast<octave_idx_type>(X->nzmax));
6039 j <= static_cast<octave_idx_type>(X->ncol); j++)
6042 j < static_cast<octave_idx_type>(X->nzmax); j++)
6045 retval.
xdata (j) =
static_cast<double *
>(X->x)[j];
6049 CHOLMOD_NAME(free_sparse) (&X, cm);
6050 CHOLMOD_NAME(free_factor) (&L, cm);
6051 CHOLMOD_NAME(finish) (cm);
6052 static char tmp[] =
" ";
6053 CHOLMOD_NAME(print_common) (
tmp, cm);
6057 (*current_liboctave_warning_with_id_handler)
6058 (
"Octave:missing-dependency",
6059 "support for CHOLMOD was unavailable or disabled "
6060 "when liboctave was built");
6069 #if defined (HAVE_UMFPACK)
6071 void *Numeric =
factorize (err, rcond, Control, Info,
6072 sing_handler, calc_cond);
6083 const double *Ax =
data ();
6094 retval.
xcidx (0) = 0;
6102 Ai, Ax, Xx, Bx, Numeric,
6109 (*current_liboctave_error_handler)
6110 (
"SparseMatrix::solve solve failed");
6125 sz = (sz > 10 ? sz : 10) + x_nz;
6133 retval.
xcidx (j+1) = ii;
6146 octave_unused_parameter (rcond);
6147 octave_unused_parameter (sing_handler);
6148 octave_unused_parameter (calc_cond);
6150 (*current_liboctave_error_handler)
6151 (
"support for UMFPACK was unavailable or disabled "
6152 "when liboctave was built");
6156 (*current_liboctave_error_handler) (
"incorrect matrix type");
6165 solve_singularity_handler sing_handler,
6166 bool calc_cond)
const
6174 if (nr != nc || nr != b.
rows ())
6176 (
"matrix dimension mismatch solution of linear equations");
6178 if (nr == 0 || b.
cols () == 0)
6183 volatile int typ = mattype.
type ();
6188 #if defined (HAVE_CHOLMOD)
6189 cholmod_common Common;
6190 cholmod_common *cm = &Common;
6193 CHOLMOD_NAME(
start) (cm);
6194 cm->prefer_zomplex =
false;
6200 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, 0);
6204 cm->print =
static_cast<int> (spu) + 2;
6205 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
6209 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
6210 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
6212 cm->final_ll =
true;
6214 cholmod_sparse Astore;
6215 cholmod_sparse *
A = &Astore;
6226 #if defined (OCTAVE_ENABLE_64)
6227 A->itype = CHOLMOD_LONG;
6229 A->itype = CHOLMOD_INT;
6231 A->dtype = CHOLMOD_DOUBLE;
6233 A->xtype = CHOLMOD_REAL;
6240 cholmod_dense Bstore;
6241 cholmod_dense *
B = &Bstore;
6242 B->nrow = b.
rows ();
6243 B->ncol = b.
cols ();
6245 B->nzmax = B->nrow * B->ncol;
6246 B->dtype = CHOLMOD_DOUBLE;
6247 B->xtype = CHOLMOD_COMPLEX;
6248 if (nc < 1 || b.
cols () < 1)
6256 L = CHOLMOD_NAME(analyze) (
A, cm);
6259 rcond = CHOLMOD_NAME(rcond)(L, cm);
6272 volatile double rcond_plus_one = rcond + 1.0;
6280 sing_handler (rcond);
6291 X = CHOLMOD_NAME(
solve) (CHOLMOD_A, L,
B, cm);
6303 CHOLMOD_NAME(free_dense) (&X, cm);
6304 CHOLMOD_NAME(free_factor) (&L, cm);
6305 CHOLMOD_NAME(finish) (cm);
6306 static char tmp[] =
" ";
6307 CHOLMOD_NAME(print_common) (
tmp, cm);
6311 (*current_liboctave_warning_with_id_handler)
6312 (
"Octave:missing-dependency",
6313 "support for CHOLMOD was unavailable or disabled "
6314 "when liboctave was built");
6323 #if defined (HAVE_UMFPACK)
6325 void *Numeric =
factorize (err, rcond, Control, Info,
6326 sing_handler, calc_cond);
6337 const double *Ax =
data ();
6342 retval.
resize (b_nr, b_nc);
6357 Ai, Ax, Xx, Bx, Numeric,
6361 Numeric, control, info);
6363 if (status < 0 || status2 < 0)
6368 (*current_liboctave_error_handler)
6369 (
"SparseMatrix::solve solve failed");
6387 octave_unused_parameter (rcond);
6388 octave_unused_parameter (sing_handler);
6389 octave_unused_parameter (calc_cond);
6391 (*current_liboctave_error_handler)
6392 (
"support for UMFPACK was unavailable or disabled "
6393 "when liboctave was built");
6397 (*current_liboctave_error_handler) (
"incorrect matrix type");
6406 solve_singularity_handler sing_handler,
6407 bool calc_cond)
const
6415 if (nr != nc || nr != b.
rows ())
6417 (
"matrix dimension mismatch solution of linear equations");
6419 if (nr == 0 || b.
cols () == 0)
6424 volatile int typ = mattype.
type ();
6429 #if defined (HAVE_CHOLMOD)
6430 cholmod_common Common;
6431 cholmod_common *cm = &Common;
6434 CHOLMOD_NAME(
start) (cm);
6435 cm->prefer_zomplex =
false;
6441 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, 0);
6445 cm->print =
static_cast<int> (spu) + 2;
6446 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, &
SparseCholPrint);
6450 SUITESPARSE_ASSIGN_FPTR2 (divcomplex_func, cm->complex_divide, divcomplex);
6451 SUITESPARSE_ASSIGN_FPTR2 (hypot_func, cm->hypotenuse, hypot);
6453 cm->final_ll =
true;
6455 cholmod_sparse Astore;
6456 cholmod_sparse *
A = &Astore;
6467 #if defined (OCTAVE_ENABLE_64)
6468 A->itype = CHOLMOD_LONG;
6470 A->itype = CHOLMOD_INT;
6472 A->dtype = CHOLMOD_DOUBLE;
6474 A->xtype = CHOLMOD_REAL;
6481 cholmod_sparse Bstore;
6482 cholmod_sparse *
B = &Bstore;
6483 B->nrow = b.
rows ();
6484 B->ncol = b.
cols ();
6487 B->nzmax = b.
nnz ();
6491 #if defined (OCTAVE_ENABLE_64)
6492 B->itype = CHOLMOD_LONG;
6494 B->itype = CHOLMOD_INT;
6496 B->dtype = CHOLMOD_DOUBLE;
6498 B->xtype = CHOLMOD_COMPLEX;
6500 if (b.
rows () < 1 || b.
cols () < 1)
6507 L = CHOLMOD_NAME(analyze) (
A, cm);
6510 rcond = CHOLMOD_NAME(rcond)(L, cm);
6523 volatile double rcond_plus_one = rcond + 1.0;
6531 sing_handler (rcond);
6542 X = CHOLMOD_NAME(spsolve) (CHOLMOD_A, L,
B, cm);
6546 (static_cast<octave_idx_type>(X->nrow),
6547 static_cast<octave_idx_type>(X->ncol),
6548 static_cast<octave_idx_type>(X->nzmax));
6550 j <= static_cast<octave_idx_type>(X->ncol); j++)
6553 j < static_cast<octave_idx_type>(X->nzmax); j++)
6560 CHOLMOD_NAME(free_sparse) (&X, cm);
6561 CHOLMOD_NAME(free_factor) (&L, cm);
6562 CHOLMOD_NAME(finish) (cm);
6563 static char tmp[] =
" ";
6564 CHOLMOD_NAME(print_common) (
tmp, cm);
6568 (*current_liboctave_warning_with_id_handler)
6569 (
"Octave:missing-dependency",
6570 "support for CHOLMOD was unavailable or disabled "
6571 "when liboctave was built");
6580 #if defined (HAVE_UMFPACK)
6582 void *Numeric =
factorize (err, rcond, Control, Info,
6583 sing_handler, calc_cond);
6594 const double *Ax =
data ();
6608 retval.
xcidx (0) = 0;
6619 Ai, Ax, Xx, Bx, Numeric,
6623 Numeric, control, info);
6625 if (status < 0 || status2 < 0)
6630 (*current_liboctave_error_handler)
6631 (
"SparseMatrix::solve solve failed");
6646 sz = (sz > 10 ? sz : 10) + x_nz;
6654 retval.
xcidx (j+1) = ii;
6666 octave_unused_parameter (rcond);
6667 octave_unused_parameter (sing_handler);
6668 octave_unused_parameter (calc_cond);
6670 (*current_liboctave_error_handler)
6671 (
"support for UMFPACK was unavailable or disabled "
6672 "when liboctave was built");
6676 (*current_liboctave_error_handler) (
"incorrect matrix type");
6687 return solve (mattype, b, info, rcond, 0);
6695 return solve (mattype, b, info, rcond, 0);
6702 return solve (mattype, b, info, rcond, 0);
6707 double& rcond, solve_singularity_handler sing_handler,
6708 bool singular_fallback)
const
6711 int typ = mattype.
type (
false);
6714 typ = mattype.
type (*
this);
6718 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6720 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6722 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6724 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6727 retval =
trisolve (mattype, b, err, rcond, sing_handler,
false);
6729 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6731 (*current_liboctave_error_handler) (
"unknown matrix type");
6737 #if defined (USE_QRSOLVE)
6738 retval =
qrsolve (*
this, b, err);
6752 return solve (mattype, b, info, rcond, 0);
6760 return solve (mattype, b, info, rcond, 0);
6767 return solve (mattype, b, info, rcond, 0);
6773 solve_singularity_handler sing_handler,
6774 bool singular_fallback)
const
6777 int typ = mattype.
type (
false);
6780 typ = mattype.
type (*
this);
6783 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6785 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6787 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6789 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6792 retval =
trisolve (mattype, b, err, rcond, sing_handler,
false);
6794 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6796 (*current_liboctave_error_handler) (
"unknown matrix type");
6801 #if defined (USE_QRSOLVE)
6802 retval =
qrsolve (*
this, b, err);
6817 return solve (mattype, b, info, rcond, 0);
6825 return solve (mattype, b, info, rcond, 0);
6832 return solve (mattype, b, info, rcond, 0);
6838 solve_singularity_handler sing_handler,
6839 bool singular_fallback)
const
6842 int typ = mattype.
type (
false);
6845 typ = mattype.
type (*
this);
6848 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6850 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6852 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6854 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6857 retval =
trisolve (mattype, b, err, rcond, sing_handler,
false);
6859 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6861 (*current_liboctave_error_handler) (
"unknown matrix type");
6866 #if defined (USE_QRSOLVE)
6867 retval =
qrsolve (*
this, b, err);
6882 return solve (mattype, b, info, rcond, 0);
6890 return solve (mattype, b, info, rcond, 0);
6897 return solve (mattype, b, info, rcond, 0);
6903 solve_singularity_handler sing_handler,
6904 bool singular_fallback)
const
6907 int typ = mattype.
type (
false);
6910 typ = mattype.
type (*
this);
6913 retval =
dsolve (mattype, b, err, rcond, sing_handler,
false);
6915 retval =
utsolve (mattype, b, err, rcond, sing_handler,
false);
6917 retval =
ltsolve (mattype, b, err, rcond, sing_handler,
false);
6919 retval =
bsolve (mattype, b, err, rcond, sing_handler,
false);
6922 retval =
trisolve (mattype, b, err, rcond, sing_handler,
false);
6924 retval =
fsolve (mattype, b, err, rcond, sing_handler,
true);
6926 (*current_liboctave_error_handler) (
"unknown matrix type");
6931 #if defined (USE_QRSOLVE)
6932 retval =
qrsolve (*
this, b, err);
6946 return solve (mattype, b, info, rcond);
6954 return solve (mattype, b, info, rcond);
6961 return solve (mattype, b, info, rcond, 0);
6967 solve_singularity_handler sing_handler)
const
6970 return solve (mattype, tmp, info, rcond,
6971 sing_handler).
column (static_cast<octave_idx_type> (0));
6979 return solve (mattype, b, info, rcond, 0);
6987 return solve (mattype, b, info, rcond, 0);
6993 double& rcond)
const
6995 return solve (mattype, b, info, rcond, 0);
7001 solve_singularity_handler sing_handler)
const
7004 return solve (mattype, tmp, info, rcond,
7005 sing_handler).
column (static_cast<octave_idx_type> (0));
7013 return solve (b, info, rcond, 0);
7020 return solve (b, info, rcond, 0);
7025 double& rcond)
const
7027 return solve (b, info, rcond, 0);
7032 solve_singularity_handler sing_handler)
const
7035 return solve (mattype, b, err, rcond, sing_handler);
7043 return solve (b, info, rcond, 0);
7051 return solve (b, info, rcond, 0);
7058 return solve (b, info, rcond, 0);
7063 solve_singularity_handler sing_handler)
const
7066 return solve (mattype, b, err, rcond, sing_handler);
7073 return solve (b, info, rcond, 0);
7078 double& rcond)
const
7080 return solve (b, info, rcond, 0);
7086 solve_singularity_handler sing_handler)
const
7089 return solve (mattype, b, err, rcond, sing_handler);
7097 return solve (b, info, rcond, 0);
7104 return solve (b, info, rcond, 0);
7109 double& rcond)
const
7111 return solve (b, info, rcond, 0);
7117 solve_singularity_handler sing_handler)
const
7120 return solve (mattype, b, err, rcond, sing_handler);
7127 return solve (b, info, rcond);
7134 return solve (b, info, rcond);
7139 double& rcond)
const
7141 return solve (b, info, rcond, 0);
7147 solve_singularity_handler sing_handler)
const
7150 return solve (tmp, info, rcond,
7151 sing_handler).
column (static_cast<octave_idx_type> (0));
7159 return solve (b, info, rcond, 0);
7166 return solve (b, info, rcond, 0);
7171 double& rcond)
const
7173 return solve (b, info, rcond, 0);
7179 solve_singularity_handler sing_handler)
const
7182 return solve (tmp, info, rcond,
7183 sing_handler).
column (static_cast<octave_idx_type> (0));
7247 if (val != 0.0 && val != 1.0)
7383 if ((
rows () == 1 && dim == -1) || dim == 1)
7388 (
cidx (j+1) -
cidx (j) < nr ? 0.0 : 1.0), 1.0);
7402 double d = data (i); \
7403 tmp[ridx (i)] += d * d
7406 double d = data (i); \
7453 os << a.
ridx (
i) + 1 <<
" " << j + 1 <<
" ";
7467 return read_sparse_matrix<elt_type> (
is,
a, octave_read_value<double>);
7531 return do_mul_dm_sm<SparseMatrix> (
d,
a);
7537 return do_mul_sm_dm<SparseMatrix> (
a,
d);
7543 return do_add_dm_sm<SparseMatrix> (
d,
a);
7549 return do_sub_dm_sm<SparseMatrix> (
d,
a);
7555 return do_add_sm_dm<SparseMatrix> (
a,
d);
7561 return do_sub_sm_dm<SparseMatrix> (
a,
d);
7580 #define EMPTY_RETURN_CHECK(T) \
7581 if (nr == 0 || nc == 0) \
7621 result.
xcidx (0) = 0;
7634 result.
xcidx (j+1) = ii;
7657 if (a_nr == b_nr && a_nc == b_nc)
7667 bool ja_lt_max = ja < ja_max;
7671 bool jb_lt_max = jb < jb_max;
7673 while (ja_lt_max || jb_lt_max)
7676 if ((! jb_lt_max) || (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
7686 ja_lt_max= ja < ja_max;
7688 else if ((! ja_lt_max)
7689 || (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja))))
7699 jb_lt_max= jb < jb_max;
7711 ja_lt_max= ja < ja_max;
7713 jb_lt_max= jb < jb_max;
7723 if (a_nr == 0 || a_nc == 0)
7725 else if (b_nr == 0 || b_nc == 0)
7772 result.
xcidx (0) = 0;
7784 result.
xcidx (j+1) = ii;
7807 if (a_nr == b_nr && a_nc == b_nc)
7817 bool ja_lt_max = ja < ja_max;
7821 bool jb_lt_max = jb < jb_max;
7823 while (ja_lt_max || jb_lt_max)
7826 if ((! jb_lt_max) || (ja_lt_max && (a.
ridx (ja) < b.
ridx (jb))))
7836 ja_lt_max= ja < ja_max;
7838 else if ((! ja_lt_max)
7839 || (jb_lt_max && (b.
ridx (jb) < a.
ridx (ja))))
7849 jb_lt_max= jb < jb_max;
7861 ja_lt_max= ja < ja_max;
7863 jb_lt_max= jb < jb_max;
7873 if (a_nr == 0 || a_nc == 0)
7875 else if (b_nr == 0 || b_nc == 0)
template Matrix dmsolve< Matrix, SparseMatrix, Matrix >(const SparseMatrix &, const Matrix &, octave_idx_type &)
void octave_write_double(std::ostream &os, double d)
octave_idx_type * xridx(void)
SparseMatrix min(int dim=-1) const
octave_idx_type cols(void) const
SparseMatrix reshape(const dim_vector &new_dims) const
MSparse< T > ipermute(const Array< octave_idx_type > &vec) const
bool operator==(const SparseMatrix &a) const
SparseMatrix concat(const SparseMatrix &rb, const Array< octave_idx_type > &ra_idx)
Matrix qrsolve(const SparseMatrix &a, const MArray< double > &b, octave_idx_type &info)
MSparse< T > & insert(const Sparse< T > &a, octave_idx_type r, octave_idx_type c)
octave_idx_type rows(void) const
#define SPARSE_CUMPROD(RET_TYPE, ELT_TYPE, FCN)
SparseMatrix Q(void) const
const octave_base_value const Array< octave_idx_type > & ra_idx
SparseMatrix max(double d, const SparseMatrix &m)
double & elem(octave_idx_type n)
SparseBoolMatrix all(int dim=-1) const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
SparseMatrix transpose(void) const
dim_vector dims(void) const
#define SPARSE_BASE_REDUCTION_OP(RET_TYPE, EL_TYPE, ROW_EXPR, COL_EXPR, INIT_VAL, MT_RESULT)
SparseMatrix Pc(void) const
ColumnVector column(octave_idx_type i) const
bool all_elements_are_zero(void) const
template SparseMatrix dmsolve< SparseMatrix, SparseMatrix, SparseMatrix >(const SparseMatrix &, const SparseMatrix &, octave_idx_type &)
SparseMatrix sum(int dim=-1) const
Matrix dsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
Matrix bsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
identity matrix If supplied two scalar respectively For allows like xample val
SparseMatrix Pr(void) const
void SparseCholError(int status, char *file, int line, char *message)
SparseMatrix inverse(void) const
MSparse< T > squeeze(void) const
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
#define F77_DBLE_CMPLX_ARG(x)
SM octinternal_do_mul_pm_sm(const PermMatrix &p, const SM &a)
Matrix mul_trans(const Matrix &m, const SparseMatrix &a)
#define SPARSE_SMSM_BOOL_OPS(M1, M2, ZERO)
SparseMatrix ipermute(const Array< octave_idx_type > &vec) const
octave_idx_type * xcidx(void)
SparseBoolMatrix operator!(void) const
template SparseComplexMatrix dmsolve< SparseComplexMatrix, SparseMatrix, SparseComplexMatrix >(const SparseMatrix &, const SparseComplexMatrix &, octave_idx_type &)
SparseMatrix & insert(const SparseMatrix &a, octave_idx_type r, octave_idx_type c)
RowVector row(octave_idx_type i) const
#define lo_ieee_signbit(x)
SM octinternal_do_mul_sm_pm(const SM &a, const PermMatrix &p)
#define SPARSE_FULL_TRANS_MUL(RET_TYPE, EL_TYPE, ZERO, CONJ_OP)
#define UMFPACK_DNAME(name)
octave_idx_type * cidx(void)
T & elem(octave_idx_type n)
bool is_hermitian(void) const
#define SPARSE_REDUCTION_OP(RET_TYPE, EL_TYPE, OP, INIT_VAL, MT_RESULT)
octave_idx_type columns(void) const
SparseMatrix max(int dim=-1) const
std::istream & operator>>(std::istream &is, SparseMatrix &a)
bool is_dense(void) const
SparseMatrix abs(void) const
#define FULL_SPARSE_MUL(RET_TYPE, EL_TYPE, ZERO)
bool operator!=(const SparseMatrix &a) const
#define F77_XFCN(f, F, args)
RowVector row(octave_idx_type i) const
void err_nan_to_logical_conversion(void)
static double get_key(const std::string &key)
bool is_symmetric(void) const
Matrix solve(MatrixType &typ, const Matrix &b) const
SparseMatrix cumprod(int dim=-1) const
int first_non_singleton(int def=0) const
octave_idx_type rows(void) const
#define SPARSE_SMS_CMP_OPS(M, MZ, CM, S, SZ, CS)
#define SPARSE_FULL_MUL(RET_TYPE, EL_TYPE, ZERO)
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
octave_idx_type * triangular_perm(void) const
octave_idx_type nnz(void) const
Actual number of nonzero terms.
Matrix ltsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
OCTAVE_EXPORT octave_value_list search each directory of the loadpath for element of the cell array and return the first that matches If the second optional argument return a cell array containing the list of all files that have the same name in the path If no files are found
#define SPARSE_ALL_OP(DIM)
SparseMatrix imag(const SparseComplexMatrix &a)
#define SPARSE_ANY_OP(DIM)
F77_RET_T const F77_INT F77_CMPLX const F77_INT F77_CMPLX * B
int type(bool quiet=true)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Matrix trans_mul(const SparseMatrix &m, const Matrix &a)
#define SPARSE_CUMSUM(RET_TYPE, ELT_TYPE, FCN)
DET determinant(void) const
bool all_integers(double &max_val, double &min_val) const
#define FULL_SPARSE_MUL_TRANS(RET_TYPE, EL_TYPE, ZERO, CONJ_OP)
Matrix matrix_value(void) const
void change_capacity(octave_idx_type nz)
nd deftypefn *octave_map m
SparseMatrix diag(octave_idx_type k=0) const
MatrixType transpose(void) const
#define SPARSE_SPARSE_MUL(RET_TYPE, RET_EL_TYPE, EL_TYPE)
Sparse< T > maybe_compress(bool remove_zeros=false)
void resize(octave_idx_type r, octave_idx_type c)
bool any_element_is_negative(bool=false) const
MSparse< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
SparseMatrix sumsq(int dim=-1) const
void resize(const dim_vector &dv, const T &rfv)
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
MSparse< T > reshape(const dim_vector &new_dims) const
void mark_as_unsymmetric(void)
bool too_large_for_float(void) const
SparseBoolMatrix any(int dim=-1) const
SparseMatrix real(const SparseComplexMatrix &a)
bool any_element_not_one_or_zero(void) const
SparseMatrix operator-(const DiagMatrix &d, const SparseMatrix &a)
SparseMatrix cumsum(int dim=-1) const
SparseMatrix min(double d, const SparseMatrix &m)
SparseComplexMatrix & insert(const SparseComplexMatrix &a, octave_idx_type r, octave_idx_type c)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
SparseMatrix operator+(const DiagMatrix &d, const SparseMatrix &a)
void mark_as_rectangular(void)
#define EMPTY_RETURN_CHECK(T)
octave_idx_type nnz(void) const
Count nonzero elements.
With real return the complex result
#define SPARSE_SMSM_CMP_OPS(M1, Z1, C1, M2, Z2, C2)
T & xelem(octave_idx_type n)
SparseMatrix squeeze(void) const
Matrix trisolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
octave_idx_type cols(void) const
Matrix utsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
int SparseCholPrint(const char *fmt,...)
SparseMatrix atan2(const double &x, const SparseMatrix &y)
octave_idx_type * ridx(void)
MSparse< T > diag(octave_idx_type k=0) const
#define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE
void resize(octave_idx_type nr, octave_idx_type nc, const Complex &rfv=Complex(0))
#define SPARSE_SSM_CMP_OPS(S, SZ, SC, M, MZ, MC)
=val(i)}if ode{val(i)}occurs in table i
bool test_any(F fcn) const
bool any_element_is_inf_or_nan(void) const
bool all_elements_are_int_or_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=false) const
issues an error eealso double
ColumnVector column(octave_idx_type i) const
SparseMatrix permute(const Array< octave_idx_type > &vec, bool inv=false) const
octave_idx_type ndims(void) const
Number of dimensions.
the element is set to zero In other the statement xample y
SparseMatrix prod(int dim=-1) const
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol NaN(Not a Number).NaN is the result of operations which do not produce a well defined 0 result.Common operations which produce a NaN are arithmetic with infinity ex($\infty-\infty $)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
SparseMatrix operator*(const SparseMatrix &m, const SparseMatrix &a)
bool any_element_is_nan(void) const
template ComplexMatrix dmsolve< ComplexMatrix, SparseMatrix, ComplexMatrix >(const SparseMatrix &, const ComplexMatrix &, octave_idx_type &)
bool xtoo_large_for_float(double x)
OCTAVE_EXPORT octave_value_list error nd deftypefn *const octave_scalar_map err
#define SPARSE_SMS_BOOL_OPS(M, S, ZERO)
#define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE
Matrix sum(int dim=-1) const
std::complex< double > Complex
const T * fortran_vec(void) const
#define SPARSE_SSM_BOOL_OPS(S, M, ZERO)
octave_idx_type cols(void) const
write the output to stdout if nargout is
Vector representing the dimensions (size) of an Array.
SparseMatrix dinverse(MatrixType &mattyp, octave_idx_type &info, double &rcond, const bool force=false, const bool calccond=true) const
void warn_singular_matrix(double rcond)
Matrix fsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcond, solve_singularity_handler sing_handler, bool calc_cond=false) const
SparseMatrix tinverse(MatrixType &mattyp, octave_idx_type &info, double &rcond, const bool force=false, const bool calccond=true) const
octave_idx_type length(void) const
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
F77_RET_T const F77_INT F77_CMPLX * A
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
Array< T > array_value(void) const
std::ostream & operator<<(std::ostream &os, const SparseMatrix &a)