36 #include <sys/types.h>
76 const octave_idx_type&,
const octave_idx_type&,
77 const octave_idx_type&,
const octave_idx_type&,
84 const octave_idx_type&,
Complex*,
85 const octave_idx_type&, octave_idx_type&,
86 octave_idx_type&,
double*, octave_idx_type&
92 const octave_idx_type&,
const octave_idx_type&,
93 const octave_idx_type&,
double*,
94 const octave_idx_type&,
double*,
95 const octave_idx_type&, octave_idx_type&
102 const octave_idx_type&,
const octave_idx_type&,
103 const octave_idx_type&,
const Complex&,
104 const Complex*,
const octave_idx_type&,
105 const Complex*,
const octave_idx_type&,
106 const Complex&, Complex*,
const octave_idx_type&
112 const octave_idx_type&,
const octave_idx_type&,
113 const Complex&,
const Complex*,
114 const octave_idx_type&,
const Complex*,
115 const octave_idx_type&,
const Complex&,
116 Complex*,
const octave_idx_type&
120 F77_FUNC (
xzdotu, XZDOTU) (
const octave_idx_type&,
const Complex*,
121 const octave_idx_type&,
const Complex*,
122 const octave_idx_type&, Complex&);
125 F77_FUNC (
xzdotc, XZDOTC) (
const octave_idx_type&,
const Complex*,
126 const octave_idx_type&,
const Complex*,
127 const octave_idx_type&, Complex&);
132 const octave_idx_type&,
const octave_idx_type&,
133 const Complex&,
const Complex*,
134 const octave_idx_type&,
const Complex&,
135 Complex*,
const octave_idx_type&
142 const octave_idx_type&,
const octave_idx_type&,
143 const double&,
const Complex*,
144 const octave_idx_type&,
const double&, Complex*,
145 const octave_idx_type&
150 F77_FUNC (zgetrf, ZGETRF) (
const octave_idx_type&,
const octave_idx_type&,
151 Complex*,
const octave_idx_type&,
152 octave_idx_type*, octave_idx_type&);
156 const octave_idx_type&,
const octave_idx_type&,
157 Complex*,
const octave_idx_type&,
158 const octave_idx_type*, Complex*,
159 const octave_idx_type&, octave_idx_type&
163 F77_FUNC (zgetri, ZGETRI) (
const octave_idx_type&, Complex*,
164 const octave_idx_type&,
const octave_idx_type*,
165 Complex*,
const octave_idx_type&,
170 const octave_idx_type&, Complex*,
171 const octave_idx_type&,
const double&,
double&,
172 Complex*,
double*, octave_idx_type&
176 F77_FUNC (zgelsy, ZGELSY) (
const octave_idx_type&,
const octave_idx_type&,
177 const octave_idx_type&, Complex*,
178 const octave_idx_type&, Complex*,
179 const octave_idx_type&, octave_idx_type*,
180 double&, octave_idx_type&, Complex*,
181 const octave_idx_type&,
double*,
185 F77_FUNC (zgelsd, ZGELSD) (
const octave_idx_type&,
const octave_idx_type&,
186 const octave_idx_type&, Complex*,
187 const octave_idx_type&, Complex*,
188 const octave_idx_type&,
double*,
double&,
189 octave_idx_type&, Complex*,
190 const octave_idx_type&,
double*,
191 octave_idx_type*, octave_idx_type&);
195 const octave_idx_type&, Complex*,
196 const octave_idx_type&, octave_idx_type&
201 const octave_idx_type&, Complex*,
202 const octave_idx_type&,
const double&,
203 double&, Complex*,
double*, octave_idx_type&
208 const octave_idx_type&,
const octave_idx_type&,
209 const Complex*,
const octave_idx_type&, Complex*,
210 const octave_idx_type&, octave_idx_type&
216 const octave_idx_type&,
const Complex*,
217 const octave_idx_type&, octave_idx_type&
225 const octave_idx_type&,
const Complex*,
226 const octave_idx_type&,
double&,
227 Complex*,
double*, octave_idx_type&
236 const octave_idx_type&,
const octave_idx_type&,
237 const Complex*,
const octave_idx_type&, Complex*,
238 const octave_idx_type&, octave_idx_type&
244 F77_FUNC (zlartg, ZLARTG) (
const Complex&,
const Complex&,
double&,
250 const octave_idx_type&,
const octave_idx_type&,
251 const octave_idx_type&,
const Complex*,
252 const octave_idx_type&,
const Complex*,
253 const octave_idx_type&,
const Complex*,
254 const octave_idx_type&,
double&, octave_idx_type&
260 const octave_idx_type&,
const octave_idx_type&,
261 const Complex*,
const octave_idx_type&,
349 elem (i, j) =
static_cast<unsigned char> (a.
elem (i, j));
375 return !(*
this == a);
405 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
407 (*current_liboctave_error_handler) (
"range error for insert");
411 if (a_nr >0 && a_nc > 0)
428 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
430 (*current_liboctave_error_handler) (
"range error for insert");
451 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
453 (*current_liboctave_error_handler) (
"range error for insert");
475 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
477 (*current_liboctave_error_handler) (
"range error for insert");
481 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
509 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
511 (*current_liboctave_error_handler) (
"range error for insert");
527 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
529 (*current_liboctave_error_handler) (
"range error for insert");
551 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
553 (*current_liboctave_error_handler) (
"range error for insert");
557 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
578 if (nr > 0 && nc > 0)
596 if (nr > 0 && nc > 0)
615 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
616 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
618 (*current_liboctave_error_handler) (
"range error for fill");
622 if (r1 > r2) { std::swap (r1, r2); }
623 if (c1 > c2) { std::swap (c1, c2); }
625 if (r2 >= r1 && c2 >= c1)
644 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
645 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
647 (*current_liboctave_error_handler) (
"range error for fill");
651 if (r1 > r2) { std::swap (r1, r2); }
652 if (c1 > c2) { std::swap (c1, c2); }
654 if (r2 >= r1 && c2 >=c1)
673 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
679 retval.
insert (*
this, 0, 0);
680 retval.
insert (a, 0, nc_insert);
691 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
697 retval.
insert (*
this, 0, 0);
698 retval.
insert (a, 0, nc_insert);
709 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
715 retval.
insert (*
this, 0, 0);
716 retval.
insert (a, 0, nc_insert);
727 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
733 retval.
insert (*
this, 0, 0);
734 retval.
insert (a, 0, nc_insert);
745 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
751 retval.
insert (*
this, 0, 0);
752 retval.
insert (a, 0, nc_insert);
763 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
769 retval.
insert (*
this, 0, 0);
770 retval.
insert (a, 0, nc_insert);
781 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
787 retval.
insert (*
this, 0, 0);
788 retval.
insert (a, 0, nc_insert);
799 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
805 retval.
insert (*
this, 0, 0);
806 retval.
insert (a, 0, nc_insert);
817 (*current_liboctave_error_handler)
818 (
"column dimension mismatch for stack");
824 retval.
insert (*
this, 0, 0);
825 retval.
insert (a, nr_insert, 0);
836 (*current_liboctave_error_handler)
837 (
"column dimension mismatch for stack");
843 retval.
insert (*
this, 0, 0);
844 retval.
insert (a, nr_insert, 0);
855 (*current_liboctave_error_handler)
856 (
"column dimension mismatch for stack");
862 retval.
insert (*
this, 0, 0);
863 retval.
insert (a, nr_insert, 0);
874 (*current_liboctave_error_handler)
875 (
"column dimension mismatch for stack");
881 retval.
insert (*
this, 0, 0);
882 retval.
insert (a, nr_insert, 0);
893 (*current_liboctave_error_handler)
894 (
"column dimension mismatch for stack");
900 retval.
insert (*
this, 0, 0);
901 retval.
insert (a, nr_insert, 0);
912 (*current_liboctave_error_handler)
913 (
"column dimension mismatch for stack");
919 retval.
insert (*
this, 0, 0);
920 retval.
insert (a, nr_insert, 0);
931 (*current_liboctave_error_handler)
932 (
"column dimension mismatch for stack");
938 retval.
insert (*
this, 0, 0);
939 retval.
insert (a, nr_insert, 0);
950 (*current_liboctave_error_handler)
951 (
"column dimension mismatch for stack");
957 retval.
insert (*
this, 0, 0);
958 retval.
insert (a, nr_insert, 0);
965 return do_mx_unary_map<Complex, Complex, std::conj<double> > (a);
974 if (r1 > r2) { std::swap (r1, r2); }
975 if (c1 > c2) { std::swap (c1, c2); }
1007 return inverse (mattype, info, rcon, 0, 0);
1015 return inverse (mattype, info, rcon, 0, 0);
1020 int calc_cond)
const
1023 return inverse (mattype, info, rcon, force, calc_cond);
1031 return inverse (mattype, info, rcon, 0, 0);
1038 return inverse (mattype, info, rcon, 0, 0);
1043 double& rcon,
int force,
int calc_cond)
const
1050 if (nr != nc || nr == 0 || nc == 0)
1051 (*current_liboctave_error_handler) (
"inverse requires square matrix");
1054 int typ = mattype.
type ();
1062 nr, tmp_data, nr, info
1081 nr, tmp_data, nr, rcon,
1082 cwork, rwork, ztrcon_info
1087 if (ztrcon_info != 0)
1091 if (info == -1 && ! force)
1100 double& rcon,
int force,
int calc_cond)
const
1108 (*current_liboctave_error_handler) (
"inverse requires square matrix");
1122 F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt,
1126 lwork = (lwork < 2 *nc ? 2*nc : lwork);
1135 anorm = retval.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
1138 F77_XFCN (zgetrf, ZGETRF, (nc, nc, tmp_data, nr, pipvt, info));
1152 nc, tmp_data, nr, anorm,
1153 rcon, pz, prz, zgecon_info
1156 if (zgecon_info != 0)
1160 if (info == -1 && ! force)
1166 F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt,
1167 pz, lwork, zgetri_info));
1169 if (zgetri_info != 0)
1182 double& rcon,
int force,
int calc_cond)
const
1184 int typ = mattype.
type (
false);
1188 typ = mattype.
type (*
this);
1191 ret =
tinverse (mattype, info, rcon, force, calc_cond);
1200 rcon = chol.
rcond ();
1210 ret =
finverse (mattype, info, rcon, force, calc_cond);
1212 if ((mattype.
is_hermitian () || calc_cond) && rcon == 0.)
1239 tol = nr * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
1241 tol = nc * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
1244 while (r >= 0 && sigma.
elem (r) < tol)
1260 #if defined (HAVE_FFTW)
1265 size_t nr =
rows ();
1266 size_t nc =
cols ();
1270 size_t npts, nsamples;
1272 if (nr == 1 || nc == 1)
1274 npts = nr > nc ? nr : nc;
1294 size_t nr =
rows ();
1295 size_t nc =
cols ();
1299 size_t npts, nsamples;
1301 if (nr == 1 || nc == 1)
1303 npts = nr > nc ? nr : nc;
1364 F77_FUNC (
zfftb, ZFFTB) (
const octave_idx_type&, Complex*, Complex*);
1377 if (nr == 1 || nc == 1)
1379 npts = nr > nc ? nr : nc;
1391 Complex *pwsave = wsave.fortran_vec ();
1418 if (nr == 1 || nc == 1)
1420 npts = nr > nc ? nr : nc;
1432 Complex *pwsave = wsave.fortran_vec ();
1447 tmp_data[j] = tmp_data[j] / static_cast<double> (npts);
1462 if (nr == 1 || nc == 1)
1464 npts = nr > nc ? nr : nc;
1476 Complex *pwsave = wsave.fortran_vec ();
1495 pwsave = wsave.fortran_vec ();
1498 Complex *prow = tmp.fortran_vec ();
1507 prow[i] = tmp_data[i*nr + j];
1512 tmp_data[i*nr + j] = prow[i];
1528 if (nr == 1 || nc == 1)
1530 npts = nr > nc ? nr : nc;
1542 Complex *pwsave = wsave.fortran_vec ();
1557 tmp_data[j] = tmp_data[j] / static_cast<double> (npts);
1564 pwsave = wsave.fortran_vec ();
1567 Complex *prow = tmp.fortran_vec ();
1576 prow[i] = tmp_data[i*nr + j];
1581 tmp_data[i*nr + j] = prow[i] / static_cast<double> (npts);
1606 int calc_cond)
const
1609 return determinant (mattype, info, rcon, calc_cond);
1615 int calc_cond)
const
1626 (*current_liboctave_error_handler) (
"matrix must be square");
1629 volatile int typ = mattype.
type ();
1636 typ = mattype.
type (*
this);
1643 retval *=
elem (i,i);
1651 if (calc_cond) anorm =
xnorm (*
this, 1);
1673 nr, tmp_data, nr, anorm,
1681 retval *= atmp (i,i);
1683 retval = retval.
square ();
1687 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
1701 if (calc_cond) anorm =
xnorm (*
this, 1);
1703 F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1724 nc, tmp_data, nr, anorm,
1739 retval *= (ipvt(i) != (i+1)) ? -c : c;
1753 return rcond (mattype);
1764 (*current_liboctave_error_handler) (
"matrix must be square");
1765 else if (nr == 0 || nc == 0)
1769 volatile int typ = mattype.
type ();
1772 typ = mattype.
type (*
this);
1791 nr, tmp_data, nr, rcon,
1801 (*current_liboctave_error_handler)
1802 (
"permuted triangular matrix not implemented");
1819 nr, tmp_data, nr, rcon,
1829 (*current_liboctave_error_handler)
1830 (
"permuted triangular matrix not implemented");
1833 double anorm = -1.0;
1843 anorm = atmp.
abs().
sum().
1844 row(static_cast<octave_idx_type>(0)).
max();
1865 nr, tmp_data, nr, anorm,
1886 anorm = atmp.
abs ().
sum ().
1887 row(static_cast<octave_idx_type>(0)).
max ();
1894 F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1905 nc, tmp_data, nr, anorm,
1932 if (nr != b.
rows ())
1934 (
"matrix dimension mismatch solution of linear equations");
1935 else if (nr == 0 || nc == 0 || b.
cols () == 0)
1939 volatile int typ = mattype.
type ();
1949 (*current_liboctave_error_handler)
1950 (
"permuted triangular matrix not implemented");
1966 nr, b_nc, tmp_data, nr,
1986 nr, tmp_data, nr, rcon,
1995 volatile double rcond_plus_one = rcon + 1.0;
1997 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2002 sing_handler (rcon);
2027 if (nr != b.
rows ())
2029 (
"matrix dimension mismatch solution of linear equations");
2030 else if (nr == 0 || nc == 0 || b.
cols () == 0)
2034 volatile int typ = mattype.
type ();
2044 (*current_liboctave_error_handler)
2045 (
"permuted triangular matrix not implemented");
2061 nr, b_nc, tmp_data, nr,
2081 nr, tmp_data, nr, rcon,
2090 volatile double rcond_plus_one = rcon + 1.0;
2092 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2097 sing_handler (rcon);
2115 bool calc_cond)
const
2123 if (nr != nc || nr != b.
rows ())
2125 (
"matrix dimension mismatch solution of linear equations");
2126 else if (nr == 0 || b.
cols () == 0)
2130 volatile int typ = mattype.
type ();
2143 anorm = atmp.
abs().
sum().
row(static_cast<octave_idx_type>(0)).
max();
2168 nr, tmp_data, nr, anorm,
2175 volatile double rcond_plus_one = rcon + 1.0;
2177 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2182 sing_handler (rcon);
2196 nr, b_nc, tmp_data, nr,
2197 result, b.
rows (), info
2225 anorm = atmp.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
2228 F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info));
2237 sing_handler (rcon);
2251 nc, tmp_data, nr, anorm,
2258 volatile double rcond_plus_one = rcon + 1.0;
2260 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2265 sing_handler (rcon);
2280 nr, b_nc, tmp_data, nr,
2281 pipvt, result, b.
rows (), info
2298 return solve (typ, b, info, rcon, 0);
2306 return solve (typ, b, info, rcon, 0);
2313 return solve (typ, b, info, rcon, 0);
2322 return solve (typ, tmp, info, rcon, sing_handler, singular_fallback, transt);
2330 return solve (typ, b, info, rcon, 0);
2338 return solve (typ, b, info, rcon, 0);
2345 return solve (typ, b, info, rcon, 0);
2355 int typ = mattype.
type ();
2358 typ = mattype.
type (*
this);
2362 retval =
utsolve (mattype, b, info, rcon, sing_handler,
true, transt);
2364 retval =
ltsolve (mattype, b, info, rcon, sing_handler,
true, transt);
2369 retval =
hermitian ().
solve (mattype, b, info, rcon, sing_handler,
2372 retval =
fsolve (mattype, b, info, rcon, sing_handler,
true);
2375 (*current_liboctave_error_handler) (
"unknown matrix type");
2383 retval =
lssolve (b, info, rank, rcon);
2426 return solve (typ, b, info, rcon, 0);
2434 return solve (typ, b, info, rcon, 0);
2441 return solve (typ, b, info, rcon, 0);
2452 tmp =
solve (typ, tmp, info, rcon, sing_handler,
true, transt);
2453 return tmp.
column (static_cast<octave_idx_type> (0));
2461 return solve (b, info, rcon, 0);
2468 return solve (b, info, rcon, 0);
2475 return solve (b, info, rcon, 0);
2484 return solve (tmp, info, rcon, sing_handler, transt);
2492 return solve (b, info, rcon, 0);
2499 return solve (b, info, rcon, 0);
2506 return solve (b, info, rcon, 0);
2516 return solve (mattype, b, info, rcon, sing_handler,
true, transt);
2555 return solve (b, info, rcon, 0);
2562 return solve (b, info, rcon, 0);
2569 return solve (b, info, rcon, 0);
2579 return solve (mattype, b, info, rcon, sing_handler, transt);
2620 return lssolve (b, info, rank, rcon);
2628 return lssolve (b, info, rank, rcon);
2636 return lssolve (b, info, rank, rcon);
2652 (
"matrix dimension mismatch solution of linear equations");
2653 else if (m== 0 || n == 0 || b.
cols () == 0)
2667 retval.
elem (i, j) = b.
elem (i, j);
2694 m, n, nrhs, -1, mnthr
2701 double dminmn =
static_cast<double> (minmn);
2702 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
2703 double tmp =
xlog2 (dminmn / dsmlsizp1);
2712 n*(1+nrhs) + 2*nrhs);
2724 F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2726 lwork, prwork, piwork, info));
2732 if (n > m && n >= mnthr)
2748 work(0) = lworkaround;
2755 work(0) = lworkaround;
2761 F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval,
2762 maxmn, ps, rcon, rank,
2764 prwork, piwork, info));
2766 if (s.
elem (0) == 0.0)
2769 rcon = s.
elem (minmn - 1) / s.
elem (0);
2815 return lssolve (b, info, rank, rcon);
2824 return lssolve (b, info, rank, rcon);
2832 return lssolve (b, info, rank, rcon);
2849 (
"matrix dimension mismatch solution of linear equations");
2850 else if (m == 0 || n == 0 || b.
cols () == 0)
2890 double dminmn =
static_cast<double> (minmn);
2891 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
2892 double tmp =
xlog2 (dminmn / dsmlsizp1);
2899 + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1);
2911 F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2913 lwork, prwork, piwork, info));
2920 F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval,
2921 maxmn, ps, rcon, rank,
2923 prwork, piwork, info));
2927 if (s.
elem (0) == 0.0)
2930 rcon = s.
elem (minmn - 1) / s.
elem (0);
2971 len, a_len, 1, 1.0, v.
data (), len,
2972 a.
data (), 1, 0.0, c, len
2991 if (nr != a_nr || nc != a_nc)
3012 if (nr != a_nr || nc != a_nc)
3033 if (nr != a_nr || nc != a_nc)
3054 if (nr != a_nr || nc != a_nc)
3077 if (nr != a_nr || nc != a_nc)
3083 if (nr == 0 || nc == 0)
3101 if (nr != a_nr || nc != a_nc)
3107 if (nr == 0 || nc == 0)
3180 if (nr == 1 || nc == 1)
3184 (
"diag: expecting vector argument");
3242 if (nr > 0 && nc > 0)
3257 for (idx_j = 0; idx_j < nc; idx_j++)
3259 tmp_min =
elem (i, idx_j);
3263 abs_min = real_only ?
std::real (tmp_min)
3278 if (abs_tmp < abs_min)
3289 idx_arg.
elem (i) = 0;
3293 result.
elem (i) = tmp_min;
3294 idx_arg.
elem (i) = idx_j;
3317 if (nr > 0 && nc > 0)
3332 for (idx_j = 0; idx_j < nc; idx_j++)
3334 tmp_max =
elem (i, idx_j);
3338 abs_max = real_only ?
std::real (tmp_max)
3353 if (abs_tmp > abs_max)
3364 idx_arg.
elem (i) = 0;
3368 result.
elem (i) = tmp_max;
3369 idx_arg.
elem (i) = idx_j;
3392 if (nr > 0 && nc > 0)
3407 for (idx_i = 0; idx_i < nr; idx_i++)
3409 tmp_min =
elem (idx_i, j);
3413 abs_min = real_only ?
std::real (tmp_min)
3428 if (abs_tmp < abs_min)
3439 idx_arg.
elem (j) = 0;
3443 result.
elem (j) = tmp_min;
3444 idx_arg.
elem (j) = idx_i;
3467 if (nr > 0 && nc > 0)
3482 for (idx_i = 0; idx_i < nr; idx_i++)
3484 tmp_max =
elem (idx_i, j);
3488 abs_max = real_only ?
std::real (tmp_max)
3503 if (abs_tmp > abs_max)
3514 idx_arg.
elem (j) = 0;
3518 result.
elem (j) = tmp_max;
3519 idx_arg.
elem (j) = idx_i;
3550 if (nr > 0 && nc > 0)
3556 tmp = octave_read_value<Complex> (is);
3558 a.
elem (i, j) = tmp;
3575 F77_FUNC (zlartg, ZLARTG) (
x, y, cc, cs, temp_r);
3624 1, a_nr, b_nr, pa, a_nr, pb,
3625 b_nr, px, a_nr, scale, info
3680 return trans ? (conj ?
'C' :
'T') :
'N';
3706 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
3708 else if (a.
data () == b.
data () && a_nr == b_nc && tra != trb)
3726 a.
data (), lda, 0.0, c, a_nr
3738 a.
data (), lda, 0.0, c, a_nr
3758 if (b_nc == 1 && a_nr == 1)
3773 else if (b_nc == 1 && ! cjb)
3777 lda, tda, 1.0, a.
data (), lda,
3778 b.
data (), 1, 0.0, c, 1
3781 else if (a_nr == 1 && ! cja && ! cjb)
3785 ldb, tdb, 1.0, b.
data (), ldb,
3786 a.
data (), 1, 0.0, c, 1
3795 a_nr, b_nc, a_nc, 1.0, a.
data (),
3796 lda, b.
data (), ldb, 0.0, c, a_nr
3809 return xgemm (a, b);
3814 #define EMPTY_RETURN_CHECK(T) \
3815 if (nr == 0 || nc == 0) \
3832 result(i, j) =
xmin (c, m(i, j));
3852 result(i, j) =
xmin (m(i, j), c);
3866 (*current_liboctave_error_handler)
3867 (
"two-arg min expecting args of same size");
3877 int columns_are_real_only = 1;
3883 columns_are_real_only = 0;
3888 if (columns_are_real_only)
3898 result(i, j) =
xmin (a(i, j), b(i, j));
3920 result(i, j) =
xmax (c, m(i, j));
3940 result(i, j) =
xmax (m(i, j), c);
3954 (*current_liboctave_error_handler)
3955 (
"two-arg max expecting args of same size");
3965 int columns_are_real_only = 1;
3971 columns_are_real_only = 0;
3976 if (columns_are_real_only)
3989 result(i, j) =
xmax (a(i, j), b(i, j));
4008 (
"linspace: vectors must be of equal length");
4012 retval.clear (m, n);
4014 retval(i, 0) = x1(i);
4017 Complex *delta = &retval(0, n-1);
4019 delta[i] = (x2(i) - x1(i)) / (n - 1.0);
4023 retval(i, j) = x1(i) +
static_cast<double> (j)*delta[i];
4026 retval(i, n-1) = x2(i);
ComplexMatrix stack(const Matrix &a) const
void mx_inline_add2(size_t n, R *r, const X *x)
ComplexMatrix ifourier(void) const
#define F77_CHAR_ARG_LEN(l)
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
ComplexMatrix utsolve(MatrixType &typ, const ComplexMatrix &b, octave_idx_type &info, double &rcon, solve_singularity_handler sing_handler, bool calc_cond=false, blas_trans_type transt=blas_no_trans) const
void gripe_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
void mx_inline_sub2(size_t n, R *r, const X *x)
#define MM_BOOL_OPS(M1, M2)
ComplexDET determinant(void) const
static int fft(const double *in, Complex *out, size_t npts, size_t nsamples=1, octave_idx_type stride=1, octave_idx_type dist=-1)
T elem(octave_idx_type r, octave_idx_type c) const
ComplexMatrix inverse(void) const
ComplexNDArray diag(octave_idx_type k=0) const
static const idx_vector colon
octave_idx_type numel(void) const
Number of elements in the array.
subroutine zffti(n, wsave)
static octave_idx_type nn
ComplexMatrix Sylvester(const ComplexMatrix &a, const ComplexMatrix &b, const ComplexMatrix &c)
ComplexMatrix inverse(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
RowVector row(octave_idx_type i) const
bool column_is_real_only(octave_idx_type) const
ComplexMatrix conj(const ComplexMatrix &a)
Complex xmin(const Complex &x, const Complex &y)
ComplexMatrix schur_matrix(void) const
subroutine xilaenv(ispec, name, opts, n1, n2, n3, n4, retval)
ComplexRowVector row(octave_idx_type i) const
Complex & elem(octave_idx_type n)
bool is_hermitian(void) const
ComplexMatrix operator*(const ColumnVector &v, const ComplexRowVector &a)
void(* solve_singularity_handler)(double rcon)
subroutine xzlange(NORM, M, N, A, LDA, WORK, VALUE)
#define F77_XFCN(f, F, args)
ColumnVector extract_diag(octave_idx_type k=0) const
octave_idx_type rows(void) const
F77_RET_T F77_CONST_CHAR_ARG_DECL
F77_RET_T const double const double double * d
subroutine zfftb(n, c, wsave)
ComplexMatrix prod(int dim=-1) const
static int fftNd(const double *, Complex *, const int, const dim_vector &)
ComplexRowVector column_min(void) const
#define F77_CONST_CHAR_ARG2(x, l)
ComplexMatrix fsolve(MatrixType &typ, const ComplexMatrix &b, octave_idx_type &info, double &rcon, solve_singularity_handler sing_handler, bool calc_cond=false) const
ComplexNDArray sumsq(int dim=-1) const
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type r2
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
ComplexNDArray cumprod(int dim=-1) const
ComplexMatrix cumprod(int dim=-1) const
liboctave_error_handler current_liboctave_error_handler
subroutine xzdotu(n, zx, incx, zy, incy, retval)
int type(bool quiet=true)
ComplexNDArray prod(int dim=-1) const
ComplexMatrix hermitian(void) const
ComplexNDArray sum(int dim=-1) const
ComplexNDArray & insert(const NDArray &a, octave_idx_type r, octave_idx_type c)
ComplexMatrix cumsum(int dim=-1) const
bool is_hermitian(void) const
boolMatrix all(int dim=-1) const
ComplexMatrix & operator-=(const DiagMatrix &a)
std::istream & operator>>(std::istream &is, ComplexMatrix &a)
bool row_is_real_only(octave_idx_type) 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)
const Complex * data(void) const
double norm(const ColumnVector &v)
ComplexMatrix min(const Complex &c, const ComplexMatrix &m)
void resize(const dim_vector &dv, const T &rfv)
ComplexColumnVector row_min(void) const
boolMatrix any(int dim=-1) const
boolNDArray all(int dim=-1) const
void mark_as_unsymmetric(void)
ComplexMatrix solve(MatrixType &typ, const Matrix &b) const
bool is_square(void) const
ComplexMatrix ltsolve(MatrixType &typ, const ComplexMatrix &b, octave_idx_type &info, double &rcon, solve_singularity_handler sing_handler, bool calc_cond=false, blas_trans_type transt=blas_no_trans) const
OCTAVE_API double xnorm(const ColumnVector &x, double p)
void gripe_singular_matrix(double rcond)
ComplexMatrix fourier(void) const
ComplexMatrix sumsq(int dim=-1) const
ComplexColumnVector row_max(void) const
ComplexMatrix transpose(void) const
ComplexMatrix max(const Complex &c, const ComplexMatrix &m)
static char get_blas_trans_arg(bool trans, bool conj)
ComplexMatrix unitary_matrix(void) const
void mark_as_rectangular(void)
ComplexMatrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
ComplexMatrix left_singular_matrix(void) const
ComplexMatrix & operator+=(const DiagMatrix &a)
friend OCTAVE_API ComplexMatrix conj(const ComplexMatrix &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
static int ifftNd(const Complex *, Complex *, const int, const dim_vector &)
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
Complex & xelem(octave_idx_type n)
ComplexMatrix linspace(const ComplexColumnVector &x1, const ComplexColumnVector &x2, octave_idx_type n)
ComplexNDArray cumsum(int dim=-1) const
F77_RET_T F77_FUNC(xilaenv, XILAENV)(const octave_idx_type &
ComplexMatrix xgemm(const ComplexMatrix &a, const ComplexMatrix &b, blas_trans_type transa, blas_trans_type transb)
bool operator!=(const ComplexMatrix &a) const
subroutine xzdotc(n, zx, incx, zy, incy, retval)
ComplexMatrix pseudo_inverse(double tol=0.0) const
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 ...
ComplexRowVector column_max(void) const
ComplexMatrix finverse(MatrixType &mattype, octave_idx_type &info, double &rcon, int force, int calc_cond) const
void resize(octave_idx_type nr, octave_idx_type nc, const Complex &rfv=Complex(0))
F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type const double const double octave_idx_type double * V
DiagMatrix singular_values(void) const
ComplexMatrix Givens(const Complex &x, const Complex &y)
void scale(Matrix &m, double x, double y, double z)
ComplexMatrix sum(int dim=-1) const
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
ComplexMatrix & fill(double val)
#define MS_BOOL_OPS(M, S)
#define MM_CMP_OPS(M1, M2)
char get_blas_char(blas_trans_type transt)
std::ostream & operator<<(std::ostream &os, const ComplexMatrix &a)
ComplexMatrix ifourier2d(void) const
ColumnVector imag(const ComplexColumnVector &a)
base_det< Complex > ComplexDET
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
ComplexMatrix diag(octave_idx_type k=0) const
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type r1
Matrix sum(int dim=-1) const
std::complex< double > Complex
const T * fortran_vec(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
ComplexMatrix lssolve(const Matrix &b) const
ComplexMatrix tinverse(MatrixType &mattype, octave_idx_type &info, double &rcon, int force, int calc_cond) const
ComplexColumnVector column(octave_idx_type i) const
ComplexMatrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
ComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
bool operator==(const ComplexMatrix &a) const
octave_idx_type columns(void) const
ComplexMatrix append(const Matrix &a) const
octave_idx_type length(void) const
boolNDArray any(int dim=-1) const
static const Complex Complex_NaN_result((lo_ieee_nan_value()),(lo_ieee_nan_value()))
Array< Complex > index(const idx_vector &i) const
Indexing without resizing.
subroutine zfftf(n, c, wsave)
F77_RET_T const double * x
ComplexMatrix fourier2d(void) const
#define EMPTY_RETURN_CHECK(T)
ComplexMatrix right_singular_matrix(void) const
ColumnVector extract(octave_idx_type r1, octave_idx_type r2) const