74 const octave_idx_type&,
const octave_idx_type&,
75 const octave_idx_type&,
const octave_idx_type&,
82 const octave_idx_type&,
double*,
83 const octave_idx_type&, octave_idx_type&,
84 octave_idx_type&,
double*, octave_idx_type&
90 const octave_idx_type&,
const octave_idx_type&,
91 const octave_idx_type&,
double*,
92 const octave_idx_type&,
double*,
93 const octave_idx_type&, octave_idx_type&
101 const octave_idx_type&,
const octave_idx_type&,
102 const octave_idx_type&,
const double&,
103 const double*,
const octave_idx_type&,
104 const double*,
const octave_idx_type&,
105 const double&,
double*,
const octave_idx_type&
111 const octave_idx_type&,
const octave_idx_type&,
112 const double&,
const double*,
113 const octave_idx_type&,
const double*,
114 const octave_idx_type&,
const double&,
double*,
115 const octave_idx_type&
119 F77_FUNC (
xddot, XDDOT) (
const octave_idx_type&,
const double*,
120 const octave_idx_type&,
const double*,
121 const octave_idx_type&,
double&);
126 const octave_idx_type&,
const octave_idx_type&,
127 const double&,
const double*,
const octave_idx_type&,
128 const double&,
double*,
const octave_idx_type&
133 F77_FUNC (dgetrf, DGETRF) (
const octave_idx_type&,
const octave_idx_type&,
134 double*,
const octave_idx_type&,
135 octave_idx_type*, octave_idx_type&);
139 const octave_idx_type&,
const octave_idx_type&,
140 const double*,
const octave_idx_type&,
141 const octave_idx_type*,
double*,
142 const octave_idx_type&, octave_idx_type&
146 F77_FUNC (dgetri, DGETRI) (
const octave_idx_type&,
double*,
147 const octave_idx_type&,
const octave_idx_type*,
148 double*,
const octave_idx_type&,
153 const octave_idx_type&,
double*,
154 const octave_idx_type&,
const double&,
double&,
155 double*, octave_idx_type*, octave_idx_type&
159 F77_FUNC (dgelsy, DGELSY) (
const octave_idx_type&,
const octave_idx_type&,
160 const octave_idx_type&,
double*,
161 const octave_idx_type&,
double*,
162 const octave_idx_type&, octave_idx_type*,
163 double&, octave_idx_type&,
double*,
164 const octave_idx_type&, octave_idx_type&);
167 F77_FUNC (dgelsd, DGELSD) (
const octave_idx_type&,
const octave_idx_type&,
168 const octave_idx_type&,
double*,
169 const octave_idx_type&,
double*,
170 const octave_idx_type&,
double*,
double&,
171 octave_idx_type&,
double*,
172 const octave_idx_type&, octave_idx_type*,
177 const octave_idx_type&,
double *,
178 const octave_idx_type&, octave_idx_type&
183 const octave_idx_type&,
double*,
184 const octave_idx_type&,
const double&,
185 double&,
double*, octave_idx_type*,
190 const octave_idx_type&,
const octave_idx_type&,
191 const double*,
const octave_idx_type&,
double*,
192 const octave_idx_type&, octave_idx_type&
198 const octave_idx_type&,
const double*,
199 const octave_idx_type&, octave_idx_type&
206 const octave_idx_type&,
const double*,
207 const octave_idx_type&,
double&,
208 double*, octave_idx_type*, octave_idx_type&
216 const octave_idx_type&,
const octave_idx_type&,
217 const double*,
const octave_idx_type&,
double*,
218 const octave_idx_type&, octave_idx_type&
224 F77_FUNC (dlartg, DLARTG) (
const double&,
const double&,
double&,
230 const octave_idx_type&,
const octave_idx_type&,
231 const octave_idx_type&,
const double*,
232 const octave_idx_type&,
const double*,
233 const octave_idx_type&,
const double*,
234 const octave_idx_type&,
double&, octave_idx_type&
240 const octave_idx_type&,
const octave_idx_type&,
241 const double*,
const octave_idx_type&,
285 elem (ia(i), i) = 1.0;
300 elem (i, j) =
static_cast<unsigned char> (a.
elem (i, j));
315 return !(*
this == a);
346 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
348 (*current_liboctave_error_handler) (
"range error for insert");
368 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
370 (*current_liboctave_error_handler) (
"range error for insert");
391 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
393 (*current_liboctave_error_handler) (
"range error for insert");
397 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
418 if (nr > 0 && nc > 0)
437 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
438 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
440 (*current_liboctave_error_handler) (
"range error for fill");
444 if (r1 > r2) { std::swap (r1, r2); }
445 if (c1 > c2) { std::swap (c1, c2); }
447 if (r2 >= r1 && c2 >= c1)
466 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
472 retval.
insert (*
this, 0, 0);
473 retval.
insert (a, 0, nc_insert);
484 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
490 retval.
insert (*
this, 0, 0);
491 retval.
insert (a, 0, nc_insert);
502 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
507 Matrix retval (nr, nc + 1);
508 retval.
insert (*
this, 0, 0);
509 retval.
insert (a, 0, nc_insert);
520 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
526 retval.
insert (*
this, 0, 0);
527 retval.
insert (a, 0, nc_insert);
538 (*current_liboctave_error_handler)
539 (
"column dimension mismatch for stack");
545 retval.
insert (*
this, 0, 0);
546 retval.
insert (a, nr_insert, 0);
557 (*current_liboctave_error_handler)
558 (
"column dimension mismatch for stack");
563 Matrix retval (nr + 1, nc);
564 retval.
insert (*
this, 0, 0);
565 retval.
insert (a, nr_insert, 0);
576 (*current_liboctave_error_handler)
577 (
"column dimension mismatch for stack");
583 retval.
insert (*
this, 0, 0);
584 retval.
insert (a, nr_insert, 0);
595 (*current_liboctave_error_handler)
596 (
"column dimension mismatch for stack");
602 retval.
insert (*
this, 0, 0);
603 retval.
insert (a, nr_insert, 0);
623 if (r1 > r2) { std::swap (r1, r2); }
624 if (c1 > c2) { std::swap (c1, c2); }
656 return inverse (mattype, info, rcon, 0, 0);
664 return inverse (mattype, info, rcon, 0, 0);
672 return inverse (mattype, info, rcon, force, calc_cond);
680 return inverse (mattype, info, rcon, 0, 0);
687 return inverse (mattype, info, rcon, 0, 0);
692 int force,
int calc_cond)
const
699 if (nr != nc || nr == 0 || nc == 0)
700 (*current_liboctave_error_handler) (
"inverse requires square matrix");
703 int typ = mattype.
type ();
711 nr, tmp_data, nr, info
730 nr, tmp_data, nr, rcon,
731 work, iwork, dtrcon_info
736 if (dtrcon_info != 0)
740 if (info == -1 && ! force)
750 int force,
int calc_cond)
const
757 if (nr != nc || nr == 0 || nc == 0)
758 (*current_liboctave_error_handler) (
"inverse requires square matrix");
771 F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt,
775 lwork = (lwork < 2 *nc ? 2*nc : lwork);
784 anorm = retval.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
787 F77_XFCN (dgetrf, DGETRF, (nc, nc, tmp_data, nr, pipvt, info));
802 nc, tmp_data, nr, anorm,
803 rcon, pz, piz, dgecon_info
806 if (dgecon_info != 0)
810 if (info == -1 && ! force)
816 F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt,
817 pz, lwork, dgetri_info));
819 if (dgetri_info != 0)
832 int force,
int calc_cond)
const
834 int typ = mattype.
type (
false);
838 typ = mattype.
type (*
this);
841 ret =
tinverse (mattype, info, rcon, force, calc_cond);
846 CHOL chol (*
this, info, calc_cond);
850 rcon = chol.
rcond ();
860 ret =
finverse (mattype, info, rcon, force, calc_cond);
862 if ((mattype.
is_hermitian () || calc_cond) && rcon == 0.)
887 tol = nr * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
889 tol = nc * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
892 while (r >= 0 && sigma.
elem (r) < tol)
896 return Matrix (nc, nr, 0.0);
906 #if defined (HAVE_FFTW)
916 size_t npts, nsamples;
918 if (nr == 1 || nc == 1)
920 npts = nr > nc ? nr : nc;
945 size_t npts, nsamples;
947 if (nr == 1 || nc == 1)
949 npts = nr > nc ? nr : nc;
1008 F77_FUNC (
zfftb, ZFFTB) (
const octave_idx_type&, Complex*, Complex*);
1021 if (nr == 1 || nc == 1)
1023 npts = nr > nc ? nr : nc;
1035 Complex *pwsave = wsave.fortran_vec ();
1062 if (nr == 1 || nc == 1)
1064 npts = nr > nc ? nr : nc;
1076 Complex *pwsave = wsave.fortran_vec ();
1091 tmp_data[j] = tmp_data[j] / static_cast<double> (npts);
1106 if (nr == 1 || nc == 1)
1108 npts = nr > nc ? nr : nc;
1120 Complex *pwsave = wsave.fortran_vec ();
1139 pwsave = wsave.fortran_vec ();
1142 Complex *prow = tmp.fortran_vec ();
1151 prow[i] = tmp_data[i*nr + j];
1156 tmp_data[i*nr + j] = prow[i];
1172 if (nr == 1 || nc == 1)
1174 npts = nr > nc ? nr : nc;
1186 Complex *pwsave = wsave.fortran_vec ();
1201 tmp_data[j] = tmp_data[j] / static_cast<double> (npts);
1208 pwsave = wsave.fortran_vec ();
1211 Complex *prow = tmp.fortran_vec ();
1220 prow[i] = tmp_data[i*nr + j];
1225 tmp_data[i*nr + j] = prow[i] / static_cast<double> (npts);
1252 return determinant (mattype, info, rcon, calc_cond);
1268 (*current_liboctave_error_handler) (
"matrix must be square");
1271 volatile int typ = mattype.
type ();
1278 typ = mattype.
type (*
this);
1285 retval *=
elem (i,i);
1293 if (calc_cond) anorm =
xnorm (*
this, 1);
1315 nr, tmp_data, nr, anorm,
1323 retval *= atmp (i,i);
1325 retval = retval.
square ();
1329 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
1343 if (calc_cond) anorm =
xnorm (*
this, 1);
1345 F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1366 nc, tmp_data, nr, anorm,
1380 double c = atmp(i,i);
1381 retval *= (ipvt(i) != (i+1)) ? -c : c;
1395 return rcond (mattype);
1406 (*current_liboctave_error_handler) (
"matrix must be square");
1407 else if (nr == 0 || nc == 0)
1411 volatile int typ = mattype.
type ();
1414 typ = mattype.
type (*
this);
1433 nr, tmp_data, nr, rcon,
1443 (*current_liboctave_error_handler)
1444 (
"permuted triangular matrix not implemented");
1461 nr, tmp_data, nr, rcon,
1471 (*current_liboctave_error_handler)
1472 (
"permuted triangular matrix not implemented");
1475 double anorm = -1.0;
1485 anorm = atmp.
abs().
sum().
1486 row(static_cast<octave_idx_type>(0)).
max();
1506 nr, tmp_data, nr, anorm,
1526 anorm = atmp.
abs ().
sum ().
1527 row(static_cast<octave_idx_type>(0)).
max ();
1534 F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1545 nc, tmp_data, nr, anorm,
1563 double& rcon, solve_singularity_handler sing_handler,
1571 if (nr != b.
rows ())
1573 (
"matrix dimension mismatch solution of linear equations");
1574 else if (nr == 0 || nc == 0 || b.
cols () == 0)
1578 volatile int typ = mattype.
type ();
1588 (*current_liboctave_error_handler)
1589 (
"permuted triangular matrix not implemented");
1605 nr, b_nc, tmp_data, nr,
1625 nr, tmp_data, nr, rcon,
1634 volatile double rcond_plus_one = rcon + 1.0;
1636 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
1641 sing_handler (rcon);
1657 double& rcon, solve_singularity_handler sing_handler,
1665 if (nr != b.
rows ())
1667 (
"matrix dimension mismatch solution of linear equations");
1668 else if (nr == 0 || nc == 0 || b.
cols () == 0)
1672 volatile int typ = mattype.
type ();
1682 (*current_liboctave_error_handler)
1683 (
"permuted triangular matrix not implemented");
1699 nr, b_nc, tmp_data, nr,
1719 nr, tmp_data, nr, rcon,
1728 volatile double rcond_plus_one = rcon + 1.0;
1730 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
1735 sing_handler (rcon);
1751 double& rcon, solve_singularity_handler sing_handler,
1752 bool calc_cond)
const
1759 if (nr != nc || nr != b.
rows ())
1761 (
"matrix dimension mismatch solution of linear equations");
1762 else if (nr == 0 || b.
cols () == 0)
1766 volatile int typ = mattype.
type ();
1779 anorm = atmp.
abs().
sum().
row(static_cast<octave_idx_type>(0)).
max();
1804 nr, tmp_data, nr, anorm,
1811 volatile double rcond_plus_one = rcon + 1.0;
1813 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
1818 sing_handler (rcon);
1832 nr, b_nc, tmp_data, nr,
1833 result, b.
rows (), info
1855 anorm = atmp.
abs().
sum().
row(static_cast<octave_idx_type>(0)).
max();
1862 F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1871 sing_handler (rcon);
1885 nc, tmp_data, nr, anorm,
1892 volatile double rcond_plus_one = rcon + 1.0;
1894 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
1899 sing_handler (rcon);
1914 nr, b_nc, tmp_data, nr,
1915 pipvt, result, b.
rows (), info
1923 (*current_liboctave_error_handler) (
"incorrect matrix type");
1934 return solve (typ, b, info, rcon, 0);
1941 return solve (typ, b, info, rcon, 0);
1948 return solve (typ, b, info, rcon, 0);
1953 double& rcon, solve_singularity_handler sing_handler,
1957 int typ = mattype.
type ();
1960 typ = mattype.
type (*
this);
1964 retval =
utsolve (mattype, b, info, rcon, sing_handler,
true, transt);
1966 retval =
ltsolve (mattype, b, info, rcon, sing_handler,
true, transt);
1971 retval =
fsolve (mattype, b, info, rcon, sing_handler,
true);
1974 (*current_liboctave_error_handler) (
"unknown matrix type");
1982 retval =
lssolve (b, info, rank, rcon);
1993 return solve (typ, b, info, rcon, 0);
2001 return solve (typ, b, info, rcon, 0);
2008 return solve (typ, b, info, rcon, 0);
2035 const double *smd = sm.
data ();
2038 rd[i] =
Complex (smd[i], smd[nel+i]);
2044 double& rcon, solve_singularity_handler sing_handler,
2048 tmp =
solve (typ, tmp, info, rcon, sing_handler, singular_fallback, transt);
2056 return solve (typ, b, info, rcon);
2064 return solve (typ, b, info, rcon);
2071 return solve (typ, b, info, rcon, 0);
2076 double& rcon, solve_singularity_handler sing_handler,
2080 tmp =
solve (typ, tmp, info, rcon, sing_handler,
true, transt);
2081 return tmp.
column (static_cast<octave_idx_type> (0));
2088 return tmp.
solve (typ, b);
2096 return tmp.
solve (typ, b, info);
2104 return tmp.
solve (typ, b, info, rcon);
2110 solve_singularity_handler sing_handler,
2114 return tmp.
solve (typ, b, info, rcon, sing_handler, transt);
2122 return solve (b, info, rcon, 0);
2129 return solve (b, info, rcon, 0);
2135 return solve (b, info, rcon, 0);
2140 double& rcon, solve_singularity_handler sing_handler,
2144 return solve (mattype, b, info, rcon, sing_handler,
true, transt);
2151 return tmp.
solve (b);
2158 return tmp.
solve (b, info);
2166 return tmp.
solve (b, info, rcon);
2171 solve_singularity_handler sing_handler,
2175 return tmp.
solve (b, info, rcon, sing_handler, transt);
2182 return solve (b, info, rcon);
2189 return solve (b, info, rcon);
2195 return solve (b, info, rcon, 0);
2200 solve_singularity_handler sing_handler,
2204 return solve (mattype, b, info, rcon, sing_handler, transt);
2211 return tmp.
solve (b);
2218 return tmp.
solve (b, info);
2226 return tmp.
solve (b, info, rcon);
2232 solve_singularity_handler sing_handler,
2236 return tmp.
solve (b, info, rcon, sing_handler, transt);
2245 return lssolve (b, info, rank, rcon);
2253 return lssolve (b, info, rank, rcon);
2261 return lssolve (b, info, rank, rcon);
2277 (
"matrix dimension mismatch solution of linear equations");
2278 else if (m == 0 || n == 0 || b.
cols () == 0)
2287 retval =
Matrix (maxmn, nrhs, 0.0);
2291 retval.
elem (i, j) = b.
elem (i, j);
2318 m, n, nrhs, -1, mnthr
2324 double dminmn =
static_cast<double> (minmn);
2325 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
2326 double tmp =
xlog2 (dminmn / dsmlsizp1);
2338 F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2340 lwork, piwork, info));
2346 if (n > m && n >= mnthr)
2349 = 9*m + 2*m*smlsiz + 8*m*nlvl + m*nrhs + (smlsiz+1)*(smlsiz+1);
2362 if (wlalsd > addend)
2367 if (work(0) < lworkaround)
2368 work(0) = lworkaround;
2373 = 12*n + 2*n*smlsiz + 8*n*nlvl + n*nrhs + (smlsiz+1)*(smlsiz+1);
2375 if (work(0) < lworkaround)
2376 work(0) = lworkaround;
2382 F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval,
2383 maxmn, ps, rcon, rank,
2387 if (s.
elem (0) == 0.0)
2390 rcon = s.
elem (minmn - 1) / s.
elem (0);
2405 return tmp.
lssolve (b, info, rank, rcon);
2414 return tmp.
lssolve (b, info, rank, rcon);
2423 return tmp.
lssolve (b, info, rank, rcon);
2431 return tmp.
lssolve (b, info, rank, rcon);
2440 return lssolve (b, info, rank, rcon);
2448 return lssolve (b, info, rank, rcon);
2456 return lssolve (b, info, rank, rcon);
2472 (
"matrix dimension mismatch solution of linear equations");
2473 else if (m == 0 || n == 0)
2512 double dminmn =
static_cast<double> (minmn);
2513 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
2514 double tmp =
xlog2 (dminmn / dsmlsizp1);
2526 F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2528 lwork, piwork, info));
2533 F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval,
2534 maxmn, ps, rcon, rank,
2540 if (s.
elem (0) == 0.0)
2543 rcon = s.
elem (minmn - 1) / s.
elem (0);
2559 return tmp.
lssolve (b, info, rank, rcon);
2568 return tmp.
lssolve (b, info, rank, rcon);
2577 return tmp.
lssolve (b, info, rank, rcon);
2585 return tmp.
lssolve (b, info, rank, rcon);
2597 if (nr != a_nr || nc != a_nc)
2618 if (nr != a_nr || nc != a_nc)
2645 retval =
Matrix (len, a_len);
2650 len, a_len, 1, 1.0, v.
data (), len,
2651 a.
data (), 1, 0.0, c, len
2725 if (nr == 1 || nc == 1)
2729 (
"diag: expecting vector argument");
2749 if (nr > 0 && nc > 0)
2760 for (idx_j = 0; idx_j < nc; idx_j++)
2762 tmp_min =
elem (i, idx_j);
2770 double tmp =
elem (i, j);
2774 else if (tmp < tmp_min)
2781 result.
elem (i) = tmp_min;
2782 idx_arg.
elem (i) =
xisnan (tmp_min) ? 0 : idx_j;
2804 if (nr > 0 && nc > 0)
2815 for (idx_j = 0; idx_j < nc; idx_j++)
2817 tmp_max =
elem (i, idx_j);
2825 double tmp =
elem (i, j);
2829 else if (tmp > tmp_max)
2836 result.
elem (i) = tmp_max;
2837 idx_arg.
elem (i) =
xisnan (tmp_max) ? 0 : idx_j;
2859 if (nr > 0 && nc > 0)
2870 for (idx_i = 0; idx_i < nr; idx_i++)
2872 tmp_min =
elem (idx_i, j);
2880 double tmp =
elem (i, j);
2884 else if (tmp < tmp_min)
2891 result.
elem (j) = tmp_min;
2892 idx_arg.
elem (j) =
xisnan (tmp_min) ? 0 : idx_i;
2914 if (nr > 0 && nc > 0)
2925 for (idx_i = 0; idx_i < nr; idx_i++)
2927 tmp_max =
elem (idx_i, j);
2935 double tmp =
elem (i, j);
2939 else if (tmp > tmp_max)
2946 result.
elem (j) = tmp_max;
2947 idx_arg.
elem (j) =
xisnan (tmp_max) ? 0 : idx_i;
2975 if (nr > 0 && nc > 0)
2981 tmp = octave_read_value<double> (is);
2983 a.
elem (i, j) = tmp;
2997 double cc, s, temp_r;
2999 F77_FUNC (dlartg, DLARTG) (
x, y, cc, s, temp_r);
3047 1, a_nr, b_nr, pa, a_nr, pb,
3048 b_nr, px, a_nr, scale, info
3089 return trans ?
'T' :
'N';
3113 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
3114 retval =
Matrix (a_nr, b_nc, 0.0);
3115 else if (a.
data () == b.
data () && a_nr == b_nc && tra != trb)
3119 retval =
Matrix (a_nr, b_nc);
3126 a.
data (), lda, 0.0, c, a_nr
3129 for (
int j = 0; j < a_nr; j++)
3130 for (
int i = 0; i < j; i++)
3141 retval =
Matrix (a_nr, b_nc);
3152 lda, tda, 1.0, a.
data (), lda,
3153 b.
data (), 1, 0.0, c, 1
3161 ldb, tdb, 1.0, b.
data (), ldb,
3162 a.
data (), 1, 0.0, c, 1
3171 a_nr, b_nc, a_nc, 1.0, a.
data (),
3172 lda, b.
data (), ldb, 0.0, c, a_nr
3185 return xgemm (a, b);
3190 #define EMPTY_RETURN_CHECK(T) \
3191 if (nr == 0 || nc == 0) \
3208 result(i, j) =
xmin (d, m(i, j));
3228 result(i, j) =
xmin (m(i, j), d);
3242 (*current_liboctave_error_handler)
3243 (
"two-arg min expecting args of same size");
3255 result(i, j) =
xmin (a(i, j), b(i, j));
3275 result(i, j) =
xmax (d, m(i, j));
3295 result(i, j) =
xmax (m(i, j), d);
3309 (*current_liboctave_error_handler)
3310 (
"two-arg max expecting args of same size");
3322 result(i, j) =
xmax (a(i, j), b(i, j));
3339 (
"linspace: vectors must be of equal length");
3343 retval.clear (m, n);
3345 retval(i, 0) = x1(i);
3348 double *delta = &retval(0, n-1);
3350 delta[i] = (x2(i) - x1(i)) / (n - 1);
3354 retval(i, j) = x1(i) + j*delta[i];
3357 retval(i, n-1) = x2(i);
Matrix diag(octave_idx_type k=0) const
void octave_write_double(std::ostream &os, double d)
DiagMatrix singular_values(void) const
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)
#define F77_CHAR_ARG_LEN(l)
void gripe_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
#define MM_BOOL_OPS(M1, M2)
Matrix tinverse(MatrixType &mattype, octave_idx_type &info, double &rcon, int force, int calc_cond) const
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)
Matrix right_singular_matrix(void) const
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
subroutine zffti(n, wsave)
static octave_idx_type nn
Matrix finverse(MatrixType &mattype, octave_idx_type &info, double &rcon, int force, int calc_cond) const
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
NDArray sumsq(int dim=-1) const
void mx_inline_real(size_t n, T *r, const std::complex< T > *x)
subroutine xdlange(norm, m, n, a, lda, work, retval)
#define SM_BOOL_OPS(S, M)
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
Complex xmax(const Complex &x, const Complex &y)
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)
Matrix min(double d, const Matrix &m)
Complex xmin(const Complex &x, const Complex &y)
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
std::ostream & operator<<(std::ostream &os, const Matrix &a)
octave_idx_type rows(void) const
F77_RET_T const double const double double * d
subroutine zfftb(n, c, wsave)
static int fftNd(const double *, Complex *, const int, const dim_vector &)
#define F77_CONST_CHAR_ARG2(x, l)
void mx_inline_imag(size_t n, T *r, const std::complex< T > *x)
Array< T > & insert(const Array< T > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type r2
Matrix & fill(double val)
F77_RET_T F77_CONST_CHAR_ARG_DECL
RowVector column_max(void) const
ColumnVector row_max(void) const
liboctave_error_handler current_liboctave_error_handler
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
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)
void resize(const dim_vector &dv, const T &rfv)
Matrix inverse(void) const
Matrix transpose(void) 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)
void gripe_singular_matrix(double rcond)
Matrix xgemm(const Matrix &a, const Matrix &b, blas_trans_type transa, blas_trans_type transb)
Matrix real(const ComplexMatrix &a)
void mark_as_rectangular(void)
Matrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
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 &)
Matrix left_singular_matrix(void) const
DET determinant(void) const
double & xelem(octave_idx_type n)
Matrix & operator-=(const DiagMatrix &a)
static ComplexMatrix unstack_complex_matrix(const Matrix &sm)
F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type const octave_idx_type octave_idx_type &F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL
octave_idx_type cols(void) const
boolNDArray all(int dim=-1) const
octave_idx_type length(void) const
Number of elements in the array.
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
F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type const double const double octave_idx_type double * V
F77_RET_T F77_FUNC(xilaenv, XILAENV)(const octave_idx_type &
Matrix prod(int dim=-1) const
boolMatrix all(int dim=-1) const
ColumnVector column(octave_idx_type i) const
void scale(Matrix &m, double x, double y, double z)
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
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type r1
Matrix sum(int dim=-1) const
ComplexMatrix ifourier2d(void) const
std::complex< double > Complex
const T * fortran_vec(void) const
Matrix unitary_matrix(void) const
bool mx_inline_equal(size_t n, const T1 *x, const T2 *y)
octave_idx_type cols(void) const
ComplexMatrix lssolve(const Matrix &b) const
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.
subroutine zfftf(n, c, wsave)
Matrix inverse(void) const
F77_RET_T const double * x
Matrix schur_matrix(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