25 #if defined (HAVE_CONFIG_H) 55 #include "mx-fdm-fm.h" 56 #include "mx-fm-fdm.h" 118 elem (
i, j) =
static_cast<unsigned char> (
a.elem (
i, j));
124 if (
rows () !=
a.rows () ||
cols () !=
a.cols ())
133 return !(*
this ==
a);
166 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
167 (*current_liboctave_error_handler) (
"range error for insert");
186 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
187 (*current_liboctave_error_handler) (
"range error for insert");
207 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
208 (*current_liboctave_error_handler) (
"range error for insert");
231 if (nr > 0 && nc > 0)
250 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
251 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
252 (*current_liboctave_error_handler) (
"range error for fill");
257 if (r2 >= r1 && c2 >= c1)
279 retval.insert (*
this, 0, 0);
280 retval.insert (
a, 0, nc_insert);
290 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
294 retval.insert (*
this, 0, 0);
295 retval.insert (
a, 0, nc_insert);
304 if (nr !=
a.numel ())
309 retval.insert (*
this, 0, 0);
310 retval.insert (
a, 0, nc_insert);
324 retval.insert (*
this, 0, 0);
325 retval.insert (
a, 0, nc_insert);
339 retval.insert (*
this, 0, 0);
340 retval.insert (
a, nr_insert, 0);
349 if (nc !=
a.numel ())
354 retval.insert (*
this, 0, 0);
355 retval.insert (
a, nr_insert, 0);
365 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
369 retval.insert (*
this, 0, 0);
370 retval.insert (
a, nr_insert, 0);
384 retval.insert (*
this, 0, 0);
385 retval.insert (
a, nr_insert, 0);
442 float sum = colsum.
xelem (
i);
461 return inverse (mattype, info, rcon, 0, 0);
469 return inverse (mattype, info, rcon, 0, 0);
474 bool calc_cond)
const 477 return inverse (mattype, info, rcon, force, calc_cond);
485 return inverse (mattype, info, rcon, 0, 0);
492 return inverse (mattype, info, rcon, 0, 0);
497 bool force,
bool calc_cond)
const 504 if (nr != nc || nr == 0 || nc == 0)
505 (*current_liboctave_error_handler) (
"inverse requires square matrix");
507 int typ = mattype.
type ();
511 float *tmp_data =
retval.fortran_vec ();
515 F77_XFCN (strtri, STRTRI, (F77_CONST_CHAR_ARG2 (&uplo, 1),
516 F77_CONST_CHAR_ARG2 (&udiag, 1),
517 nr, tmp_data, nr, tmp_info
519 F77_CHAR_ARG_LEN (1)));
535 F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&job, 1),
536 F77_CONST_CHAR_ARG2 (&uplo, 1),
537 F77_CONST_CHAR_ARG2 (&udiag, 1),
538 nr, tmp_data, nr, rcon,
539 work, iwork, dtrcon_info
542 F77_CHAR_ARG_LEN (1)));
544 if (dtrcon_info != 0)
548 if (info == -1 && ! force)
556 bool force,
bool calc_cond)
const 563 if (nr != nc || nr == 0 || nc == 0)
564 (*current_liboctave_error_handler) (
"inverse requires square matrix");
567 F77_INT *pipvt = ipvt.fortran_vec ();
570 float *tmp_data =
retval.fortran_vec ();
578 F77_XFCN (sgetri, SGETRI, (nc, tmp_data, nr, pipvt,
583 lwork =
static_cast<F77_INT> (z(0));
584 lwork = (lwork < 4 * nc ? 4 * nc : lwork);
596 F77_XFCN (sgetrf, SGETRF, (nc, nc, tmp_data, nr, pipvt, tmp_info));
612 F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
613 nc, tmp_data, nr, anorm,
614 rcon, pz, piz, sgecon_info
615 F77_CHAR_ARG_LEN (1)));
617 if (sgecon_info != 0)
621 if (info == -1 && ! force)
627 F77_XFCN (sgetri, SGETRI, (nc, tmp_data, nr, pipvt,
628 pz, lwork, dgetri_info));
630 if (dgetri_info != 0)
642 bool force,
bool calc_cond)
const 644 int typ = mattype.
type (
false);
648 typ = mattype.
type (*
this);
651 ret =
tinverse (mattype, info, rcon, force, calc_cond);
660 rcon =
chol.rcond ();
663 ret =
chol.inverse ();
670 ret =
finverse (mattype, info, rcon, force, calc_cond);
672 if ((calc_cond || mattype.
ishermitian ()) && rcon == 0.
673 && ! (
numel () == 1))
700 * std::numeric_limits<float>::epsilon ();
706 while (r >= 0 && sigma.
elem (r) < tol)
720 #if defined (HAVE_FFTW) 730 size_t npts, nsamples;
732 if (nr == 1 || nc == 1)
734 npts = (nr > nc ? nr : nc);
759 size_t npts, nsamples;
761 if (nr == 1 || nc == 1)
763 npts = (nr > nc ? nr : nc);
821 if (nr == 1 || nc == 1)
823 npts = octave::to_f77_int (nr > nc ? nr : nc);
828 npts = octave::to_f77_int (nr);
864 if (nr == 1 || nc == 1)
866 npts = octave::to_f77_int (nr > nc ? nr : nc);
894 tmp_data[j] = tmp_data[j] / static_cast<float> (npts);
909 if (nr == 1 || nc == 1)
911 npts = (nr > nc ? nr : nc);
930 for (
F77_INT j = 0; j < nsamples; j++)
943 pwsave = wsave.fortran_vec ();
950 for (
F77_INT j = 0; j < nsamples; j++)
955 prow[
i] = tmp_data[
i*nr + j];
960 tmp_data[
i*nr + j] = prow[
i];
976 if (nr == 1 || nc == 1)
978 npts = (nr > nc ? nr : nc);
997 for (
F77_INT j = 0; j < nsamples; j++)
1005 for (
F77_INT j = 0; j < npts*nsamples; j++)
1006 tmp_data[j] = tmp_data[j] / static_cast<float> (npts);
1013 pwsave = wsave.fortran_vec ();
1020 for (
F77_INT j = 0; j < nsamples; j++)
1025 prow[
i] = tmp_data[
i*nr + j];
1030 tmp_data[
i*nr + j] = prow[
i] / static_cast<float> (npts);
1055 bool calc_cond)
const 1058 return determinant (mattype, info, rcon, calc_cond);
1064 bool calc_cond)
const 1075 (*current_liboctave_error_handler) (
"matrix must be square");
1077 volatile int typ = mattype.
type ();
1084 typ = mattype.
type (*
this);
1100 anorm =
norm1 (*
this);
1105 F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1106 tmp_data, nr, tmp_info
1107 F77_CHAR_ARG_LEN (1)));
1124 F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1125 nr, tmp_data, nr, anorm,
1126 rcon, pz, piz, tmp_info
1127 F77_CHAR_ARG_LEN (1)));
1141 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
1157 anorm =
norm1 (*
this);
1159 F77_XFCN (sgetrf, SGETRF, (nr, nr, tmp_data, nr, pipvt, tmp_info));
1181 F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1182 nc, tmp_data, nr, anorm,
1183 rcon, pz, piz, tmp_info
1184 F77_CHAR_ARG_LEN (1)));
1198 float c = atmp(
i,
i);
1212 return rcond (mattype);
1223 (*current_liboctave_error_handler) (
"matrix must be square");
1225 if (nr == 0 || nc == 0)
1229 volatile int typ = mattype.
type ();
1232 typ = mattype.
type (*
this);
1248 F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1249 F77_CONST_CHAR_ARG2 (&uplo, 1),
1250 F77_CONST_CHAR_ARG2 (&dia, 1),
1251 nr, tmp_data, nr, rcon,
1253 F77_CHAR_ARG_LEN (1)
1254 F77_CHAR_ARG_LEN (1)
1255 F77_CHAR_ARG_LEN (1)));
1261 (*current_liboctave_error_handler)
1262 (
"permuted triangular matrix not implemented");
1276 F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1277 F77_CONST_CHAR_ARG2 (&uplo, 1),
1278 F77_CONST_CHAR_ARG2 (&dia, 1),
1279 nr, tmp_data, nr, rcon,
1281 F77_CHAR_ARG_LEN (1)
1282 F77_CHAR_ARG_LEN (1)
1283 F77_CHAR_ARG_LEN (1)));
1289 (*current_liboctave_error_handler)
1290 (
"permuted triangular matrix not implemented");
1303 anorm =
norm1 (atmp);
1305 F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1307 F77_CHAR_ARG_LEN (1)));
1322 F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1323 nr, tmp_data, nr, anorm,
1325 F77_CHAR_ARG_LEN (1)));
1343 anorm =
norm1 (atmp);
1350 F77_XFCN (sgetrf, SGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1360 F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1361 nc, tmp_data, nr, anorm,
1363 F77_CHAR_ARG_LEN (1)));
1380 float& rcon, solve_singularity_handler sing_handler,
1392 (*current_liboctave_error_handler)
1393 (
"matrix dimension mismatch solution of linear equations");
1395 if (nr == 0 || nc == 0 ||
b_nc == 0)
1399 volatile int typ = mattype.
type ();
1407 (*current_liboctave_error_handler)
1408 (
"permuted triangular matrix not implemented");
1422 F77_XFCN (strtrs, STRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1),
1423 F77_CONST_CHAR_ARG2 (&trans, 1),
1424 F77_CONST_CHAR_ARG2 (&dia, 1),
1425 nr,
b_nc, tmp_data, nr,
1427 F77_CHAR_ARG_LEN (1)
1428 F77_CHAR_ARG_LEN (1)
1429 F77_CHAR_ARG_LEN (1)));
1444 F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1445 F77_CONST_CHAR_ARG2 (&uplo, 1),
1446 F77_CONST_CHAR_ARG2 (&dia, 1),
1447 nr, tmp_data, nr, rcon,
1449 F77_CHAR_ARG_LEN (1)
1450 F77_CHAR_ARG_LEN (1)
1451 F77_CHAR_ARG_LEN (1)));
1458 volatile float rcond_plus_one = rcon + 1.0;
1465 sing_handler (rcon);
1483 float& rcon, solve_singularity_handler sing_handler,
1495 (*current_liboctave_error_handler)
1496 (
"matrix dimension mismatch solution of linear equations");
1498 if (nr == 0 || nc == 0 ||
b_nc == 0)
1502 volatile int typ = mattype.
type ();
1510 (*current_liboctave_error_handler)
1511 (
"permuted triangular matrix not implemented");
1525 F77_XFCN (strtrs, STRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1),
1526 F77_CONST_CHAR_ARG2 (&trans, 1),
1527 F77_CONST_CHAR_ARG2 (&dia, 1),
1528 nr,
b_nc, tmp_data, nr,
1530 F77_CHAR_ARG_LEN (1)
1531 F77_CHAR_ARG_LEN (1)
1532 F77_CHAR_ARG_LEN (1)));
1547 F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1548 F77_CONST_CHAR_ARG2 (&uplo, 1),
1549 F77_CONST_CHAR_ARG2 (&dia, 1),
1550 nr, tmp_data, nr, rcon,
1552 F77_CHAR_ARG_LEN (1)
1553 F77_CHAR_ARG_LEN (1)
1554 F77_CHAR_ARG_LEN (1)));
1561 volatile float rcond_plus_one = rcon + 1.0;
1568 sing_handler (rcon);
1585 float& rcon, solve_singularity_handler sing_handler,
1586 bool calc_cond)
const 1596 if (nr != nc || nr !=
b_nr)
1597 (*current_liboctave_error_handler)
1598 (
"matrix dimension mismatch solution of linear equations");
1600 if (nr == 0 ||
b_nc == 0)
1604 volatile int typ = mattype.
type ();
1617 anorm =
norm1 (atmp);
1621 F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1622 tmp_data, nr, tmp_info
1623 F77_CHAR_ARG_LEN (1)));
1645 F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1646 nr, tmp_data, nr, anorm,
1647 rcon, pz, piz, tmp_info
1648 F77_CHAR_ARG_LEN (1)));
1655 volatile float rcond_plus_one = rcon + 1.0;
1662 sing_handler (rcon);
1673 F77_XFCN (spotrs, SPOTRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1674 nr,
b_nc, tmp_data, nr,
1676 F77_CHAR_ARG_LEN (1)));
1699 anorm =
norm1 (atmp);
1708 F77_XFCN (sgetrf, SGETRF, (nr, nr, tmp_data, nr, pipvt, tmp_info));
1719 sing_handler (rcon);
1732 F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1733 nc, tmp_data, nr, anorm,
1734 rcon, pz, piz, tmp_info
1735 F77_CHAR_ARG_LEN (1)));
1742 volatile float rcond_plus_one = rcon + 1.0;
1749 sing_handler (rcon);
1761 F77_XFCN (sgetrs, SGETRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1762 nr,
b_nc, tmp_data, nr,
1764 F77_CHAR_ARG_LEN (1)));
1773 (*current_liboctave_error_handler) (
"incorrect matrix type");
1784 return solve (mattype,
b, info, rcon,
nullptr);
1792 return solve (mattype,
b, info, rcon,
nullptr);
1799 return solve (mattype,
b, info, rcon,
nullptr);
1805 float& rcon, solve_singularity_handler sing_handler,
1809 int typ = mattype.
type ();
1812 typ = mattype.
type (*
this);
1816 retval =
utsolve (mattype,
b, info, rcon, sing_handler,
true, transt);
1818 retval =
ltsolve (mattype,
b, info, rcon, sing_handler,
true, transt);
1823 retval =
fsolve (mattype,
b, info, rcon, sing_handler,
true);
1825 (*current_liboctave_error_handler) (
"unknown matrix type");
1842 return solve (mattype,
b, info, rcon,
nullptr);
1850 return solve (mattype,
b, info, rcon,
nullptr);
1858 return solve (mattype,
b, info, rcon,
nullptr);
1869 float *rd =
retval.fortran_vec ();
1885 const float *smd = sm.
data ();
1895 float& rcon, solve_singularity_handler sing_handler,
1899 tmp =
solve (mattype,
tmp, info, rcon, sing_handler, singular_fallback,
1909 return solve (mattype,
b, info, rcon);
1917 return solve (mattype,
b, info, rcon);
1925 return solve (mattype,
b, info, rcon,
nullptr);
1931 float& rcon, solve_singularity_handler sing_handler,
1935 tmp =
solve (mattype,
tmp, info, rcon, sing_handler,
true, transt);
1936 return tmp.column (static_cast<octave_idx_type> (0));
1944 return tmp.solve (mattype,
b);
1952 return tmp.solve (mattype,
b, info);
1960 return tmp.solve (mattype,
b, info, rcon);
1966 solve_singularity_handler sing_handler,
1970 return tmp.solve (mattype,
b, info, rcon, sing_handler, transt);
1978 return solve (
b, info, rcon,
nullptr);
1985 return solve (
b, info, rcon,
nullptr);
1992 return solve (
b, info, rcon,
nullptr);
1997 float& rcon, solve_singularity_handler sing_handler,
2001 return solve (mattype,
b, info, rcon, sing_handler,
true, transt);
2008 return tmp.solve (
b);
2015 return tmp.solve (
b, info);
2023 return tmp.solve (
b, info, rcon);
2029 solve_singularity_handler sing_handler,
2033 return tmp.solve (
b, info, rcon, sing_handler, transt);
2040 return solve (
b, info, rcon);
2047 return solve (
b, info, rcon);
2054 return solve (
b, info, rcon,
nullptr);
2059 float& rcon, solve_singularity_handler sing_handler,
2063 return solve (mattype,
b, info, rcon, sing_handler, transt);
2070 return tmp.solve (
b);
2078 return tmp.solve (
b, info);
2086 return tmp.solve (
b, info, rcon);
2091 float& rcon, solve_singularity_handler sing_handler,
2095 return tmp.solve (
b, info, rcon, sing_handler, transt);
2104 return lssolve (
b, info, rank, rcon);
2112 return lssolve (
b, info, rank, rcon);
2120 return lssolve (
b, info, rank, rcon);
2130 F77_INT nrhs = octave::to_f77_int (
b.cols ());
2139 (*current_liboctave_error_handler)
2140 (
"matrix dimension mismatch solution of linear equations");
2142 if (m == 0 || n == 0 ||
b_nc == 0)
2146 volatile F77_INT minmn = (m < n ? m : n);
2147 F77_INT maxmn = (m > n ? m : n);
2153 for (
F77_INT j = 0; j < nrhs; j++)
2163 float *pretval =
retval.fortran_vec ();
2165 float *ps =
s.fortran_vec ();
2174 F77_CONST_CHAR_ARG2 (
" ", 1),
2176 F77_CHAR_ARG_LEN (6)
2177 F77_CHAR_ARG_LEN (1));
2181 F77_CONST_CHAR_ARG2 (
" ", 1),
2182 m, n, nrhs, -1, mnthr
2183 F77_CHAR_ARG_LEN (6)
2184 F77_CHAR_ARG_LEN (1));
2188 float dminmn =
static_cast<float> (minmn);
2189 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2197 F77_INT liwork = 3 * minmn * nlvl + 11 * minmn;
2206 F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2208 lwork, piwork, tmp_info));
2217 if (n > m && n >= mnthr)
2220 = 9*m + 2*m*smlsiz + 8*m*nlvl + m*nrhs + (smlsiz+1)*(smlsiz+1);
2233 if (wlalsd > addend)
2236 const F77_INT lworkaround = 4*m + m*m + addend;
2238 if (work(0) < lworkaround)
2239 work(0) = lworkaround;
2244 = 12*n + 2*n*smlsiz + 8*n*nlvl + n*nrhs + (smlsiz+1)*(smlsiz+1);
2246 if (work(0) < lworkaround)
2247 work(0) = lworkaround;
2250 lwork =
static_cast<F77_INT> (work(0));
2253 anorm =
norm1 (*
this);
2269 F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval,
2270 maxmn, ps, rcon, tmp_rank,
2277 if (
s.elem (0) == 0.0)
2280 rcon =
s.elem (minmn - 1) /
s.elem (0);
2296 return tmp.lssolve (
b, info, rank, rcon);
2305 return tmp.lssolve (
b, info, rank, rcon);
2314 return tmp.lssolve (
b, info, rank, rcon);
2322 return tmp.lssolve (
b, info, rank, rcon);
2331 return lssolve (
b, info, rank, rcon);
2339 return lssolve (
b, info, rank, rcon);
2347 return lssolve (
b, info, rank, rcon);
2361 if (m !=
b.numel ())
2363 (
"matrix dimension mismatch solution of linear equations");
2365 if (m == 0 || n == 0)
2369 volatile F77_INT minmn = (m < n ? m : n);
2370 F77_INT maxmn = (m > n ? m : n);
2386 float *pretval =
retval.fortran_vec ();
2388 float *ps =
s.fortran_vec ();
2397 F77_CONST_CHAR_ARG2 (
" ", 1),
2399 F77_CHAR_ARG_LEN (6)
2400 F77_CHAR_ARG_LEN (1));
2404 float dminmn =
static_cast<float> (minmn);
2405 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2412 F77_INT liwork = 3 * minmn * nlvl + 11 * minmn;
2421 F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2423 lwork, piwork, tmp_info));
2428 lwork =
static_cast<F77_INT> (work(0));
2431 F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval,
2432 maxmn, ps, rcon, tmp_rank,
2441 if (
s.elem (0) == 0.0)
2444 rcon =
s.elem (minmn - 1) /
s.elem (0);
2460 return tmp.lssolve (
b, info, rank, rcon);
2470 return tmp.lssolve (
b, info, rank, rcon);
2479 return tmp.lssolve (
b, info, rank, rcon);
2487 return tmp.lssolve (
b, info, rank, rcon);
2537 F77_INT a_len = octave::to_f77_int (
a.numel ());
2540 float *
c =
retval.fortran_vec ();
2542 F77_XFCN (sgemm, SGEMM, (F77_CONST_CHAR_ARG2 (
"N", 1),
2543 F77_CONST_CHAR_ARG2 (
"N", 1),
2544 len, a_len, 1, 1.0, v.
data (), len,
2545 a.data (), 1, 0.0,
c, len
2546 F77_CHAR_ARG_LEN (1)
2547 F77_CHAR_ARG_LEN (1)));
2605 if (nr == 1 || nc == 1)
2628 if (nr > 0 && nc > 0)
2639 for (idx_j = 0; idx_j < nc; idx_j++)
2641 tmp_min =
elem (
i, idx_j);
2653 else if (
tmp < tmp_min)
2683 if (nr > 0 && nc > 0)
2694 for (idx_j = 0; idx_j < nc; idx_j++)
2696 tmp_max =
elem (
i, idx_j);
2708 else if (
tmp > tmp_max)
2738 if (nr > 0 && nc > 0)
2749 for (idx_i = 0; idx_i < nr; idx_i++)
2751 tmp_min =
elem (idx_i, j);
2763 else if (
tmp < tmp_min)
2770 result.elem (j) = tmp_min;
2793 if (nr > 0 && nc > 0)
2804 for (idx_i = 0; idx_i < nr; idx_i++)
2806 tmp_max =
elem (idx_i, j);
2818 else if (
tmp > tmp_max)
2825 result.elem (j) = tmp_max;
2854 if (nr > 0 && nc > 0)
2860 tmp = octave_read_value<float> (
is);
2862 a.elem (
i, j) =
tmp;
2874 float cc,
s, temp_r;
2923 F77_XFCN (strsyl, STRSYL, (F77_CONST_CHAR_ARG2 (
"N", 1),
2924 F77_CONST_CHAR_ARG2 (
"N", 1),
2927 F77_CHAR_ARG_LEN (1)
2928 F77_CHAR_ARG_LEN (1)));
2961 return trans ?
'T' :
'N';
2975 F77_INT a_nr = octave::to_f77_int (tra ?
a.cols () :
a.rows ());
2976 F77_INT a_nc = octave::to_f77_int (tra ?
a.rows () :
a.cols ());
2978 F77_INT b_nr = octave::to_f77_int (trb ?
b.cols () :
b.rows ());
2979 F77_INT b_nc = octave::to_f77_int (trb ?
b.rows () :
b.cols ());
2986 else if (
a.data () ==
b.data () &&
a_nr ==
b_nc && tra != trb)
2988 F77_INT lda = octave::to_f77_int (
a.rows ());
2991 float *
c =
retval.fortran_vec ();
2994 F77_XFCN (ssyrk, SSYRK, (F77_CONST_CHAR_ARG2 (
"U", 1),
2995 F77_CONST_CHAR_ARG2 (&ctra, 1),
2997 a.data (), lda, 0.0,
c,
a_nr 2998 F77_CHAR_ARG_LEN (1)
2999 F77_CHAR_ARG_LEN (1)));
3000 for (
int j = 0; j <
a_nr; j++)
3001 for (
int i = 0;
i < j;
i++)
3007 F77_INT lda = octave::to_f77_int (
a.rows ());
3008 F77_INT tda = octave::to_f77_int (
a.cols ());
3009 F77_INT ldb = octave::to_f77_int (
b.rows ());
3010 F77_INT tdb = octave::to_f77_int (
b.cols ());
3013 float *
c =
retval.fortran_vec ();
3022 F77_XFCN (sgemv, SGEMV, (F77_CONST_CHAR_ARG2 (&ctra, 1),
3023 lda, tda, 1.0,
a.data (), lda,
3024 b.data (), 1, 0.0,
c, 1
3025 F77_CHAR_ARG_LEN (1)));
3031 F77_XFCN (sgemv, SGEMV, (F77_CONST_CHAR_ARG2 (&crevtrb, 1),
3032 ldb, tdb, 1.0,
b.data (), ldb,
3033 a.data (), 1, 0.0,
c, 1
3034 F77_CHAR_ARG_LEN (1)));
3040 F77_XFCN (sgemm, SGEMM, (F77_CONST_CHAR_ARG2 (&ctra, 1),
3041 F77_CONST_CHAR_ARG2 (&ctrb, 1),
3043 lda,
b.data (), ldb, 0.0,
c,
a_nr 3044 F77_CHAR_ARG_LEN (1)
3045 F77_CHAR_ARG_LEN (1)));
3060 #define EMPTY_RETURN_CHECK(T) \ 3061 if (nr == 0 || nc == 0) \ 3110 if (nr !=
b.rows () || nc !=
b.columns ())
3112 (
"two-arg min requires same size arguments");
3174 if (nr !=
b.rows () || nc !=
b.columns ())
3176 (
"two-arg max requires same size arguments");
3199 if (x2.
numel () != m)
3201 (
"linspace: vectors must be of equal length");
3216 float *delta = &
retval(0, n-1);
3218 delta[
i] = (x2(
i) - x1(
i)) / (n - 1);
FloatMatrix append(const FloatMatrix &a) const
FloatMatrix xgemm(const FloatMatrix &a, const FloatMatrix &b, blas_trans_type transa, blas_trans_type transb)
octave_idx_type rows(void) const
FloatColumnVector extract_diag(octave_idx_type k=0) const
FloatMatrix lssolve(const FloatMatrix &b) const
#define EMPTY_RETURN_CHECK(T)
FloatMatrix solve(MatrixType &mattype, const FloatMatrix &b) const
F77_RET_T const F77_INT const F77_INT const F77_INT const F77_DBLE const F77_DBLE F77_INT F77_DBLE * V
FloatMatrix & operator-=(const FloatDiagMatrix &a)
FloatMatrix operator*(const FloatColumnVector &v, const FloatRowVector &a)
#define MM_BOOL_OPS(M1, M2)
std::ostream & operator<<(std::ostream &os, const FloatMatrix &a)
FloatMatrix & insert(const FloatMatrix &a, octave_idx_type r, octave_idx_type c)
FloatMatrix min(float d, const FloatMatrix &m)
FloatMatrix Givens(float x, float y)
const float * data(void) const
FloatComplexMatrix fourier(void) const
FloatComplexMatrix ifourier(void) const
FloatMatrix & operator+=(const FloatDiagMatrix &a)
static const idx_vector colon
FloatRowVector row(octave_idx_type i) const
identity matrix If supplied two scalar respectively For allows like xample val
bool ishermitian(void) const
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
bool operator==(const FloatMatrix &a) const
void mx_inline_real(size_t n, T *r, const std::complex< T > *x)
#define SM_BOOL_OPS(S, M)
FloatMatrix & fill(float val)
const T * fortran_vec(void) const
std::istream & operator>>(std::istream &is, FloatMatrix &a)
static char get_blas_trans_arg(bool trans)
FloatMatrix cumsum(int dim=-1) const
FloatColumnVector row_min(void) const
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)
static int fftNd(const double *, Complex *, const int, const dim_vector &)
FloatColumnVector row_max(void) const
subroutine xilaenv(ispec, name, opts, n1, n2, n3, n4, retval)
FloatMatrix utsolve(MatrixType &mattype, const FloatMatrix &b, octave_idx_type &info, float &rcon, solve_singularity_handler sing_handler, bool calc_cond=false, blas_trans_type transt=blas_no_trans) const
octave_idx_type columns(void) const
float & elem(octave_idx_type n)
FloatMatrix cumprod(int dim=-1) const
FloatNDArray sumsq(int dim=-1) const
static float norm1(const FloatMatrix &a)
subroutine cfftb(n, c, wsave)
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
#define F77_XFCN(f, F, args)
Complex log2(const Complex &x)
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
FloatNDArray prod(int dim=-1) const
void mx_inline_imag(size_t n, T *r, const std::complex< T > *x)
octave_idx_type cols(void) const
octave_value resize(const dim_vector &dv, bool fill=false) const
FloatMatrix sum(int dim=-1) 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
base_det< float > FloatDET
FloatNDArray cumsum(int dim=-1) const
FloatComplexMatrix fourier2d(void) const
bool issymmetric(void) const
FloatMatrix tinverse(MatrixType &mattype, octave_idx_type &info, float &rcon, bool force, bool calc_cond) const
subroutine cffti(n, wsave)
FloatColumnVector extract(octave_idx_type r1, octave_idx_type r2) const
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)
int type(bool quiet=true)
Array< float > index(const idx_vector &i) const
Indexing without resizing.
bool issquare(void) const
T schur_matrix(void) const
bool operator!=(const FloatMatrix &a) const
FloatMatrix pseudo_inverse(float tol=0.0) const
FloatMatrix imag(const FloatComplexMatrix &a)
FloatMatrix real(const FloatComplexMatrix &a)
FloatMatrix stack(const FloatMatrix &a) const
FloatNDArray cumprod(int dim=-1) const
double norm(const ColumnVector &v)
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
FloatMatrix fsolve(MatrixType &mattype, const FloatMatrix &b, octave_idx_type &info, float &rcon, solve_singularity_handler sing_handler, bool calc_cond=false) const
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
subroutine cfftf(n, c, wsave)
void mark_as_unsymmetric(void)
FloatMatrix inverse(void) const
T unitary_matrix(void) const
subroutine xsdot(n, dx, incx, dy, incy, retval)
FloatMatrix transpose(void) const
FloatRowVector column_max(void) const
FloatMatrix sumsq(int dim=-1) const
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
F77_RET_T F77_FUNC(xerbla, XERBLA)
With real return the complex result
friend class FloatComplexMatrix
float & xelem(octave_idx_type n)
FloatNDArray sum(int dim=-1) const
This is a simple wrapper template that will subclass an Array<T> type or any later type derived from ...
FloatComplexMatrix ifourier2d(void) const
void octave_write_float(std::ostream &os, float d)
FloatMatrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
octave_f77_int_type F77_INT
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$)
FloatNDArray diag(octave_idx_type k=0) const
FloatMatrix prod(int dim=-1) const
FloatRowVector column_min(void) const
static FloatComplexMatrix unstack_complex_matrix(const FloatMatrix &sm)
static int ifftNd(const Complex *, Complex *, const int, const dim_vector &)
the element is set to zero In other the statement xample y
void scale(Matrix &m, double x, double y, double z)
FloatMatrix diag(octave_idx_type k=0) const
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
#define MS_BOOL_OPS(M, S)
#define MM_CMP_OPS(M1, M2)
char get_blas_char(blas_trans_type transt)
FloatNDArray & insert(const FloatNDArray &a, octave_idx_type r, octave_idx_type c)
FloatNDArray abs(void) const
FloatDET determinant(void) const
std::complex< float > FloatComplex
FloatMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
FloatMatrix Sylvester(const FloatMatrix &a, const FloatMatrix &b, const FloatMatrix &c)
FloatColumnVector column(octave_idx_type i) const
octave_idx_type numel(void) const
Number of elements in the array.
bool mx_inline_equal(size_t n, const T1 *x, const T2 *y)
write the output to stdout if nargout is
Vector representing the dimensions (size) of an Array.
void warn_singular_matrix(double rcond)
static FloatMatrix stack_complex_matrix(const FloatComplexMatrix &cm)
FloatMatrix abs(void) const
FloatMatrix finverse(MatrixType &mattype, octave_idx_type &info, float &rcon, bool force, bool calc_cond) const
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
FloatMatrix linspace(const FloatColumnVector &x1, const FloatColumnVector &x2, octave_idx_type n)
FloatMatrix max(float d, const FloatMatrix &m)
FloatMatrix ltsolve(MatrixType &mattype, const FloatMatrix &b, octave_idx_type &info, float &rcon, solve_singularity_handler sing_handler, bool calc_cond=false, blas_trans_type transt=blas_no_trans) const