26 #if defined (HAVE_CONFIG_H)
143 elem (i, j) =
static_cast<unsigned char> (a.
elem (i, j));
151 (*current_liboctave_error_handler) (
"complex: internal error");
170 return !(*
this == a);
201 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
202 (*current_liboctave_error_handler) (
"range error for insert");
204 if (a_nr >0 && a_nc > 0)
222 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
223 (*current_liboctave_error_handler) (
"range error for insert");
242 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
243 (*current_liboctave_error_handler) (
"range error for insert");
263 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
264 (*current_liboctave_error_handler) (
"range error for insert");
266 fill (0.0,
r, c,
r + a_nr - 1, c + a_nc - 1);
294 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
295 (*current_liboctave_error_handler) (
"range error for insert");
309 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
310 (*current_liboctave_error_handler) (
"range error for insert");
330 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
331 (*current_liboctave_error_handler) (
"range error for insert");
333 fill (0.0,
r, c,
r + a_nr - 1, c + a_nc - 1);
354 if (nr > 0 && nc > 0)
372 if (nr > 0 && nc > 0)
391 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
392 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
393 (*current_liboctave_error_handler) (
"range error for fill");
395 if (r1 > r2) { std::swap (r1, r2); }
396 if (c1 > c2) { std::swap (c1, c2); }
398 if (r2 >= r1 && c2 >= c1)
418 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
419 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
420 (*current_liboctave_error_handler) (
"range error for fill");
422 if (r1 > r2) { std::swap (r1, r2); }
423 if (c1 > c2) { std::swap (c1, c2); }
425 if (r2 >= r1 && c2 >=c1)
443 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
447 retval.
insert (*
this, 0, 0);
448 retval.
insert (a, 0, nc_insert);
458 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
462 retval.
insert (*
this, 0, 0);
463 retval.
insert (a, 0, nc_insert);
472 if (nr != a.
numel ())
473 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
477 retval.
insert (*
this, 0, 0);
478 retval.
insert (a, 0, nc_insert);
488 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
492 retval.
insert (*
this, 0, 0);
493 retval.
insert (a, 0, nc_insert);
503 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
507 retval.
insert (*
this, 0, 0);
508 retval.
insert (a, 0, nc_insert);
518 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
522 retval.
insert (*
this, 0, 0);
523 retval.
insert (a, 0, nc_insert);
532 if (nr != a.
numel ())
533 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
537 retval.
insert (*
this, 0, 0);
538 retval.
insert (a, 0, nc_insert);
548 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
552 retval.
insert (*
this, 0, 0);
553 retval.
insert (a, 0, nc_insert);
563 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
567 retval.
insert (*
this, 0, 0);
568 retval.
insert (a, nr_insert, 0);
577 if (nc != a.
numel ())
578 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
582 retval.
insert (*
this, 0, 0);
583 retval.
insert (a, nr_insert, 0);
593 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
597 retval.
insert (*
this, 0, 0);
598 retval.
insert (a, nr_insert, 0);
608 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
612 retval.
insert (*
this, 0, 0);
613 retval.
insert (a, nr_insert, 0);
623 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
627 retval.
insert (*
this, 0, 0);
628 retval.
insert (a, nr_insert, 0);
637 if (nc != a.
numel ())
638 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
642 retval.
insert (*
this, 0, 0);
643 retval.
insert (a, nr_insert, 0);
653 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
657 retval.
insert (*
this, 0, 0);
658 retval.
insert (a, nr_insert, 0);
668 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
672 retval.
insert (*
this, 0, 0);
673 retval.
insert (a, nr_insert, 0);
680 return do_mx_unary_map<FloatComplex, FloatComplex, std::conj<float>> (a);
689 if (r1 > r2) { std::swap (r1, r2); }
690 if (c1 > c2) { std::swap (c1, c2); }
726 float sum = colsum.
xelem (i);
745 return inverse (mattype, info, rcon, 0, 0);
753 return inverse (mattype, info, rcon, 0, 0);
758 bool calc_cond)
const
761 return inverse (mattype, info, rcon, force, calc_cond);
769 return inverse (mattype, info, rcon, 0, 0);
776 return inverse (mattype, info, rcon, 0, 0);
781 float& rcon,
bool force,
bool calc_cond)
const
788 if (nr != nc || nr == 0 || nc == 0)
789 (*current_liboctave_error_handler) (
"inverse requires square matrix");
791 int typ = mattype.
type ();
799 F77_XFCN (ctrtri, CTRTRI, (F77_CONST_CHAR_ARG2 (&uplo, 1),
800 F77_CONST_CHAR_ARG2 (&udiag, 1),
803 F77_CHAR_ARG_LEN (1)));
819 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&job, 1),
820 F77_CONST_CHAR_ARG2 (&uplo, 1),
821 F77_CONST_CHAR_ARG2 (&udiag, 1),
826 F77_CHAR_ARG_LEN (1)));
828 if (ztrcon_info != 0)
832 if (info == -1 && ! force)
840 float& rcon,
bool force,
bool calc_cond)
const
848 (*current_liboctave_error_handler) (
"inverse requires square matrix");
851 F77_INT *pipvt = ipvt.fortran_vec ();
868 lwork = (lwork < 2 * nc ? 2 * nc : lwork);
876 float anorm = norm1 (retval);
905 float *prz = rz.fortran_vec ();
906 F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
909 F77_CHAR_ARG_LEN (1)));
911 if (cgecon_info != 0)
916 if ((info == -1 && ! force)
926 if (zgetri_info != 0)
938 float& rcon,
bool force,
bool calc_cond)
const
940 int typ = mattype.
type (
false);
944 typ = mattype.
type (*
this);
971 ret = tinverse (mattype, info, rcon, force, calc_cond);
976 octave::math::chol<FloatComplexMatrix>
chol (*
this, info,
true, calc_cond);
990 ret = finverse (mattype, info, rcon, force, calc_cond);
992 if ((calc_cond || mattype.
ishermitian ()) && rcon == 0.0)
1007 octave::math::svd<FloatComplexMatrix> result
1008 (*
this, octave::math::svd<FloatComplexMatrix>::Type::economy);
1023 * std::numeric_limits<float>::epsilon ();
1029 while (
r >= 0 && sigma.
elem (
r) < tol)
1045 #if defined (HAVE_FFTW)
1050 std::size_t nr =
rows ();
1051 std::size_t nc =
cols ();
1055 std::size_t npts, nsamples;
1057 if (nr == 1 || nc == 1)
1059 npts = (nr > nc ? nr : nc);
1071 octave::fftw::fft (in, out, npts, nsamples);
1079 std::size_t nr =
rows ();
1080 std::size_t nc =
cols ();
1084 std::size_t npts, nsamples;
1086 if (nr == 1 || nc == 1)
1088 npts = (nr > nc ? nr : nc);
1100 octave::fftw::ifft (in, out, npts, nsamples);
1114 octave::fftw::fftNd (in, out, 2, dv);
1128 octave::fftw::ifftNd (in, out, 2, dv);
1138 (*current_liboctave_error_handler)
1139 (
"support for FFTW was unavailable or disabled when liboctave was built");
1147 (*current_liboctave_error_handler)
1148 (
"support for FFTW was unavailable or disabled when liboctave was built");
1156 (*current_liboctave_error_handler)
1157 (
"support for FFTW was unavailable or disabled when liboctave was built");
1165 (*current_liboctave_error_handler)
1166 (
"support for FFTW was unavailable or disabled when liboctave was built");
1190 bool calc_cond)
const
1193 return determinant (mattype, info, rcon, calc_cond);
1199 bool calc_cond)
const
1210 (*current_liboctave_error_handler) (
"matrix must be square");
1212 volatile int typ = mattype.
type ();
1219 typ = mattype.
type (*
this);
1225 for (
F77_INT i = 0; i < nc; i++)
1226 retval *=
elem (i, i);
1235 anorm = norm1 (*
this);
1240 F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1242 F77_CHAR_ARG_LEN (1)));
1261 F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1264 F77_CHAR_ARG_LEN (1)));
1272 for (
F77_INT i = 0; i < nc; i++)
1273 retval *= atmp(i, i);
1275 retval = retval.
square ();
1279 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
1292 float anorm = norm1 (*
this);
1325 F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1328 F77_CHAR_ARG_LEN (1)));
1340 for (
F77_INT i = 0; i < nc; i++)
1343 retval *= (ipvt(i) != (i+1)) ? -c : c;
1356 return rcond (mattype);
1367 (*current_liboctave_error_handler) (
"matrix must be square");
1369 if (nr == 0 || nc == 0)
1373 volatile int typ = mattype.
type ();
1376 typ = mattype.
type (*
this);
1392 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1393 F77_CONST_CHAR_ARG2 (&uplo, 1),
1394 F77_CONST_CHAR_ARG2 (&dia, 1),
1397 F77_CHAR_ARG_LEN (1)
1398 F77_CHAR_ARG_LEN (1)
1399 F77_CHAR_ARG_LEN (1)));
1405 (*current_liboctave_error_handler)
1406 (
"permuted triangular matrix not implemented");
1420 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1421 F77_CONST_CHAR_ARG2 (&uplo, 1),
1422 F77_CONST_CHAR_ARG2 (&dia, 1),
1425 F77_CHAR_ARG_LEN (1)
1426 F77_CHAR_ARG_LEN (1)
1427 F77_CHAR_ARG_LEN (1)));
1433 (*current_liboctave_error_handler)
1434 (
"permuted triangular matrix not implemented");
1447 anorm = norm1 (atmp);
1449 F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1451 F77_CHAR_ARG_LEN (1)));
1467 F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1470 F77_CHAR_ARG_LEN (1)));
1488 anorm = norm1 (atmp);
1510 F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1513 F77_CHAR_ARG_LEN (1)));
1530 solve_singularity_handler sing_handler,
1542 (*current_liboctave_error_handler)
1543 (
"matrix dimension mismatch solution of linear equations");
1545 if (nr == 0 || nc == 0 || b_nc == 0)
1549 volatile int typ = mattype.
type ();
1557 (*current_liboctave_error_handler)
1558 (
"permuted triangular matrix not implemented");
1572 F77_XFCN (ctrtrs, CTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1),
1573 F77_CONST_CHAR_ARG2 (&trans, 1),
1574 F77_CONST_CHAR_ARG2 (&dia, 1),
1577 F77_CHAR_ARG_LEN (1)
1578 F77_CHAR_ARG_LEN (1)
1579 F77_CHAR_ARG_LEN (1)));
1592 float *prz = rz.fortran_vec ();
1594 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1595 F77_CONST_CHAR_ARG2 (&uplo, 1),
1596 F77_CONST_CHAR_ARG2 (&dia, 1),
1599 F77_CHAR_ARG_LEN (1)
1600 F77_CHAR_ARG_LEN (1)
1601 F77_CHAR_ARG_LEN (1)));
1608 volatile float rcond_plus_one = rcon + 1.0;
1615 sing_handler (rcon);
1632 solve_singularity_handler sing_handler,
1644 (*current_liboctave_error_handler)
1645 (
"matrix dimension mismatch solution of linear equations");
1647 if (nr == 0 || nc == 0 || b_nc == 0)
1651 volatile int typ = mattype.
type ();
1659 (*current_liboctave_error_handler)
1660 (
"permuted triangular matrix not implemented");
1674 F77_XFCN (ctrtrs, CTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1),
1675 F77_CONST_CHAR_ARG2 (&trans, 1),
1676 F77_CONST_CHAR_ARG2 (&dia, 1),
1679 F77_CHAR_ARG_LEN (1)
1680 F77_CHAR_ARG_LEN (1)
1681 F77_CHAR_ARG_LEN (1)));
1694 float *prz = rz.fortran_vec ();
1696 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&
norm, 1),
1697 F77_CONST_CHAR_ARG2 (&uplo, 1),
1698 F77_CONST_CHAR_ARG2 (&dia, 1),
1701 F77_CHAR_ARG_LEN (1)
1702 F77_CHAR_ARG_LEN (1)
1703 F77_CHAR_ARG_LEN (1)));
1710 volatile float rcond_plus_one = rcon + 1.0;
1717 sing_handler (rcon);
1734 solve_singularity_handler sing_handler,
1735 bool calc_cond)
const
1745 if (nr != nc || nr != b_nr)
1746 (*current_liboctave_error_handler)
1747 (
"matrix dimension mismatch solution of linear equations");
1749 if (nr == 0 || b_nc == 0)
1753 volatile int typ = mattype.
type ();
1768 anorm = norm1 (atmp);
1772 F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1774 F77_CHAR_ARG_LEN (1)));
1794 float *prz = rz.fortran_vec ();
1796 F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1799 F77_CHAR_ARG_LEN (1)));
1806 volatile float rcond_plus_one = rcon + 1.0;
1813 sing_handler (rcon);
1824 F77_XFCN (cpotrs, CPOTRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1827 F77_CHAR_ARG_LEN (1)));
1844 F77_INT *pipvt = ipvt.fortran_vec ();
1852 float *prz = rz.fortran_vec ();
1855 if (calc_cond && anorm < 0.0)
1856 anorm = norm1 (atmp);
1867 nr, pipvt, tmp_info));
1879 sing_handler (rcon);
1891 F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1894 F77_CHAR_ARG_LEN (1)));
1901 volatile float rcond_plus_one = rcon + 1.0;
1906 sing_handler (rcon);
1918 F77_XFCN (cgetrs, CGETRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1921 F77_CHAR_ARG_LEN (1)));
1946 return solve (mattype, b, info, rcon,
nullptr);
1954 return solve (mattype, b, info, rcon,
nullptr);
1961 return solve (mattype, b, info, rcon,
nullptr);
1967 solve_singularity_handler sing_handler,
1971 return solve (mattype, tmp, info, rcon, sing_handler, singular_fallback,
1981 return solve (mattype, b, info, rcon,
nullptr);
1989 return solve (mattype, b, info, rcon,
nullptr);
1996 return solve (mattype, b, info, rcon,
nullptr);
2002 solve_singularity_handler sing_handler,
2003 bool singular_fallback,
2007 int typ = mattype.
type ();
2010 typ = mattype.
type (*
this);
2014 retval = utsolve (mattype, b, info, rcon, sing_handler,
true, transt);
2017 retval = ltsolve (mattype, b, info, rcon, sing_handler,
true, transt);
2022 retval =
hermitian ().
solve (mattype, b, info, rcon, sing_handler,
2025 retval = fsolve (mattype, b, info, rcon, sing_handler,
true);
2027 (*current_liboctave_error_handler) (
"unknown matrix type");
2033 retval =
lssolve (b, info, rank, rcon);
2066 solve_singularity_handler sing_handler,
2070 sing_handler, transt);
2079 return solve (mattype, b, info, rcon,
nullptr);
2088 return solve (mattype, b, info, rcon,
nullptr);
2096 return solve (mattype, b, info, rcon,
nullptr);
2103 solve_singularity_handler sing_handler,
2108 tmp =
solve (mattype, tmp, info, rcon, sing_handler,
true, transt);
2117 return solve (b, info, rcon,
nullptr);
2124 return solve (b, info, rcon,
nullptr);
2131 return solve (b, info, rcon,
nullptr);
2137 solve_singularity_handler sing_handler,
2141 return solve (tmp, info, rcon, sing_handler, transt);
2149 return solve (b, info, rcon,
nullptr);
2157 return solve (b, info, rcon,
nullptr);
2164 return solve (b, info, rcon,
nullptr);
2170 solve_singularity_handler sing_handler,
2174 return solve (mattype, b, info, rcon, sing_handler,
true, transt);
2203 solve_singularity_handler sing_handler,
2214 return solve (b, info, rcon,
nullptr);
2222 return solve (b, info, rcon,
nullptr);
2230 return solve (b, info, rcon,
nullptr);
2237 solve_singularity_handler sing_handler,
2241 return solve (mattype, b, info, rcon, sing_handler, transt);
2282 return lssolve (b, info, rank, rcon);
2291 return lssolve (b, info, rank, rcon);
2299 return lssolve (b, info, rank, rcon);
2316 (*current_liboctave_error_handler)
2317 (
"matrix dimension mismatch solution of linear equations");
2319 if (
m == 0 ||
n == 0 || b_nc == 0)
2331 for (
F77_INT j = 0; j < nrhs; j++)
2333 retval.
elem (i, j) = b.
elem (i, j);
2352 F77_CONST_CHAR_ARG2 (
" ", 1),
2354 F77_CHAR_ARG_LEN (6)
2355 F77_CHAR_ARG_LEN (1));
2359 F77_CONST_CHAR_ARG2 (
" ", 1),
2360 m,
n, nrhs, -1, mnthr
2361 F77_CHAR_ARG_LEN (6)
2362 F77_CHAR_ARG_LEN (1));
2367 float dminmn =
static_cast<float> (minmn);
2368 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2375 F77_INT lrwork = minmn*(10 + 2*smlsiz + 8*nlvl)
2378 n*(1+nrhs) + 2*nrhs);
2384 F77_INT liwork = 3 * minmn * nlvl + 11 * minmn;
2396 lwork, prwork, piwork, tmp_info));
2405 if (
n >
m &&
n >= mnthr)
2418 const F77_INT lworkaround = 4*
m +
m*
m + addend;
2421 work(0) = lworkaround;
2428 work(0) = lworkaround;
2434 float anorm = norm1 (*
this);
2451 maxmn, ps, rcon, tmp_rank,
2453 lwork, prwork, piwork, tmp_info));
2458 if (s.
elem (0) == 0.0)
2461 rcon = s.
elem (minmn - 1) / s.
elem (0);
2509 return lssolve (b, info, rank, rcon);
2518 return lssolve (b, info, rank, rcon);
2527 return lssolve (b, info, rank, rcon);
2546 (*current_liboctave_error_handler)
2547 (
"matrix dimension mismatch solution of linear equations");
2549 if (
m == 0 ||
n == 0)
2581 F77_CONST_CHAR_ARG2 (
" ", 1),
2583 F77_CHAR_ARG_LEN (6)
2584 F77_CHAR_ARG_LEN (1));
2589 float dminmn =
static_cast<float> (minmn);
2590 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2597 F77_INT lrwork = minmn*(10 + 2*smlsiz + 8*nlvl)
2598 + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1);
2604 F77_INT liwork = 3 * minmn * nlvl + 11 * minmn;
2616 lwork, prwork, piwork, tmp_info));
2628 maxmn, ps, rcon, tmp_rank,
2630 prwork, piwork, tmp_info));
2637 if (s.
elem (0) == 0.0)
2640 rcon = s.
elem (minmn - 1) / s.
elem (0);
2679 F77_XFCN (cgemm, CGEMM, (F77_CONST_CHAR_ARG2 (
"N", 1),
2680 F77_CONST_CHAR_ARG2 (
"N", 1),
2683 F77_CHAR_ARG_LEN (1)
2684 F77_CHAR_ARG_LEN (1)));
2701 if (nr != a_nr || nc != a_nc)
2719 if (nr != a_nr || nc != a_nc)
2737 if (nr != a_nr || nc != a_nc)
2755 if (nr != a_nr || nc != a_nc)
2775 if (nr != a_nr || nc != a_nc)
2778 if (nr == 0 || nc == 0)
2796 if (nr != a_nr || nc != a_nc)
2799 if (nr == 0 || nc == 0)
2872 if (nr == 1 || nc == 1)
2933 if (nr > 0 && nc > 0)
2948 for (idx_j = 0; idx_j < nc; idx_j++)
2950 tmp_min =
elem (i, idx_j);
2954 abs_min = (real_only ? tmp_min.real ()
2955 : std::abs (tmp_min));
2967 float abs_tmp = (real_only ? tmp.real () : std::abs (tmp));
2969 if (abs_tmp < abs_min)
2979 result.
elem (i) = FloatComplex_NaN_result;
2980 idx_arg.
elem (i) = 0;
2984 result.
elem (i) = tmp_min;
2985 idx_arg.
elem (i) = idx_j;
3008 if (nr > 0 && nc > 0)
3023 for (idx_j = 0; idx_j < nc; idx_j++)
3025 tmp_max =
elem (i, idx_j);
3029 abs_max = (real_only ? tmp_max.real ()
3030 : std::abs (tmp_max));
3042 float abs_tmp = (real_only ? tmp.real () : std::abs (tmp));
3044 if (abs_tmp > abs_max)
3054 result.
elem (i) = FloatComplex_NaN_result;
3055 idx_arg.
elem (i) = 0;
3059 result.
elem (i) = tmp_max;
3060 idx_arg.
elem (i) = idx_j;
3083 if (nr > 0 && nc > 0)
3098 for (idx_i = 0; idx_i < nr; idx_i++)
3100 tmp_min =
elem (idx_i, j);
3104 abs_min = (real_only ? tmp_min.real ()
3105 : std::abs (tmp_min));
3117 float abs_tmp = (real_only ? tmp.real () : std::abs (tmp));
3119 if (abs_tmp < abs_min)
3129 result.
elem (j) = FloatComplex_NaN_result;
3130 idx_arg.
elem (j) = 0;
3134 result.
elem (j) = tmp_min;
3135 idx_arg.
elem (j) = idx_i;
3158 if (nr > 0 && nc > 0)
3173 for (idx_i = 0; idx_i < nr; idx_i++)
3175 tmp_max =
elem (idx_i, j);
3179 abs_max = (real_only ? tmp_max.real ()
3180 : std::abs (tmp_max));
3192 float abs_tmp = (real_only ? tmp.real () : std::abs (tmp));
3194 if (abs_tmp > abs_max)
3204 result.
elem (j) = FloatComplex_NaN_result;
3205 idx_arg.
elem (j) = 0;
3209 result.
elem (j) = tmp_max;
3210 idx_arg.
elem (j) = idx_i;
3228 octave::write_value<Complex> (os, a.
elem (i, j));
3241 if (nr > 0 && nc > 0)
3247 tmp = octave::read_value<FloatComplex> (is);
3249 a.
elem (i, j) = tmp;
3288 octave::math::schur<FloatComplexMatrix> as (a,
"U");
3289 octave::math::schur<FloatComplexMatrix> bs (b,
"U");
3314 F77_XFCN (ctrsyl, CTRSYL, (F77_CONST_CHAR_ARG2 (
"N", 1),
3315 F77_CONST_CHAR_ARG2 (
"N", 1),
3318 F77_CHAR_ARG_LEN (1)
3319 F77_CHAR_ARG_LEN (1)));
3370 get_blas_trans_arg (
bool trans,
bool conj)
3372 return trans ? (
conj ?
'C' :
'T') :
'N';
3397 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
3399 else if (a.
data () == b.
data () && a_nr == b_nc && tra != trb)
3411 const char ctra = get_blas_trans_arg (tra, cja);
3414 F77_XFCN (cherk, CHERK, (F77_CONST_CHAR_ARG2 (
"U", 1),
3415 F77_CONST_CHAR_ARG2 (&ctra, 1),
3418 F77_CHAR_ARG_LEN (1)
3419 F77_CHAR_ARG_LEN (1)));
3420 for (
F77_INT j = 0; j < a_nr; j++)
3421 for (
F77_INT i = 0; i < j; i++)
3426 F77_XFCN (csyrk, CSYRK, (F77_CONST_CHAR_ARG2 (
"U", 1),
3427 F77_CONST_CHAR_ARG2 (&ctra, 1),
3430 F77_CHAR_ARG_LEN (1)
3431 F77_CHAR_ARG_LEN (1)));
3432 for (
F77_INT j = 0; j < a_nr; j++)
3433 for (
F77_INT i = 0; i < j; i++)
3449 if (b_nc == 1 && a_nr == 1)
3467 else if (b_nc == 1 && ! cjb)
3469 const char ctra = get_blas_trans_arg (tra, cja);
3470 F77_XFCN (cgemv, CGEMV, (F77_CONST_CHAR_ARG2 (&ctra, 1),
3473 F77_CHAR_ARG_LEN (1)));
3475 else if (a_nr == 1 && ! cja && ! cjb)
3477 const char crevtrb = get_blas_trans_arg (! trb, cjb);
3478 F77_XFCN (cgemv, CGEMV, (F77_CONST_CHAR_ARG2 (&crevtrb, 1),
3481 F77_CHAR_ARG_LEN (1)));
3485 const char ctra = get_blas_trans_arg (tra, cja);
3486 const char ctrb = get_blas_trans_arg (trb, cjb);
3487 F77_XFCN (cgemm, CGEMM, (F77_CONST_CHAR_ARG2 (&ctra, 1),
3488 F77_CONST_CHAR_ARG2 (&ctrb, 1),
3491 F77_CHAR_ARG_LEN (1)
3492 F77_CHAR_ARG_LEN (1)));
3502 return xgemm (a, b);
3508 #define EMPTY_RETURN_CHECK(T) \
3509 if (nr == 0 || nc == 0) \
3545 (*current_liboctave_error_handler)
3546 (
"two-arg min requires same size arguments");
3554 bool columns_are_real_only =
true;
3560 columns_are_real_only =
false;
3565 if (columns_are_real_only)
3617 (*current_liboctave_error_handler)
3618 (
"two-arg max requires same size arguments");
3626 bool columns_are_real_only =
true;
3632 columns_are_real_only =
false;
3637 if (columns_are_real_only)
3668 (*current_liboctave_error_handler)
3669 (
"linspace: vectors must be of equal length");
3679 retval.clear (
m,
n);
3681 retval.insert (
linspace (x1(i), x2(i),
n), i, 0);
base_det< FloatComplex > FloatComplexDET
N Dimensional Array with copy-on-write semantics.
T & elem(octave_idx_type n)
Size of the specified dimension.
T * fortran_vec()
Size of the specified dimension.
Array< T, Alloc > index(const octave::idx_vector &i) const
Indexing without resizing.
bool issquare() const
Size of the specified dimension.
octave_idx_type rows() const
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Array< T, Alloc > & insert(const Array< T, Alloc > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
const T * data() const
Size of the specified dimension.
octave_idx_type columns() const
octave_idx_type cols() const
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
octave_idx_type rows() const
octave_idx_type length() const
T elem(octave_idx_type r, octave_idx_type c) const
octave_idx_type cols() const
FloatColumnVector extract(octave_idx_type r1, octave_idx_type r2) const
void resize(octave_idx_type n, const FloatComplex &rfv=FloatComplex(0))
FloatComplexColumnVector row_min() const
FloatComplexMatrix hermitian() const
FloatComplexMatrix ifourier() const
bool row_is_real_only(octave_idx_type) const
boolMatrix all(int dim=-1) const
FloatComplexMatrix sumsq(int dim=-1) const
FloatComplexMatrix pseudo_inverse(float tol=0.0) const
FloatComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
FloatComplexMatrix lssolve(const FloatMatrix &b) const
FloatComplexMatrix & operator+=(const FloatDiagMatrix &a)
FloatComplexRowVector row(octave_idx_type i) const
bool operator!=(const FloatComplexMatrix &a) const
FloatComplexColumnVector column(octave_idx_type i) const
FloatComplexMatrix fourier2d() const
FloatComplexMatrix stack(const FloatMatrix &a) const
FloatComplexMatrix cumsum(int dim=-1) const
FloatComplexMatrix & insert(const FloatMatrix &a, octave_idx_type r, octave_idx_type c)
bool operator==(const FloatComplexMatrix &a) const
FloatComplexMatrix diag(octave_idx_type k=0) const
void resize(octave_idx_type nr, octave_idx_type nc, const FloatComplex &rfv=FloatComplex(0))
FloatComplexMatrix ifourier2d() const
FloatComplexMatrix transpose() const
FloatComplexMatrix fourier() const
FloatComplexMatrix sum(int dim=-1) const
FloatComplexMatrix()=default
friend FloatComplexMatrix conj(const FloatComplexMatrix &a)
FloatComplexRowVector column_max() const
FloatComplexMatrix solve(MatrixType &mattype, const FloatMatrix &b) const
FloatComplexMatrix & operator-=(const FloatDiagMatrix &a)
boolMatrix any(int dim=-1) const
FloatComplexRowVector column_min() const
FloatComplexMatrix & fill(float val)
FloatComplexDET determinant() const
bool column_is_real_only(octave_idx_type) const
FloatComplexMatrix inverse() const
FloatComplexMatrix append(const FloatMatrix &a) const
FloatComplexMatrix cumprod(int dim=-1) const
FloatComplexColumnVector row_max() const
FloatComplexMatrix prod(int dim=-1) const
FloatComplexMatrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
FloatComplexNDArray sum(int dim=-1) const
FloatComplexNDArray cumprod(int dim=-1) const
FloatComplexNDArray sumsq(int dim=-1) const
FloatComplexNDArray prod(int dim=-1) const
FloatComplexNDArray cumsum(int dim=-1) const
boolNDArray all(int dim=-1) const
boolNDArray any(int dim=-1) const
FloatComplexNDArray diag(octave_idx_type k=0) const
void resize(octave_idx_type n, const FloatComplex &rfv=FloatComplex(0))
FloatDiagMatrix inverse() const
FloatColumnVector extract_diag(octave_idx_type k=0) const
FloatMatrix sum(int dim=-1) const
FloatRowVector row(octave_idx_type i) const
void mark_as_unsymmetric()
int type(bool quiet=true)
void mark_as_rectangular()
Vector representing the dimensions (size) of an Array.
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
#define F77_CONST_CMPLX_ARG(x)
#define F77_XFCN(f, F, args)
octave_f77_int_type F77_INT
FloatComplexMatrix Sylvester(const FloatComplexMatrix &a, const FloatComplexMatrix &b, const FloatComplexMatrix &c)
FloatComplexMatrix xgemm(const FloatComplexMatrix &a, const FloatComplexMatrix &b, blas_trans_type transa, blas_trans_type transb)
FloatComplexMatrix operator*(const FloatColumnVector &v, const FloatComplexRowVector &a)
FloatComplexMatrix max(const FloatComplex &c, const FloatComplexMatrix &m)
FloatComplexMatrix linspace(const FloatComplexColumnVector &x1, const FloatComplexColumnVector &x2, octave_idx_type n)
#define EMPTY_RETURN_CHECK(T)
std::ostream & operator<<(std::ostream &os, const FloatComplexMatrix &a)
FloatComplexMatrix min(const FloatComplex &c, const FloatComplexMatrix &m)
FloatComplexMatrix conj(const FloatComplexMatrix &a)
std::istream & operator>>(std::istream &is, FloatComplexMatrix &a)
FloatComplexMatrix Givens(const FloatComplex &x, const FloatComplex &y)
double norm(const ColumnVector &v)
void scale(Matrix &m, double x, double y, double z)
octave::idx_vector idx_vector
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
void warn_singular_matrix(double rcond)
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
Complex log2(const Complex &x)
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
char get_blas_char(blas_trans_type transt)
void mx_inline_sub2(std::size_t n, R *r, const X *x)
void mx_inline_add2(std::size_t n, R *r, const X *x)
bool mx_inline_equal(std::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)
std::complex< float > FloatComplex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
subroutine xcdotc(n, zx, incx, zy, incy, retval)
subroutine xcdotu(n, zx, incx, zy, 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)