26 #if defined (HAVE_CONFIG_H)
103 elem (ia(i), i) = 1.0;
117 elem (i, j) =
static_cast<unsigned char> (a.
elem (i, j));
132 return !(*
this == a);
163 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
164 (*current_liboctave_error_handler) (
"range error for insert");
182 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
183 (*current_liboctave_error_handler) (
"range error for insert");
202 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
203 (*current_liboctave_error_handler) (
"range error for insert");
205 fill (0.0,
r, c,
r + a_nr - 1, c + a_nc - 1);
226 if (nr > 0 && nc > 0)
245 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
246 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
247 (*current_liboctave_error_handler) (
"range error for fill");
249 if (r1 > r2) { std::swap (r1, r2); }
250 if (c1 > c2) { std::swap (c1, c2); }
252 if (r2 >= r1 && c2 >= c1)
270 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
285 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
299 if (nr != a.
numel ())
300 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
315 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
330 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
344 if (nc != a.
numel ())
345 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
360 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
375 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
400 if (r1 > r2) { std::swap (r1, r2); }
401 if (c1 > c2) { std::swap (c1, c2); }
437 double sum = colsum.
xelem (i);
456 return inverse (mattype, info, rcon, 0, 0);
464 return inverse (mattype, info, rcon, 0, 0);
469 bool calc_cond)
const
472 return inverse (mattype, info, rcon, force, calc_cond);
480 return inverse (mattype, info, rcon, 0, 0);
487 return inverse (mattype, info, rcon, 0, 0);
492 bool force,
bool calc_cond)
const
499 if (nr != nc || nr == 0 || nc == 0)
500 (*current_liboctave_error_handler) (
"inverse requires square matrix");
502 int typ = mattype.
type ();
510 F77_XFCN (dtrtri, DTRTRI, (F77_CONST_CHAR_ARG2 (&uplo, 1),
511 F77_CONST_CHAR_ARG2 (&udiag, 1),
512 nr, tmp_data, nr, tmp_info
514 F77_CHAR_ARG_LEN (1)));
530 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&job, 1),
531 F77_CONST_CHAR_ARG2 (&uplo, 1),
532 F77_CONST_CHAR_ARG2 (&udiag, 1),
533 nr, tmp_data, nr, rcon,
534 work, iwork, dtrcon_info
537 F77_CHAR_ARG_LEN (1)));
539 if (dtrcon_info != 0)
543 if (info == -1 && ! force)
551 bool force,
bool calc_cond)
const
558 if (nr != nc || nr == 0 || nc == 0)
559 (*current_liboctave_error_handler) (
"inverse requires square matrix");
562 F77_INT *pipvt = ipvt.fortran_vec ();
573 F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt,
576 lwork =
static_cast<F77_INT> (z(0));
577 lwork = (lwork < 4 * nc ? 4 * nc : lwork);
589 F77_XFCN (dgetrf, DGETRF, (nc, nc, tmp_data, nr, pipvt, tmp_info));
605 F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
606 nc, tmp_data, nr, anorm,
607 rcon, pz, piz, dgecon_info
608 F77_CHAR_ARG_LEN (1)));
610 if (dgecon_info != 0)
614 if (info == -1 && ! force)
620 F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt,
621 pz, lwork, dgetri_info));
623 if (dgetri_info != 0)
635 bool force,
bool calc_cond)
const
637 int typ = mattype.
type (
false);
641 typ = mattype.
type (*
this);
644 ret =
tinverse (mattype, info, rcon, force, calc_cond);
653 rcon =
chol.rcond ();
656 ret =
chol.inverse ();
663 ret =
finverse (mattype, info, rcon, force, calc_cond);
665 if ((calc_cond || mattype.
ishermitian ()) && rcon == 0.0
693 * std::numeric_limits<double>::epsilon ();
699 while (
r >= 0 && sigma.
elem (
r) < tol)
703 return Matrix (nc, nr, 0.0);
708 Matrix Vr =
V.extract (0, 0, nc-1,
r);
713 #if defined (HAVE_FFTW)
723 size_t npts, nsamples;
725 if (nr == 1 || nc == 1)
727 npts = (nr > nc ? nr : nc);
752 size_t npts, nsamples;
754 if (nr == 1 || nc == 1)
756 npts = (nr > nc ? nr : nc);
804 (*current_liboctave_error_handler)
805 (
"support for FFTW was unavailable or disabled when liboctave was built");
813 (*current_liboctave_error_handler)
814 (
"support for FFTW was unavailable or disabled when liboctave was built");
822 (*current_liboctave_error_handler)
823 (
"support for FFTW was unavailable or disabled when liboctave was built");
831 (*current_liboctave_error_handler)
832 (
"support for FFTW was unavailable or disabled when liboctave was built");
858 return determinant (mattype, info, rcon, calc_cond);
874 (*current_liboctave_error_handler) (
"matrix must be square");
876 volatile int typ = mattype.
type ();
882 typ = mattype.
type (*
this);
888 for (
F77_INT i = 0; i < nc; i++)
899 anorm =
norm1 (*
this);
904 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
905 tmp_data, nr, tmp_info
906 F77_CHAR_ARG_LEN (1)));
925 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
926 nr, tmp_data, nr, anorm,
927 rcon, pz, piz, tmp_info
928 F77_CHAR_ARG_LEN (1)));
936 for (
F77_INT i = 0; i < nc; i++)
943 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
959 anorm =
norm1 (*
this);
961 F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, tmp_info));
983 F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
984 nc, tmp_data, nr, anorm,
985 rcon, pz, piz, tmp_info
986 F77_CHAR_ARG_LEN (1)));
998 for (
F77_INT i = 0; i < nc; i++)
1000 double c = atmp(i,i);
1001 retval *= (ipvt(i) != (i+1)) ? -c : c;
1014 return rcond (mattype);
1025 (*current_liboctave_error_handler) (
"matrix must be square");
1027 if (nr == 0 || nc == 0)
1031 volatile int typ = mattype.
type ();
1034 typ = mattype.
type (*
this);
1050 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1051 F77_CONST_CHAR_ARG2 (&uplo, 1),
1052 F77_CONST_CHAR_ARG2 (&dia, 1),
1053 nr, tmp_data, nr, rcon,
1055 F77_CHAR_ARG_LEN (1)
1056 F77_CHAR_ARG_LEN (1)
1057 F77_CHAR_ARG_LEN (1)));
1063 (*current_liboctave_error_handler)
1064 (
"permuted triangular matrix not implemented");
1078 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1079 F77_CONST_CHAR_ARG2 (&uplo, 1),
1080 F77_CONST_CHAR_ARG2 (&dia, 1),
1081 nr, tmp_data, nr, rcon,
1083 F77_CHAR_ARG_LEN (1)
1084 F77_CHAR_ARG_LEN (1)
1085 F77_CHAR_ARG_LEN (1)));
1091 (*current_liboctave_error_handler)
1092 (
"permuted triangular matrix not implemented");
1095 double anorm = -1.0;
1105 anorm =
norm1 (atmp);
1107 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1109 F77_CHAR_ARG_LEN (1)));
1124 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1125 nr, tmp_data, nr, anorm,
1127 F77_CHAR_ARG_LEN (1)));
1145 anorm =
norm1 (atmp);
1152 F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1162 F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1163 nc, tmp_data, nr, anorm,
1165 F77_CHAR_ARG_LEN (1)));
1181 double& rcon, solve_singularity_handler sing_handler,
1193 (*current_liboctave_error_handler)
1194 (
"matrix dimension mismatch solution of linear equations");
1196 if (nr == 0 || nc == 0 || b_nc == 0)
1200 volatile int typ = mattype.
type ();
1203 (*current_liboctave_error_handler) (
"incorrect matrix type");
1209 (*current_liboctave_error_handler)
1210 (
"permuted triangular matrix not implemented");
1223 F77_XFCN (dtrtrs, DTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1),
1224 F77_CONST_CHAR_ARG2 (&trans, 1),
1225 F77_CONST_CHAR_ARG2 (&dia, 1),
1226 nr, b_nc, tmp_data, nr,
1227 result, nr, tmp_info
1228 F77_CHAR_ARG_LEN (1)
1229 F77_CHAR_ARG_LEN (1)
1230 F77_CHAR_ARG_LEN (1)));
1245 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1246 F77_CONST_CHAR_ARG2 (&uplo, 1),
1247 F77_CONST_CHAR_ARG2 (&dia, 1),
1248 nr, tmp_data, nr, rcon,
1250 F77_CHAR_ARG_LEN (1)
1251 F77_CHAR_ARG_LEN (1)
1252 F77_CHAR_ARG_LEN (1)));
1260 volatile double rcond_plus_one = rcon + 1.0;
1267 sing_handler (rcon);
1279 double& rcon, solve_singularity_handler sing_handler,
1291 (*current_liboctave_error_handler)
1292 (
"matrix dimension mismatch solution of linear equations");
1294 if (nr == 0 || nc == 0 || b_nc == 0)
1298 volatile int typ = mattype.
type ();
1301 (*current_liboctave_error_handler) (
"incorrect matrix type");
1307 (*current_liboctave_error_handler)
1308 (
"permuted triangular matrix not implemented");
1321 F77_XFCN (dtrtrs, DTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1),
1322 F77_CONST_CHAR_ARG2 (&trans, 1),
1323 F77_CONST_CHAR_ARG2 (&dia, 1),
1324 nr, b_nc, tmp_data, nr,
1325 result, nr, tmp_info
1326 F77_CHAR_ARG_LEN (1)
1327 F77_CHAR_ARG_LEN (1)
1328 F77_CHAR_ARG_LEN (1)));
1343 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1344 F77_CONST_CHAR_ARG2 (&uplo, 1),
1345 F77_CONST_CHAR_ARG2 (&dia, 1),
1346 nr, tmp_data, nr, rcon,
1348 F77_CHAR_ARG_LEN (1)
1349 F77_CHAR_ARG_LEN (1)
1350 F77_CHAR_ARG_LEN (1)));
1357 volatile double rcond_plus_one = rcon + 1.0;
1364 sing_handler (rcon);
1376 double& rcon, solve_singularity_handler sing_handler,
1377 bool calc_cond)
const
1384 if (nr != nc || nr != b.
rows ())
1385 (*current_liboctave_error_handler)
1386 (
"matrix dimension mismatch solution of linear equations");
1388 if (nr == 0 || b.
cols () == 0)
1392 volatile int typ = mattype.
type ();
1395 double anorm = -1.0;
1407 anorm =
norm1 (atmp);
1411 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1412 tmp_data, nr, tmp_info
1413 F77_CHAR_ARG_LEN (1)));
1435 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1436 nr, tmp_data, nr, anorm,
1437 rcon, pz, piz, tmp_info
1438 F77_CHAR_ARG_LEN (1)));
1445 volatile double rcond_plus_one = rcon + 1.0;
1452 sing_handler (rcon);
1466 F77_XFCN (dpotrs, DPOTRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1467 nr, b_nc, tmp_data, nr,
1468 result, b_nr, tmp_info
1469 F77_CHAR_ARG_LEN (1)));
1491 if (calc_cond && anorm < 0.0)
1492 anorm =
norm1 (atmp);
1501 F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, tmp_info));
1512 sing_handler (rcon);
1524 F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1525 nc, tmp_data, nr, anorm,
1526 rcon, pz, piz, tmp_info
1527 F77_CHAR_ARG_LEN (1)));
1534 volatile double rcond_plus_one = rcon + 1.0;
1541 sing_handler (rcon);
1556 F77_XFCN (dgetrs, DGETRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1557 nr, b_nc, tmp_data, nr,
1558 pipvt, result, b_nr, tmp_info
1559 F77_CHAR_ARG_LEN (1)));
1568 (*current_liboctave_error_handler) (
"incorrect matrix type");
1579 return solve (mattype, b, info, rcon,
nullptr);
1587 return solve (mattype, b, info, rcon,
nullptr);
1594 return solve (mattype, b, info, rcon,
nullptr);
1599 double& rcon, solve_singularity_handler sing_handler,
1603 int typ = mattype.
type ();
1606 typ = mattype.
type (*
this);
1610 retval =
utsolve (mattype, b, info, rcon, sing_handler,
true, transt);
1612 retval =
ltsolve (mattype, b, info, rcon, sing_handler,
true, transt);
1617 retval =
fsolve (mattype, b, info, rcon, sing_handler,
true);
1619 (*current_liboctave_error_handler) (
"unknown matrix type");
1636 return solve (mattype, b, info, rcon,
nullptr);
1644 return solve (mattype, b, info, rcon,
nullptr);
1651 return solve (mattype, b, info, rcon,
nullptr);
1678 const double *smd = sm.
data ();
1681 rd[i] =
Complex (smd[i], smd[nel+i]);
1688 solve_singularity_handler sing_handler,
1692 tmp =
solve (mattype, tmp, info, rcon, sing_handler, singular_fallback,
1701 return solve (mattype, b, info, rcon);
1709 return solve (mattype, b, info, rcon);
1716 return solve (mattype, b, info, rcon,
nullptr);
1722 solve_singularity_handler sing_handler,
1726 tmp =
solve (mattype, tmp, info, rcon, sing_handler,
true, transt);
1734 return tmp.
solve (mattype, b);
1742 return tmp.
solve (mattype, b, info);
1750 return tmp.
solve (mattype, b, info, rcon);
1756 solve_singularity_handler sing_handler,
1760 return tmp.
solve (mattype, b, info, rcon, sing_handler, transt);
1768 return solve (b, info, rcon,
nullptr);
1775 return solve (b, info, rcon,
nullptr);
1781 return solve (b, info, rcon,
nullptr);
1786 double& rcon, solve_singularity_handler sing_handler,
1790 return solve (mattype, b, info, rcon, sing_handler,
true, transt);
1797 return tmp.
solve (b);
1804 return tmp.
solve (b, info);
1812 return tmp.
solve (b, info, rcon);
1817 solve_singularity_handler sing_handler,
1821 return tmp.
solve (b, info, rcon, sing_handler, transt);
1828 return solve (b, info, rcon);
1835 return solve (b, info, rcon);
1841 return solve (b, info, rcon,
nullptr);
1846 solve_singularity_handler sing_handler,
1850 return solve (mattype, b, info, rcon, sing_handler, transt);
1857 return tmp.
solve (b);
1864 return tmp.
solve (b, info);
1872 return tmp.
solve (b, info, rcon);
1878 solve_singularity_handler sing_handler,
1882 return tmp.
solve (b, info, rcon, sing_handler, transt);
1891 return lssolve (b, info, rank, rcon);
1899 return lssolve (b, info, rank, rcon);
1907 return lssolve (b, info, rank, rcon);
1924 (*current_liboctave_error_handler)
1925 (
"matrix dimension mismatch solution of linear equations");
1927 if (
m == 0 ||
n == 0 || b_nc == 0)
1938 for (
F77_INT j = 0; j < nrhs; j++)
1959 F77_CONST_CHAR_ARG2 (
" ", 1),
1961 F77_CHAR_ARG_LEN (6)
1962 F77_CHAR_ARG_LEN (1));
1966 F77_CONST_CHAR_ARG2 (
" ", 1),
1967 m,
n, nrhs, -1, mnthr
1968 F77_CHAR_ARG_LEN (6)
1969 F77_CHAR_ARG_LEN (1));
1973 double dminmn =
static_cast<double> (minmn);
1974 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
1981 F77_INT liwork = 3 * minmn * nlvl + 11 * minmn;
1990 F77_XFCN (dgelsd, DGELSD, (
m,
n, nrhs, tmp_data,
m, pretval, maxmn,
1992 lwork, piwork, tmp_info));
2001 if (
n >
m &&
n >= mnthr)
2004 = 9*
m + 2*
m*smlsiz + 8*
m*nlvl +
m*nrhs + (smlsiz+1)*(smlsiz+1);
2017 if (wlalsd > addend)
2020 const F77_INT lworkaround = 4*
m +
m*
m + addend;
2022 if (work(0) < lworkaround)
2023 work(0) = lworkaround;
2028 = 12*
n + 2*
n*smlsiz + 8*
n*nlvl +
n*nrhs + (smlsiz+1)*(smlsiz+1);
2030 if (work(0) < lworkaround)
2031 work(0) = lworkaround;
2034 lwork =
static_cast<F77_INT> (work(0));
2037 double anorm =
norm1 (*
this);
2051 F77_XFCN (dgelsd, DGELSD, (
m,
n, nrhs, tmp_data,
m, pretval,
2052 maxmn, ps, rcon, tmp_rank,
2059 if (s.
elem (0) == 0.0)
2062 rcon = s.
elem (minmn - 1) / s.
elem (0);
2078 return tmp.
lssolve (b, info, rank, rcon);
2087 return tmp.
lssolve (b, info, rank, rcon);
2096 return tmp.
lssolve (b, info, rank, rcon);
2104 return tmp.
lssolve (b, info, rank, rcon);
2113 return lssolve (b, info, rank, rcon);
2121 return lssolve (b, info, rank, rcon);
2129 return lssolve (b, info, rank, rcon);
2146 (*current_liboctave_error_handler)
2147 (
"matrix dimension mismatch solution of linear equations");
2149 if (
m == 0 ||
n == 0)
2181 F77_CONST_CHAR_ARG2 (
" ", 1),
2183 F77_CHAR_ARG_LEN (6)
2184 F77_CHAR_ARG_LEN (1));
2188 double dminmn =
static_cast<double> (minmn);
2189 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
2196 F77_INT liwork = 3 * minmn * nlvl + 11 * minmn;
2205 F77_XFCN (dgelsd, DGELSD, (
m,
n, nrhs, tmp_data,
m, pretval, maxmn,
2207 lwork, piwork, tmp_info));
2212 lwork =
static_cast<F77_INT> (work(0));
2215 F77_XFCN (dgelsd, DGELSD, (
m,
n, nrhs, tmp_data,
m, pretval,
2216 maxmn, ps, rcon, tmp_rank,
2225 if (s.
elem (0) == 0.0)
2228 rcon = s.
elem (minmn - 1) / s.
elem (0);
2244 return tmp.
lssolve (b, info, rank, rcon);
2253 return tmp.
lssolve (b, info, rank, rcon);
2262 return tmp.
lssolve (b, info, rank, rcon);
2270 return tmp.
lssolve (b, info, rank, rcon);
2282 if (nr != a_nr || nc != a_nc)
2300 if (nr != a_nr || nc != a_nc)
2327 F77_XFCN (dgemm, DGEMM, (F77_CONST_CHAR_ARG2 (
"N", 1),
2328 F77_CONST_CHAR_ARG2 (
"N", 1),
2331 F77_CHAR_ARG_LEN (1)
2332 F77_CHAR_ARG_LEN (1)));
2404 if (nr == 1 || nc == 1)
2427 if (nr > 0 && nc > 0)
2438 for (idx_j = 0; idx_j < nc; idx_j++)
2440 tmp_min =
elem (i, idx_j);
2448 double tmp =
elem (i, j);
2452 else if (tmp < tmp_min)
2459 result.
elem (i) = tmp_min;
2482 if (nr > 0 && nc > 0)
2493 for (idx_j = 0; idx_j < nc; idx_j++)
2495 tmp_max =
elem (i, idx_j);
2503 double tmp =
elem (i, j);
2507 else if (tmp > tmp_max)
2514 result.
elem (i) = tmp_max;
2537 if (nr > 0 && nc > 0)
2548 for (idx_i = 0; idx_i < nr; idx_i++)
2550 tmp_min =
elem (idx_i, j);
2558 double tmp =
elem (i, j);
2562 else if (tmp < tmp_min)
2569 result.
elem (j) = tmp_min;
2592 if (nr > 0 && nc > 0)
2603 for (idx_i = 0; idx_i < nr; idx_i++)
2605 tmp_max =
elem (idx_i, j);
2613 double tmp =
elem (i, j);
2617 else if (tmp > tmp_max)
2624 result.
elem (j) = tmp_max;
2653 if (nr > 0 && nc > 0)
2659 tmp = octave_read_value<double> (is);
2661 a.
elem (i, j) = tmp;
2673 double cc, s, temp_r;
2675 F77_FUNC (dlartg, DLARTG) (
x, y, cc, s, temp_r);
2721 F77_XFCN (dtrsyl, DTRSYL, (F77_CONST_CHAR_ARG2 (
"N", 1),
2722 F77_CONST_CHAR_ARG2 (
"N", 1),
2723 1, a_nr, b_nr, pa, a_nr, pb,
2724 b_nr, px, a_nr,
scale, info
2725 F77_CHAR_ARG_LEN (1)
2726 F77_CHAR_ARG_LEN (1)));
2764 return trans ?
'T' :
'N';
2787 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
2789 else if (a.
data () == b.
data () && a_nr == b_nc && tra != trb)
2797 F77_XFCN (dsyrk, DSYRK, (F77_CONST_CHAR_ARG2 (
"U", 1),
2798 F77_CONST_CHAR_ARG2 (&ctra, 1),
2800 a.
data (), lda, 0.0, c, a_nr
2801 F77_CHAR_ARG_LEN (1)
2802 F77_CHAR_ARG_LEN (1)));
2803 for (
int j = 0; j < a_nr; j++)
2804 for (
int i = 0; i < j; i++)
2825 F77_XFCN (dgemv, DGEMV, (F77_CONST_CHAR_ARG2 (&ctra, 1),
2826 lda, tda, 1.0, a.
data (), lda,
2827 b.
data (), 1, 0.0, c, 1
2828 F77_CHAR_ARG_LEN (1)));
2834 F77_XFCN (dgemv, DGEMV, (F77_CONST_CHAR_ARG2 (&crevtrb, 1),
2835 ldb, tdb, 1.0, b.
data (), ldb,
2836 a.
data (), 1, 0.0, c, 1
2837 F77_CHAR_ARG_LEN (1)));
2843 F77_XFCN (dgemm, DGEMM, (F77_CONST_CHAR_ARG2 (&ctra, 1),
2844 F77_CONST_CHAR_ARG2 (&ctrb, 1),
2845 a_nr, b_nc, a_nc, 1.0, a.
data (),
2846 lda, b.
data (), ldb, 0.0, c, a_nr
2847 F77_CHAR_ARG_LEN (1)
2848 F77_CHAR_ARG_LEN (1)));
2858 return xgemm (a, b);
2863 #define EMPTY_RETURN_CHECK(T) \
2864 if (nr == 0 || nc == 0) \
2914 (*current_liboctave_error_handler)
2915 (
"two-arg min requires same size arguments");
2978 (*current_liboctave_error_handler)
2979 (
"two-arg max requires same size arguments");
3003 (*current_liboctave_error_handler)
3004 (
"linspace: vectors must be of equal length");
3021 delta[i] = (x1(i) == x2(i)) ? 0 : (x2(i) - x1(i)) / (
n - 1);
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.
octave_idx_type columns(void) const
double & xelem(octave_idx_type n)
octave_idx_type numel(void) const
Number of elements in the array.
double & elem(octave_idx_type n)
bool issquare(void) const
const double * data(void) const
octave_idx_type cols(void) const
octave_idx_type rows(void) const
Array< double > index(const idx_vector &i) const
Indexing without resizing.
const T * fortran_vec(void) const
Size of the specified dimension.
void resize(octave_idx_type n, const double &rfv=0)
ColumnVector extract(octave_idx_type r1, octave_idx_type r2) const
ComplexMatrix lssolve(const Matrix &b) const
ComplexMatrix solve(MatrixType &mattype, const Matrix &b) const
T elem(octave_idx_type r, octave_idx_type c) const
octave_idx_type length(void) const
octave_idx_type cols(void) const
octave_idx_type rows(void) const
DiagMatrix inverse(void) const
ColumnVector extract_diag(octave_idx_type k=0) const
bool ishermitian(void) const
void mark_as_rectangular(void)
void mark_as_unsymmetric(void)
int type(bool quiet=true)
Matrix pseudo_inverse(double tol=0.0) const
Matrix & fill(double val)
Matrix diag(octave_idx_type k=0) const
Matrix ltsolve(MatrixType &mattype, const Matrix &b, octave_idx_type &info, double &rcon, solve_singularity_handler sing_handler, bool calc_cond=false, blas_trans_type transt=blas_no_trans) const
ComplexMatrix fourier(void) const
ComplexMatrix fourier2d(void) const
RowVector column_min(void) const
boolMatrix all(int dim=-1) const
ColumnVector row_max(void) const
Matrix sum(int dim=-1) const
Matrix sumsq(int dim=-1) const
Matrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
Matrix prod(int dim=-1) const
RowVector row(octave_idx_type i) const
Matrix stack(const Matrix &a) const
Matrix append(const Matrix &a) const
Matrix fsolve(MatrixType &mattype, const Matrix &b, octave_idx_type &info, double &rcon, solve_singularity_handler sing_handler, bool calc_cond=false) const
Matrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
RowVector column_max(void) const
Matrix utsolve(MatrixType &mattype, const Matrix &b, octave_idx_type &info, double &rcon, solve_singularity_handler sing_handler, bool calc_cond=false, blas_trans_type transt=blas_no_trans) const
Matrix cumprod(int dim=-1) const
Matrix inverse(void) const
Matrix tinverse(MatrixType &mattype, octave_idx_type &info, double &rcon, bool force, bool calc_cond) const
Matrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
Matrix & operator+=(const DiagMatrix &a)
bool issymmetric(void) const
boolMatrix any(int dim=-1) const
ColumnVector row_min(void) const
Matrix & operator-=(const DiagMatrix &a)
ComplexMatrix ifourier2d(void) const
friend class ComplexMatrix
Matrix transpose(void) const
ComplexMatrix ifourier(void) const
DET determinant(void) const
Matrix finverse(MatrixType &mattype, octave_idx_type &info, double &rcon, bool force, bool calc_cond) const
bool operator==(const Matrix &a) const
Matrix solve(MatrixType &mattype, const Matrix &b) const
Matrix cumsum(int dim=-1) const
bool operator!=(const Matrix &a) const
Matrix lssolve(const Matrix &b) const
ColumnVector column(octave_idx_type i) const
NDArray diag(octave_idx_type k=0) const
NDArray cumsum(int dim=-1) const
NDArray sumsq(int dim=-1) const
NDArray prod(int dim=-1) const
NDArray cumprod(int dim=-1) const
boolNDArray all(int dim=-1) const
boolNDArray any(int dim=-1) const
NDArray sum(int dim=-1) const
const Array< octave_idx_type > & col_perm_vec(void) const
octave_idx_type rows(void) const
void resize(octave_idx_type n, const double &rfv=0)
Vector representing the dimensions (size) of an Array.
static const idx_vector colon
static int fft(const double *in, Complex *out, size_t npts, size_t nsamples=1, octave_idx_type stride=1, octave_idx_type dist=-1)
static int fftNd(const double *, Complex *, const int, const dim_vector &)
static int ifftNd(const Complex *, Complex *, const int, const dim_vector &)
static int ifft(const Complex *in, Complex *out, size_t npts, size_t nsamples=1, octave_idx_type stride=1, octave_idx_type dist=-1)
T unitary_matrix(void) const
T schur_matrix(void) const
DM_T singular_values(void) const
T right_singular_matrix(void) const
T left_singular_matrix(void) const
Matrix imag(const ComplexMatrix &a)
std::ostream & operator<<(std::ostream &os, const Matrix &a)
Matrix xgemm(const Matrix &a, const Matrix &b, blas_trans_type transa, blas_trans_type transb)
static ComplexMatrix unstack_complex_matrix(const Matrix &sm)
std::istream & operator>>(std::istream &is, Matrix &a)
static Matrix stack_complex_matrix(const ComplexMatrix &cm)
Matrix Givens(double x, double y)
static double norm1(const Matrix &a)
Matrix max(double d, const Matrix &m)
Matrix Sylvester(const Matrix &a, const Matrix &b, const Matrix &c)
Matrix operator*(const ColumnVector &v, const RowVector &a)
#define EMPTY_RETURN_CHECK(T)
Matrix linspace(const ColumnVector &x1, const ColumnVector &x2, octave_idx_type n)
Matrix min(double d, const Matrix &m)
static char get_blas_trans_arg(bool trans)
Matrix real(const ComplexMatrix &a)
#define F77_XFCN(f, F, args)
octave_f77_int_type F77_INT
double norm(const ColumnVector &v)
void scale(Matrix &m, double x, double y, double z)
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
F77_RET_T const F77_INT const F77_INT const F77_INT const F77_DBLE const F77_DBLE F77_INT F77_DBLE * V
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
void octave_write_double(std::ostream &os, double d)
char get_blas_char(blas_trans_type transt)
void mx_inline_imag(size_t n, T *r, const std::complex< T > *x)
void mx_inline_real(size_t n, T *r, const std::complex< T > *x)
bool mx_inline_equal(size_t n, const T1 *x, const T2 *y)
#define MM_BOOL_OPS(M1, M2)
#define MM_CMP_OPS(M1, M2)
#define SM_BOOL_OPS(S, M)
#define MS_BOOL_OPS(M, S)
Complex log2(const Complex &x)
void warn_singular_matrix(double rcond)
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
std::complex< double > Complex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
octave_value::octave_value(const Array< char > &chm, char type) return retval
subroutine xddot(n, dx, incx, dy, incy, retval)
F77_RET_T F77_FUNC(xerbla, XERBLA)(F77_CONST_CHAR_ARG_DEF(s_arg
subroutine xilaenv(ispec, name, opts, n1, n2, n3, n4, retval)