36 #include <sys/types.h>
74 const octave_idx_type&,
const octave_idx_type&,
75 const octave_idx_type&,
const octave_idx_type&,
83 const octave_idx_type&, octave_idx_type&,
84 octave_idx_type&,
float*, octave_idx_type&
90 const octave_idx_type&,
const octave_idx_type&,
91 const octave_idx_type&,
float*,
92 const octave_idx_type&,
float*,
93 const octave_idx_type&, octave_idx_type&
100 const octave_idx_type&,
const octave_idx_type&,
101 const octave_idx_type&,
const FloatComplex&,
102 const FloatComplex*,
const octave_idx_type&,
103 const FloatComplex*,
const octave_idx_type&,
104 const FloatComplex&, FloatComplex*,
105 const octave_idx_type&
111 const octave_idx_type&,
const octave_idx_type&,
112 const FloatComplex&,
const FloatComplex*,
113 const octave_idx_type&,
const FloatComplex*,
114 const octave_idx_type&,
const FloatComplex&,
115 FloatComplex*,
const octave_idx_type&
119 F77_FUNC (
xcdotu, XCDOTU) (
const octave_idx_type&,
const FloatComplex*,
120 const octave_idx_type&,
const FloatComplex*,
121 const octave_idx_type&, FloatComplex&);
124 F77_FUNC (
xcdotc, XCDOTC) (
const octave_idx_type&,
const FloatComplex*,
125 const octave_idx_type&,
const FloatComplex*,
126 const octave_idx_type&, FloatComplex&);
131 const octave_idx_type&,
const octave_idx_type&,
132 const FloatComplex&,
const FloatComplex*,
133 const octave_idx_type&,
const FloatComplex&,
134 FloatComplex*,
const octave_idx_type&
141 const octave_idx_type&,
const octave_idx_type&,
142 const float&,
const FloatComplex*,
143 const octave_idx_type&,
const float&,
144 FloatComplex*,
const octave_idx_type&
149 F77_FUNC (cgetrf, CGETRF) (
const octave_idx_type&,
const octave_idx_type&,
150 FloatComplex*,
const octave_idx_type&,
151 octave_idx_type*, octave_idx_type&);
155 const octave_idx_type&,
const octave_idx_type&,
156 FloatComplex*,
const octave_idx_type&,
157 const octave_idx_type*, FloatComplex*,
158 const octave_idx_type&, octave_idx_type&
162 F77_FUNC (cgetri, CGETRI) (
const octave_idx_type&, FloatComplex*,
163 const octave_idx_type&,
const octave_idx_type*,
164 FloatComplex*,
const octave_idx_type&,
169 const octave_idx_type&, FloatComplex*,
170 const octave_idx_type&,
const float&,
float&,
171 FloatComplex*,
float*, octave_idx_type&
175 F77_FUNC (cgelsy, CGELSY) (
const octave_idx_type&,
const octave_idx_type&,
176 const octave_idx_type&, FloatComplex*,
177 const octave_idx_type&, FloatComplex*,
178 const octave_idx_type&, octave_idx_type*,
179 float&, octave_idx_type&, FloatComplex*,
180 const octave_idx_type&,
float*, octave_idx_type&);
183 F77_FUNC (cgelsd, CGELSD) (
const octave_idx_type&,
const octave_idx_type&,
184 const octave_idx_type&, FloatComplex*,
185 const octave_idx_type&, FloatComplex*,
186 const octave_idx_type&,
float*,
float&,
187 octave_idx_type&, FloatComplex*,
188 const octave_idx_type&,
float*,
189 octave_idx_type*, octave_idx_type&);
193 const octave_idx_type&, FloatComplex*,
194 const octave_idx_type&, octave_idx_type&
199 const octave_idx_type&, FloatComplex*,
200 const octave_idx_type&,
const float&,
float&,
201 FloatComplex*,
float*, octave_idx_type&
206 const octave_idx_type&,
207 const octave_idx_type&,
const FloatComplex*,
208 const octave_idx_type&, FloatComplex*,
209 const octave_idx_type&, octave_idx_type&
215 const octave_idx_type&,
const FloatComplex*,
216 const octave_idx_type&, octave_idx_type&
224 const octave_idx_type&,
const FloatComplex*,
225 const octave_idx_type&,
float&, FloatComplex*,
226 float*, octave_idx_type&
235 const octave_idx_type&,
const octave_idx_type&,
236 const FloatComplex*,
const octave_idx_type&,
237 FloatComplex*,
const octave_idx_type&,
244 F77_FUNC (clartg, CLARTG) (
const FloatComplex&,
const FloatComplex&,
245 float&, FloatComplex&, FloatComplex&);
250 const octave_idx_type&,
const octave_idx_type&,
251 const octave_idx_type&,
const FloatComplex*,
252 const octave_idx_type&,
const FloatComplex*,
253 const octave_idx_type&,
const FloatComplex*,
254 const octave_idx_type&,
float&, octave_idx_type&
260 const octave_idx_type&,
const octave_idx_type&,
261 const FloatComplex*,
const octave_idx_type&,
351 elem (i, j) =
static_cast<unsigned char> (a.
elem (i, j));
378 return !(*
this == a);
409 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
411 (*current_liboctave_error_handler) (
"range error for insert");
415 if (a_nr >0 && a_nc > 0)
433 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
435 (*current_liboctave_error_handler) (
"range error for insert");
456 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
458 (*current_liboctave_error_handler) (
"range error for insert");
480 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
482 (*current_liboctave_error_handler) (
"range error for insert");
486 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
514 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
516 (*current_liboctave_error_handler) (
"range error for insert");
532 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
534 (*current_liboctave_error_handler) (
"range error for insert");
556 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
558 (*current_liboctave_error_handler) (
"range error for insert");
562 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
583 if (nr > 0 && nc > 0)
601 if (nr > 0 && nc > 0)
620 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
621 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
623 (*current_liboctave_error_handler) (
"range error for fill");
627 if (r1 > r2) { std::swap (r1, r2); }
628 if (c1 > c2) { std::swap (c1, c2); }
630 if (r2 >= r1 && c2 >= c1)
650 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
651 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
653 (*current_liboctave_error_handler) (
"range error for fill");
657 if (r1 > r2) { std::swap (r1, r2); }
658 if (c1 > c2) { std::swap (c1, c2); }
660 if (r2 >= r1 && c2 >=c1)
679 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
685 retval.
insert (*
this, 0, 0);
686 retval.
insert (a, 0, nc_insert);
697 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
703 retval.
insert (*
this, 0, 0);
704 retval.
insert (a, 0, nc_insert);
715 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
721 retval.
insert (*
this, 0, 0);
722 retval.
insert (a, 0, nc_insert);
733 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
739 retval.
insert (*
this, 0, 0);
740 retval.
insert (a, 0, nc_insert);
751 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
757 retval.
insert (*
this, 0, 0);
758 retval.
insert (a, 0, nc_insert);
769 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
775 retval.
insert (*
this, 0, 0);
776 retval.
insert (a, 0, nc_insert);
787 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
793 retval.
insert (*
this, 0, 0);
794 retval.
insert (a, 0, nc_insert);
805 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
811 retval.
insert (*
this, 0, 0);
812 retval.
insert (a, 0, nc_insert);
823 (*current_liboctave_error_handler)
824 (
"column dimension mismatch for stack");
830 retval.
insert (*
this, 0, 0);
831 retval.
insert (a, nr_insert, 0);
842 (*current_liboctave_error_handler)
843 (
"column dimension mismatch for stack");
849 retval.
insert (*
this, 0, 0);
850 retval.
insert (a, nr_insert, 0);
861 (*current_liboctave_error_handler)
862 (
"column dimension mismatch for stack");
868 retval.
insert (*
this, 0, 0);
869 retval.
insert (a, nr_insert, 0);
880 (*current_liboctave_error_handler)
881 (
"column dimension mismatch for stack");
887 retval.
insert (*
this, 0, 0);
888 retval.
insert (a, nr_insert, 0);
899 (*current_liboctave_error_handler)
900 (
"column dimension mismatch for stack");
906 retval.
insert (*
this, 0, 0);
907 retval.
insert (a, nr_insert, 0);
918 (*current_liboctave_error_handler)
919 (
"column dimension mismatch for stack");
925 retval.
insert (*
this, 0, 0);
926 retval.
insert (a, nr_insert, 0);
937 (*current_liboctave_error_handler)
938 (
"column dimension mismatch for stack");
944 retval.
insert (*
this, 0, 0);
945 retval.
insert (a, nr_insert, 0);
956 (*current_liboctave_error_handler)
957 (
"column dimension mismatch for stack");
963 retval.
insert (*
this, 0, 0);
964 retval.
insert (a, nr_insert, 0);
971 return do_mx_unary_map<FloatComplex, FloatComplex, std::conj<float> > (a);
980 if (r1 > r2) { std::swap (r1, r2); }
981 if (c1 > c2) { std::swap (c1, c2); }
1013 return inverse (mattype, info, rcon, 0, 0);
1021 return inverse (mattype, info, rcon, 0, 0);
1026 int calc_cond)
const
1029 return inverse (mattype, info, rcon, force, calc_cond);
1037 return inverse (mattype, info, rcon, 0, 0);
1044 return inverse (mattype, info, rcon, 0, 0);
1049 float& rcon,
int force,
int calc_cond)
const
1056 if (nr != nc || nr == 0 || nc == 0)
1057 (*current_liboctave_error_handler) (
"inverse requires square matrix");
1060 int typ = mattype.
type ();
1068 nr, tmp_data, nr, info
1087 nr, tmp_data, nr, rcon,
1088 cwork, rwork, ztrcon_info
1093 if (ztrcon_info != 0)
1097 if (info == -1 && ! force)
1106 float& rcon,
int force,
int calc_cond)
const
1114 (*current_liboctave_error_handler) (
"inverse requires square matrix");
1128 F77_XFCN (cgetri, CGETRI, (nc, tmp_data, nr, pipvt,
1132 lwork = (lwork < 2 *nc ? 2*nc : lwork);
1141 anorm = retval.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
1144 F77_XFCN (cgetrf, CGETRF, (nc, nc, tmp_data, nr, pipvt, info));
1158 nc, tmp_data, nr, anorm,
1159 rcon, pz, prz, zgecon_info
1162 if (zgecon_info != 0)
1166 if (info == -1 && ! force)
1172 F77_XFCN (cgetri, CGETRI, (nc, tmp_data, nr, pipvt,
1173 pz, lwork, zgetri_info));
1175 if (zgetri_info != 0)
1188 float& rcon,
int force,
int calc_cond)
const
1190 int typ = mattype.
type (
false);
1194 typ = mattype.
type (*
this);
1197 ret =
tinverse (mattype, info, rcon, force, calc_cond);
1206 rcon = chol.
rcond ();
1216 ret =
finverse (mattype, info, rcon, force, calc_cond);
1218 if ((mattype.
is_hermitian () || calc_cond) && rcon == 0.)
1246 tol = nr * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
1248 tol = nc * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
1251 while (r >= 0 && sigma.
elem (r) < tol)
1267 #if defined (HAVE_FFTW)
1272 size_t nr =
rows ();
1273 size_t nc =
cols ();
1277 size_t npts, nsamples;
1279 if (nr == 1 || nc == 1)
1281 npts = nr > nc ? nr : nc;
1301 size_t nr =
rows ();
1302 size_t nc =
cols ();
1306 size_t npts, nsamples;
1308 if (nr == 1 || nc == 1)
1310 npts = nr > nc ? nr : nc;
1367 F77_FUNC (
cfftb, CFFTB) (
const octave_idx_type&, FloatComplex*,
1381 if (nr == 1 || nc == 1)
1383 npts = nr > nc ? nr : nc;
1422 if (nr == 1 || nc == 1)
1424 npts = nr > nc ? nr : nc;
1451 tmp_data[j] = tmp_data[j] / static_cast<float> (npts);
1466 if (nr == 1 || nc == 1)
1468 npts = nr > nc ? nr : nc;
1499 pwsave = wsave.fortran_vec ();
1511 prow[i] = tmp_data[i*nr + j];
1516 tmp_data[i*nr + j] = prow[i];
1532 if (nr == 1 || nc == 1)
1534 npts = nr > nc ? nr : nc;
1561 tmp_data[j] = tmp_data[j] / static_cast<float> (npts);
1568 pwsave = wsave.fortran_vec ();
1580 prow[i] = tmp_data[i*nr + j];
1585 tmp_data[i*nr + j] = prow[i] / static_cast<float> (npts);
1610 int calc_cond)
const
1613 return determinant (mattype, info, rcon, calc_cond);
1619 int calc_cond)
const
1630 (*current_liboctave_error_handler) (
"matrix must be square");
1633 volatile int typ = mattype.
type ();
1640 typ = mattype.
type (*
this);
1647 retval *=
elem (i,i);
1655 if (calc_cond) anorm =
xnorm (*
this, 1);
1677 nr, tmp_data, nr, anorm,
1685 retval *= atmp (i,i);
1687 retval = retval.
square ();
1691 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
1705 if (calc_cond) anorm =
xnorm (*
this, 1);
1707 F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1728 nc, tmp_data, nr, anorm,
1743 retval *= (ipvt(i) != (i+1)) ? -c : c;
1757 return rcond (mattype);
1768 (*current_liboctave_error_handler) (
"matrix must be square");
1769 else if (nr == 0 || nc == 0)
1773 volatile int typ = mattype.
type ();
1776 typ = mattype.
type (*
this);
1795 nr, tmp_data, nr, rcon,
1805 (*current_liboctave_error_handler)
1806 (
"permuted triangular matrix not implemented");
1823 nr, tmp_data, nr, rcon,
1833 (*current_liboctave_error_handler)
1834 (
"permuted triangular matrix not implemented");
1847 anorm = atmp.
abs().
sum().
1848 row(static_cast<octave_idx_type>(0)).
max();
1869 nr, tmp_data, nr, anorm,
1890 anorm = atmp.
abs ().
sum ().
1891 row(static_cast<octave_idx_type>(0)).
max ();
1898 F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1909 nc, tmp_data, nr, anorm,
1928 solve_singularity_handler sing_handler,
1936 if (nr != b.
rows ())
1938 (
"matrix dimension mismatch solution of linear equations");
1939 else if (nr == 0 || nc == 0 || b.
cols () == 0)
1943 volatile int typ = mattype.
type ();
1953 (*current_liboctave_error_handler)
1954 (
"permuted triangular matrix not implemented");
1970 nr, b_nc, tmp_data, nr,
1990 nr, tmp_data, nr, rcon,
1999 volatile float rcond_plus_one = rcon + 1.0;
2001 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2006 sing_handler (rcon);
2023 solve_singularity_handler sing_handler,
2031 if (nr != b.
rows ())
2033 (
"matrix dimension mismatch solution of linear equations");
2034 else if (nr == 0 || nc == 0 || b.
cols () == 0)
2038 volatile int typ = mattype.
type ();
2048 (*current_liboctave_error_handler)
2049 (
"permuted triangular matrix not implemented");
2065 nr, b_nc, tmp_data, nr,
2085 nr, tmp_data, nr, rcon,
2094 volatile float rcond_plus_one = rcon + 1.0;
2096 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2101 sing_handler (rcon);
2118 solve_singularity_handler sing_handler,
2119 bool calc_cond)
const
2127 if (nr != nc || nr != b.
rows ())
2129 (
"matrix dimension mismatch solution of linear equations");
2130 else if (nr == 0 || b.
cols () == 0)
2134 volatile int typ = mattype.
type ();
2147 anorm = atmp.
abs().
sum().
row(static_cast<octave_idx_type>(0)).
max();
2172 nr, tmp_data, nr, anorm,
2179 volatile float rcond_plus_one = rcon + 1.0;
2181 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2186 sing_handler (rcon);
2200 nr, b_nc, tmp_data, nr,
2201 result, b.
rows (), info
2229 anorm = atmp.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
2232 F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info));
2241 sing_handler (rcon);
2255 nc, tmp_data, nr, anorm,
2262 volatile float rcond_plus_one = rcon + 1.0;
2264 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2269 sing_handler (rcon);
2284 nr, b_nc, tmp_data, nr,
2285 pipvt, result, b.
rows (), info
2302 return solve (typ, b, info, rcon, 0);
2310 return solve (typ, b, info, rcon, 0);
2318 return solve (typ, b, info, rcon, 0);
2324 float& rcon, solve_singularity_handler sing_handler,
2328 return solve (typ, tmp, info, rcon, sing_handler, singular_fallback, transt);
2336 return solve (typ, b, info, rcon, 0);
2344 return solve (typ, b, info, rcon, 0);
2351 return solve (typ, b, info, rcon, 0);
2357 solve_singularity_handler sing_handler,
2361 int typ = mattype.
type ();
2364 typ = mattype.
type (*
this);
2368 retval =
utsolve (mattype, b, info, rcon, sing_handler,
true, transt);
2370 retval =
ltsolve (mattype, b, info, rcon, sing_handler,
true, transt);
2375 retval =
hermitian ().
solve (mattype, b, info, rcon, sing_handler,
2378 retval =
fsolve (mattype, b, info, rcon, sing_handler,
true);
2381 (*current_liboctave_error_handler) (
"unknown matrix type");
2389 retval =
lssolve (b, info, rank, rcon);
2421 solve_singularity_handler sing_handler,
2434 return solve (typ, b, info, rcon, 0);
2442 return solve (typ, b, info, rcon, 0);
2449 return solve (typ, b, info, rcon, 0);
2455 solve_singularity_handler sing_handler,
2460 tmp =
solve (typ, tmp, info, rcon, sing_handler,
true, transt);
2461 return tmp.
column (static_cast<octave_idx_type> (0));
2469 return solve (b, info, rcon, 0);
2476 return solve (b, info, rcon, 0);
2483 return solve (b, info, rcon, 0);
2489 solve_singularity_handler sing_handler,
2493 return solve (tmp, info, rcon, sing_handler, transt);
2501 return solve (b, info, rcon, 0);
2509 return solve (b, info, rcon, 0);
2516 return solve (b, info, rcon, 0);
2522 solve_singularity_handler sing_handler,
2526 return solve (mattype, b, info, rcon, sing_handler,
true, transt);
2555 solve_singularity_handler sing_handler,
2566 return solve (b, info, rcon, 0);
2574 return solve (b, info, rcon, 0);
2582 return solve (b, info, rcon, 0);
2589 solve_singularity_handler sing_handler,
2593 return solve (mattype, b, info, rcon, sing_handler, transt);
2634 return lssolve (b, info, rank, rcon);
2643 return lssolve (b, info, rank, rcon);
2651 return lssolve (b, info, rank, rcon);
2667 (
"matrix dimension mismatch solution of linear equations");
2668 else if (m== 0 || n == 0 || b.
cols () == 0)
2682 retval.
elem (i, j) = b.
elem (i, j);
2709 m, n, nrhs, -1, mnthr
2716 float dminmn =
static_cast<float> (minmn);
2717 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2718 float tmp =
xlog2 (dminmn / dsmlsizp1);
2727 n*(1+nrhs) + 2*nrhs);
2739 F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2741 lwork, prwork, piwork, info));
2747 if (n > m && n >= mnthr)
2763 work(0) = lworkaround;
2770 work(0) = lworkaround;
2776 F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval,
2777 maxmn, ps, rcon, rank,
2779 prwork, piwork, info));
2781 if (s.
elem (0) == 0.0)
2784 rcon = s.
elem (minmn - 1) / s.
elem (0);
2831 return lssolve (b, info, rank, rcon);
2840 return lssolve (b, info, rank, rcon);
2849 return lssolve (b, info, rank, rcon);
2867 (
"matrix dimension mismatch solution of linear equations");
2868 else if (m == 0 || n == 0 || b.
cols () == 0)
2908 float dminmn =
static_cast<float> (minmn);
2909 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2910 float tmp =
xlog2 (dminmn / dsmlsizp1);
2917 + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1);
2929 F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2931 lwork, prwork, piwork, info));
2938 F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval,
2939 maxmn, ps, rcon, rank,
2941 prwork, piwork, info));
2945 if (s.
elem (0) == 0.0)
2948 rcon = s.
elem (minmn - 1) / s.
elem (0);
2989 len, a_len, 1, 1.0, v.
data (), len,
2990 a.
data (), 1, 0.0, c, len
3009 if (nr != a_nr || nc != a_nc)
3030 if (nr != a_nr || nc != a_nc)
3051 if (nr != a_nr || nc != a_nc)
3072 if (nr != a_nr || nc != a_nc)
3095 if (nr != a_nr || nc != a_nc)
3101 if (nr == 0 || nc == 0)
3119 if (nr != a_nr || nc != a_nc)
3125 if (nr == 0 || nc == 0)
3197 if (nr == 1 || nc == 1)
3201 (
"diag: expecting vector argument");
3259 if (nr > 0 && nc > 0)
3274 for (idx_j = 0; idx_j < nc; idx_j++)
3276 tmp_min =
elem (i, idx_j);
3280 abs_min = real_only ?
std::real (tmp_min)
3295 if (abs_tmp < abs_min)
3306 idx_arg.
elem (i) = 0;
3310 result.
elem (i) = tmp_min;
3311 idx_arg.
elem (i) = idx_j;
3334 if (nr > 0 && nc > 0)
3349 for (idx_j = 0; idx_j < nc; idx_j++)
3351 tmp_max =
elem (i, idx_j);
3355 abs_max = real_only ?
std::real (tmp_max)
3370 if (abs_tmp > abs_max)
3381 idx_arg.
elem (i) = 0;
3385 result.
elem (i) = tmp_max;
3386 idx_arg.
elem (i) = idx_j;
3409 if (nr > 0 && nc > 0)
3424 for (idx_i = 0; idx_i < nr; idx_i++)
3426 tmp_min =
elem (idx_i, j);
3430 abs_min = real_only ?
std::real (tmp_min)
3445 if (abs_tmp < abs_min)
3456 idx_arg.
elem (j) = 0;
3460 result.
elem (j) = tmp_min;
3461 idx_arg.
elem (j) = idx_i;
3484 if (nr > 0 && nc > 0)
3499 for (idx_i = 0; idx_i < nr; idx_i++)
3501 tmp_max =
elem (idx_i, j);
3505 abs_max = real_only ?
std::real (tmp_max)
3520 if (abs_tmp > abs_max)
3531 idx_arg.
elem (j) = 0;
3535 result.
elem (j) = tmp_max;
3536 idx_arg.
elem (j) = idx_i;
3567 if (nr > 0 && nc > 0)
3573 tmp = octave_read_value<FloatComplex> (is);
3575 a.
elem (i, j) = tmp;
3592 F77_FUNC (clartg, CLARTG) (
x, y, cc, cs, temp_r);
3643 1, a_nr, b_nr, pa, a_nr, pb,
3644 b_nr, px, a_nr, scale, info
3699 return trans ? (conj ?
'C' :
'T') :
'N';
3725 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
3727 else if (a.
data () == b.
data () && a_nr == b_nc && tra != trb)
3745 a.
data (), lda, 0.0, c, a_nr
3757 a.
data (), lda, 0.0, c, a_nr
3777 if (b_nc == 1 && a_nr == 1)
3792 else if (b_nc == 1 && ! cjb)
3796 lda, tda, 1.0, a.
data (), lda,
3797 b.
data (), 1, 0.0, c, 1
3800 else if (a_nr == 1 && ! cja && ! cjb)
3804 ldb, tdb, 1.0, b.
data (), ldb,
3805 a.
data (), 1, 0.0, c, 1
3814 a_nr, b_nc, a_nc, 1.0, a.
data (),
3815 lda, b.
data (), ldb, 0.0, c, a_nr
3828 return xgemm (a, b);
3834 #define EMPTY_RETURN_CHECK(T) \
3835 if (nr == 0 || nc == 0) \
3852 result(i, j) =
xmin (c, m(i, j));
3872 result(i, j) =
xmin (m(i, j), c);
3886 (*current_liboctave_error_handler)
3887 (
"two-arg min expecting args of same size");
3897 int columns_are_real_only = 1;
3903 columns_are_real_only = 0;
3908 if (columns_are_real_only)
3918 result(i, j) =
xmin (a(i, j), b(i, j));
3940 result(i, j) =
xmax (c, m(i, j));
3960 result(i, j) =
xmax (m(i, j), c);
3974 (*current_liboctave_error_handler)
3975 (
"two-arg max expecting args of same size");
3985 int columns_are_real_only = 1;
3991 columns_are_real_only = 0;
3996 if (columns_are_real_only)
4009 result(i, j) =
xmax (a(i, j), b(i, j));
4028 (
"linspace: vectors must be of equal length");
4032 retval.clear (m, n);
4034 retval(i, 0) = x1(i);
4039 delta[i] = (x2(i) - x1(i)) / (n - 1.0f);
4043 retval(i, j) = x1(i) +
static_cast<float> (j)*delta[i];
4046 retval(i, n-1) = x2(i);
FloatComplexMatrix transpose(void) const
F77_RET_T F77_CONST_CHAR_ARG_DECL
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))
#define F77_CHAR_ARG_LEN(l)
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 gripe_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))
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 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
FloatComplexMatrix left_singular_matrix(void) const
subroutine xclange(NORM, M, N, A, LDA, WORK, VALUE)
FloatNDArray abs(void) const
#define SM_BOOL_OPS(S, M)
Complex xmax(const Complex &x, const Complex &y)
void octave_write_complex(std::ostream &os, const Complex &c)
octave_idx_type rows(void) const
FloatComplexMatrix right_singular_matrix(void) const
FloatComplexMatrix finverse(MatrixType &mattype, octave_idx_type &info, float &rcon, int force, int calc_cond) const
Complex xmin(const Complex &x, const Complex &y)
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
F77_RET_T F77_FUNC(xilaenv, XILAENV)(const octave_idx_type &
FloatComplexMatrix inverse(void) const
FloatComplexMatrix lssolve(const FloatMatrix &b) const
subroutine cfftb(n, c, wsave)
FloatComplexMatrix unitary_matrix(void) const
#define F77_XFCN(f, F, args)
FloatComplexMatrix & fill(float val)
static const FloatComplex FloatComplex_NaN_result((lo_ieee_float_nan_value()),(lo_ieee_float_nan_value()))
FloatComplexMatrix inverse(void) const
bool is_hermitian(void) const
octave_idx_type rows(void) const
F77_RET_T const double const double double * d
static int fftNd(const double *, Complex *, const int, const dim_vector &)
#define F77_CONST_CHAR_ARG2(x, l)
FloatComplexMatrix tinverse(MatrixType &mattype, octave_idx_type &info, float &rcon, int force, int calc_cond) 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.
FloatDiagMatrix singular_values(void) const
FloatComplexNDArray cumsum(int dim=-1) const
FloatMatrix abs(void) const
FloatComplexMatrix diag(octave_idx_type k=0) const
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type r2
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
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
subroutine cffti(n, wsave)
liboctave_error_handler current_liboctave_error_handler
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)
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
FloatComplexMatrix & operator-=(const FloatDiagMatrix &a)
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)
FloatComplexMatrix schur_matrix(void) const
FloatComplexColumnVector row_min(void) const
void resize(const dim_vector &dv, const T &rfv)
void resize(octave_idx_type n, const FloatComplex &rfv=FloatComplex(0))
subroutine cfftf(n, c, wsave)
FloatComplexMatrix sum(int dim=-1) 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)
void gripe_singular_matrix(double rcond)
FloatComplexMatrix cumsum(int dim=-1) const
FloatColumnVector extract_diag(octave_idx_type k=0) const
void mark_as_rectangular(void)
FloatComplexMatrix ifourier(void) const
FloatComplexMatrix conj(const FloatComplexMatrix &a)
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
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 ...
subroutine xcdotc(n, zx, incx, zy, incy, retval)
F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type const double const double octave_idx_type double * V
FloatComplexMatrix prod(int dim=-1) const
FloatComplexMatrix fourier(void) const
void scale(Matrix &m, double x, double y, double z)
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)
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
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
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
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type r1
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
FloatComplexRowVector row(octave_idx_type i) const
FloatComplexMatrix max(const FloatComplex &c, const FloatComplexMatrix &m)
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 const double * x
std::istream & operator>>(std::istream &is, FloatComplexMatrix &a)