36 #include <sys/types.h>
69 const octave_idx_type&,
const octave_idx_type&,
70 const octave_idx_type&,
const octave_idx_type&,
78 const octave_idx_type&, octave_idx_type&,
79 octave_idx_type&,
float*, octave_idx_type&
85 const octave_idx_type&,
const octave_idx_type&,
86 const octave_idx_type&,
float*,
87 const octave_idx_type&,
float*,
88 const octave_idx_type&, octave_idx_type&
95 const octave_idx_type&,
const octave_idx_type&,
96 const octave_idx_type&,
const FloatComplex&,
97 const FloatComplex*,
const octave_idx_type&,
98 const FloatComplex*,
const octave_idx_type&,
99 const FloatComplex&, FloatComplex*,
100 const octave_idx_type&
106 const octave_idx_type&,
const octave_idx_type&,
107 const FloatComplex&,
const FloatComplex*,
108 const octave_idx_type&,
const FloatComplex*,
109 const octave_idx_type&,
const FloatComplex&,
110 FloatComplex*,
const octave_idx_type&
114 F77_FUNC (
xcdotu, XCDOTU) (
const octave_idx_type&,
const FloatComplex*,
115 const octave_idx_type&,
const FloatComplex*,
116 const octave_idx_type&, FloatComplex&);
119 F77_FUNC (
xcdotc, XCDOTC) (
const octave_idx_type&,
const FloatComplex*,
120 const octave_idx_type&,
const FloatComplex*,
121 const octave_idx_type&, FloatComplex&);
126 const octave_idx_type&,
const octave_idx_type&,
127 const FloatComplex&,
const FloatComplex*,
128 const octave_idx_type&,
const FloatComplex&,
129 FloatComplex*,
const octave_idx_type&
136 const octave_idx_type&,
const octave_idx_type&,
137 const float&,
const FloatComplex*,
138 const octave_idx_type&,
const float&,
139 FloatComplex*,
const octave_idx_type&
144 F77_FUNC (cgetrf, CGETRF) (
const octave_idx_type&,
const octave_idx_type&,
145 FloatComplex*,
const octave_idx_type&,
146 octave_idx_type*, octave_idx_type&);
150 const octave_idx_type&,
const octave_idx_type&,
151 FloatComplex*,
const octave_idx_type&,
152 const octave_idx_type*, FloatComplex*,
153 const octave_idx_type&, octave_idx_type&
157 F77_FUNC (cgetri, CGETRI) (
const octave_idx_type&, FloatComplex*,
158 const octave_idx_type&,
const octave_idx_type*,
159 FloatComplex*,
const octave_idx_type&,
164 const octave_idx_type&, FloatComplex*,
165 const octave_idx_type&,
const float&,
float&,
166 FloatComplex*,
float*, octave_idx_type&
170 F77_FUNC (cgelsy, CGELSY) (
const octave_idx_type&,
const octave_idx_type&,
171 const octave_idx_type&, FloatComplex*,
172 const octave_idx_type&, FloatComplex*,
173 const octave_idx_type&, octave_idx_type*,
174 float&, octave_idx_type&, FloatComplex*,
175 const octave_idx_type&,
float*, octave_idx_type&);
178 F77_FUNC (cgelsd, CGELSD) (
const octave_idx_type&,
const octave_idx_type&,
179 const octave_idx_type&, FloatComplex*,
180 const octave_idx_type&, FloatComplex*,
181 const octave_idx_type&,
float*,
float&,
182 octave_idx_type&, FloatComplex*,
183 const octave_idx_type&,
float*,
184 octave_idx_type*, octave_idx_type&);
188 const octave_idx_type&, FloatComplex*,
189 const octave_idx_type&, octave_idx_type&
194 const octave_idx_type&, FloatComplex*,
195 const octave_idx_type&,
const float&,
float&,
196 FloatComplex*,
float*, octave_idx_type&
201 const octave_idx_type&,
202 const octave_idx_type&,
const FloatComplex*,
203 const octave_idx_type&, FloatComplex*,
204 const octave_idx_type&, octave_idx_type&
210 const octave_idx_type&,
const FloatComplex*,
211 const octave_idx_type&, octave_idx_type&
219 const octave_idx_type&,
const FloatComplex*,
220 const octave_idx_type&,
float&, FloatComplex*,
221 float*, octave_idx_type&
230 const octave_idx_type&,
const octave_idx_type&,
231 const FloatComplex*,
const octave_idx_type&,
232 FloatComplex*,
const octave_idx_type&,
239 F77_FUNC (clartg, CLARTG) (
const FloatComplex&,
const FloatComplex&,
240 float&, FloatComplex&, FloatComplex&);
245 const octave_idx_type&,
const octave_idx_type&,
246 const octave_idx_type&,
const FloatComplex*,
247 const octave_idx_type&,
const FloatComplex*,
248 const octave_idx_type&,
const FloatComplex*,
249 const octave_idx_type&,
float&, octave_idx_type&
255 const octave_idx_type&,
const octave_idx_type&,
256 const FloatComplex*,
const octave_idx_type&,
318 elem (i, j) =
static_cast<unsigned char> (a.
elem (i, j));
345 return !(*
this == a);
376 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
378 (*current_liboctave_error_handler) (
"range error for insert");
382 if (a_nr >0 && a_nc > 0)
400 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
402 (*current_liboctave_error_handler) (
"range error for insert");
423 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
425 (*current_liboctave_error_handler) (
"range error for insert");
447 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
449 (*current_liboctave_error_handler) (
"range error for insert");
453 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
481 if (r < 0 || r >=
rows () || c < 0 || c + a_len >
cols ())
483 (*current_liboctave_error_handler) (
"range error for insert");
499 if (r < 0 || r + a_len >
rows () || c < 0 || c >=
cols ())
501 (*current_liboctave_error_handler) (
"range error for insert");
523 if (r < 0 || r + a_nr >
rows () || c < 0 || c + a_nc >
cols ())
525 (*current_liboctave_error_handler) (
"range error for insert");
529 fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1);
550 if (nr > 0 && nc > 0)
568 if (nr > 0 && nc > 0)
587 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
588 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
590 (*current_liboctave_error_handler) (
"range error for fill");
594 if (r1 > r2) { std::swap (r1, r2); }
595 if (c1 > c2) { std::swap (c1, c2); }
597 if (r2 >= r1 && c2 >= c1)
617 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
618 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
620 (*current_liboctave_error_handler) (
"range error for fill");
624 if (r1 > r2) { std::swap (r1, r2); }
625 if (c1 > c2) { std::swap (c1, c2); }
627 if (r2 >= r1 && c2 >=c1)
646 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
652 retval.
insert (*
this, 0, 0);
653 retval.
insert (a, 0, nc_insert);
664 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
670 retval.
insert (*
this, 0, 0);
671 retval.
insert (a, 0, nc_insert);
682 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
688 retval.
insert (*
this, 0, 0);
689 retval.
insert (a, 0, nc_insert);
700 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
706 retval.
insert (*
this, 0, 0);
707 retval.
insert (a, 0, nc_insert);
718 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
724 retval.
insert (*
this, 0, 0);
725 retval.
insert (a, 0, nc_insert);
736 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
742 retval.
insert (*
this, 0, 0);
743 retval.
insert (a, 0, nc_insert);
754 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
760 retval.
insert (*
this, 0, 0);
761 retval.
insert (a, 0, nc_insert);
772 (*current_liboctave_error_handler) (
"row dimension mismatch for append");
778 retval.
insert (*
this, 0, 0);
779 retval.
insert (a, 0, nc_insert);
790 (*current_liboctave_error_handler)
791 (
"column dimension mismatch for stack");
797 retval.
insert (*
this, 0, 0);
798 retval.
insert (a, nr_insert, 0);
809 (*current_liboctave_error_handler)
810 (
"column dimension mismatch for stack");
816 retval.
insert (*
this, 0, 0);
817 retval.
insert (a, nr_insert, 0);
828 (*current_liboctave_error_handler)
829 (
"column dimension mismatch for stack");
835 retval.
insert (*
this, 0, 0);
836 retval.
insert (a, nr_insert, 0);
847 (*current_liboctave_error_handler)
848 (
"column dimension mismatch for stack");
854 retval.
insert (*
this, 0, 0);
855 retval.
insert (a, nr_insert, 0);
866 (*current_liboctave_error_handler)
867 (
"column dimension mismatch for stack");
873 retval.
insert (*
this, 0, 0);
874 retval.
insert (a, nr_insert, 0);
885 (*current_liboctave_error_handler)
886 (
"column dimension mismatch for stack");
892 retval.
insert (*
this, 0, 0);
893 retval.
insert (a, nr_insert, 0);
904 (*current_liboctave_error_handler)
905 (
"column dimension mismatch for stack");
911 retval.
insert (*
this, 0, 0);
912 retval.
insert (a, nr_insert, 0);
923 (*current_liboctave_error_handler)
924 (
"column dimension mismatch for stack");
930 retval.
insert (*
this, 0, 0);
931 retval.
insert (a, nr_insert, 0);
938 return do_mx_unary_map<FloatComplex, FloatComplex, std::conj<float> > (a);
947 if (r1 > r2) { std::swap (r1, r2); }
948 if (c1 > c2) { std::swap (c1, c2); }
980 return inverse (mattype, info, rcon, 0, 0);
988 return inverse (mattype, info, rcon, 0, 0);
996 return inverse (mattype, info, rcon, force, calc_cond);
1004 return inverse (mattype, info, rcon, 0, 0);
1011 return inverse (mattype, info, rcon, 0, 0);
1016 float& rcon,
int force,
int calc_cond)
const
1023 if (nr != nc || nr == 0 || nc == 0)
1024 (*current_liboctave_error_handler) (
"inverse requires square matrix");
1027 int typ = mattype.
type ();
1035 nr, tmp_data, nr, info
1054 nr, tmp_data, nr, rcon,
1055 cwork, rwork, ztrcon_info
1060 if (ztrcon_info != 0)
1064 if (info == -1 && ! force)
1073 float& rcon,
int force,
int calc_cond)
const
1081 (*current_liboctave_error_handler) (
"inverse requires square matrix");
1095 F77_XFCN (cgetri, CGETRI, (nc, tmp_data, nr, pipvt,
1099 lwork = (lwork < 2 *nc ? 2*nc : lwork);
1108 anorm = retval.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
1111 F77_XFCN (cgetrf, CGETRF, (nc, nc, tmp_data, nr, pipvt, info));
1125 nc, tmp_data, nr, anorm,
1126 rcon, pz, prz, zgecon_info
1129 if (zgecon_info != 0)
1133 if (info == -1 && ! force)
1139 F77_XFCN (cgetri, CGETRI, (nc, tmp_data, nr, pipvt,
1140 pz, lwork, zgetri_info));
1142 if (zgetri_info != 0)
1155 float& rcon,
int force,
int calc_cond)
const
1157 int typ = mattype.
type (
false);
1161 typ = mattype.
type (*
this);
1164 ret =
tinverse (mattype, info, rcon, force, calc_cond);
1173 rcon = chol.
rcond ();
1183 ret =
finverse (mattype, info, rcon, force, calc_cond);
1185 if ((mattype.
is_hermitian () || calc_cond) && rcon == 0.)
1213 tol = nr * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
1215 tol = nc * sigma.
elem (0) * std::numeric_limits<double>::epsilon ();
1218 while (r >= 0 && sigma.
elem (r) < tol)
1234 #if defined (HAVE_FFTW)
1239 size_t nr =
rows ();
1240 size_t nc =
cols ();
1244 size_t npts, nsamples;
1246 if (nr == 1 || nc == 1)
1248 npts = nr > nc ? nr : nc;
1268 size_t nr =
rows ();
1269 size_t nc =
cols ();
1273 size_t npts, nsamples;
1275 if (nr == 1 || nc == 1)
1277 npts = nr > nc ? nr : nc;
1334 F77_FUNC (
cfftb, CFFTB) (
const octave_idx_type&, FloatComplex*,
1348 if (nr == 1 || nc == 1)
1350 npts = nr > nc ? nr : nc;
1389 if (nr == 1 || nc == 1)
1391 npts = nr > nc ? nr : nc;
1418 tmp_data[j] = tmp_data[j] / static_cast<float> (npts);
1433 if (nr == 1 || nc == 1)
1435 npts = nr > nc ? nr : nc;
1466 pwsave = wsave.fortran_vec ();
1478 prow[i] = tmp_data[i*nr + j];
1483 tmp_data[i*nr + j] = prow[i];
1499 if (nr == 1 || nc == 1)
1501 npts = nr > nc ? nr : nc;
1528 tmp_data[j] = tmp_data[j] / static_cast<float> (npts);
1535 pwsave = wsave.fortran_vec ();
1547 prow[i] = tmp_data[i*nr + j];
1552 tmp_data[i*nr + j] = prow[i] / static_cast<float> (npts);
1577 int calc_cond)
const
1580 return determinant (mattype, info, rcon, calc_cond);
1586 int calc_cond)
const
1597 (*current_liboctave_error_handler) (
"matrix must be square");
1600 volatile int typ = mattype.
type ();
1607 typ = mattype.
type (*
this);
1614 retval *=
elem (i,i);
1622 if (calc_cond) anorm =
xnorm (*
this, 1);
1644 nr, tmp_data, nr, anorm,
1652 retval *= atmp (i,i);
1654 retval = retval.
square ();
1658 (*current_liboctave_error_handler) (
"det: invalid dense matrix type");
1672 if (calc_cond) anorm =
xnorm (*
this, 1);
1674 F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1695 nc, tmp_data, nr, anorm,
1710 retval *= (ipvt(i) != (i+1)) ? -c : c;
1724 return rcond (mattype);
1735 (*current_liboctave_error_handler) (
"matrix must be square");
1736 else if (nr == 0 || nc == 0)
1740 volatile int typ = mattype.
type ();
1743 typ = mattype.
type (*
this);
1762 nr, tmp_data, nr, rcon,
1772 (*current_liboctave_error_handler)
1773 (
"permuted triangular matrix not implemented");
1790 nr, tmp_data, nr, rcon,
1800 (*current_liboctave_error_handler)
1801 (
"permuted triangular matrix not implemented");
1814 anorm = atmp.
abs().
sum().
1815 row(static_cast<octave_idx_type>(0)).
max();
1836 nr, tmp_data, nr, anorm,
1857 anorm = atmp.
abs ().
sum ().
1858 row(static_cast<octave_idx_type>(0)).
max ();
1865 F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info));
1876 nc, tmp_data, nr, anorm,
1895 solve_singularity_handler sing_handler,
1903 if (nr != b.
rows ())
1905 (
"matrix dimension mismatch solution of linear equations");
1906 else if (nr == 0 || nc == 0 || b.
cols () == 0)
1910 volatile int typ = mattype.
type ();
1921 (*current_liboctave_error_handler)
1922 (
"permuted triangular matrix not implemented");
1942 nr, tmp_data, nr, rcon,
1951 volatile float rcond_plus_one = rcon + 1.0;
1953 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
1958 sing_handler (rcon);
1961 (
"matrix singular to machine precision, rcond = %g",
1978 nr, b_nc, tmp_data, nr,
1996 solve_singularity_handler sing_handler,
2004 if (nr != b.
rows ())
2006 (
"matrix dimension mismatch solution of linear equations");
2007 else if (nr == 0 || nc == 0 || b.
cols () == 0)
2011 volatile int typ = mattype.
type ();
2022 (*current_liboctave_error_handler)
2023 (
"permuted triangular matrix not implemented");
2043 nr, tmp_data, nr, rcon,
2052 volatile float rcond_plus_one = rcon + 1.0;
2054 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2059 sing_handler (rcon);
2062 (
"matrix singular to machine precision, rcond = %g",
2079 nr, b_nc, tmp_data, nr,
2097 solve_singularity_handler sing_handler,
2098 bool calc_cond)
const
2106 if (nr != nc || nr != b.
rows ())
2108 (
"matrix dimension mismatch solution of linear equations");
2109 else if (nr == 0 || b.
cols () == 0)
2113 volatile int typ = mattype.
type ();
2126 anorm = atmp.
abs().
sum().
row(static_cast<octave_idx_type>(0)).
max();
2151 nr, tmp_data, nr, anorm,
2158 volatile float rcond_plus_one = rcon + 1.0;
2160 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2165 sing_handler (rcon);
2168 (
"matrix singular to machine precision, rcond = %g",
2181 nr, b_nc, tmp_data, nr,
2182 result, b.
rows (), info
2210 anorm = atmp.
abs ().
sum ().
row (static_cast<octave_idx_type>(0))
2213 F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info));
2222 sing_handler (rcon);
2225 (
"matrix singular to machine precision");
2237 nc, tmp_data, nr, anorm,
2244 volatile float rcond_plus_one = rcon + 1.0;
2246 if (rcond_plus_one == 1.0 ||
xisnan (rcon))
2251 sing_handler (rcon);
2254 (
"matrix singular to machine precision, rcond = %g",
2268 nr, b_nc, tmp_data, nr,
2269 pipvt, result, b.
rows (), info
2286 return solve (typ, b, info, rcon, 0);
2294 return solve (typ, b, info, rcon, 0);
2302 return solve (typ, b, info, rcon, 0);
2308 float& rcon, solve_singularity_handler sing_handler,
2312 return solve (typ, tmp, info, rcon, sing_handler, singular_fallback, transt);
2320 return solve (typ, b, info, rcon, 0);
2328 return solve (typ, b, info, rcon, 0);
2335 return solve (typ, b, info, rcon, 0);
2341 solve_singularity_handler sing_handler,
2345 int typ = mattype.
type ();
2348 typ = mattype.
type (*
this);
2352 retval =
utsolve (mattype, b, info, rcon, sing_handler,
false, transt);
2354 retval =
ltsolve (mattype, b, info, rcon, sing_handler,
false, transt);
2359 retval =
hermitian ().
solve (mattype, b, info, rcon, sing_handler,
2362 retval =
fsolve (mattype, b, info, rcon, sing_handler,
true);
2365 (*current_liboctave_error_handler) (
"unknown matrix type");
2373 retval =
lssolve (b, info, rank, rcon);
2405 solve_singularity_handler sing_handler,
2418 return solve (typ, b, info, rcon, 0);
2426 return solve (typ, b, info, rcon, 0);
2433 return solve (typ, b, info, rcon, 0);
2439 solve_singularity_handler sing_handler,
2444 tmp =
solve (typ, tmp, info, rcon, sing_handler,
true, transt);
2445 return tmp.
column (static_cast<octave_idx_type> (0));
2453 return solve (b, info, rcon, 0);
2460 return solve (b, info, rcon, 0);
2467 return solve (b, info, rcon, 0);
2473 solve_singularity_handler sing_handler,
2477 return solve (tmp, info, rcon, sing_handler, transt);
2485 return solve (b, info, rcon, 0);
2493 return solve (b, info, rcon, 0);
2500 return solve (b, info, rcon, 0);
2506 solve_singularity_handler sing_handler,
2510 return solve (mattype, b, info, rcon, sing_handler,
true, transt);
2539 solve_singularity_handler sing_handler,
2550 return solve (b, info, rcon, 0);
2558 return solve (b, info, rcon, 0);
2566 return solve (b, info, rcon, 0);
2573 solve_singularity_handler sing_handler,
2577 return solve (mattype, b, info, rcon, sing_handler, transt);
2618 return lssolve (b, info, rank, rcon);
2627 return lssolve (b, info, rank, rcon);
2635 return lssolve (b, info, rank, rcon);
2651 (
"matrix dimension mismatch solution of linear equations");
2652 else if (m== 0 || n == 0 || b.
cols () == 0)
2666 retval.
elem (i, j) = b.
elem (i, j);
2693 m, n, nrhs, -1, mnthr
2700 float dminmn =
static_cast<float> (minmn);
2701 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2702 #if defined (HAVE_LOG2)
2703 float tmp = log2 (dminmn / dsmlsizp1);
2705 float tmp = log (dminmn / dsmlsizp1) / log (2.0);
2714 n*(1+nrhs) + 2*nrhs);
2726 F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2728 lwork, prwork, piwork, info));
2734 if (n > m && n >= mnthr)
2750 work(0) = lworkaround;
2757 work(0) = lworkaround;
2763 F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval,
2764 maxmn, ps, rcon, rank,
2766 prwork, piwork, info));
2768 if (s.
elem (0) == 0.0)
2771 rcon = s.
elem (minmn - 1) / s.
elem (0);
2818 return lssolve (b, info, rank, rcon);
2827 return lssolve (b, info, rank, rcon);
2836 return lssolve (b, info, rank, rcon);
2854 (
"matrix dimension mismatch solution of linear equations");
2855 else if (m == 0 || n == 0 || b.
cols () == 0)
2895 float dminmn =
static_cast<float> (minmn);
2896 float dsmlsizp1 =
static_cast<float> (smlsiz+1);
2897 #if defined (HAVE_LOG2)
2898 float tmp = log2 (dminmn / dsmlsizp1);
2900 float tmp = log (dminmn / dsmlsizp1) / log (2.0);
2907 + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1);
2919 F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn,
2921 lwork, prwork, piwork, info));
2928 F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval,
2929 maxmn, ps, rcon, rank,
2931 prwork, piwork, info));
2935 if (s.
elem (0) == 0.0)
2938 rcon = s.
elem (minmn - 1) / s.
elem (0);
2979 len, a_len, 1, 1.0, v.
data (), len,
2980 a.
data (), 1, 0.0, c, len
2999 if (nr != a_nr || nc != a_nc)
3020 if (nr != a_nr || nc != a_nc)
3041 if (nr != a_nr || nc != a_nc)
3062 if (nr != a_nr || nc != a_nc)
3085 if (nr != a_nr || nc != a_nc)
3091 if (nr == 0 || nc == 0)
3109 if (nr != a_nr || nc != a_nc)
3115 if (nr == 0 || nc == 0)
3132 return do_mx_unary_op<bool, FloatComplex> (*
this,
mx_inline_not);
3167 if (nr > 0 && nc > 0)
3177 if (i_val > max_val)
3180 if (i_val < max_val)
3194 if (r_val > max_val)
3197 if (i_val > max_val)
3200 if (r_val < min_val)
3203 if (i_val < min_val)
3206 if (
D_NINT (r_val) != r_val ||
D_NINT (i_val) != i_val)
3225 return do_mx_red_op<bool, FloatComplex> (*
this, dim,
mx_inline_all);
3231 return do_mx_red_op<bool, FloatComplex> (*
this, dim,
mx_inline_any);
3237 return do_mx_cum_op<FloatComplex, FloatComplex> (*
this, dim,
3244 return do_mx_cum_op<FloatComplex, FloatComplex> (*
this, dim,
3251 return do_mx_red_op<FloatComplex, FloatComplex> (*
this, dim,
mx_inline_prod);
3257 return do_mx_red_op<FloatComplex, FloatComplex> (*
this, dim,
mx_inline_sum);
3263 return do_mx_red_op<float, FloatComplex> (*
this, dim,
mx_inline_sumsq);
3268 return do_mx_unary_map<float, FloatComplex, std::abs> (*this);
3285 if (nr == 1 || nc == 1)
3289 (
"diag: expecting vector argument");
3347 if (nr > 0 && nc > 0)
3362 for (idx_j = 0; idx_j < nc; idx_j++)
3364 tmp_min =
elem (i, idx_j);
3368 abs_min = real_only ?
std::real (tmp_min)
3383 if (abs_tmp < abs_min)
3394 idx_arg.
elem (i) = 0;
3398 result.
elem (i) = tmp_min;
3399 idx_arg.
elem (i) = idx_j;
3422 if (nr > 0 && nc > 0)
3437 for (idx_j = 0; idx_j < nc; idx_j++)
3439 tmp_max =
elem (i, idx_j);
3443 abs_max = real_only ?
std::real (tmp_max)
3458 if (abs_tmp > abs_max)
3469 idx_arg.
elem (i) = 0;
3473 result.
elem (i) = tmp_max;
3474 idx_arg.
elem (i) = idx_j;
3497 if (nr > 0 && nc > 0)
3512 for (idx_i = 0; idx_i < nr; idx_i++)
3514 tmp_min =
elem (idx_i, j);
3518 abs_min = real_only ?
std::real (tmp_min)
3533 if (abs_tmp < abs_min)
3544 idx_arg.
elem (j) = 0;
3548 result.
elem (j) = tmp_min;
3549 idx_arg.
elem (j) = idx_i;
3572 if (nr > 0 && nc > 0)
3587 for (idx_i = 0; idx_i < nr; idx_i++)
3589 tmp_max =
elem (idx_i, j);
3593 abs_max = real_only ?
std::real (tmp_max)
3608 if (abs_tmp > abs_max)
3619 idx_arg.
elem (j) = 0;
3623 result.
elem (j) = tmp_max;
3624 idx_arg.
elem (j) = idx_i;
3655 if (nr > 0 && nc > 0)
3661 tmp = octave_read_value<FloatComplex> (is);
3663 a.
elem (i, j) = tmp;
3680 F77_FUNC (clartg, CLARTG) (
x, y, cc, cs, temp_r);
3731 1, a_nr, b_nr, pa, a_nr, pb,
3732 b_nr, px, a_nr, scale, info
3787 return trans ? (conj ?
'C' :
'T') :
'N';
3811 if (a_nr == 0 || a_nc == 0 || b_nc == 0)
3813 else if (a.
data () == b.
data () && a_nr == b_nc && tra != trb)
3831 a.
data (), lda, 0.0, c, a_nr
3843 a.
data (), lda, 0.0, c, a_nr
3861 if (b_nc == 1 && a_nr == 1)
3876 else if (b_nc == 1 && ! cjb)
3880 lda, tda, 1.0, a.
data (), lda,
3881 b.
data (), 1, 0.0, c, 1
3884 else if (a_nr == 1 && ! cja && ! cjb)
3888 ldb, tdb, 1.0, b.
data (), ldb,
3889 a.
data (), 1, 0.0, c, 1
3898 a_nr, b_nc, a_nc, 1.0, a.
data (),
3899 lda, b.
data (), ldb, 0.0, c, a_nr
3912 return xgemm (a, b);
3918 #define EMPTY_RETURN_CHECK(T) \
3919 if (nr == 0 || nc == 0) \
3936 result (i, j) =
xmin (c, m (i, j));
3956 result (i, j) =
xmin (m (i, j), c);
3970 (*current_liboctave_error_handler)
3971 (
"two-arg min expecting args of same size");
3981 int columns_are_real_only = 1;
3987 columns_are_real_only = 0;
3992 if (columns_are_real_only)
4002 result (i, j) =
xmin (a (i, j), b (i, j));
4024 result (i, j) =
xmax (c, m (i, j));
4044 result (i, j) =
xmax (m (i, j), c);
4058 (*current_liboctave_error_handler)
4059 (
"two-arg max expecting args of same size");
4069 int columns_are_real_only = 1;
4075 columns_are_real_only = 0;
4080 if (columns_are_real_only)
4093 result (i, j) =
xmax (a (i, j), b (i, j));
4112 (
"linspace: vectors must be of equal length");
4116 retval.clear (m, n);
4118 retval(i, 0) = x1(i);
4123 delta[i] = (x2(i) - x1(i)) / (n - 1.0f);
4127 retval(i, j) = x1(i) +
static_cast<float> (j)*delta[i];
4130 retval(i, n-1) = x2(i);
4141 MM_CMP_OPS (FloatComplexMatrix, FloatComplexMatrix)
4142 MM_BOOL_OPS (FloatComplexMatrix, FloatComplexMatrix)