36 #include <sys/types.h>
70 const octave_idx_type&,
const octave_idx_type&,
71 const octave_idx_type&,
const octave_idx_type&,
78 const octave_idx_type&,
Complex*,
79 const octave_idx_type&, octave_idx_type&,
80 octave_idx_type&,
double*, octave_idx_type&
86 const octave_idx_type&,
const octave_idx_type&,
87 const octave_idx_type&,
double*,
88 const octave_idx_type&,
double*,
89 const octave_idx_type&, octave_idx_type&
96 const octave_idx_type&,
const octave_idx_type&,
97 const octave_idx_type&,
const Complex&,
98 const Complex*,
const octave_idx_type&,
99 const Complex*,
const octave_idx_type&,
100 const Complex&, Complex*,
const octave_idx_type&
106 const octave_idx_type&,
const octave_idx_type&,
107 const Complex&,
const Complex*,
108 const octave_idx_type&,
const Complex*,
109 const octave_idx_type&,
const Complex&,
110 Complex*,
const octave_idx_type&
114 F77_FUNC (
xzdotu, XZDOTU) (
const octave_idx_type&,
const Complex*,
115 const octave_idx_type&,
const Complex*,
116 const octave_idx_type&, Complex&);
119 F77_FUNC (
xzdotc, XZDOTC) (
const octave_idx_type&,
const Complex*,
120 const octave_idx_type&,
const Complex*,
121 const octave_idx_type&, Complex&);
126 const octave_idx_type&,
const octave_idx_type&,
127 const Complex&,
const Complex*,
128 const octave_idx_type&,
const Complex&,
129 Complex*,
const octave_idx_type&
136 const octave_idx_type&,
const octave_idx_type&,
137 const double&,
const Complex*,
138 const octave_idx_type&,
const double&, Complex*,
139 const octave_idx_type&
144 F77_FUNC (zgetrf, ZGETRF) (
const octave_idx_type&,
const octave_idx_type&,
145 Complex*,
const octave_idx_type&,
146 octave_idx_type*, octave_idx_type&);
150 const octave_idx_type&,
const octave_idx_type&,
151 Complex*,
const octave_idx_type&,
152 const octave_idx_type*, Complex*,
153 const octave_idx_type&, octave_idx_type&
157 F77_FUNC (zgetri, ZGETRI) (
const octave_idx_type&, Complex*,
158 const octave_idx_type&,
const octave_idx_type*,
159 Complex*,
const octave_idx_type&,
164 const octave_idx_type&, Complex*,
165 const octave_idx_type&,
const double&,
double&,
166 Complex*,
double*, octave_idx_type&
170 F77_FUNC (zgelsy, ZGELSY) (
const octave_idx_type&,
const octave_idx_type&,
171 const octave_idx_type&, Complex*,
172 const octave_idx_type&, Complex*,
173 const octave_idx_type&, octave_idx_type*,
174 double&, octave_idx_type&, Complex*,
175 const octave_idx_type&,
double*,
179 F77_FUNC (zgelsd, ZGELSD) (
const octave_idx_type&,
const octave_idx_type&,
180 const octave_idx_type&, Complex*,
181 const octave_idx_type&, Complex*,
182 const octave_idx_type&,
double*,
double&,
183 octave_idx_type&, Complex*,
184 const octave_idx_type&,
double*,
185 octave_idx_type*, octave_idx_type&);
189 const octave_idx_type&, Complex*,
190 const octave_idx_type&, octave_idx_type&
195 const octave_idx_type&, Complex*,
196 const octave_idx_type&,
const double&,
197 double&, Complex*,
double*, octave_idx_type&
202 const octave_idx_type&,
const octave_idx_type&,
203 const Complex*,
const octave_idx_type&, Complex*,
204 const octave_idx_type&, octave_idx_type&
210 const octave_idx_type&,
const Complex*,
211 const octave_idx_type&, octave_idx_type&
219 const octave_idx_type&,
const Complex*,
220 const octave_idx_type&,
double&,
221 Complex*,
double*, octave_idx_type&
230 const octave_idx_type&,
const octave_idx_type&,
231 const Complex*,
const octave_idx_type&, Complex*,
232 const octave_idx_type&, octave_idx_type&
238 F77_FUNC (zlartg, ZLARTG) (
const Complex&,
const Complex&,
double&,
244 const octave_idx_type&,
const octave_idx_type&,
245 const octave_idx_type&,
const Complex*,
246 const octave_idx_type&,
const Complex*,
247 const octave_idx_type&,
const Complex*,
248 const octave_idx_type&,
double&, octave_idx_type&
254 const octave_idx_type&,
const octave_idx_type&,
255 const Complex*,
const octave_idx_type&,
315 elem (i, j) =
static_cast<unsigned char> (a.
elem (i, j));
341 return !(*
this == a);
371 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
373 (*current_liboctave_error_handler) (
"range error for insert");
377 if (a_nr >0 && a_nc > 0)
394 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
396 (*current_liboctave_error_handler) (
"range error for insert");
417 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
419 (*current_liboctave_error_handler) (
"range error for insert");
441 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
443 (*current_liboctave_error_handler) (
"range error for insert");
447 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
475 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
477 (*current_liboctave_error_handler) (
"range error for insert");
493 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
495 (*current_liboctave_error_handler) (
"range error for insert");
517 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
519 (*current_liboctave_error_handler) (
"range error for insert");
523 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
544 if (nr > 0 && nc > 0)
562 if (nr > 0 && nc > 0)
581 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
582 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
584 (*current_liboctave_error_handler) (
"range error for fill");
588 if (r1 > r2) { std::swap (r1, r2); }
589 if (c1 > c2) { std::swap (c1, c2); }
591 if (r2 >= r1 && c2 >= c1)
610 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
611 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
613 (*current_liboctave_error_handler) (
"range error for fill");
617 if (r1 > r2) { std::swap (r1, r2); }
618 if (c1 > c2) { std::swap (c1, c2); }
620 if (r2 >= r1 && c2 >=c1)
639 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
645 retval.
insert (*
this, 0, 0);
646 retval.
insert (a, 0, nc_insert);
657 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
663 retval.
insert (*
this, 0, 0);
664 retval.
insert (a, 0, nc_insert);
675 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
681 retval.
insert (*
this, 0, 0);
682 retval.
insert (a, 0, nc_insert);
693 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
699 retval.
insert (*
this, 0, 0);
700 retval.
insert (a, 0, nc_insert);
711 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
717 retval.
insert (*
this, 0, 0);
718 retval.
insert (a, 0, nc_insert);
729 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
735 retval.
insert (*
this, 0, 0);
736 retval.
insert (a, 0, nc_insert);
747 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
753 retval.
insert (*
this, 0, 0);
754 retval.
insert (a, 0, nc_insert);
765 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
771 retval.
insert (*
this, 0, 0);
772 retval.
insert (a, 0, nc_insert);
783 (*current_liboctave_error_handler)
784 (
"column dimension mismatch for stack");
790 retval.
insert (*
this, 0, 0);
791 retval.
insert (a, nr_insert, 0);
802 (*current_liboctave_error_handler)
803 (
"column dimension mismatch for stack");
809 retval.
insert (*
this, 0, 0);
810 retval.
insert (a, nr_insert, 0);
821 (*current_liboctave_error_handler)
822 (
"column dimension mismatch for stack");
828 retval.
insert (*
this, 0, 0);
829 retval.
insert (a, nr_insert, 0);
840 (*current_liboctave_error_handler)
841 (
"column dimension mismatch for stack");
847 retval.
insert (*
this, 0, 0);
848 retval.
insert (a, nr_insert, 0);
859 (*current_liboctave_error_handler)
860 (
"column dimension mismatch for stack");
866 retval.
insert (*
this, 0, 0);
867 retval.
insert (a, nr_insert, 0);
878 (*current_liboctave_error_handler)
879 (
"column dimension mismatch for stack");
885 retval.
insert (*
this, 0, 0);
886 retval.
insert (a, nr_insert, 0);
897 (*current_liboctave_error_handler)
898 (
"column dimension mismatch for stack");
904 retval.
insert (*
this, 0, 0);
905 retval.
insert (a, nr_insert, 0);
916 (*current_liboctave_error_handler)
917 (
"column dimension mismatch for stack");
923 retval.
insert (*
this, 0, 0);
924 retval.
insert (a, nr_insert, 0);
931 return do_mx_unary_map<Complex, Complex, std::conj<double> > (a);
940 if (r1 > r2) { std::swap (r1, r2); }
941 if (c1 > c2) { std::swap (c1, c2); }
973 return inverse (mattype, info, rcon, 0, 0);
981 return inverse (mattype, info, rcon, 0, 0);
989 return inverse (mattype, info, rcon, force, calc_cond);
997 return inverse (mattype, info, rcon, 0, 0);
1004 return inverse (mattype, info, rcon, 0, 0);
1009 double& rcon,
int force,
int calc_cond)
const
1016 if (nr != nc || nr == 0 || nc == 0)
1017 (*current_liboctave_error_handler) (
"inverse requires square matrix");
1020 int typ = mattype.
type ();
1028 nr, tmp_data, nr, info
1047 nr, tmp_data, nr, rcon,
1048 cwork, rwork, ztrcon_info
1053 if (ztrcon_info != 0)
1057 if (info == -1 && ! force)
1066 double& rcon,
int force,
int calc_cond)
const
1074 (*current_liboctave_error_handler) (
"inverse requires square matrix");
1088 F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt,
1092 lwork = (lwork < 2 *nc ? 2*nc : lwork);
1101 anorm = retval.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
1104 F77_XFCN (zgetrf, ZGETRF, (nc, nc, tmp_data, nr, pipvt, info));
1118 nc, tmp_data, nr, anorm,
1119 rcon, pz, prz, zgecon_info
1122 if (zgecon_info != 0)
1126 if (info == -1 && ! force)
1132 F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt,
1133 pz, lwork, zgetri_info));
1135 if (zgetri_info != 0)
1148 double& rcon,
int force,
int calc_cond)
const
1150 int typ = mattype.
type (
false);
1154 typ = mattype.
type (*
this);
1157 ret =
tinverse (mattype, info, rcon, force, calc_cond);
1166 rcon = chol.
rcond ();
1176 ret =
finverse (mattype, info, rcon, force, calc_cond);
1178 if ((mattype.
is_hermitian () || calc_cond) && rcon == 0.)
1205 tol = nr * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
1207 tol = nc * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
1210 while (r >= 0 && sigma.
elem (r) < tol)
1226 #if defined (HAVE_FFTW)
1231 size_t nr =
rows ();
1232 size_t nc =
cols ();
1236 size_t npts, nsamples;
1238 if (nr == 1 || nc == 1)
1240 npts = nr > nc ? nr : nc;
1260 size_t nr =
rows ();
1261 size_t nc =
cols ();
1265 size_t npts, nsamples;
1267 if (nr == 1 || nc == 1)
1269 npts = nr > nc ? nr : nc;
1330 F77_FUNC (
zfftb, ZFFTB) (
const octave_idx_type&, Complex*, Complex*);
1343 if (nr == 1 || nc == 1)
1345 npts = nr > nc ? nr : nc;
1357 Complex *pwsave = wsave.fortran_vec ();
1384 if (nr == 1 || nc == 1)
1386 npts = nr > nc ? nr : nc;
1398 Complex *pwsave = wsave.fortran_vec ();
1413 tmp_data[j] = tmp_data[j] / static_cast<double> (npts);
1428 if (nr == 1 || nc == 1)
1430 npts = nr > nc ? nr : nc;
1442 Complex *pwsave = wsave.fortran_vec ();
1461 pwsave = wsave.fortran_vec ();
1464 Complex *prow = tmp.fortran_vec ();
1473 prow[i] = tmp_data[i*nr + j];
1478 tmp_data[i*nr + j] = prow[i];
1494 if (nr == 1 || nc == 1)
1496 npts = nr > nc ? nr : nc;
1508 Complex *pwsave = wsave.fortran_vec ();
1523 tmp_data[j] = tmp_data[j] / static_cast<double> (npts);
1530 pwsave = wsave.fortran_vec ();
1533 Complex *prow = tmp.fortran_vec ();
1542 prow[i] = tmp_data[i*nr + j];
1547 tmp_data[i*nr + j] = prow[i] / static_cast<double> (npts);
1572 int calc_cond)
const
1575 return determinant (mattype, info, rcon, calc_cond);
1581 int calc_cond)
const
1592 (*current_liboctave_error_handler) (
"matrix must be square");
1595 volatile int typ = mattype.
type ();
1602 typ = mattype.
type (*
this);
1609 retval *=
elem (i,i);
1617 if (calc_cond) anorm =
xnorm (*
this, 1);
1639 nr, tmp_data, nr, anorm,
1647 retval *= atmp (i,i);
1649 retval = retval.
square ();
1653 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
1667 if (calc_cond) anorm =
xnorm (*
this, 1);
1669 F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1690 nc, tmp_data, nr, anorm,
1705 retval *= (ipvt(i) != (i+1)) ? -c : c;
1719 return rcond (mattype);
1730 (*current_liboctave_error_handler) (
"matrix must be square");
1731 else if (nr == 0 || nc == 0)
1735 volatile int typ = mattype.
type ();
1738 typ = mattype.
type (*
this);
1757 nr, tmp_data, nr, rcon,
1767 (*current_liboctave_error_handler)
1768 (
"permuted triangular matrix not implemented");
1785 nr, tmp_data, nr, rcon,
1795 (*current_liboctave_error_handler)
1796 (
"permuted triangular matrix not implemented");
1799 double anorm = -1.0;
1809 anorm = atmp.
abs().
sum().
1810 row(static_cast<octave_idx_type>(0)).
max();
1831 nr, tmp_data, nr, anorm,
1852 anorm = atmp.
abs ().
sum ().
1853 row(static_cast<octave_idx_type>(0)).
max ();
1860 F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1871 nc, tmp_data, nr, anorm,
1898 if (nr != b.
rows ())
1900 (
"matrix dimension mismatch solution of linear equations");
1901 else if (nr == 0 || nc == 0 || b.
cols () == 0)
1905 volatile int typ = mattype.
type ();
1916 (*current_liboctave_error_handler)
1917 (
"permuted triangular matrix not implemented");
1937 nr, tmp_data, nr, rcon,
1946 volatile double rcond_plus_one = rcon + 1.0;
1948 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
1953 sing_handler (rcon);
1956 (
"matrix singular to machine precision, rcond = %g",
1973 nr, b_nc, tmp_data, nr,
1999 if (nr != b.
rows ())
2001 (
"matrix dimension mismatch solution of linear equations");
2002 else if (nr == 0 || nc == 0 || b.
cols () == 0)
2006 volatile int typ = mattype.
type ();
2017 (*current_liboctave_error_handler)
2018 (
"permuted triangular matrix not implemented");
2038 nr, tmp_data, nr, rcon,
2047 volatile double rcond_plus_one = rcon + 1.0;
2049 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2054 sing_handler (rcon);
2057 (
"matrix singular to machine precision, rcond = %g",
2074 nr, b_nc, tmp_data, nr,
2093 bool calc_cond)
const
2101 if (nr != nc || nr != b.
rows ())
2103 (
"matrix dimension mismatch solution of linear equations");
2104 else if (nr == 0 || b.
cols () == 0)
2108 volatile int typ = mattype.
type ();
2121 anorm = atmp.
abs().
sum().
row(static_cast<octave_idx_type>(0)).
max();
2146 nr, tmp_data, nr, anorm,
2153 volatile double rcond_plus_one = rcon + 1.0;
2155 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2160 sing_handler (rcon);
2163 (
"matrix singular to machine precision, rcond = %g",
2176 nr, b_nc, tmp_data, nr,
2177 result, b.
rows (), info
2205 anorm = atmp.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
2208 F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info));
2217 sing_handler (rcon);
2220 (
"matrix singular to machine precision");
2232 nc, tmp_data, nr, anorm,
2239 volatile double rcond_plus_one = rcon + 1.0;
2241 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2246 sing_handler (rcon);
2249 (
"matrix singular to machine precision, rcond = %g",
2263 nr, b_nc, tmp_data, nr,
2264 pipvt, result, b.
rows (), info
2281 return solve (typ, b, info, rcon, 0);
2289 return solve (typ, b, info, rcon, 0);
2296 return solve (typ, b, info, rcon, 0);
2305 return solve (typ, tmp, info, rcon, sing_handler, singular_fallback, transt);
2313 return solve (typ, b, info, rcon, 0);
2321 return solve (typ, b, info, rcon, 0);
2328 return solve (typ, b, info, rcon, 0);
2338 int typ = mattype.
type ();
2341 typ = mattype.
type (*
this);
2345 retval =
utsolve (mattype, b, info, rcon, sing_handler,
false, transt);
2347 retval =
ltsolve (mattype, b, info, rcon, sing_handler,
false, transt);
2352 retval =
hermitian ().
solve (mattype, b, info, rcon, sing_handler,
2355 retval =
fsolve (mattype, b, info, rcon, sing_handler,
true);
2358 (*current_liboctave_error_handler) (
"unknown matrix type");
2366 retval =
lssolve (b, info, rank, rcon);
2409 return solve (typ, b, info, rcon, 0);
2417 return solve (typ, b, info, rcon, 0);
2424 return solve (typ, b, info, rcon, 0);
2435 tmp =
solve (typ, tmp, info, rcon, sing_handler,
true, transt);
2436 return tmp.
column (static_cast<octave_idx_type> (0));
2444 return solve (b, info, rcon, 0);
2451 return solve (b, info, rcon, 0);
2458 return solve (b, info, rcon, 0);
2467 return solve (tmp, info, rcon, sing_handler, transt);
2475 return solve (b, info, rcon, 0);
2482 return solve (b, info, rcon, 0);
2489 return solve (b, info, rcon, 0);
2499 return solve (mattype, b, info, rcon, sing_handler,
true, transt);
2538 return solve (b, info, rcon, 0);
2545 return solve (b, info, rcon, 0);
2552 return solve (b, info, rcon, 0);
2562 return solve (mattype, b, info, rcon, sing_handler, transt);
2603 return lssolve (b, info, rank, rcon);
2611 return lssolve (b, info, rank, rcon);
2619 return lssolve (b, info, rank, rcon);
2635 (
"matrix dimension mismatch solution of linear equations");
2636 else if (m== 0 || n == 0 || b.
cols () == 0)
2650 retval.
elem (i, j) = b.
elem (i, j);
2677 m, n, nrhs, -1, mnthr
2684 double dminmn =
static_cast<double> (minmn);
2685 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
2686 #if defined (HAVE_LOG2)
2687 double tmp = log2 (dminmn / dsmlsizp1);
2689 double tmp = log (dminmn / dsmlsizp1) / log (2.0);
2698 n*(1+nrhs) + 2*nrhs);
2710 F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2712 lwork, prwork, piwork, info));
2718 if (n > m && n >= mnthr)
2734 work(0) = lworkaround;
2741 work(0) = lworkaround;
2747 F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval,
2748 maxmn, ps, rcon, rank,
2750 prwork, piwork, info));
2752 if (s.
elem (0) == 0.0)
2755 rcon = s.
elem (minmn - 1) / s.
elem (0);
2801 return lssolve (b, info, rank, rcon);
2810 return lssolve (b, info, rank, rcon);
2818 return lssolve (b, info, rank, rcon);
2835 (
"matrix dimension mismatch solution of linear equations");
2836 else if (m == 0 || n == 0 || b.
cols () == 0)
2876 double dminmn =
static_cast<double> (minmn);
2877 double dsmlsizp1 =
static_cast<double> (smlsiz+1);
2878 #if defined (HAVE_LOG2)
2879 double tmp = log2 (dminmn / dsmlsizp1);
2881 double tmp = log (dminmn / dsmlsizp1) / log (2.0);
2888 + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1);
2900 F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2902 lwork, prwork, piwork, info));
2909 F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval,
2910 maxmn, ps, rcon, rank,
2912 prwork, piwork, info));
2916 if (s.
elem (0) == 0.0)
2919 rcon = s.
elem (minmn - 1) / s.
elem (0);
2960 len, a_len, 1, 1.0, v.
data (), len,
2961 a.
data (), 1, 0.0, c, len
2980 if (nr != a_nr || nc != a_nc)
3001 if (nr != a_nr || nc != a_nc)
3022 if (nr != a_nr || nc != a_nc)
3043 if (nr != a_nr || nc != a_nc)
3066 if (nr != a_nr || nc != a_nc)
3072 if (nr == 0 || nc == 0)
3090 if (nr != a_nr || nc != a_nc)
3096 if (nr == 0 || nc == 0)
3113 return do_mx_unary_op<bool, Complex> (*
this,
mx_inline_not);
3148 if (nr > 0 && nc > 0)
3158 if (i_val > max_val)
3161 if (i_val < max_val)
3175 if (r_val > max_val)
3178 if (i_val > max_val)
3181 if (r_val < min_val)
3184 if (i_val < min_val)
3187 if (
D_NINT (r_val) != r_val ||
D_NINT (i_val) != i_val)
3205 return do_mx_red_op<bool, Complex> (*
this, dim,
mx_inline_all);
3211 return do_mx_red_op<bool, Complex> (*
this, dim,
mx_inline_any);
3229 return do_mx_red_op<Complex, Complex> (*
this, dim,
mx_inline_prod);
3235 return do_mx_red_op<Complex, Complex> (*
this, dim,
mx_inline_sum);
3246 return do_mx_unary_map<double, Complex, std::abs> (*this);
3263 if (nr == 1 || nc == 1)
3267 (
"diag: expecting vector argument");
3325 if (nr > 0 && nc > 0)
3340 for (idx_j = 0; idx_j < nc; idx_j++)
3342 tmp_min =
elem (i, idx_j);
3346 abs_min = real_only ?
std::real (tmp_min)
3361 if (abs_tmp < abs_min)
3372 idx_arg.
elem (i) = 0;
3376 result.
elem (i) = tmp_min;
3377 idx_arg.
elem (i) = idx_j;
3400 if (nr > 0 && nc > 0)
3415 for (idx_j = 0; idx_j < nc; idx_j++)
3417 tmp_max =
elem (i, idx_j);
3421 abs_max = real_only ?
std::real (tmp_max)
3436 if (abs_tmp > abs_max)
3447 idx_arg.
elem (i) = 0;
3451 result.
elem (i) = tmp_max;
3452 idx_arg.
elem (i) = idx_j;
3475 if (nr > 0 && nc > 0)
3490 for (idx_i = 0; idx_i < nr; idx_i++)
3492 tmp_min =
elem (idx_i, j);
3496 abs_min = real_only ?
std::real (tmp_min)
3511 if (abs_tmp < abs_min)
3522 idx_arg.
elem (j) = 0;
3526 result.
elem (j) = tmp_min;
3527 idx_arg.
elem (j) = idx_i;
3550 if (nr > 0 && nc > 0)
3565 for (idx_i = 0; idx_i < nr; idx_i++)
3567 tmp_max =
elem (idx_i, j);
3571 abs_max = real_only ?
std::real (tmp_max)
3586 if (abs_tmp > abs_max)
3597 idx_arg.
elem (j) = 0;
3601 result.
elem (j) = tmp_max;
3602 idx_arg.
elem (j) = idx_i;
3633 if (nr > 0 && nc > 0)
3639 tmp = octave_read_value<Complex> (is);
3641 a.
elem (i, j) = tmp;
3658 F77_FUNC (zlartg, ZLARTG) (
x, y, cc, cs, temp_r);
3707 1, a_nr, b_nr, pa, a_nr, pb,
3708 b_nr, px, a_nr, scale, info
3763 return trans ? (conj ?
'C' :
'T') :
'N';
3787 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
3789 else if (a.
data () == b.
data () && a_nr == b_nc && tra != trb)
3807 a.
data (), lda, 0.0, c, a_nr
3819 a.
data (), lda, 0.0, c, a_nr
3837 if (b_nc == 1 && a_nr == 1)
3852 else if (b_nc == 1 && ! cjb)
3856 lda, tda, 1.0, a.
data (), lda,
3857 b.
data (), 1, 0.0, c, 1
3860 else if (a_nr == 1 && ! cja && ! cjb)
3864 ldb, tdb, 1.0, b.
data (), ldb,
3865 a.
data (), 1, 0.0, c, 1
3874 a_nr, b_nc, a_nc, 1.0, a.
data (),
3875 lda, b.
data (), ldb, 0.0, c, a_nr
3888 return xgemm (a, b);
3893 #define EMPTY_RETURN_CHECK(T) \
3894 if (nr == 0 || nc == 0) \
3911 result (i, j) =
xmin (c, m (i, j));
3931 result (i, j) =
xmin (m (i, j), c);
3945 (*current_liboctave_error_handler)
3946 (
"two-arg min expecting args of same size");
3956 int columns_are_real_only = 1;
3962 columns_are_real_only = 0;
3967 if (columns_are_real_only)
3977 result (i, j) =
xmin (a (i, j), b (i, j));
3999 result (i, j) =
xmax (c, m (i, j));
4019 result (i, j) =
xmax (m (i, j), c);
4033 (*current_liboctave_error_handler)
4034 (
"two-arg max expecting args of same size");
4044 int columns_are_real_only = 1;
4050 columns_are_real_only = 0;
4055 if (columns_are_real_only)
4068 result (i, j) =
xmax (a (i, j), b (i, j));
4087 (
"linspace: vectors must be of equal length");
4091 retval.clear (m, n);
4093 retval(i, 0) = x1(i);
4096 Complex *delta = &retval(0, n-1);
4098 delta[i] = (x2(i) - x1(i)) / (n - 1.0);
4102 retval(i, j) = x1(i) +
static_cast<double> (j)*delta[i];
4105 retval(i, n-1) = x2(i);