26 #if defined (HAVE_CONFIG_H)
118 elem (
i, j) =
static_cast<unsigned char> (a.
elem (
i, j));
133 return !(*
this ==
a);
164 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
165 (*current_liboctave_error_handler) (
"range error for insert");
183 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
184 (*current_liboctave_error_handler) (
"range error for insert");
203 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
204 (*current_liboctave_error_handler) (
"range error for insert");
206 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
227 if (nr > 0 && nc > 0)
246 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
247 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
248 (*current_liboctave_error_handler) (
"range error for fill");
253 if (r2 >= r1 && c2 >= c1)
275 retval.insert (*
this, 0, 0);
276 retval.insert (a, 0, nc_insert);
286 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
290 retval.insert (*
this, 0, 0);
291 retval.insert (a, 0, nc_insert);
300 if (nr != a.
numel ())
305 retval.
insert (*
this, 0, 0);
306 retval.
insert (a, 0, nc_insert);
320 retval.insert (*
this, 0, 0);
321 retval.insert (a, 0, nc_insert);
335 retval.insert (*
this, 0, 0);
336 retval.insert (a, nr_insert, 0);
345 if (nc != a.
numel ())
350 retval.
insert (*
this, 0, 0);
351 retval.
insert (a, nr_insert, 0);
361 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
365 retval.insert (*
this, 0, 0);
366 retval.insert (a, nr_insert, 0);
380 retval.insert (*
this, 0, 0);
381 retval.insert (a, nr_insert, 0);
434 return inverse (mattype, info, rcon, 0, 0);
442 return inverse (mattype, info, rcon, 0, 0);
447 bool calc_cond)
const
450 return inverse (mattype, info, rcon, force, calc_cond);
458 return inverse (mattype, info, rcon, 0, 0);
465 return inverse (mattype, info, rcon, 0, 0);
470 bool force,
bool calc_cond)
const
477 if (nr != nc || nr == 0 || nc == 0)
478 (*current_liboctave_error_handler) (
"inverse requires square matrix");
480 int typ = mattype.
type ();
486 F77_XFCN (dtrtri, DTRTRI, (F77_CONST_CHAR_ARG2 (&uplo, 1),
487 F77_CONST_CHAR_ARG2 (&udiag, 1),
488 nr, tmp_data, nr, info
490 F77_CHAR_ARG_LEN (1)));
504 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&job, 1),
505 F77_CONST_CHAR_ARG2 (&uplo, 1),
506 F77_CONST_CHAR_ARG2 (&udiag, 1),
507 nr, tmp_data, nr, rcon,
508 work, iwork, dtrcon_info
511 F77_CHAR_ARG_LEN (1)));
513 if (dtrcon_info != 0)
517 if (info == -1 && ! force)
525 bool force,
bool calc_cond)
const
532 if (nr != nc || nr == 0 || nc == 0)
533 (*current_liboctave_error_handler) (
"inverse requires square matrix");
545 F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt,
549 lwork = (lwork < 2 *nc ? 2*nc : lwork);
558 anorm = retval.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
561 F77_XFCN (dgetrf, DGETRF, (nc, nc, tmp_data, nr, pipvt, info));
575 F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
576 nc, tmp_data, nr, anorm,
577 rcon, pz, piz, dgecon_info
578 F77_CHAR_ARG_LEN (1)));
580 if (dgecon_info != 0)
584 if (info == -1 && ! force)
590 F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt,
591 pz, lwork, dgetri_info));
593 if (dgetri_info != 0)
605 bool force,
bool calc_cond)
const
607 int typ = mattype.
type (
false);
611 typ = mattype.
type (*
this);
614 ret =
tinverse (mattype, info, rcon, force, calc_cond);
623 rcon = chol.
rcond ();
633 ret =
finverse (mattype, info, rcon, force, calc_cond);
635 if ((mattype.
is_hermitian () || calc_cond) && rcon == 0.)
661 tol = nr * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
663 tol = nc * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
666 while (r >= 0 && sigma.
elem (r) < tol)
670 return Matrix (nc, nr, 0.0);
680 #if defined (HAVE_FFTW)
690 size_t npts, nsamples;
692 if (nr == 1 || nc == 1)
694 npts = nr > nc ? nr : nc;
719 size_t npts, nsamples;
721 if (nr == 1 || nc == 1)
723 npts = nr > nc ? nr : nc;
780 if (nr == 1 || nc == 1)
782 npts = nr > nc ? nr : nc;
794 Complex *pwsave = wsave.fortran_vec ();
822 if (nr == 1 || nc == 1)
824 npts = nr > nc ? nr : nc;
836 Complex *pwsave = wsave.fortran_vec ();
852 tmp_data[j] = tmp_data[j] / static_cast<double> (npts);
867 if (nr == 1 || nc == 1)
869 npts = nr > nc ? nr : nc;
881 Complex *pwsave = wsave.fortran_vec ();
901 pwsave = wsave.fortran_vec ();
913 prow[
i] = tmp_data[
i*nr + j];
919 tmp_data[
i*nr + j] = prow[
i];
935 if (nr == 1 || nc == 1)
937 npts = nr > nc ? nr : nc;
949 Complex *pwsave = wsave.fortran_vec ();
965 tmp_data[j] = tmp_data[j] / static_cast<double> (npts);
972 pwsave = wsave.fortran_vec ();
984 prow[
i] = tmp_data[
i*nr + j];
990 tmp_data[
i*nr + j] = prow[
i] / static_cast<double> (npts);
1017 return determinant (mattype, info, rcon, calc_cond);
1033 (*current_liboctave_error_handler) (
"matrix must be square");
1035 volatile int typ = mattype.
type ();
1042 typ = mattype.
type (*
this);
1057 if (calc_cond) anorm =
xnorm (*
this, 1);
1060 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1062 F77_CHAR_ARG_LEN (1)));
1077 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1078 nr, tmp_data, nr, anorm,
1080 F77_CHAR_ARG_LEN (1)));
1086 retval *= atmp (
i,
i);
1088 retval = retval.
square ();
1092 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
1106 if (calc_cond) anorm =
xnorm (*
this, 1);
1108 F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1128 F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1129 nc, tmp_data, nr, anorm,
1131 F77_CHAR_ARG_LEN (1)));
1143 double c = atmp(
i,
i);
1144 retval *= (ipvt(
i) != (
i+1)) ? -c :
c;
1157 return rcond (mattype);
1168 (*current_liboctave_error_handler) (
"matrix must be square");
1170 if (nr == 0 || nc == 0)
1174 volatile int typ = mattype.
type ();
1177 typ = mattype.
type (*
this);
1193 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1),
1194 F77_CONST_CHAR_ARG2 (&uplo, 1),
1195 F77_CONST_CHAR_ARG2 (&dia, 1),
1196 nr, tmp_data, nr, rcon,
1198 F77_CHAR_ARG_LEN (1)
1199 F77_CHAR_ARG_LEN (1)
1200 F77_CHAR_ARG_LEN (1)));
1206 (*current_liboctave_error_handler)
1207 (
"permuted triangular matrix not implemented");
1221 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1),
1222 F77_CONST_CHAR_ARG2 (&uplo, 1),
1223 F77_CONST_CHAR_ARG2 (&dia, 1),
1224 nr, tmp_data, nr, rcon,
1226 F77_CHAR_ARG_LEN (1)
1227 F77_CHAR_ARG_LEN (1)
1228 F77_CHAR_ARG_LEN (1)));
1234 (*current_liboctave_error_handler)
1235 (
"permuted triangular matrix not implemented");
1238 double anorm = -1.0;
1248 anorm = atmp.
abs().
sum().
1249 row(static_cast<octave_idx_type>(0)).
max();
1251 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1253 F77_CHAR_ARG_LEN (1)));
1268 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1269 nr, tmp_data, nr, anorm,
1271 F77_CHAR_ARG_LEN (1)));
1289 anorm = atmp.
abs ().
sum ().
1290 row(static_cast<octave_idx_type>(0)).
max ();
1297 F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1307 F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1308 nc, tmp_data, nr, anorm,
1310 F77_CHAR_ARG_LEN (1)));
1326 double& rcon, solve_singularity_handler sing_handler,
1334 if (nr != b.
rows ())
1336 (
"matrix dimension mismatch solution of linear equations");
1338 if (nr == 0 || nc == 0 || b.
cols () == 0)
1342 volatile int typ = mattype.
type ();
1345 (*current_liboctave_error_handler) (
"incorrect matrix type");
1352 (*current_liboctave_error_handler)
1353 (
"permuted triangular matrix not implemented");
1364 F77_XFCN (dtrtrs, DTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1),
1365 F77_CONST_CHAR_ARG2 (&trans, 1),
1366 F77_CONST_CHAR_ARG2 (&dia, 1),
1367 nr, b_nc, tmp_data, nr,
1369 F77_CHAR_ARG_LEN (1)
1370 F77_CHAR_ARG_LEN (1)
1371 F77_CHAR_ARG_LEN (1)));
1384 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1),
1385 F77_CONST_CHAR_ARG2 (&uplo, 1),
1386 F77_CONST_CHAR_ARG2 (&dia, 1),
1387 nr, tmp_data, nr, rcon,
1389 F77_CHAR_ARG_LEN (1)
1390 F77_CHAR_ARG_LEN (1)
1391 F77_CHAR_ARG_LEN (1)));
1396 volatile double rcond_plus_one = rcon + 1.0;
1403 sing_handler (rcon);
1415 double& rcon, solve_singularity_handler sing_handler,
1423 if (nr != b.
rows ())
1425 (
"matrix dimension mismatch solution of linear equations");
1427 if (nr == 0 || nc == 0 || b.
cols () == 0)
1431 volatile int typ = mattype.
type ();
1434 (*current_liboctave_error_handler) (
"incorrect matrix type");
1441 (*current_liboctave_error_handler)
1442 (
"permuted triangular matrix not implemented");
1453 F77_XFCN (dtrtrs, DTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1),
1454 F77_CONST_CHAR_ARG2 (&trans, 1),
1455 F77_CONST_CHAR_ARG2 (&dia, 1),
1456 nr, b_nc, tmp_data, nr,
1458 F77_CHAR_ARG_LEN (1)
1459 F77_CHAR_ARG_LEN (1)
1460 F77_CHAR_ARG_LEN (1)));
1473 F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1),
1474 F77_CONST_CHAR_ARG2 (&uplo, 1),
1475 F77_CONST_CHAR_ARG2 (&dia, 1),
1476 nr, tmp_data, nr, rcon,
1478 F77_CHAR_ARG_LEN (1)
1479 F77_CHAR_ARG_LEN (1)
1480 F77_CHAR_ARG_LEN (1)));
1485 volatile double rcond_plus_one = rcon + 1.0;
1492 sing_handler (rcon);
1504 double& rcon, solve_singularity_handler sing_handler,
1505 bool calc_cond)
const
1512 if (nr != nc || nr != b.
rows ())
1514 (
"matrix dimension mismatch solution of linear equations");
1516 if (nr == 0 || b.
cols () == 0)
1520 volatile int typ = mattype.
type ();
1533 anorm = atmp.
abs().
sum().
row(static_cast<octave_idx_type>(0)).
max();
1535 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1537 F77_CHAR_ARG_LEN (1)));
1557 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1558 nr, tmp_data, nr, anorm,
1560 F77_CHAR_ARG_LEN (1)));
1565 volatile double rcond_plus_one = rcon + 1.0;
1572 sing_handler (rcon);
1585 F77_XFCN (dpotrs, DPOTRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1586 nr, b_nc, tmp_data, nr,
1587 result, b.
rows (), info
1588 F77_CHAR_ARG_LEN (1)));
1609 anorm = atmp.
abs().
sum().
row(static_cast<octave_idx_type>(0)).
max();
1616 F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1625 sing_handler (rcon);
1638 F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1639 nc, tmp_data, nr, anorm,
1641 F77_CHAR_ARG_LEN (1)));
1646 volatile double rcond_plus_one = rcon + 1.0;
1653 sing_handler (rcon);
1667 F77_XFCN (dgetrs, DGETRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1668 nr, b_nc, tmp_data, nr,
1669 pipvt, result, b.
rows (), info
1670 F77_CHAR_ARG_LEN (1)));
1677 (*current_liboctave_error_handler) (
"incorrect matrix type");
1688 return solve (typ, b, info, rcon, 0);
1695 return solve (typ, b, info, rcon, 0);
1702 return solve (typ, b, info, rcon, 0);
1707 double& rcon, solve_singularity_handler sing_handler,
1711 int typ = mattype.
type ();
1714 typ = mattype.
type (*
this);
1718 retval =
utsolve (mattype, b, info, rcon, sing_handler,
true, transt);
1720 retval =
ltsolve (mattype, b, info, rcon, sing_handler,
true, transt);
1725 retval =
fsolve (mattype, b, info, rcon, sing_handler,
true);
1727 (*current_liboctave_error_handler) (
"unknown matrix type");
1733 retval =
lssolve (b, info, rank, rcon);
1744 return solve (typ, b, info, rcon, 0);
1752 return solve (typ, b, info, rcon, 0);
1759 return solve (typ, b, info, rcon, 0);
1786 const double *smd = sm.
data ();
1795 double& rcon, solve_singularity_handler sing_handler,
1799 tmp =
solve (typ, tmp, info, rcon, sing_handler, singular_fallback, transt);
1807 return solve (typ, b, info, rcon);
1815 return solve (typ, b, info, rcon);
1822 return solve (typ, b, info, rcon, 0);
1827 double& rcon, solve_singularity_handler sing_handler,
1831 tmp =
solve (typ, tmp, info, rcon, sing_handler,
true, transt);
1832 return tmp.
column (static_cast<octave_idx_type> (0));
1839 return tmp.
solve (typ, b);
1847 return tmp.
solve (typ, b, info);
1855 return tmp.
solve (typ, b, info, rcon);
1861 solve_singularity_handler sing_handler,
1865 return tmp.
solve (typ, b, info, rcon, sing_handler, transt);
1873 return solve (b, info, rcon, 0);
1880 return solve (b, info, rcon, 0);
1886 return solve (b, info, rcon, 0);
1891 double& rcon, solve_singularity_handler sing_handler,
1895 return solve (mattype, b, info, rcon, sing_handler,
true, transt);
1902 return tmp.
solve (b);
1909 return tmp.
solve (b, info);
1917 return tmp.
solve (b, info, rcon);
1922 solve_singularity_handler sing_handler,
1926 return tmp.
solve (b, info, rcon, sing_handler, transt);
1933 return solve (b, info, rcon);
1940 return solve (b, info, rcon);
1946 return solve (b, info, rcon, 0);
1951 solve_singularity_handler sing_handler,
1955 return solve (mattype, b, info, rcon, sing_handler, transt);
1962 return tmp.
solve (b);
1969 return tmp.
solve (b, info);
1977 return tmp.
solve (b, info, rcon);
1983 solve_singularity_handler sing_handler,
1987 return tmp.
solve (b, info, rcon, sing_handler, transt);
1996 return lssolve (b, info, rank, rcon);
2004 return lssolve (b, info, rank, rcon);
2012 return lssolve (b, info, rank, rcon);
2028 (
"matrix dimension mismatch solution of linear equations");
2030 if (m == 0 || n == 0 || b.
cols () == 0)
2039 retval =
Matrix (maxmn, nrhs, 0.0);
2062 F77_CONST_CHAR_ARG2 (
" ", 1),
2064 F77_CHAR_ARG_LEN (6)
2065 F77_CHAR_ARG_LEN (1));
2069 F77_CONST_CHAR_ARG2 (
" ", 1),
2070 m, n, nrhs, -1, mnthr
2071 F77_CHAR_ARG_LEN (6)
2072 F77_CHAR_ARG_LEN (1));
2076 double dminmn =
static_cast<double> (minmn);
2077 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
2091 F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2093 lwork, piwork, info));
2099 if (n > m && n >= mnthr)
2102 = 9*m + 2*m*smlsiz + 8*m*nlvl + m*nrhs + (smlsiz+1)*(smlsiz+1);
2115 if (wlalsd > addend)
2120 if (work(0) < lworkaround)
2121 work(0) = lworkaround;
2126 = 12*n + 2*n*smlsiz + 8*n*nlvl + n*nrhs + (smlsiz+1)*(smlsiz+1);
2128 if (work(0) < lworkaround)
2129 work(0) = lworkaround;
2135 anorm =
xnorm (*
this, 1);
2141 retval =
Matrix (n, m, 0.0);
2145 F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval,
2146 maxmn, ps, rcon, rank,
2150 if (s.
elem (0) == 0.0)
2153 rcon = s.
elem (minmn - 1) / s.
elem (0);
2169 return tmp.
lssolve (b, info, rank, rcon);
2178 return tmp.
lssolve (b, info, rank, rcon);
2187 return tmp.
lssolve (b, info, rank, rcon);
2195 return tmp.
lssolve (b, info, rank, rcon);
2204 return lssolve (b, info, rank, rcon);
2212 return lssolve (b, info, rank, rcon);
2220 return lssolve (b, info, rank, rcon);
2234 if (m != b.
numel ())
2236 (
"matrix dimension mismatch solution of linear equations");
2238 if (m == 0 || n == 0)
2270 F77_CONST_CHAR_ARG2 (
" ", 1),
2272 F77_CHAR_ARG_LEN (6)
2273 F77_CHAR_ARG_LEN (1));
2277 double dminmn =
static_cast<double> (minmn);
2278 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
2291 F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2293 lwork, piwork, info));
2298 F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval,
2299 maxmn, ps, rcon, rank,
2305 if (s.
elem (0) == 0.0)
2308 rcon = s.
elem (minmn - 1) / s.
elem (0);
2324 return tmp.
lssolve (b, info, rank, rcon);
2333 return tmp.
lssolve (b, info, rank, rcon);
2342 return tmp.
lssolve (b, info, rank, rcon);
2350 return tmp.
lssolve (b, info, rank, rcon);
2362 if (nr != a_nr || nc != a_nc)
2380 if (nr != a_nr || nc != a_nc)
2404 retval =
Matrix (len, a_len);
2407 F77_XFCN (dgemm, DGEMM, (F77_CONST_CHAR_ARG2 (
"N", 1),
2408 F77_CONST_CHAR_ARG2 (
"N", 1),
2409 len, a_len, 1, 1.0, v.
data (), len,
2410 a.
data (), 1, 0.0,
c, len
2411 F77_CHAR_ARG_LEN (1)
2412 F77_CHAR_ARG_LEN (1)));
2484 if (nr == 1 || nc == 1)
2507 if (nr > 0 && nc > 0)
2518 for (idx_j = 0; idx_j < nc; idx_j++)
2520 tmp_min =
elem (
i, idx_j);
2532 else if (tmp < tmp_min)
2539 result.
elem (
i) = tmp_min;
2562 if (nr > 0 && nc > 0)
2573 for (idx_j = 0; idx_j < nc; idx_j++)
2575 tmp_max =
elem (
i, idx_j);
2587 else if (tmp > tmp_max)
2594 result.
elem (
i) = tmp_max;
2617 if (nr > 0 && nc > 0)
2628 for (idx_i = 0; idx_i < nr; idx_i++)
2630 tmp_min =
elem (idx_i, j);
2642 else if (tmp < tmp_min)
2649 result.
elem (j) = tmp_min;
2672 if (nr > 0 && nc > 0)
2683 for (idx_i = 0; idx_i < nr; idx_i++)
2685 tmp_max =
elem (idx_i, j);
2697 else if (tmp > tmp_max)
2704 result.
elem (j) = tmp_max;
2733 if (nr > 0 && nc > 0)
2739 tmp = octave_read_value<double> (
is);
2753 double cc,
s, temp_r;
2801 F77_XFCN (dtrsyl, DTRSYL, (F77_CONST_CHAR_ARG2 (
"N", 1),
2802 F77_CONST_CHAR_ARG2 (
"N", 1),
2803 1, a_nr, b_nr, pa, a_nr, pb,
2804 b_nr, px, a_nr, scale, info
2805 F77_CHAR_ARG_LEN (1)
2806 F77_CHAR_ARG_LEN (1)));
2844 return trans ?
'T' :
'N';
2867 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
2868 retval =
Matrix (a_nr, b_nc, 0.0);
2869 else if (a.
data () == b.
data () && a_nr == b_nc && tra != trb)
2873 retval =
Matrix (a_nr, b_nc);
2877 F77_XFCN (dsyrk, DSYRK, (F77_CONST_CHAR_ARG2 (
"U", 1),
2878 F77_CONST_CHAR_ARG2 (&ctra, 1),
2880 a.
data (), lda, 0.0,
c, a_nr
2881 F77_CHAR_ARG_LEN (1)
2882 F77_CHAR_ARG_LEN (1)));
2883 for (
int j = 0; j <
a_nr; j++)
2884 for (
int i = 0;
i < j;
i++)
2895 retval =
Matrix (a_nr, b_nc);
2905 F77_XFCN (dgemv, DGEMV, (F77_CONST_CHAR_ARG2 (&ctra, 1),
2906 lda, tda, 1.0, a.
data (), lda,
2907 b.
data (), 1, 0.0,
c, 1
2908 F77_CHAR_ARG_LEN (1)));
2914 F77_XFCN (dgemv, DGEMV, (F77_CONST_CHAR_ARG2 (&crevtrb, 1),
2915 ldb, tdb, 1.0, b.
data (), ldb,
2916 a.
data (), 1, 0.0,
c, 1
2917 F77_CHAR_ARG_LEN (1)));
2923 F77_XFCN (dgemm, DGEMM, (F77_CONST_CHAR_ARG2 (&ctra, 1),
2924 F77_CONST_CHAR_ARG2 (&ctrb, 1),
2925 a_nr, b_nc, a_nc, 1.0, a.
data (),
2926 lda, b.
data (), ldb, 0.0,
c, a_nr
2927 F77_CHAR_ARG_LEN (1)
2928 F77_CHAR_ARG_LEN (1)));
2938 return xgemm (a, b);
2943 #define EMPTY_RETURN_CHECK(T) \
2944 if (nr == 0 || nc == 0) \
2995 (
"two-arg min requires same size arguments");
3059 (
"two-arg max requires same size arguments");
3084 (
"linspace: vectors must be of equal length");
3090 retval.clear (m, 0);
3094 retval.clear (m, n);
3099 double *delta = &
retval(0, n-1);
3101 delta[
i] = (x2(
i) - x1(
i)) / (n - 1);
Matrix diag(octave_idx_type k=0) const
void octave_write_double(std::ostream &os, double d)
bool is_symmetric(void) const
Matrix linspace(const ColumnVector &x1, const ColumnVector &x2, octave_idx_type n)
NDArray cumsum(int dim=-1) const
#define EMPTY_RETURN_CHECK(T)
Matrix finverse(MatrixType &mattype, octave_idx_type &info, double &rcon, bool force, bool calc_cond) const
F77_RET_T const F77_INT const F77_INT const F77_INT const F77_DBLE const F77_DBLE F77_INT F77_DBLE * V
#define MM_BOOL_OPS(M1, M2)
subroutine xddot(n, dx, incx, dy, incy, retval)
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)
void resize(octave_idx_type n, const double &rfv=0)
T elem(octave_idx_type r, octave_idx_type c) const
RowVector column_min(void) const
boolMatrix any(int dim=-1) const
Matrix Givens(double x, double y)
static Matrix stack_complex_matrix(const ComplexMatrix &cm)
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
Matrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
octave_idx_type rows(void) const
static const idx_vector colon
octave_idx_type numel(void) const
Number of elements in the array.
subroutine zffti(n, wsave)
static octave_idx_type nn
identity matrix If supplied two scalar respectively For allows like xample val
Matrix ltsolve(MatrixType &typ, 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
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
#define F77_DBLE_CMPLX_ARG(x)
NDArray sumsq(int dim=-1) const
void mx_inline_real(size_t n, T *r, const std::complex< T > *x)
#define SM_BOOL_OPS(S, M)
T unitary_matrix(void) const
NDArray prod(int dim=-1) const
Matrix cumsum(int dim=-1) const
Matrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
friend class ComplexMatrix
Matrix Sylvester(const Matrix &a, const Matrix &b, const Matrix &c)
octave_idx_type rows(void) const
RowVector row(octave_idx_type i) const
Matrix utsolve(MatrixType &typ, 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
static char get_blas_trans_arg(bool trans)
T left_singular_matrix(void) const
Matrix min(double d, const Matrix &m)
subroutine xilaenv(ispec, name, opts, n1, n2, n3, n4, retval)
double & elem(octave_idx_type n)
bool is_hermitian(void) const
Matrix & operator+=(const DiagMatrix &a)
NDArray cumprod(int dim=-1) const
#define F77_XFCN(f, F, args)
ColumnVector extract_diag(octave_idx_type k=0) const
Matrix tinverse(MatrixType &mattype, octave_idx_type &info, double &rcon, bool force, bool calc_cond) const
std::ostream & operator<<(std::ostream &os, const Matrix &a)
octave_idx_type rows(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 const F77_DBLE F77_DBLE * d
subroutine zfftb(n, c, wsave)
T schur_matrix(void) const
static int fftNd(const double *, Complex *, const int, const dim_vector &)
void mx_inline_imag(size_t n, T *r, const std::complex< T > *x)
T right_singular_matrix(void) const
Array< T > & insert(const Array< T > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
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
Matrix & fill(double val)
RowVector column_max(void) const
ColumnVector row_max(void) const
int type(bool quiet=true)
ComplexMatrix ifourier(void) const
ComplexMatrix fourier2d(void) const
Matrix max(double d, const Matrix &m)
const Array< octave_idx_type > & col_perm_vec(void) const
nd deftypefn *octave_map m
std::istream & operator>>(std::istream &is, Matrix &a)
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)
const double * data(void) const
double norm(const ColumnVector &v)
DM_T singular_values(void) 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)
Matrix transpose(void) const
F77_RET_T F77_FUNC(xstopx, XSTOPX) const
void mark_as_unsymmetric(void)
ComplexMatrix solve(MatrixType &typ, const Matrix &b) const
bool is_square(void) const
Matrix lssolve(const Matrix &b) const
OCTAVE_API double xnorm(const ColumnVector &x, double p)
Matrix xgemm(const Matrix &a, const Matrix &b, blas_trans_type transa, blas_trans_type transb)
Matrix real(const ComplexMatrix &a)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
void mark_as_rectangular(void)
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims
Matrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
With real return the complex result
Matrix fsolve(MatrixType &typ, const Matrix &b, octave_idx_type &info, double &rcon, solve_singularity_handler sing_handler, bool calc_cond=false) const
Matrix solve(MatrixType &typ, const Matrix &b) const
static int ifftNd(const Complex *, Complex *, const int, const dim_vector &)
DET determinant(void) const
double & xelem(octave_idx_type n)
Matrix & operator-=(const DiagMatrix &a)
static ComplexMatrix unstack_complex_matrix(const Matrix &sm)
octave_idx_type cols(void) const
boolNDArray all(int dim=-1) const
This is a simple wrapper template that will subclass an Array type or any later type derived from ...
Matrix imag(const ComplexMatrix &a)
Matrix stack(const Matrix &a) const
NDArray sum(int dim=-1) const
boolNDArray any(int dim=-1) const
bool operator!=(const Matrix &a) const
NDArray diag(octave_idx_type k=0) const
=val(i)}if ode{val(i)}occurs in table i
Matrix prod(int dim=-1) const
boolMatrix all(int dim=-1) const
ColumnVector column(octave_idx_type i) const
the element is set to zero In other the statement xample y
void scale(Matrix &m, double x, double y, double z)
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 $)
Matrix sumsq(int dim=-1) const
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
ColumnVector row_min(void) const
#define MS_BOOL_OPS(M, S)
#define MM_CMP_OPS(M1, M2)
char get_blas_char(blas_trans_type transt)
Matrix cumprod(int dim=-1) const
Matrix sum(int dim=-1) const
ComplexMatrix ifourier2d(void) const
std::complex< double > Complex
const T * fortran_vec(void) const
bool mx_inline_equal(size_t n, const T1 *x, const T2 *y)
octave_idx_type cols(void) const
write the output to stdout if nargout is
Vector representing the dimensions (size) of an Array.
ComplexMatrix lssolve(const Matrix &b) const
void warn_singular_matrix(double rcond)
ComplexMatrix fourier(void) const
octave_idx_type columns(void) const
Matrix pseudo_inverse(double tol=0.0) const
octave_idx_type length(void) const
Array< double > index(const idx_vector &i) const
Indexing without resizing.
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
subroutine zfftf(n, c, wsave)
Matrix inverse(void) const
ColumnVector extract(octave_idx_type r1, octave_idx_type r2) const
Matrix append(const Matrix &a) const
void resize(octave_idx_type n, const double &rfv=0)
Matrix operator*(const ColumnVector &v, const RowVector &a)
bool operator==(const Matrix &a) const