26 #if defined (HAVE_CONFIG_H)
52 #if defined (HAVE_ARPACK)
57 (*current_liboctave_warning_with_id_handler)
58 (
"Octave:convergence",
59 "eigs: 'A - sigma*B' is singular, indicating sigma is exactly "
60 "an eigenvalue so convergence is not guaranteed");
68 std::string bug_msg =
"\nThis should not happen. Please, see https://www.gnu.org/software/octave/bugs.html, and file a bug report";
73 msg =
"N must be positive";
77 msg =
"NEV must be positive";
81 msg =
"NCV-NEV >= 2 and less than or equal to N";
85 msg =
"The maximum number of Arnoldi update iterations allowed must be greater than zero";
89 msg =
"WHICH must be one of 'LM', 'SM', 'LR', 'SR', 'LI', 'SI'";
93 msg =
"BMAT must be one of 'I' or 'G'";
97 msg =
"Length of private work WORKL array is insufficient";
101 msg =
"Error return from LAPACK eigenvalue calculation";
105 if (fcn_name.compare (
"zneupd") == 0)
106 msg =
"Error return from calculation of eigenvectors. Informational error from LAPACK routine ztrevc";
107 else if (fcn_name.compare (
"dneupd") == 0)
108 msg =
"Error return from calculation of eigenvectors. Informational error from LAPACK routine dtrevc";
110 msg =
"Starting vector is zero";
115 if (fcn_name.compare (
"dneupd") == 0
116 || fcn_name.compare (
"dnaupd") == 0)
117 msg =
"IPARAM(7) must be 1,2,3,4";
118 else if (fcn_name.compare (
"zneupd") == 0
119 || fcn_name.compare (
"znaupd") == 0)
120 msg =
"IPARAM(7) must be 1,2,3";
122 msg =
"IPARAM(7) must be 1,2,3,4,5";
127 msg =
"IPARAM(7) = 1 and BMAT = 'G' are incompatible";
131 if (fcn_name.compare (
"dnaupd") == 0
132 || fcn_name.compare (
"znaupd") == 0
133 || fcn_name.compare (
"dsaupd") == 0)
134 msg = std::string (
"IPARAM(1) must be equal to 0 or 1");
135 else if (fcn_name.compare (
"dneupd") == 0
136 || fcn_name.compare (
"zneupd") == 0)
137 msg =
"HOWMNY = 'S' not yet implemented";
139 msg =
"NEV and WHICH = 'BE' are incompatible";
144 if (fcn_name.compare (
"dneupd") == 0
145 || fcn_name.compare (
"zneupd") == 0)
146 msg =
"HOWMNY must be one of 'A' or 'P' if RVEC = .true.";
147 else if (fcn_name.compare (
"dsaupd") == 0)
148 msg =
"NEV and WHICH = 'BE' are incompatible";
153 if (fcn_name.compare (
"dneupd") == 0)
154 msg =
"DNAUPD did not find any eigenvalues to sufficient accuracy.";
155 else if (fcn_name.compare (
"zneupd") == 0)
156 msg =
"ZNAUPD did not find any eigenvalues to sufficient accuracy.";
157 else if (fcn_name.compare (
"dseupd") == 0)
158 msg =
"DSAUPD did not find any eigenvalues to sufficient accuracy.";
163 if (fcn_name.compare (
"dseupd") == 0)
164 msg =
"HOWMNY must be one of 'A' or 'S' if RVEC = .true.";
169 if (fcn_name.compare (
"dseupd") == 0)
170 msg =
"HOWMNY = 'S' not yet implemented";
175 if (fcn_name.compare (
"dnaupd") == 0)
176 msg =
"Could not build an Arnoldi factorization. IPARAM(5) returns the size of the current Arnoldi factorization";
181 if (fcn_name.compare (
"dneupd") == 0)
182 msg =
"The Schur form computed by LAPACK routine dlahqr could not be reordered by LAPACK routine dtrsen. Re-enter subroutine DNEUPD with IPARAM(5)=NCV and increase the size of the arrays DR and DI to have dimension at least dimension NCV and allocate at least NCV columns for Z. NOTE: Not necessary if Z and V share the same space. Please notify the authors if this error occurs.";
183 else if (fcn_name.compare (
"dnaupd") == 0
184 || fcn_name.compare (
"znaupd") == 0
185 || fcn_name.compare (
"dsaupd") == 0)
186 msg =
"Maximum number of iterations taken. All possible eigenvalues of OP has been found. IPARAM(5) returns the number of wanted converged Ritz values";
187 else if (fcn_name.compare (
"znaupd") == 0)
188 msg =
"The Schur form computed by LAPACK routine csheqr could not be reordered by LAPACK routine ztrsen. Re-enter subroutine ZNEUPD with IPARAM(5)=NCV and increase the size of the array D to have dimension at least dimension NCV and allocate at least NCV columns for Z. NOTE: Not necessary if Z and V share the same space. Please notify the authors if this error occurs.";
193 if (fcn_name.compare (
"dnaupd") == 0
194 || fcn_name.compare (
"znaupd") == 0
195 || fcn_name.compare (
"dsaupd") == 0)
196 msg =
"No longer an informational error. Deprecated starting with release 2 of ARPACK.";
201 if (fcn_name.compare (
"dnaupd") == 0
202 || fcn_name.compare (
"znaupd") == 0
203 || fcn_name.compare (
"dsaupd") == 0)
204 msg =
"No shifts could be applied during a cycle of the implicitly restarted Arnoldi iteration. One possibility is to increase the size of NCV relative to NEV.";
210 if ((errno != -9) & (errno != -14) & (errno != -9999))
212 msg.append (bug_msg);
217 template <
typename M,
typename SM>
227 m = L.solve (ltyp,
m, err, rcond,
nullptr);
231 m = U.solve (utyp,
m, err, rcond,
nullptr);
236 template <
typename SM,
typename M>
247 const double *qv =
Q.fortran_vec ();
253 return L.solve (ltyp,
retval, err, rcond,
nullptr);
256 template <
typename SM,
typename M>
266 M tmp = U.solve (utyp,
m, err, rcond,
nullptr);
268 const double *qv =
Q.fortran_vec ();
294 y[
m.ridx (i)] +=
m.data (i) *
x[j];
302 F77_INT nr = octave::to_f77_int (
m.rows ());
303 F77_INT nc = octave::to_f77_int (
m.cols ());
305 F77_XFCN (dgemv, DGEMV, (F77_CONST_CHAR_ARG2 (
"N", 1),
306 nr, nc, 1.0,
m.data (), nr,
308 F77_CHAR_ARG_LEN (1)));
324 y[
m.ridx (i)] +=
m.data (i) *
x[j];
332 F77_INT nr = octave::to_f77_int (
m.rows ());
333 F77_INT nc = octave::to_f77_int (
m.cols ());
335 F77_XFCN (zgemv, ZGEMV, (F77_CONST_CHAR_ARG2 (
"N", 1),
340 F77_CHAR_ARG_LEN (1)));
377 permB = fact.
perm () - 1.0;
415 permB = fact.
perm () - 1.0;
450 AminusSigmaB -= sigma * tmp *
454 AminusSigmaB -= sigma * b.
transpose () * b;
457 AminusSigmaB -= sigma * b;
464 sigmat.
xcidx (0) = 0;
467 sigmat.
xdata (i) = sigma;
468 sigmat.
xridx (i) = i;
469 sigmat.
xcidx (i+1) = i + 1;
472 AminusSigmaB -= sigmat;
510 double rcond = (minU / maxU);
511 volatile double rcond_plus_one = rcond + 1.0;
555 AminusSigmaB -= sigma * b;
592 double rcond = (minU / maxU);
593 volatile double rcond_plus_one = rcond + 1.0;
631 AminusSigmaB -= tmp * b.
hermitian () * b *
635 AminusSigmaB -= sigma * b.
hermitian () * b;
638 AminusSigmaB -= sigma * b;
645 sigmat.
xcidx (0) = 0;
648 sigmat.
xdata (i) = sigma;
649 sigmat.
xridx (i) = i;
650 sigmat.
xcidx (i+1) = i + 1;
653 AminusSigmaB -= sigmat;
692 double rcond = (minU / maxU);
693 volatile double rcond_plus_one = rcond + 1.0;
737 AminusSigmaB -= sigma * b;
774 double rcond = (minU / maxU);
775 volatile double rcond_plus_one = rcond + 1.0;
783 template <
typename M>
790 std::ostream& os,
double tol,
bool rvec,
791 bool cholB,
int disp,
int maxit)
793 F77_INT k = octave::to_f77_int (k_arg);
794 F77_INT p = octave::to_f77_int (p_arg);
796 F77_INT n = octave::to_f77_int (
m.cols ());
798 bool have_b = ! b.isempty ();
804 if (
m.rows () !=
m.cols ())
805 (*current_liboctave_error_handler) (
"eigs: A must be square");
806 if (have_b && (
m.rows () != b.rows () ||
m.rows () != b.cols ()))
808 (
"eigs: B must be square and the same size as A");
817 else if (
m.cols () != resid.
numel ())
818 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
821 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
834 if (k < 1 || k >
n - 2)
835 (*current_liboctave_error_handler)
836 (
"eigs: Invalid number of eigenvalues to extract"
837 " (must be 0 < k < n-1-1).\n"
838 " Use 'eig (full (A))' instead");
841 (*current_liboctave_error_handler)
842 (
"eigs: opts.p must be greater than k and less than or equal to n");
844 if (have_b && cholB && ! permB.
isempty ())
855 if (checked(bidx) || bidx < 0 || bidx >=
n
861 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
862 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
864 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
866 if (typ ==
"LI" || typ ==
"SI" || typ ==
"LR" || typ ==
"SR")
867 (*current_liboctave_error_handler)
868 (
"eigs: invalid sigma value for real symmetric problem");
888 (*current_liboctave_error_handler)
889 (
"eigs: The matrix B is not positive definite");
923 F77_INT tmp_info = octave::to_f77_int (info);
926 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
927 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
928 k, tol, presid, p, v,
n, iparam,
929 ipntr, workd, workl, lwork, tmp_info
930 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
938 os <<
"Iteration " << iter - 1 <<
939 ": a few Ritz values of the " << p <<
"-by-" <<
943 for (
F77_INT i = 0; i < k; i++)
944 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
949 for (
F77_INT i = p - k; i < p; i++)
950 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
963 if (ido == -1 || ido == 1 || ido == 2)
969 mtmp(i,0) = workd[i + iptr(0) - 1];
974 workd[i+iptr(1)-1] = mtmp(i,0);
977 workd + iptr(1) - 1))
983 (*current_liboctave_error_handler)
984 (
"eigs: error in dsaupd: %s",
1011 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel,
d, z,
n, sigma,
1012 F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
1013 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v,
n, iparam,
1014 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
1015 F77_CHAR_ARG_LEN(2));
1019 for (
F77_INT i = ip(4); i < k; i++)
1022 if (typ !=
"SM" && typ !=
"BE" && ! (typ ==
"SA" && rvec))
1024 for (
F77_INT i = 0; i < k2; i++)
1027 d[i] =
d[ip(4) - i - 1];
1028 d[ip(4) - i - 1] = dtmp;
1034 for (
F77_INT i = ip(4); i < k; i++)
1040 if (typ !=
"SM" && typ !=
"BE" && typ !=
"SA")
1044 for (
F77_INT i = 0; i < k2; i++)
1047 F77_INT off2 = (ip(4) - i - 1) *
n;
1053 dtmp[j] = z[off1 + j];
1056 z[off1 + j] = z[off2 + j];
1059 z[off2 + j] = dtmp[j];
1064 eig_vec =
utsolve (bt, permB, eig_vec);
1069 (
"eigs: error in dseupd: %s",
1075 template <
typename M>
1082 std::ostream& os,
double tol,
bool rvec,
1083 bool cholB,
int disp,
int maxit)
1085 F77_INT k = octave::to_f77_int (k_arg);
1086 F77_INT p = octave::to_f77_int (p_arg);
1088 F77_INT n = octave::to_f77_int (
m.cols ());
1090 bool have_b = ! b.isempty ();
1091 std::string typ =
"LM";
1093 if (
m.rows () !=
m.cols ())
1094 (*current_liboctave_error_handler) (
"eigs: A must be square");
1095 if (have_b && (
m.rows () != b.rows () ||
m.rows () != b.cols ()))
1097 (
"eigs: B must be square and the same size as A");
1112 else if (
m.cols () != resid.
numel ())
1113 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
1116 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
1118 if (k <= 0 || k >=
n - 1)
1119 (*current_liboctave_error_handler)
1120 (
"eigs: Invalid number of eigenvalues to extract"
1121 " (must be 0 < k < n-1-1).\n"
1122 " Use 'eig (full (A))' instead");
1135 if (p <= k || p >
n)
1136 (*current_liboctave_error_handler)
1137 (
"eigs: opts.p must be greater than k and less than or equal to n");
1139 if (have_b && cholB && ! permB.
isempty ())
1150 if (checked(bidx) || bidx < 0 || bidx >=
n
1199 F77_INT tmp_info = octave::to_f77_int (info);
1202 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
1203 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1204 k, tol, presid, p, v,
n, iparam,
1205 ipntr, workd, workl, lwork, tmp_info
1206 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1213 os <<
"Iteration " << iter - 1 <<
1214 ": a few Ritz values of the " << p <<
"-by-" <<
1218 for (
F77_INT i = 0; i < k; i++)
1219 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1224 for (
F77_INT i = p - k; i < p; i++)
1225 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1238 if (ido == -1 || ido == 1 || ido == 2)
1251 tmp(i,0) = dtmp[P[i]] /
r(P[i]);
1255 double *ip2 = workd+iptr(1)-1;
1257 ip2[
Q[i]] = tmp(i,0);
1263 double *ip2 = workd+iptr(2)-1;
1267 tmp(i,0) = ip2[P[i]] /
r(P[i]);
1271 ip2 = workd+iptr(1)-1;
1273 ip2[
Q[i]] = tmp(i,0);
1279 double *ip2 = workd+iptr(0)-1;
1283 tmp(i,0) = ip2[P[i]] /
r(P[i]);
1287 ip2 = workd+iptr(1)-1;
1289 ip2[
Q[i]] = tmp(i,0);
1295 (*current_liboctave_error_handler)
1296 (
"eigs: error in dsaupd: %s",
1323 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel,
d, z,
n, sigma,
1324 F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
1325 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1326 k, tol, presid, p, v,
n, iparam, ipntr, workd, workl, lwork, info2
1327 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1331 for (
F77_INT i = ip(4); i < k; i++)
1334 for (
F77_INT i = 0; i < k2; i++)
1337 d[i] =
d[ip(4) - i - 1];
1338 d[ip(4) - i - 1] = dtmp;
1345 for (
F77_INT i = ip(4); i < k; i++)
1351 for (
F77_INT i = 0; i < k2; i++)
1354 F77_INT off2 = (ip(4) - i - 1) *
n;
1360 dtmp[j] = z[off1 + j];
1363 z[off1 + j] = z[off2 + j];
1366 z[off2 + j] = dtmp[j];
1372 (
"eigs: error in dseupd: %s",
1378 template <
typename M>
1381 const std::string& _typ,
double sigma,
1386 std::ostream& os,
double tol,
bool rvec,
1387 bool cholB,
int disp,
int maxit)
1389 F77_INT n = octave::to_f77_int (n_arg);
1390 F77_INT k = octave::to_f77_int (k_arg);
1391 F77_INT p = octave::to_f77_int (p_arg);
1393 std::string typ (_typ);
1394 bool have_sigma = (sigma ? true :
false);
1395 bool have_b = ! b.isempty ();
1409 else if (
n != resid.
numel ())
1410 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
1413 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
1426 if (k <= 0 || k >=
n - 1)
1427 (*current_liboctave_error_handler)
1428 (
"eigs: Invalid number of eigenvalues to extract"
1429 " (must be 0 < k < n-1).\n"
1430 " Use 'eig (full (A))' instead");
1432 if (p <= k || p >
n)
1433 (*current_liboctave_error_handler)
1434 (
"eigs: opts.p must be greater than k and less than or equal to n");
1436 if (have_b && cholB && ! permB.
isempty ())
1447 if (checked(bidx) || bidx < 0 || bidx >=
n
1455 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
1456 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
1458 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
1460 if (typ ==
"LI" || typ ==
"SI" || typ ==
"LR" || typ ==
"SR")
1461 (*current_liboctave_error_handler)
1462 (
"eigs: invalid sigma value for real symmetric problem");
1464 if (typ !=
"SM" && have_b)
1490 if (mode == 1 && have_b)
1508 (*current_liboctave_error_handler)
1509 (
"eigs: The matrix B is not positive definite");
1543 F77_INT tmp_info = octave::to_f77_int (info);
1546 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
1547 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1548 k, tol, presid, p, v,
n, iparam,
1549 ipntr, workd, workl, lwork, tmp_info
1550 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1558 os <<
"Iteration " << iter - 1 <<
1559 ": a few Ritz values of the " << p <<
"-by-" <<
1563 for (
F77_INT i = 0; i < k; i++)
1564 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1569 for (
F77_INT i = p - k; i < p; i++)
1570 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1583 if (ido == -1 || ido == 1 || ido == 2)
1591 mtmp(i,0) = workd[i + iptr(0) - 1];
1593 mtmp =
utsolve (bt, permB, mtmp);
1602 workd[i+iptr(1)-1] = mtmp(i,0);
1622 double *ip2 = workd + iptr(1) - 1;
1630 double *ip2 = workd+iptr(2)-1;
1641 ip2 = workd + iptr(1) - 1;
1649 double *ip2 = workd + iptr(0) - 1;
1660 ip2 = workd + iptr(1) - 1;
1668 (*current_liboctave_error_handler)
1669 (
"eigs: error in dsaupd: %s",
1696 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel,
d, z,
n, sigma,
1697 F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
1698 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1699 k, tol, presid, p, v,
n, iparam, ipntr, workd, workl, lwork, info2
1700 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1704 for (
F77_INT i = ip(4); i < k; i++)
1707 if (mode == 3 || (mode == 1 && typ !=
"SM" && typ !=
"BE"))
1709 for (
F77_INT i = 0; i < k2; i++)
1712 d[i] =
d[ip(4) - i - 1];
1713 d[ip(4) - i - 1] = dtmp;
1719 for (
F77_INT i = ip(4); i < k; i++)
1725 if (mode == 3 || (mode == 1 && typ !=
"SM" && typ !=
"BE"))
1729 for (
F77_INT i = 0; i < k2; i++)
1732 F77_INT off2 = (ip(4) - i - 1) *
n;
1738 dtmp[j] = z[off1 + j];
1741 z[off1 + j] = z[off2 + j];
1744 z[off2 + j] = dtmp[j];
1748 eig_vec =
utsolve (bt, permB, eig_vec);
1753 (
"eigs: error in dseupd: %s",
1759 template <
typename M>
1766 std::ostream& os,
double tol,
bool rvec,
1767 bool cholB,
int disp,
int maxit)
1769 F77_INT k = octave::to_f77_int (k_arg);
1770 F77_INT p = octave::to_f77_int (p_arg);
1772 F77_INT n = octave::to_f77_int (
m.cols ());
1774 bool have_b = ! b.isempty ();
1781 if (
m.rows () !=
m.cols ())
1782 (*current_liboctave_error_handler) (
"eigs: A must be square");
1783 if (have_b && (
m.rows () != b.rows () ||
m.rows () != b.cols ()))
1785 (
"eigs: B must be square and the same size as A");
1794 else if (
m.cols () != resid.
numel ())
1795 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
1798 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
1811 if (k <= 0 || k >=
n - 1)
1812 (*current_liboctave_error_handler)
1813 (
"eigs: Invalid number of eigenvalues to extract"
1814 " (must be 0 < k < n-1).\n"
1815 " Use 'eig (full (A))' instead");
1817 if (p <= k || p >
n)
1818 (*current_liboctave_error_handler)
1819 (
"eigs: opts.p must be greater than k and less than or equal to n");
1821 if (have_b && cholB && ! permB.
isempty ())
1832 if (checked(bidx) || bidx < 0 || bidx >=
n
1838 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
1839 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
1841 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
1843 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
1844 (*current_liboctave_error_handler)
1845 (
"eigs: invalid sigma value for unsymmetric problem");
1865 (*current_liboctave_error_handler)
1866 (
"eigs: The matrix B is not positive definite");
1891 F77_INT lwork = 3 * p * (p + 2);
1900 F77_INT tmp_info = octave::to_f77_int (info);
1905 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
1906 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1907 k, tol, presid, p, v,
n, iparam,
1908 ipntr, workd, workl, lwork, tmp_info
1909 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1918 os <<
"Iteration " << iter - 1 <<
1919 ": a few Ritz values of the " << p <<
"-by-" <<
1923 os <<
" " << workl[iptr(5)+k] <<
"\n";
1924 for (
F77_INT i = 0; i < k; i++)
1925 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1930 for (
F77_INT i = p - k - 1; i < p; i++)
1931 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1944 if (ido == -1 || ido == 1 || ido == 2)
1950 mtmp(i,0) = workd[i + iptr(0) - 1];
1955 workd[i+iptr(1)-1] = mtmp(i,0);
1958 workd + iptr(1) - 1))
1964 (*current_liboctave_error_handler)
1965 (
"eigs: error in dnaupd: %s",
1992 Matrix eig_vec2 (
n, k + 1, 0.0);
1998 for (
F77_INT i = 0; i < k+1; i++)
2003 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel, dr, di, z,
n, sigmar,
2004 sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
2005 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v,
n, iparam,
2006 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
2007 F77_CHAR_ARG_LEN(2));
2011 if (! rvec && ip(4) > k)
2019 bool have_cplx_eig =
false;
2020 for (
F77_INT i = 0; i < ip(4); i++)
2026 have_cplx_eig =
true;
2032 for (
F77_INT i = ip(4); i < k; i++)
2038 for (
F77_INT i = ip(4); i < k; i++)
2045 for (
F77_INT i = 0; i < k2; i++)
2048 d[i] =
d[ip(4) - i - 1];
2049 d[ip(4) - i - 1] = dtmp;
2064 eig_vec(j,i) =
Complex (z[j+off1], 0.);
2071 eig_vec(j,i) =
Complex (z[j+off1],z[j+off2]);
2073 eig_vec(j,i+1) =
Complex (z[j+off1],-z[j+off2]);
2080 for (
F77_INT ii = ip(4); ii < k; ii++)
2088 for (
F77_INT ii = ip(4); ii < k; ii++)
2094 eig_vec =
utsolve (bt, permB, eig_vec);
2104 (
"eigs: error in dneupd: %s",
2110 template <
typename M>
2118 std::ostream& os,
double tol,
bool rvec,
2119 bool cholB,
int disp,
int maxit)
2121 F77_INT k = octave::to_f77_int (k_arg);
2122 F77_INT p = octave::to_f77_int (p_arg);
2124 F77_INT n = octave::to_f77_int (
m.cols ());
2126 bool have_b = ! b.isempty ();
2127 std::string typ =
"LM";
2130 if (
m.rows () !=
m.cols ())
2131 (*current_liboctave_error_handler) (
"eigs: A must be square");
2132 if (have_b && (
m.rows () != b.rows () ||
m.rows () != b.cols ()))
2134 (
"eigs: B must be square and the same size as A");
2149 else if (
m.cols () != resid.
numel ())
2150 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
2153 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
2166 if (k <= 0 || k >=
n - 1)
2167 (*current_liboctave_error_handler)
2168 (
"eigs: Invalid number of eigenvalues to extract"
2169 " (must be 0 < k < n-1).\n"
2170 " Use 'eig (full (A))' instead");
2172 if (p <= k || p >
n)
2173 (*current_liboctave_error_handler)
2174 (
"eigs: opts.p must be greater than k and less than or equal to n");
2176 if (have_b && cholB && ! permB.
isempty ())
2187 if (checked(bidx) || bidx < 0 || bidx >=
n
2227 F77_INT lwork = 3 * p * (p + 2);
2236 F77_INT tmp_info = octave::to_f77_int (info);
2241 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
2242 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
2243 k, tol, presid, p, v,
n, iparam,
2244 ipntr, workd, workl, lwork, tmp_info
2245 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
2254 os <<
"Iteration " << iter - 1 <<
2255 ": a few Ritz values of the " << p <<
"-by-" <<
2259 os <<
" " << workl[iptr(5)+k] <<
"\n";
2260 for (
F77_INT i = 0; i < k; i++)
2261 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2266 for (
F77_INT i = p - k - 1; i < p; i++)
2267 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2280 if (ido == -1 || ido == 1 || ido == 2)
2293 tmp(i,0) = dtmp[P[i]] /
r(P[i]);
2297 double *ip2 = workd+iptr(1)-1;
2299 ip2[
Q[i]] = tmp(i,0);
2305 double *ip2 = workd+iptr(2)-1;
2309 tmp(i,0) = ip2[P[i]] /
r(P[i]);
2313 ip2 = workd+iptr(1)-1;
2315 ip2[
Q[i]] = tmp(i,0);
2321 double *ip2 = workd+iptr(0)-1;
2325 tmp(i,0) = ip2[P[i]] /
r(P[i]);
2329 ip2 = workd+iptr(1)-1;
2331 ip2[
Q[i]] = tmp(i,0);
2337 (*current_liboctave_error_handler)
2338 (
"eigs: error in dnaupd: %s",
2365 Matrix eig_vec2 (
n, k + 1, 0.0);
2371 for (
F77_INT i = 0; i < k+1; i++)
2376 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel, dr, di, z,
n, sigmar,
2377 sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
2378 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v,
n, iparam,
2379 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
2380 F77_CHAR_ARG_LEN(2));
2384 if (! rvec && ip(4) > k)
2392 bool have_cplx_eig =
false;
2393 for (
F77_INT i = 0; i < ip(4); i++)
2399 have_cplx_eig =
true;
2405 for (
F77_INT i = ip(4); i < k; i++)
2411 for (
F77_INT i = ip(4); i < k; i++)
2419 for (
F77_INT i = 0; i < k2; i++)
2422 d[i] =
d[ip(4) - i - 1];
2423 d[ip(4) - i - 1] = dtmp;
2438 eig_vec(j,i) =
Complex (z[j+off1], 0.);
2445 eig_vec(j,i) =
Complex (z[j+off1],z[j+off2]);
2447 eig_vec(j,i+1) =
Complex (z[j+off1],-z[j+off2]);
2454 for (
F77_INT ii = ip(4); ii < k; ii++)
2462 for (
F77_INT ii = ip(4); ii < k; ii++)
2476 (
"eigs: error in dneupd: %s",
2482 template <
typename M>
2485 const std::string& _typ,
double sigmar,
2490 std::ostream& os,
double tol,
bool rvec,
2491 bool cholB,
int disp,
int maxit)
2493 F77_INT n = octave::to_f77_int (n_arg);
2494 F77_INT k = octave::to_f77_int (k_arg);
2495 F77_INT p = octave::to_f77_int (p_arg);
2497 std::string typ (_typ);
2498 bool have_sigma = (sigmar ? true :
false);
2501 bool have_b = ! b.isempty ();
2514 else if (
n != resid.
numel ())
2515 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
2518 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
2531 if (k <= 0 || k >=
n - 1)
2532 (*current_liboctave_error_handler)
2533 (
"eigs: Invalid number of eigenvalues to extract"
2534 " (must be 0 < k < n-1).\n"
2535 " Use 'eig (full (A))' instead");
2537 if (p <= k || p >
n)
2538 (*current_liboctave_error_handler)
2539 (
"eigs: opts.p must be greater than k and less than or equal to n");
2541 if (have_b && cholB && ! permB.
isempty ())
2552 if (checked(bidx) || bidx < 0 || bidx >=
n
2560 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
2561 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
2563 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
2565 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
2566 (*current_liboctave_error_handler)
2567 (
"eigs: invalid sigma value for unsymmetric problem");
2569 if (typ !=
"SM" && have_b)
2595 if (mode == 1 && have_b)
2613 (*current_liboctave_error_handler)
2614 (
"eigs: The matrix B is not positive definite");
2639 F77_INT lwork = 3 * p * (p + 2);
2648 F77_INT tmp_info = octave::to_f77_int (info);
2653 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
2654 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
2655 k, tol, presid, p, v,
n, iparam,
2656 ipntr, workd, workl, lwork, tmp_info
2657 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
2666 os <<
"Iteration " << iter - 1 <<
2667 ": a few Ritz values of the " << p <<
"-by-" <<
2671 os <<
" " << workl[iptr(5)+k] <<
"\n";
2672 for (
F77_INT i = 0; i < k; i++)
2673 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2678 for (
F77_INT i = p - k - 1; i < p; i++)
2679 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2692 if (ido == -1 || ido == 1 || ido == 2)
2700 mtmp(i,0) = workd[i + iptr(0) - 1];
2702 mtmp =
utsolve (bt, permB, mtmp);
2711 workd[i+iptr(1)-1] = mtmp(i,0);
2731 double *ip2 = workd + iptr(1) - 1;
2739 double *ip2 = workd+iptr(2)-1;
2750 ip2 = workd + iptr(1) - 1;
2758 double *ip2 = workd + iptr(0) - 1;
2769 ip2 = workd + iptr(1) - 1;
2777 (*current_liboctave_error_handler)
2778 (
"eigs: error in dnaupd: %s",
2805 Matrix eig_vec2 (
n, k + 1, 0.0);
2811 for (
F77_INT i = 0; i < k+1; i++)
2816 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel, dr, di, z,
n, sigmar,
2817 sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
2818 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v,
n, iparam,
2819 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
2820 F77_CHAR_ARG_LEN(2));
2824 if (! rvec && ip(4) > k)
2832 bool have_cplx_eig =
false;
2833 for (
F77_INT i = 0; i < ip(4); i++)
2839 have_cplx_eig =
true;
2845 for (
F77_INT i = ip(4); i < k; i++)
2851 for (
F77_INT i = ip(4); i < k; i++)
2859 for (
F77_INT i = 0; i < k2; i++)
2862 d[i] =
d[ip(4) - i - 1];
2863 d[ip(4) - i - 1] = dtmp;
2878 eig_vec(j,i) =
Complex (z[j+off1], 0.);
2885 eig_vec(j,i) =
Complex (z[j+off1],z[j+off2]);
2887 eig_vec(j,i+1) =
Complex (z[j+off1],-z[j+off2]);
2894 for (
F77_INT ii = ip(4); ii < k; ii++)
2902 for (
F77_INT ii = ip(4); ii < k; ii++)
2908 eig_vec =
utsolve (bt, permB, eig_vec);
2918 (
"eigs: error in dneupd: %s",
2924 template <
typename M>
2932 std::ostream& os,
double tol,
bool rvec,
2933 bool cholB,
int disp,
int maxit)
2935 F77_INT k = octave::to_f77_int (k_arg);
2936 F77_INT p = octave::to_f77_int (p_arg);
2938 F77_INT n = octave::to_f77_int (
m.cols ());
2940 bool have_b = ! b.isempty ();
2946 if (
m.rows () !=
m.cols ())
2947 (*current_liboctave_error_handler) (
"eigs: A must be square");
2948 if (have_b && (
m.rows () != b.rows () ||
m.rows () != b.cols ()))
2950 (
"eigs: B must be square and the same size as A");
2960 cresid(i) =
Complex (rr(i),ri(i));
2963 else if (
m.cols () != cresid.
numel ())
2964 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
2967 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
2980 if (k <= 0 || k >=
n - 1)
2981 (*current_liboctave_error_handler)
2982 (
"eigs: Invalid number of eigenvalues to extract"
2983 " (must be 0 < k < n-1).\n"
2984 " Use 'eig (full (A))' instead");
2986 if (p <= k || p >
n)
2987 (*current_liboctave_error_handler)
2988 (
"eigs: opts.p must be greater than k and less than or equal to n");
2990 if (have_b && cholB && ! permB.
isempty ())
3001 if (checked(bidx) || bidx < 0 || bidx >=
n
3007 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
3008 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
3010 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
3012 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
3013 (*current_liboctave_error_handler)
3014 (
"eigs: invalid sigma value for complex problem");
3034 (*current_liboctave_error_handler)
3035 (
"eigs: The matrix B is not positive definite");
3060 F77_INT lwork = p * (3 * p + 5);
3070 F77_INT tmp_info = octave::to_f77_int (info);
3073 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
3074 F77_CONST_CHAR_ARG2 (typ.c_str (), 2),
3078 tmp_info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3086 os <<
"Iteration " << iter - 1 <<
3087 ": a few Ritz values of the " << p <<
"-by-" <<
3091 for (
F77_INT i = 0; i < k; i++)
3092 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3097 for (
F77_INT i = p - k; i < p; i++)
3098 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3111 if (ido == -1 || ido == 1 || ido == 2)
3117 mtmp(i,0) = workd[i + iptr(0) - 1];
3120 workd[i+iptr(1)-1] = mtmp(i,0);
3124 workd + iptr(1) - 1))
3130 (*current_liboctave_error_handler)
3131 (
"eigs: error in znaupd: %s",
3163 F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
3164 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3168 info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3172 for (
F77_INT i = ip(4); i < k; i++)
3177 for (
F77_INT i = 0; i < k2; i++)
3180 d[i] =
d[ip(4) - i - 1];
3181 d[ip(4) - i - 1] = ctmp;
3189 for (
F77_INT i = ip(4); i < k; i++)
3197 for (
F77_INT i = 0; i < k2; i++)
3200 F77_INT off2 = (ip(4) - i - 1) *
n;
3206 ctmp[j] = z[off1 + j];
3209 z[off1 + j] = z[off2 + j];
3212 z[off2 + j] = ctmp[j];
3216 eig_vec =
utsolve (bt, permB, eig_vec);
3221 (
"eigs: error in zneupd: %s",
3227 template <
typename M>
3236 std::ostream& os,
double tol,
bool rvec,
3237 bool cholB,
int disp,
int maxit)
3239 F77_INT k = octave::to_f77_int (k_arg);
3240 F77_INT p = octave::to_f77_int (p_arg);
3242 F77_INT n = octave::to_f77_int (
m.cols ());
3244 bool have_b = ! b.isempty ();
3245 std::string typ =
"LM";
3247 if (
m.rows () !=
m.cols ())
3248 (*current_liboctave_error_handler) (
"eigs: A must be square");
3249 if (have_b && (
m.rows () != b.rows () ||
m.rows () != b.cols ()))
3251 (
"eigs: B must be square and the same size as A");
3267 cresid(i) =
Complex (rr(i),ri(i));
3270 else if (
m.cols () != cresid.
numel ())
3271 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
3274 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
3287 if (k <= 0 || k >=
n - 1)
3288 (*current_liboctave_error_handler)
3289 (
"eigs: Invalid number of eigenvalues to extract"
3290 " (must be 0 < k < n-1).\n"
3291 " Use 'eig (full (A))' instead");
3293 if (p <= k || p >
n)
3294 (*current_liboctave_error_handler)
3295 (
"eigs: opts.p must be greater than k and less than or equal to n");
3297 if (have_b && cholB && ! permB.
isempty ())
3308 if (checked(bidx) || bidx < 0 || bidx >=
n
3348 F77_INT lwork = p * (3 * p + 5);
3358 F77_INT tmp_info = octave::to_f77_int (info);
3361 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
3362 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3366 tmp_info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3374 os <<
"Iteration " << iter - 1 <<
3375 ": a few Ritz values of the " << p <<
"-by-" <<
3379 for (
F77_INT i = 0; i < k; i++)
3380 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3385 for (
F77_INT i = p - k; i < p; i++)
3386 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3399 if (ido == -1 || ido == 1 || ido == 2)
3412 tmp(i,0) = ctmp[P[i]] /
r(P[i]);
3416 Complex *ip2 = workd+iptr(1)-1;
3418 ip2[
Q[i]] = tmp(i,0);
3424 Complex *ip2 = workd+iptr(2)-1;
3428 tmp(i,0) = ip2[P[i]] /
r(P[i]);
3432 ip2 = workd+iptr(1)-1;
3434 ip2[
Q[i]] = tmp(i,0);
3440 Complex *ip2 = workd+iptr(0)-1;
3444 tmp(i,0) = ip2[P[i]] /
r(P[i]);
3448 ip2 = workd+iptr(1)-1;
3450 ip2[
Q[i]] = tmp(i,0);
3456 (*current_liboctave_error_handler)
3457 (
"eigs: error in znaupd: %s",
3489 F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
3490 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3494 info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3498 for (
F77_INT i = ip(4); i < k; i++)
3503 for (
F77_INT i = 0; i < k2; i++)
3506 d[i] =
d[ip(4) - i - 1];
3507 d[ip(4) - i - 1] = ctmp;
3515 for (
F77_INT i = ip(4); i < k; i++)
3523 for (
F77_INT i = 0; i < k2; i++)
3526 F77_INT off2 = (ip(4) - i - 1) *
n;
3532 ctmp[j] = z[off1 + j];
3535 z[off1 + j] = z[off2 + j];
3538 z[off2 + j] = ctmp[j];
3544 (
"eigs: error in zneupd: %s",
3550 template <
typename M>
3553 const std::string& _typ,
Complex sigma,
3558 std::ostream& os,
double tol,
bool rvec,
3559 bool cholB,
int disp,
int maxit)
3561 F77_INT n = octave::to_f77_int (n_arg);
3562 F77_INT k = octave::to_f77_int (k_arg);
3563 F77_INT p = octave::to_f77_int (p_arg);
3565 std::string typ (_typ);
3566 bool have_sigma = (
std::abs (sigma) ? true :
false);
3568 bool have_b = ! b.isempty ();
3582 cresid(i) =
Complex (rr(i),ri(i));
3585 else if (
n != cresid.
numel ())
3586 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
3589 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
3602 if (k <= 0 || k >=
n - 1)
3603 (*current_liboctave_error_handler)
3604 (
"eigs: Invalid number of eigenvalues to extract"
3605 " (must be 0 < k < n-1).\n"
3606 " Use 'eig (full (A))' instead");
3608 if (p <= k || p >
n)
3609 (*current_liboctave_error_handler)
3610 (
"eigs: opts.p must be greater than k and less than or equal to n");
3612 if (have_b && cholB && ! permB.
isempty ())
3623 if (checked(bidx) || bidx < 0 || bidx >=
n
3631 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
3632 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
3634 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
3636 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
3637 (*current_liboctave_error_handler)
3638 (
"eigs: invalid sigma value for complex problem");
3640 if (typ !=
"SM" && have_b)
3666 if (mode == 1 && have_b)
3684 (*current_liboctave_error_handler)
3685 (
"eigs: The matrix B is not positive definite");
3710 F77_INT lwork = p * (3 * p + 5);
3720 F77_INT tmp_info = octave::to_f77_int (info);
3723 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
3724 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3728 tmp_info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3736 os <<
"Iteration " << iter - 1 <<
3737 ": a few Ritz values of the " << p <<
"-by-" <<
3741 for (
F77_INT i = 0; i < k; i++)
3742 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3747 for (
F77_INT i = p - k; i < p; i++)
3748 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3761 if (ido == -1 || ido == 1 || ido == 2)
3769 mtmp(i,0) = workd[i + iptr(0) - 1];
3771 mtmp =
utsolve (bt, permB, mtmp);
3780 workd[i+iptr(1)-1] = mtmp(i,0);
3800 Complex *ip2 = workd+iptr(1)-1;
3808 Complex *ip2 = workd+iptr(2)-1;
3819 ip2 = workd + iptr(1) - 1;
3827 Complex *ip2 = workd + iptr(0) - 1;
3838 ip2 = workd + iptr(1) - 1;
3846 (*current_liboctave_error_handler)
3847 (
"eigs: error in znaupd: %s",
3879 F77_CONST_CHAR_ARG2 (&bmat, 1),
n,
3880 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3884 info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3888 for (
F77_INT i = ip(4); i < k; i++)
3893 for (
F77_INT i = 0; i < k2; i++)
3896 d[i] =
d[ip(4) - i - 1];
3897 d[ip(4) - i - 1] = ctmp;
3905 for (
F77_INT i = ip(4); i < k; i++)
3913 for (
F77_INT i = 0; i < k2; i++)
3916 F77_INT off2 = (ip(4) - i - 1) *
n;
3922 ctmp[j] = z[off1 + j];
3925 z[off1 + j] = z[off2 + j];
3928 z[off2 + j] = ctmp[j];
3931 eig_vec =
utsolve (bt, permB, eig_vec);
3936 (
"eigs: error in zneupd: %s",
3952 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
3953 bool cholB,
int disp,
int maxit);
3961 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
3962 bool cholB,
int disp,
int maxit);
3971 bool rvec,
bool cholB,
int disp,
int maxit);
3979 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
3980 bool cholB,
int disp,
int maxit);
3988 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
3989 bool cholB,
int disp,
int maxit);
3998 bool rvec,
bool cholB,
int disp,
int maxit);
4008 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4009 bool cholB,
int disp,
int maxit);
4017 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4018 bool cholB,
int disp,
int maxit);
4027 bool rvec,
bool cholB,
int disp,
int maxit);
4035 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4036 bool cholB,
int disp,
int maxit);
4044 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4045 bool cholB,
int disp,
int maxit);
4054 std::ostream& os,
double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4065 bool rvec,
bool cholB,
int disp,
int maxit);
4074 bool rvec,
bool cholB,
int disp,
int maxit);
4083 std::ostream& os,
double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4094 double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4103 double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4113 bool cholB,
int disp,
int maxit);
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type numel(void) const
Number of elements in the array.
T & elem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type cols(void) const
octave_idx_type rows(void) const
const T * fortran_vec(void) const
Size of the specified dimension.
bool isempty(void) const
Size of the specified dimension.
void resize(octave_idx_type n, const double &rfv=0)
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
ComplexMatrix hermitian(void) const
void resize(octave_idx_type nr, octave_idx_type nc, const Complex &rfv=Complex(0))
Matrix transpose(void) const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
SparseComplexMatrix hermitian(void) const
SparseMatrix transpose(void) const
octave_idx_type * xridx(void)
octave_idx_type * xcidx(void)
Vector representing the dimensions (size) of an Array.
T chol_matrix(void) const
ColumnVector P_vec(void) const
RowVector perm(void) const
const octave_idx_type * row_perm(void) const
const octave_idx_type * col_perm(void) const
SparseMatrix R(void) const
static std::string distribution(void)
static Array< double > vector(octave_idx_type n, double a=1.0)
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
octave_idx_type EigsRealSymmetricFunc(EigsFunc fun, octave_idx_type n_arg, const std::string &_typ, double sigma, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
static M utsolve(const SM &U, const ColumnVector &Q, const M &m)
template octave_idx_type EigsComplexNonSymmetricMatrix< SparseComplexMatrix >(const SparseComplexMatrix &m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const SparseComplexMatrix &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsComplexNonSymmetricFunc< SparseComplexMatrix >(EigsComplexFunc fun, octave_idx_type n, const std::string &_typ, Complex sigma, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const SparseComplexMatrix &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealNonSymmetricFunc< Matrix >(EigsFunc fun, octave_idx_type n, const std::string &_typ, double sigmar, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const Matrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealSymmetricFunc< Matrix >(EigsFunc fun, octave_idx_type n, const std::string &_typ, double sigma, octave_idx_type k, octave_idx_type p, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const Matrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsComplexNonSymmetricMatrixShift< SparseComplexMatrix >(const SparseComplexMatrix &m, Complex sigma, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const SparseComplexMatrix &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
static bool make_cholb(Matrix &b, Matrix &bt, ColumnVector &permB)
octave_idx_type EigsRealNonSymmetricMatrixShift(const M &m, double sigmar, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
octave_idx_type EigsRealSymmetricMatrixShift(const M &m, double sigma, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
static M ltsolve(const SM &L, const ColumnVector &Q, const M &m)
template octave_idx_type EigsComplexNonSymmetricFunc< ComplexMatrix >(EigsComplexFunc fun, octave_idx_type n, const std::string &_typ, Complex sigma, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const ComplexMatrix &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealNonSymmetricMatrixShift< Matrix >(const Matrix &m, double sigmar, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const Matrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
static void warn_convergence(void)
static bool LuAminusSigmaB(const SparseMatrix &m, const SparseMatrix &b, bool cholB, const ColumnVector &permB, double sigma, SparseMatrix &L, SparseMatrix &U, octave_idx_type *P, octave_idx_type *Q, ColumnVector &r)
octave_idx_type EigsRealNonSymmetricMatrix(const M &m, const std::string typ, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
octave_idx_type EigsComplexNonSymmetricMatrix(const M &m, const std::string typ, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
octave_idx_type EigsComplexNonSymmetricFunc(EigsComplexFunc fun, octave_idx_type n_arg, const std::string &_typ, Complex sigma, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
std::string arpack_errno2str(const octave_idx_type &errnum, const std::string &fcn_name)
template octave_idx_type EigsRealSymmetricMatrixShift< SparseMatrix >(const SparseMatrix &m, double sigma, octave_idx_type k, octave_idx_type p, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const SparseMatrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealNonSymmetricMatrixShift< SparseMatrix >(const SparseMatrix &m, double sigmar, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const SparseMatrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
static octave_idx_type lusolve(const SM &L, const SM &U, M &m)
octave_idx_type EigsRealNonSymmetricFunc(EigsFunc fun, octave_idx_type n_arg, const std::string &_typ, double sigmar, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealNonSymmetricFunc< SparseMatrix >(EigsFunc fun, octave_idx_type n, const std::string &_typ, double sigmar, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const SparseMatrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealSymmetricFunc< SparseMatrix >(EigsFunc fun, octave_idx_type n, const std::string &_typ, double sigma, octave_idx_type k, octave_idx_type p, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const SparseMatrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsComplexNonSymmetricMatrixShift< ComplexMatrix >(const ComplexMatrix &m, Complex sigma, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const ComplexMatrix &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealNonSymmetricMatrix< Matrix >(const Matrix &m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const Matrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealSymmetricMatrixShift< Matrix >(const Matrix &m, double sigma, octave_idx_type k, octave_idx_type p, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const Matrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealSymmetricMatrix< Matrix >(const Matrix &m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const Matrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
octave_idx_type EigsComplexNonSymmetricMatrixShift(const M &m, Complex sigma, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealNonSymmetricMatrix< SparseMatrix >(const SparseMatrix &m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const SparseMatrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
octave_idx_type EigsRealSymmetricMatrix(const M &m, const std::string typ, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
static bool vector_product(const SparseMatrix &m, const double *x, double *y)
template octave_idx_type EigsComplexNonSymmetricMatrix< ComplexMatrix >(const ComplexMatrix &m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const ComplexMatrix &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
template octave_idx_type EigsRealSymmetricMatrix< SparseMatrix >(const SparseMatrix &m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const SparseMatrix &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
ColumnVector(* EigsFunc)(const ColumnVector &x, int &eigs_error)
ComplexColumnVector(* EigsComplexFunc)(const ComplexColumnVector &x, int &eigs_error)
#define F77_DBLE_CMPLX_ARG(x)
#define F77_XFCN(f, F, args)
octave_f77_int_type F77_INT
#define F77_CONST_DBLE_CMPLX_ARG(x)
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
F77_RET_T const F77_INT const F77_INT const F77_INT const F77_DBLE const F77_DBLE F77_INT & M
F77_RET_T const F77_INT const F77_INT const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE * Q
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
std::complex< double > Complex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
octave_value::octave_value(const Array< char > &chm, char type) return retval
F77_RET_T F77_FUNC(xerbla, XERBLA)(F77_CONST_CHAR_ARG_DEF(s_arg