26 #if defined (HAVE_CONFIG_H)
36 #include <sys/types.h>
146 elem (
i, j) =
static_cast<unsigned char> (a.
elem (
i, j));
173 return !(*
this ==
a);
204 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
205 (*current_liboctave_error_handler) (
"range error for insert");
207 if (a_nr >0 && a_nc > 0)
225 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
226 (*current_liboctave_error_handler) (
"range error for insert");
245 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
246 (*current_liboctave_error_handler) (
"range error for insert");
266 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
267 (*current_liboctave_error_handler) (
"range error for insert");
269 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
297 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
298 (*current_liboctave_error_handler) (
"range error for insert");
312 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
313 (*current_liboctave_error_handler) (
"range error for insert");
333 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
334 (*current_liboctave_error_handler) (
"range error for insert");
336 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
357 if (nr > 0 && nc > 0)
375 if (nr > 0 && nc > 0)
394 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
395 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
396 (*current_liboctave_error_handler) (
"range error for fill");
401 if (r2 >= r1 && c2 >= c1)
421 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
422 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
423 (*current_liboctave_error_handler) (
"range error for fill");
428 if (r2 >= r1 && c2 >=c1)
450 retval.insert (*
this, 0, 0);
451 retval.insert (a, 0, nc_insert);
461 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
465 retval.insert (*
this, 0, 0);
466 retval.insert (a, 0, nc_insert);
475 if (nr != a.
numel ())
480 retval.
insert (*
this, 0, 0);
481 retval.
insert (a, 0, nc_insert);
495 retval.insert (*
this, 0, 0);
496 retval.insert (a, 0, nc_insert);
510 retval.insert (*
this, 0, 0);
511 retval.insert (a, 0, nc_insert);
521 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
525 retval.insert (*
this, 0, 0);
526 retval.insert (a, 0, nc_insert);
535 if (nr != a.
numel ())
540 retval.
insert (*
this, 0, 0);
541 retval.
insert (a, 0, nc_insert);
555 retval.insert (*
this, 0, 0);
556 retval.insert (a, 0, nc_insert);
570 retval.insert (*
this, 0, 0);
571 retval.insert (a, nr_insert, 0);
580 if (nc != a.
numel ())
585 retval.
insert (*
this, 0, 0);
586 retval.
insert (a, nr_insert, 0);
596 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
600 retval.insert (*
this, 0, 0);
601 retval.insert (a, nr_insert, 0);
615 retval.insert (*
this, 0, 0);
616 retval.insert (a, nr_insert, 0);
630 retval.insert (*
this, 0, 0);
631 retval.insert (a, nr_insert, 0);
640 if (nc != a.
numel ())
645 retval.
insert (*
this, 0, 0);
646 retval.
insert (a, nr_insert, 0);
656 (*current_liboctave_error_handler) (
"column dimension mismatch for stack");
660 retval.insert (*
this, 0, 0);
661 retval.insert (a, nr_insert, 0);
675 retval.insert (*
this, 0, 0);
676 retval.insert (a, nr_insert, 0);
683 return do_mx_unary_map<FloatComplex, FloatComplex, std::conj<float> > (
a);
725 return inverse (mattype, info, rcon, 0, 0);
733 return inverse (mattype, info, rcon, 0, 0);
738 bool calc_cond)
const
741 return inverse (mattype, info, rcon, force, calc_cond);
749 return inverse (mattype, info, rcon, 0, 0);
756 return inverse (mattype, info, rcon, 0, 0);
761 float& rcon,
bool force,
bool calc_cond)
const
768 if (nr != nc || nr == 0 || nc == 0)
769 (*current_liboctave_error_handler) (
"inverse requires square matrix");
771 int typ = mattype.
type ();
777 F77_XFCN (ctrtri, CTRTRI, (F77_CONST_CHAR_ARG2 (&uplo, 1),
778 F77_CONST_CHAR_ARG2 (&udiag, 1),
781 F77_CHAR_ARG_LEN (1)));
795 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&job, 1),
796 F77_CONST_CHAR_ARG2 (&uplo, 1),
797 F77_CONST_CHAR_ARG2 (&udiag, 1),
802 F77_CHAR_ARG_LEN (1)));
804 if (ztrcon_info != 0)
808 if (info == -1 && ! force)
816 float& rcon,
bool force,
bool calc_cond)
const
824 (*current_liboctave_error_handler) (
"inverse requires square matrix");
841 lwork = (lwork < 2 *nc ? 2*nc : lwork);
849 retval.
abs ().
sum ().
row (static_cast<octave_idx_type>(0)).
max ();
869 F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
872 F77_CHAR_ARG_LEN (1)));
874 if (zgecon_info != 0)
887 if (zgetri_info != 0)
899 float& rcon,
bool force,
bool calc_cond)
const
901 int typ = mattype.
type (
false);
905 typ = mattype.
type (*
this);
908 ret =
tinverse (mattype, info, rcon, force, calc_cond);
917 rcon = chol.
rcond ();
927 ret =
finverse (mattype, info, rcon, force, calc_cond);
929 if ((mattype.
is_hermitian () || calc_cond) && rcon == 0.)
958 tol = nr * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
960 tol = nc * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
963 while (r >= 0 && sigma.
elem (r) < tol)
979 #if defined (HAVE_FFTW)
989 size_t npts, nsamples;
991 if (nr == 1 || nc == 1)
993 npts = nr > nc ? nr : nc;
1013 size_t nr =
rows ();
1014 size_t nc =
cols ();
1018 size_t npts, nsamples;
1020 if (nr == 1 || nc == 1)
1022 npts = nr > nc ? nr : nc;
1081 if (nr == 1 || nc == 1)
1083 npts = nr > nc ? nr : nc;
1123 if (nr == 1 || nc == 1)
1125 npts = nr > nc ? nr : nc;
1153 tmp_data[j] = tmp_data[j] / static_cast<float> (npts);
1168 if (nr == 1 || nc == 1)
1170 npts = nr > nc ? nr : nc;
1202 pwsave = wsave.fortran_vec ();
1214 prow[
i] = tmp_data[
i*nr + j];
1219 tmp_data[
i*nr + j] = prow[
i];
1235 if (nr == 1 || nc == 1)
1237 npts = nr > nc ? nr : nc;
1265 tmp_data[j] = tmp_data[j] / static_cast<float> (npts);
1272 pwsave = wsave.fortran_vec ();
1284 prow[
i] = tmp_data[
i*nr + j];
1289 tmp_data[
i*nr + j] = prow[
i] / static_cast<float> (npts);
1314 bool calc_cond)
const
1317 return determinant (mattype, info, rcon, calc_cond);
1323 bool calc_cond)
const
1334 (*current_liboctave_error_handler) (
"matrix must be square");
1336 volatile int typ = mattype.
type ();
1343 typ = mattype.
type (*
this);
1358 if (calc_cond) anorm =
xnorm (*
this, 1);
1361 F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1363 F77_CHAR_ARG_LEN (1)));
1378 F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1381 F77_CHAR_ARG_LEN (1)));
1387 retval *= atmp (
i,
i);
1389 retval = retval.
square ();
1393 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
1406 float anorm =
xnorm (*
this, 1);
1432 F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1435 F77_CHAR_ARG_LEN (1)));
1448 retval *= (ipvt(
i) != (
i+1)) ? -c :
c;
1461 return rcond (mattype);
1472 (*current_liboctave_error_handler) (
"matrix must be square");
1474 if (nr == 0 || nc == 0)
1478 volatile int typ = mattype.
type ();
1481 typ = mattype.
type (*
this);
1497 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1),
1498 F77_CONST_CHAR_ARG2 (&uplo, 1),
1499 F77_CONST_CHAR_ARG2 (&dia, 1),
1502 F77_CHAR_ARG_LEN (1)
1503 F77_CHAR_ARG_LEN (1)
1504 F77_CHAR_ARG_LEN (1)));
1510 (*current_liboctave_error_handler)
1511 (
"permuted triangular matrix not implemented");
1525 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1),
1526 F77_CONST_CHAR_ARG2 (&uplo, 1),
1527 F77_CONST_CHAR_ARG2 (&dia, 1),
1530 F77_CHAR_ARG_LEN (1)
1531 F77_CHAR_ARG_LEN (1)
1532 F77_CHAR_ARG_LEN (1)));
1538 (*current_liboctave_error_handler)
1539 (
"permuted triangular matrix not implemented");
1552 anorm = atmp.
abs().
sum().
1553 row(static_cast<octave_idx_type>(0)).
max();
1555 F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1557 F77_CHAR_ARG_LEN (1)));
1573 F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1576 F77_CHAR_ARG_LEN (1)));
1594 anorm = atmp.
abs ().
sum ().
1595 row(static_cast<octave_idx_type>(0)).
max ();
1616 F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1619 F77_CHAR_ARG_LEN (1)));
1636 solve_singularity_handler sing_handler,
1644 if (nr != b.
rows ())
1646 (
"matrix dimension mismatch solution of linear equations");
1648 if (nr == 0 || nc == 0 || b.
cols () == 0)
1652 volatile int typ = mattype.
type ();
1661 (*current_liboctave_error_handler)
1662 (
"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 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1),
1695 F77_CONST_CHAR_ARG2 (&uplo, 1),
1696 F77_CONST_CHAR_ARG2 (&dia, 1),
1699 F77_CHAR_ARG_LEN (1)
1700 F77_CHAR_ARG_LEN (1)
1701 F77_CHAR_ARG_LEN (1)));
1706 volatile float rcond_plus_one = rcon + 1.0;
1713 sing_handler (rcon);
1730 solve_singularity_handler sing_handler,
1738 if (nr != b.
rows ())
1740 (
"matrix dimension mismatch solution of linear equations");
1742 if (nr == 0 || nc == 0 || b.
cols () == 0)
1746 volatile int typ = mattype.
type ();
1755 (*current_liboctave_error_handler)
1756 (
"permuted triangular matrix not implemented");
1768 F77_XFCN (ctrtrs, CTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1),
1769 F77_CONST_CHAR_ARG2 (&trans, 1),
1770 F77_CONST_CHAR_ARG2 (&dia, 1),
1773 F77_CHAR_ARG_LEN (1)
1774 F77_CHAR_ARG_LEN (1)
1775 F77_CHAR_ARG_LEN (1)));
1788 F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1),
1789 F77_CONST_CHAR_ARG2 (&uplo, 1),
1790 F77_CONST_CHAR_ARG2 (&dia, 1),
1793 F77_CHAR_ARG_LEN (1)
1794 F77_CHAR_ARG_LEN (1)
1795 F77_CHAR_ARG_LEN (1)));
1800 volatile float rcond_plus_one = rcon + 1.0;
1807 sing_handler (rcon);
1824 solve_singularity_handler sing_handler,
1825 bool calc_cond)
const
1832 if (nr != nc || nr != b.
rows ())
1834 (
"matrix dimension mismatch solution of linear equations");
1836 if (nr == 0 || b.
cols () == 0)
1840 volatile int typ = mattype.
type ();
1853 anorm = atmp.
abs().
sum().
row(static_cast<octave_idx_type>(0)).
max();
1855 F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
1857 F77_CHAR_ARG_LEN (1)));
1877 F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 (&job, 1),
1880 F77_CHAR_ARG_LEN (1)));
1885 volatile float rcond_plus_one = rcon + 1.0;
1892 sing_handler (rcon);
1905 F77_XFCN (cpotrs, CPOTRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1908 F77_CHAR_ARG_LEN (1)));
1935 anorm = atmp.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
1952 sing_handler (rcon);
1965 F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1),
1968 F77_CHAR_ARG_LEN (1)));
1973 volatile float rcond_plus_one = rcon + 1.0;
1980 sing_handler (rcon);
1994 F77_XFCN (cgetrs, CGETRS, (F77_CONST_CHAR_ARG2 (&job, 1),
1997 F77_CHAR_ARG_LEN (1)));
2020 return solve (typ, b, info, rcon, 0);
2028 return solve (typ, b, info, rcon, 0);
2036 return solve (typ, b, info, rcon, 0);
2042 float& rcon, solve_singularity_handler sing_handler,
2046 return solve (typ, tmp, info, rcon, sing_handler, singular_fallback, transt);
2054 return solve (typ, b, info, rcon, 0);
2062 return solve (typ, b, info, rcon, 0);
2069 return solve (typ, b, info, rcon, 0);
2075 solve_singularity_handler sing_handler,
2079 int typ = mattype.
type ();
2082 typ = mattype.
type (*
this);
2086 retval =
utsolve (mattype, b, info, rcon, sing_handler,
true, transt);
2088 retval =
ltsolve (mattype, b, info, rcon, sing_handler,
true, transt);
2093 retval =
hermitian ().
solve (mattype, b, info, rcon, sing_handler,
2096 retval =
fsolve (mattype, b, info, rcon, sing_handler,
true);
2098 (*current_liboctave_error_handler) (
"unknown matrix type");
2104 retval =
lssolve (b, info, rank, rcon);
2136 solve_singularity_handler sing_handler,
2149 return solve (typ, b, info, rcon, 0);
2157 return solve (typ, b, info, rcon, 0);
2164 return solve (typ, b, info, rcon, 0);
2170 solve_singularity_handler sing_handler,
2175 tmp =
solve (typ, tmp, info, rcon, sing_handler,
true, transt);
2176 return tmp.
column (static_cast<octave_idx_type> (0));
2184 return solve (b, info, rcon, 0);
2191 return solve (b, info, rcon, 0);
2198 return solve (b, info, rcon, 0);
2204 solve_singularity_handler sing_handler,
2208 return solve (tmp, info, rcon, sing_handler, transt);
2216 return solve (b, info, rcon, 0);
2224 return solve (b, info, rcon, 0);
2231 return solve (b, info, rcon, 0);
2237 solve_singularity_handler sing_handler,
2241 return solve (mattype, b, info, rcon, sing_handler,
true, transt);
2270 solve_singularity_handler sing_handler,
2281 return solve (b, info, rcon, 0);
2289 return solve (b, info, rcon, 0);
2297 return solve (b, info, rcon, 0);
2304 solve_singularity_handler sing_handler,
2308 return solve (mattype, b, info, rcon, sing_handler, transt);
2349 return lssolve (b, info, rank, rcon);
2358 return lssolve (b, info, rank, rcon);
2366 return lssolve (b, info, rank, rcon);
2382 (
"matrix dimension mismatch solution of linear equations");
2384 if (m == 0 || n == 0 || b.
cols () == 0)
2417 F77_CONST_CHAR_ARG2 (
" ", 1),
2419 F77_CHAR_ARG_LEN (6)
2420 F77_CHAR_ARG_LEN (1));
2424 F77_CONST_CHAR_ARG2 (
" ", 1),
2425 m, n, nrhs, -1, mnthr
2426 F77_CHAR_ARG_LEN (6)
2427 F77_CHAR_ARG_LEN (1));
2432 float dminmn =
static_cast<float> (minmn);
2433 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2444 n*(1+nrhs) + 2*nrhs);
2459 lwork, prwork, piwork, info));
2465 if (n > m && n >= mnthr)
2481 work(0) = lworkaround;
2488 work(0) = lworkaround;
2494 anorm =
xnorm (*
this, 1);
2500 retval =
Matrix (n, m, 0.0);
2506 maxmn, ps, rcon, rank,
2508 lwork, prwork, piwork, info));
2510 if (s.
elem (0) == 0.0)
2513 rcon = s.
elem (minmn - 1) / s.
elem (0);
2561 return lssolve (b, info, rank, rcon);
2570 return lssolve (b, info, rank, rcon);
2579 return lssolve (b, info, rank, rcon);
2595 if (m != b.
numel ())
2597 (
"matrix dimension mismatch solution of linear equations");
2599 if (m == 0 || n == 0 || b.
cols () == 0)
2631 F77_CONST_CHAR_ARG2 (
" ", 1),
2633 F77_CHAR_ARG_LEN (6)
2634 F77_CHAR_ARG_LEN (1));
2639 float dminmn =
static_cast<float> (minmn);
2640 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2648 + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1);
2663 lwork, prwork, piwork, info));
2672 maxmn, ps, rcon, rank,
2674 prwork, piwork, info));
2678 if (s.
elem (0) == 0.0)
2681 rcon = s.
elem (minmn - 1) / s.
elem (0);
2720 F77_XFCN (cgemm, CGEMM, (F77_CONST_CHAR_ARG2 (
"N", 1),
2721 F77_CONST_CHAR_ARG2 (
"N", 1),
2724 F77_CHAR_ARG_LEN (1)
2725 F77_CHAR_ARG_LEN (1)));
2742 if (nr != a_nr || nc != a_nc)
2760 if (nr != a_nr || nc != a_nc)
2778 if (nr != a_nr || nc != a_nc)
2796 if (nr != a_nr || nc != a_nc)
2816 if (nr != a_nr || nc != a_nc)
2819 if (nr == 0 || nc == 0)
2837 if (nr != a_nr || nc != a_nc)
2840 if (nr == 0 || nc == 0)
2912 if (nr == 1 || nc == 1)
2973 if (nr > 0 && nc > 0)
2988 for (idx_j = 0; idx_j < nc; idx_j++)
2990 tmp_min =
elem (
i, idx_j);
2994 abs_min = real_only ? tmp_min.real ()
3007 float abs_tmp = real_only ? tmp.real () :
std::abs (tmp);
3009 if (abs_tmp < abs_min)
3020 idx_arg.
elem (
i) = 0;
3024 result.
elem (
i) = tmp_min;
3025 idx_arg.
elem (
i) = idx_j;
3048 if (nr > 0 && nc > 0)
3063 for (idx_j = 0; idx_j < nc; idx_j++)
3065 tmp_max =
elem (
i, idx_j);
3069 abs_max = real_only ? tmp_max.real ()
3082 float abs_tmp = real_only ? tmp.real () :
std::abs (tmp);
3084 if (abs_tmp > abs_max)
3095 idx_arg.
elem (
i) = 0;
3099 result.
elem (
i) = tmp_max;
3100 idx_arg.
elem (
i) = idx_j;
3123 if (nr > 0 && nc > 0)
3138 for (idx_i = 0; idx_i < nr; idx_i++)
3140 tmp_min =
elem (idx_i, j);
3144 abs_min = real_only ? tmp_min.real ()
3157 float abs_tmp = real_only ? tmp.real () :
std::abs (tmp);
3159 if (abs_tmp < abs_min)
3170 idx_arg.
elem (j) = 0;
3174 result.
elem (j) = tmp_min;
3175 idx_arg.
elem (j) = idx_i;
3198 if (nr > 0 && nc > 0)
3213 for (idx_i = 0; idx_i < nr; idx_i++)
3215 tmp_max =
elem (idx_i, j);
3219 abs_max = real_only ? tmp_max.real ()
3232 float abs_tmp = real_only ? tmp.real () :
std::abs (tmp);
3234 if (abs_tmp > abs_max)
3245 idx_arg.
elem (j) = 0;
3249 result.
elem (j) = tmp_max;
3250 idx_arg.
elem (j) = idx_i;
3281 if (nr > 0 && nc > 0)
3287 tmp = octave_read_value<FloatComplex> (
is);
3354 F77_XFCN (ctrsyl, CTRSYL, (F77_CONST_CHAR_ARG2 (
"N", 1),
3355 F77_CONST_CHAR_ARG2 (
"N", 1),
3358 F77_CHAR_ARG_LEN (1)
3359 F77_CHAR_ARG_LEN (1)));
3412 return trans ? (conj ?
'C' :
'T') :
'N';
3437 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
3439 else if (a.
data () == b.
data () && a_nr == b_nc && tra != trb)
3454 F77_XFCN (cherk, CHERK, (F77_CONST_CHAR_ARG2 (
"U", 1),
3455 F77_CONST_CHAR_ARG2 (&ctra, 1),
3458 F77_CHAR_ARG_LEN (1)
3459 F77_CHAR_ARG_LEN (1)));
3466 F77_XFCN (csyrk, CSYRK, (F77_CONST_CHAR_ARG2 (
"U", 1),
3467 F77_CONST_CHAR_ARG2 (&ctra, 1),
3470 F77_CHAR_ARG_LEN (1)
3471 F77_CHAR_ARG_LEN (1)));
3489 if (b_nc == 1 && a_nr == 1)
3507 else if (b_nc == 1 && ! cjb)
3510 F77_XFCN (cgemv, CGEMV, (F77_CONST_CHAR_ARG2 (&ctra, 1),
3513 F77_CHAR_ARG_LEN (1)));
3515 else if (a_nr == 1 && ! cja && ! cjb)
3518 F77_XFCN (cgemv, CGEMV, (F77_CONST_CHAR_ARG2 (&crevtrb, 1),
3521 F77_CHAR_ARG_LEN (1)));
3527 F77_XFCN (cgemm, CGEMM, (F77_CONST_CHAR_ARG2 (&ctra, 1),
3528 F77_CONST_CHAR_ARG2 (&ctrb, 1),
3531 F77_CHAR_ARG_LEN (1)
3532 F77_CHAR_ARG_LEN (1)));
3542 return xgemm (a, b);
3548 #define EMPTY_RETURN_CHECK(T) \
3549 if (nr == 0 || nc == 0) \
3586 (
"two-arg min requires same size arguments");
3594 bool columns_are_real_only =
true;
3600 columns_are_real_only =
false;
3605 if (columns_are_real_only)
3658 (
"two-arg max requires same size arguments");
3666 bool columns_are_real_only =
true;
3672 columns_are_real_only =
false;
3677 if (columns_are_real_only)
3708 (
"linspace: vectors must be of equal length");
3714 retval.clear (m, 0);
3718 retval.clear (m, n);
3725 delta[
i] = (x2(
i) - x1(
i)) / (n - 1.0f);
3729 retval(
i, j) = x1(
i) +
static_cast<float> (j)*delta[
i];
FloatComplexMatrix transpose(void) const
FloatComplexRowVector column_min(void) const
void mx_inline_add2(size_t n, R *r, const X *x)
void resize(octave_idx_type nr, octave_idx_type nc, const FloatComplex &rfv=FloatComplex(0))
F77_RET_T const F77_INT const F77_INT const F77_INT const F77_DBLE const F77_DBLE F77_INT F77_DBLE * V
FloatComplexMatrix solve(MatrixType &typ, const FloatMatrix &b) const
FloatComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
void resize(octave_idx_type n, const FloatComplex &rfv=FloatComplex(0))
void mx_inline_sub2(size_t n, R *r, const X *x)
#define MM_BOOL_OPS(M1, M2)
base_det< FloatComplex > FloatComplexDET
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)
T elem(octave_idx_type r, octave_idx_type c) const
static char get_blas_trans_arg(bool trans, bool conj)
FloatComplexMatrix hermitian(void) const
FloatComplexMatrix tinverse(MatrixType &mattype, octave_idx_type &info, float &rcon, bool force, bool calc_cond) const
FloatComplexMatrix fsolve(MatrixType &typ, const FloatComplexMatrix &b, octave_idx_type &info, float &rcon, solve_singularity_handler sing_handler, bool calc_cond=false) const
static const idx_vector colon
octave_idx_type numel(void) const
Number of elements in the array.
static octave_idx_type nn
identity matrix If supplied two scalar respectively For allows like xample val
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
FloatNDArray abs(void) const
#define SM_BOOL_OPS(S, M)
T unitary_matrix(void) const
void octave_write_complex(std::ostream &os, const Complex &c)
octave_idx_type rows(void) const
T left_singular_matrix(void) const
subroutine xilaenv(ispec, name, opts, n1, n2, n3, n4, retval)
FloatComplex & elem(octave_idx_type n)
bool is_hermitian(void) const
FloatComplexMatrix xgemm(const FloatComplexMatrix &a, const FloatComplexMatrix &b, blas_trans_type transa, blas_trans_type transb)
FloatRowVector row(octave_idx_type i) const
FloatComplexNDArray sumsq(int dim=-1) const
FloatComplexMatrix inverse(void) const
FloatComplexMatrix lssolve(const FloatMatrix &b) const
subroutine cfftb(n, c, wsave)
#define F77_XFCN(f, F, args)
FloatComplexMatrix & fill(float val)
bool is_hermitian(void) const
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
T schur_matrix(void) const
static int fftNd(const double *, Complex *, const int, const dim_vector &)
T right_singular_matrix(void) const
FloatComplexMatrix cumprod(int dim=-1) 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
FloatComplexNDArray cumsum(int dim=-1) const
FloatMatrix abs(void) const
FloatComplexMatrix diag(octave_idx_type k=0) const
FloatComplexMatrix Givens(const FloatComplex &x, const FloatComplex &y)
boolNDArray all(int dim=-1) const
FloatComplexMatrix pseudo_inverse(float tol=0.0) const
FloatComplexNDArray diag(octave_idx_type k=0) const
subroutine cffti(n, wsave)
FloatComplexMatrix & insert(const FloatMatrix &a, octave_idx_type r, octave_idx_type c)
int type(bool quiet=true)
FloatComplexColumnVector column(octave_idx_type i) const
boolMatrix any(int dim=-1) const
bool column_is_real_only(octave_idx_type) const
FloatComplexMatrix fourier2d(void) const
FloatComplexMatrix operator*(const FloatColumnVector &v, const FloatComplexRowVector &a)
FloatComplexMatrix min(const FloatComplex &c, const FloatComplexMatrix &m)
std::ostream & operator<<(std::ostream &os, const FloatComplexMatrix &a)
FloatComplexMatrix & operator-=(const FloatDiagMatrix &a)
nd deftypefn *octave_map m
FloatComplexMatrix append(const FloatMatrix &a) const
FloatColumnVector extract(octave_idx_type r1, octave_idx_type r2) 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)
boolNDArray any(int dim=-1) const
const FloatComplex * data(void) const
FloatComplexMatrix & operator+=(const FloatDiagMatrix &a)
double norm(const ColumnVector &v)
FloatComplexMatrix Sylvester(const FloatComplexMatrix &a, const FloatComplexMatrix &b, const FloatComplexMatrix &c)
FloatComplexColumnVector row_min(void) const
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)
void resize(octave_idx_type n, const FloatComplex &rfv=FloatComplex(0))
subroutine cfftf(n, c, wsave)
FloatComplexMatrix sum(int dim=-1) const
F77_RET_T F77_FUNC(xstopx, XSTOPX) const
void mark_as_unsymmetric(void)
FloatComplex max(void) const
bool is_square(void) const
FloatComplexMatrix stack(const FloatMatrix &a) const
#define EMPTY_RETURN_CHECK(T)
FloatComplexMatrix sumsq(int dim=-1) const
OCTAVE_API double xnorm(const ColumnVector &x, double p)
FloatComplexMatrix cumsum(int dim=-1) const
FloatColumnVector extract_diag(octave_idx_type k=0) const
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
FloatComplexMatrix ifourier(void) const
FloatComplexMatrix conj(const FloatComplexMatrix &a)
With real return the complex result
static int ifftNd(const Complex *, Complex *, const int, const dim_vector &)
FloatComplex & xelem(octave_idx_type n)
FloatMatrix sum(int dim=-1) const
FloatComplexRowVector column_max(void) const
friend class FloatComplexColumnVector
octave_idx_type cols(void) const
This is a simple wrapper template that will subclass an Array type or any later type derived from ...
subroutine xcdotc(n, zx, incx, zy, incy, retval)
FloatComplexMatrix prod(int dim=-1) const
=val(i)}if ode{val(i)}occurs in table i
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup abs(local error in x(i))<
static const FloatComplex FloatComplex_NaN_result(octave::numeric_limits< float >::NaN(), octave::numeric_limits< float >::NaN())
FloatComplexMatrix fourier(void) 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 $)
friend OCTAVE_API FloatComplexMatrix conj(const FloatComplexMatrix &a)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
FloatComplexMatrix ltsolve(MatrixType &typ, const FloatComplexMatrix &b, octave_idx_type &info, float &rcon, solve_singularity_handler sing_handler, bool calc_cond=false, blas_trans_type transt=blas_no_trans) const
FloatComplexNDArray cumprod(int dim=-1) const
FloatComplexNDArray sum(int dim=-1) const
bool row_is_real_only(octave_idx_type) const
#define MS_BOOL_OPS(M, S)
#define MM_CMP_OPS(M1, M2)
char get_blas_char(blas_trans_type transt)
FloatComplexMatrix linspace(const FloatComplexColumnVector &x1, const FloatComplexColumnVector &x2, octave_idx_type n)
#define F77_CONST_CMPLX_ARG(x)
bool operator!=(const FloatComplexMatrix &a) const
bool operator==(const FloatComplexMatrix &a) const
ColumnVector imag(const ComplexColumnVector &a)
std::complex< float > FloatComplex
FloatComplexNDArray prod(int dim=-1) const
FloatComplexColumnVector row_max(void) const
FloatComplexDET determinant(void) const
FloatComplexMatrix utsolve(MatrixType &typ, const FloatComplexMatrix &b, octave_idx_type &info, float &rcon, solve_singularity_handler sing_handler, bool calc_cond=false, blas_trans_type transt=blas_no_trans) const
const T * fortran_vec(void) const
FloatComplexMatrix ifourier2d(void) const
ColumnVector real(const ComplexColumnVector &a)
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
FloatComplexRowVector row(octave_idx_type i) const
Vector representing the dimensions (size) of an Array.
FloatComplexMatrix max(const FloatComplex &c, const FloatComplexMatrix &m)
FloatComplexMatrix finverse(MatrixType &mattype, octave_idx_type &info, float &rcon, bool force, bool calc_cond) const
void warn_singular_matrix(double rcond)
subroutine xcdotu(n, zx, incx, zy, incy, retval)
FloatComplexMatrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
boolMatrix all(int dim=-1) const
octave_idx_type columns(void) const
octave_idx_type length(void) const
Array< FloatComplex > 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
std::istream & operator>>(std::istream &is, FloatComplexMatrix &a)