26#if defined (HAVE_CONFIG_H)
53#if defined (HAVE_ARPACK)
58 (*current_liboctave_warning_with_id_handler)
59 (
"Octave:convergence",
60 "eigs: 'A - sigma*B' is singular, indicating sigma is exactly "
61 "an eigenvalue so convergence is not guaranteed");
69 std::string bug_msg =
"\nThis should not happen. Please, see https://www.gnu.org/software/octave/bugs.html, and file a bug report";
74 msg =
"N must be positive";
78 msg =
"NEV must be positive";
82 msg =
"NCV-NEV >= 2 and less than or equal to N";
86 msg =
"The maximum number of Arnoldi update iterations allowed must be greater than zero";
90 msg =
"WHICH must be one of 'LM', 'SM', 'LR', 'SR', 'LI', 'SI'";
94 msg =
"BMAT must be one of 'I' or 'G'";
98 msg =
"Length of private work WORKL array is insufficient";
102 msg =
"Error return from LAPACK eigenvalue calculation";
106 if (fcn_name.compare (
"zneupd") == 0)
107 msg =
"Error return from calculation of eigenvectors. Informational error from LAPACK routine ztrevc";
108 else if (fcn_name.compare (
"dneupd") == 0)
109 msg =
"Error return from calculation of eigenvectors. Informational error from LAPACK routine dtrevc";
111 msg =
"Starting vector is zero";
116 if (fcn_name.compare (
"dneupd") == 0
117 || fcn_name.compare (
"dnaupd") == 0)
118 msg =
"IPARAM(7) must be 1,2,3,4";
119 else if (fcn_name.compare (
"zneupd") == 0
120 || fcn_name.compare (
"znaupd") == 0)
121 msg =
"IPARAM(7) must be 1,2,3";
123 msg =
"IPARAM(7) must be 1,2,3,4,5";
128 msg =
"IPARAM(7) = 1 and BMAT = 'G' are incompatible";
132 if (fcn_name.compare (
"dnaupd") == 0
133 || fcn_name.compare (
"znaupd") == 0
134 || fcn_name.compare (
"dsaupd") == 0)
135 msg = std::string (
"IPARAM(1) must be equal to 0 or 1");
136 else if (fcn_name.compare (
"dneupd") == 0
137 || fcn_name.compare (
"zneupd") == 0)
138 msg =
"HOWMNY = 'S' not yet implemented";
140 msg =
"NEV and WHICH = 'BE' are incompatible";
145 if (fcn_name.compare (
"dneupd") == 0
146 || fcn_name.compare (
"zneupd") == 0)
147 msg =
"HOWMNY must be one of 'A' or 'P' if RVEC = .true.";
148 else if (fcn_name.compare (
"dsaupd") == 0)
149 msg =
"NEV and WHICH = 'BE' are incompatible";
154 if (fcn_name.compare (
"dneupd") == 0)
155 msg =
"DNAUPD did not find any eigenvalues to sufficient accuracy.";
156 else if (fcn_name.compare (
"zneupd") == 0)
157 msg =
"ZNAUPD did not find any eigenvalues to sufficient accuracy.";
158 else if (fcn_name.compare (
"dseupd") == 0)
159 msg =
"DSAUPD did not find any eigenvalues to sufficient accuracy.";
161 msg +=
" Consider changing tolerance (TOL), maximum iterations (MAXIT), number of Lanzcos basis vectors (P), or starting vector (V0) in OPTS structure.";
166 if (fcn_name.compare (
"dseupd") == 0)
167 msg =
"HOWMNY must be one of 'A' or 'S' if RVEC = .true.";
172 if (fcn_name.compare (
"dseupd") == 0)
173 msg =
"HOWMNY = 'S' not yet implemented";
178 if (fcn_name.compare (
"dnaupd") == 0)
179 msg =
"Could not build an Arnoldi factorization. IPARAM(5) returns the size of the current Arnoldi factorization";
184 if (fcn_name.compare (
"dneupd") == 0)
185 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.";
186 else if (fcn_name.compare (
"dnaupd") == 0
187 || fcn_name.compare (
"znaupd") == 0
188 || fcn_name.compare (
"dsaupd") == 0)
189 msg =
"Maximum number of iterations taken. All possible eigenvalues of OP has been found. IPARAM(5) returns the number of wanted converged Ritz values";
190 else if (fcn_name.compare (
"znaupd") == 0)
191 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.";
196 if (fcn_name.compare (
"dnaupd") == 0
197 || fcn_name.compare (
"znaupd") == 0
198 || fcn_name.compare (
"dsaupd") == 0)
199 msg =
"No longer an informational error. Deprecated starting with release 2 of ARPACK.";
204 if (fcn_name.compare (
"dnaupd") == 0
205 || fcn_name.compare (
"znaupd") == 0
206 || fcn_name.compare (
"dsaupd") == 0)
207 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.";
213 if ((errnum != -9) && (errnum != -14) && (errnum != -9999))
214 msg.append (bug_msg);
219template <
typename M,
typename SM>
221lusolve (
const SM& L,
const SM& U,
M& m)
229 m = L.solve (ltyp, m, err, rcond,
nullptr);
233 m = U.solve (utyp, m, err, rcond,
nullptr);
238template <
typename SM,
typename M>
249 const double *qv =
Q.data ();
255 return L.solve (ltyp, retval, err, rcond,
nullptr);
258template <
typename SM,
typename M>
268 M tmp = U.solve (utyp, m, err, rcond,
nullptr);
270 const double *qv =
Q.data ();
274 retval.resize (n, b_nc);
287vector_product (
const SparseMatrix& m,
const double *
x,
double *y)
302vector_product (
const Matrix& m,
const double *
x,
double *y)
307 F77_XFCN (dgemv, DGEMV, (F77_CONST_CHAR_ARG2 (
"N", 1),
308 nr, nc, 1.0, m.
data (), nr,
310 F77_CHAR_ARG_LEN (1)));
337 F77_XFCN (zgemv, ZGEMV, (F77_CONST_CHAR_ARG2 (
"N", 1),
342 F77_CHAR_ARG_LEN (1)));
351 octave::math::chol<Matrix> fact (b, info);
358 bt = fact.chol_matrix ();
371 octave::math::sparse_chol<SparseMatrix> fact (b, info,
false);
379 permB = fact.perm () - 1.0;
388 octave::math::chol<ComplexMatrix> fact (b, info);
395 bt = fact.chol_matrix ();
409 octave::math::sparse_chol<SparseComplexMatrix> fact (b, info,
false);
417 permB = fact.perm () - 1.0;
452 AminusSigmaB -= sigma * tmp *
456 AminusSigmaB -= sigma * b.
transpose () * b;
459 AminusSigmaB -= sigma * b;
466 sigmat.xcidx (0) = 0;
469 sigmat.xdata (i) = sigma;
470 sigmat.xridx (i) = i;
471 sigmat.xcidx (i+1) = i + 1;
474 AminusSigmaB -= sigmat;
478 octave::math::sparse_lu<SparseMatrix> fact (AminusSigmaB,
Matrix (),
true);
496 double minU = octave::numeric_limits<double>::NaN ();
497 double maxU = octave::numeric_limits<double>::NaN ();
505 if (octave::math::isnan (minU) ||
d < minU)
508 if (octave::math::isnan (maxU) ||
d > maxU)
512 double rcond = (minU / maxU);
514 double rcond_plus_one = rcond + 1.0;
516 if (rcond_plus_one == 1.0 || octave::math::isnan (rcond))
542 const double *pB = permB.
data ();
543 double *p = AminusSigmaB.rwdata ();
558 AminusSigmaB -= sigma * b;
562 double *p = AminusSigmaB.rwdata ();
569 octave::math::lu<Matrix> fact (AminusSigmaB);
583 double minU = octave::numeric_limits<double>::NaN ();
584 double maxU = octave::numeric_limits<double>::NaN ();
587 double d = std::abs (U.
xelem (j, j));
588 if (octave::math::isnan (minU) ||
d < minU)
591 if (octave::math::isnan (maxU) ||
d > maxU)
595 double rcond = (minU / maxU);
597 double rcond_plus_one = rcond + 1.0;
599 if (rcond_plus_one == 1.0 || octave::math::isnan (rcond))
618 if (std::real (sigma) != 0.0 || std::imag (sigma) != 0.0)
635 AminusSigmaB -= tmp * b.
hermitian () * b *
639 AminusSigmaB -= sigma * b.
hermitian () * b;
642 AminusSigmaB -= sigma * b;
649 sigmat.xcidx (0) = 0;
652 sigmat.xdata (i) = sigma;
653 sigmat.xridx (i) = i;
654 sigmat.xcidx (i+1) = i + 1;
657 AminusSigmaB -= sigmat;
661 octave::math::sparse_lu<SparseComplexMatrix> fact (AminusSigmaB,
Matrix(),
680 double minU = octave::numeric_limits<double>::NaN ();
681 double maxU = octave::numeric_limits<double>::NaN ();
689 if (octave::math::isnan (minU) ||
d < minU)
692 if (octave::math::isnan (maxU) ||
d > maxU)
696 double rcond = (minU / maxU);
698 double rcond_plus_one = rcond + 1.0;
700 if (rcond_plus_one == 1.0 || octave::math::isnan (rcond))
719 if (std::real (sigma) != 0.0 || std::imag (sigma) != 0.0)
726 const double *pB = permB.
data ();
727 Complex *p = AminusSigmaB.rwdata ();
742 AminusSigmaB -= sigma * b;
753 octave::math::lu<ComplexMatrix> fact (AminusSigmaB);
767 double minU = octave::numeric_limits<double>::NaN ();
768 double maxU = octave::numeric_limits<double>::NaN ();
771 double d = std::abs (U.
xelem (j, j));
772 if (octave::math::isnan (minU) ||
d < minU)
775 if (octave::math::isnan (maxU) ||
d > maxU)
779 double rcond = (minU / maxU);
781 double rcond_plus_one = rcond + 1.0;
783 if (rcond_plus_one == 1.0 || octave::math::isnan (rcond))
796 std::ostream& os,
double tol,
bool rvec,
797 bool cholB,
int disp,
int maxit)
799 F77_INT k = octave::to_f77_int (k_arg);
800 F77_INT p = octave::to_f77_int (p_arg);
802 F77_INT n = octave::to_f77_int (m.cols ());
804 bool have_b = ! b.isempty ();
810 if (m.rows () != m.cols ())
811 (*current_liboctave_error_handler) (
"eigs: A must be square");
812 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
814 (
"eigs: B must be square and the same size as A");
818 std::string rand_dist = octave::rand::distribution ();
819 octave::rand::distribution (
"uniform");
821 octave::rand::distribution (rand_dist);
823 else if (m.cols () != resid.
numel ())
824 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
827 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
840 if (k < 1 || k > n - 2)
841 (*current_liboctave_error_handler)
842 (
"eigs: Invalid number of eigenvalues to extract"
843 " (must be 0 < k < n-1-1).\n"
844 " Use 'eig (full (A))' instead");
847 (*current_liboctave_error_handler)
848 (
"eigs: opts.p must be greater than k and less than or equal to n");
850 if (have_b && cholB && ! permB.
isempty ())
853 if (permB.
numel () != n)
857 for (
F77_INT i = 0; i < n; i++)
861 if (checked(bidx) || bidx < 0 || bidx >= n)
866 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
867 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
869 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
871 if (typ ==
"LI" || typ ==
"SI" || typ ==
"LR" || typ ==
"SR")
872 (*current_liboctave_error_handler)
873 (
"eigs: invalid sigma value for real symmetric problem");
886 for (
F77_INT i = 0; i < n; i++)
892 if (! make_cholb (b, bt, permB))
893 (*current_liboctave_error_handler)
894 (
"eigs: The matrix B is not positive definite");
922 if (octave::math::int_multiply_overflow (n, p, &elems))
923 (*current_liboctave_error_handler)
924 (
"eigs: array too large for Fortran integers");
925 if (octave::math::int_multiply_overflow (p, p + 8, &lwork))
927 (
"eigs: array too large for Fortran integers");
932 double *presid = resid.
rwdata ();
936 F77_INT tmp_info = octave::to_f77_int (info);
939 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
940 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
941 k, tol, presid, p, v, n, iparam,
942 ipntr, workd, workl, lwork, tmp_info
943 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
947 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
951 os <<
"Iteration " << iter - 1 <<
952 ": a few Ritz values of the " << p <<
"-by-" <<
956 for (
F77_INT i = 0; i < k; i++)
957 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
962 for (
F77_INT i = p - k; i < p; i++)
963 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
973 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
976 if (ido == -1 || ido == 1 || ido == 2)
981 for (
F77_INT i = 0; i < n; i++)
982 mtmp(i, 0) = workd[i + iptr(0) - 1];
984 mtmp = ltsolve (b, permB, m * utsolve (bt, permB, mtmp));
986 for (
F77_INT i = 0; i < n; i++)
987 workd[i+iptr(1)-1] = mtmp(i, 0);
989 else if (! vector_product (m, workd + iptr(0) - 1,
990 workd + iptr(1) - 1))
996 (*current_liboctave_error_handler)
997 (
"eigs: error in dsaupd: %s",
1018 double *z = eig_vec.
rwdata ();
1021 double *
d = eig_val.
rwdata ();
1024 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel,
d, z, n, sigma,
1025 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1026 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam,
1027 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
1028 F77_CHAR_ARG_LEN(2));
1032 for (
F77_INT i = ip(4); i < k; i++)
1033 d[i] = octave::numeric_limits<double>::NaN ();
1035 if (typ !=
"SM" && typ !=
"BE" && ! (typ ==
"SA" && rvec))
1037 for (
F77_INT i = 0; i < k2; i++)
1040 d[i] =
d[ip(4) - i - 1];
1041 d[ip(4) - i - 1] = dtmp;
1047 for (
F77_INT i = ip(4); i < k; i++)
1050 for (
F77_INT j = 0; j < n; j++)
1051 z[off1 + j] = octave::numeric_limits<double>::NaN ();
1053 if (typ !=
"SM" && typ !=
"BE" && typ !=
"SA")
1057 for (
F77_INT i = 0; i < k2; i++)
1060 F77_INT off2 = (ip(4) - i - 1) * n;
1065 for (
F77_INT j = 0; j < n; j++)
1066 dtmp[j] = z[off1 + j];
1068 for (
F77_INT j = 0; j < n; j++)
1069 z[off1 + j] = z[off2 + j];
1071 for (
F77_INT j = 0; j < n; j++)
1072 z[off2 + j] = dtmp[j];
1077 eig_vec = utsolve (bt, permB, eig_vec);
1082 (
"eigs: error in dseupd: %s",
1088template <
typename M>
1095 std::ostream& os,
double tol,
bool rvec,
1096 bool cholB,
int disp,
int maxit)
1098 F77_INT k = octave::to_f77_int (k_arg);
1099 F77_INT p = octave::to_f77_int (p_arg);
1101 F77_INT n = octave::to_f77_int (m.cols ());
1103 bool have_b = ! b.isempty ();
1104 std::string typ =
"LM";
1106 if (m.rows () != m.cols ())
1107 (*current_liboctave_error_handler) (
"eigs: A must be square");
1108 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
1110 (
"eigs: B must be square and the same size as A");
1120 std::string rand_dist = octave::rand::distribution ();
1121 octave::rand::distribution (
"uniform");
1123 octave::rand::distribution (rand_dist);
1125 else if (m.cols () != resid.
numel ())
1126 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
1129 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
1131 if (k <= 0 || k >= n - 1)
1132 (*current_liboctave_error_handler)
1133 (
"eigs: Invalid number of eigenvalues to extract"
1134 " (must be 0 < k < n-1-1).\n"
1135 " Use 'eig (full (A))' instead");
1148 if (p <= k || p > n)
1149 (*current_liboctave_error_handler)
1150 (
"eigs: opts.p must be greater than k and less than or equal to n");
1152 if (have_b && cholB && ! permB.
isempty ())
1155 if (permB.
numel () != n)
1159 for (
F77_INT i = 0; i < n; i++)
1163 if (checked(bidx) || bidx < 0 || bidx >= n)
1199 if (! LuAminusSigmaB (m, b, cholB, permB, sigma, L, U, P,
Q, r))
1205 if (octave::math::int_multiply_overflow (n, p, &elems))
1206 (*current_liboctave_error_handler)
1207 (
"eigs: array too large for Fortran integers");
1208 if (octave::math::int_multiply_overflow (p, p + 8, &lwork))
1210 (
"eigs: array too large for Fortran integers");
1215 double *presid = resid.
rwdata ();
1219 F77_INT tmp_info = octave::to_f77_int (info);
1222 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1223 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1224 k, tol, presid, p, v, n, iparam,
1225 ipntr, workd, workl, lwork, tmp_info
1226 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1229 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
1233 os <<
"Iteration " << iter - 1 <<
1234 ": a few Ritz values of the " << p <<
"-by-" <<
1238 for (
F77_INT i = 0; i < k; i++)
1239 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1244 for (
F77_INT i = p - k; i < p; i++)
1245 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1255 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
1258 if (ido == -1 || ido == 1 || ido == 2)
1266 vector_product (b, workd+iptr(0)-1, dtmp);
1270 for (
F77_INT i = 0; i < n; i++)
1271 tmp(i, 0) = dtmp[P[i]] / r(P[i]);
1273 lusolve (L, U, tmp);
1275 double *ip2 = workd+iptr(1)-1;
1276 for (
F77_INT i = 0; i < n; i++)
1277 ip2[
Q[i]] = tmp(i, 0);
1280 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
1283 double *ip2 = workd+iptr(2)-1;
1286 for (
F77_INT i = 0; i < n; i++)
1287 tmp(i, 0) = ip2[P[i]] / r(P[i]);
1289 lusolve (L, U, tmp);
1291 ip2 = workd+iptr(1)-1;
1292 for (
F77_INT i = 0; i < n; i++)
1293 ip2[
Q[i]] = tmp(i, 0);
1299 double *ip2 = workd+iptr(0)-1;
1302 for (
F77_INT i = 0; i < n; i++)
1303 tmp(i, 0) = ip2[P[i]] / r(P[i]);
1305 lusolve (L, U, tmp);
1307 ip2 = workd+iptr(1)-1;
1308 for (
F77_INT i = 0; i < n; i++)
1309 ip2[
Q[i]] = tmp(i, 0);
1315 (*current_liboctave_error_handler)
1316 (
"eigs: error in dsaupd: %s",
1337 double *z = eig_vec.
rwdata ();
1340 double *
d = eig_val.
rwdata ();
1343 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel,
d, z, n, sigma,
1344 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1345 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1346 k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info2
1347 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1351 for (
F77_INT i = ip(4); i < k; i++)
1352 d[i] = octave::numeric_limits<double>::NaN ();
1354 for (
F77_INT i = 0; i < k2; i++)
1357 d[i] =
d[ip(4) - i - 1];
1358 d[ip(4) - i - 1] = dtmp;
1365 for (
F77_INT i = ip(4); i < k; i++)
1368 for (
F77_INT j = 0; j < n; j++)
1369 z[off1 + j] = octave::numeric_limits<double>::NaN ();
1371 for (
F77_INT i = 0; i < k2; i++)
1374 F77_INT off2 = (ip(4) - i - 1) * n;
1379 for (
F77_INT j = 0; j < n; j++)
1380 dtmp[j] = z[off1 + j];
1382 for (
F77_INT j = 0; j < n; j++)
1383 z[off1 + j] = z[off2 + j];
1385 for (
F77_INT j = 0; j < n; j++)
1386 z[off2 + j] = dtmp[j];
1392 (
"eigs: error in dseupd: %s",
1398template <
typename M>
1401 const std::string& _typ,
double sigma,
1406 std::ostream& os,
double tol,
bool rvec,
1407 bool cholB,
int disp,
int maxit)
1409 F77_INT n = octave::to_f77_int (n_arg);
1410 F77_INT k = octave::to_f77_int (k_arg);
1411 F77_INT p = octave::to_f77_int (p_arg);
1413 std::string typ (_typ);
1414 bool have_sigma = (sigma ? true :
false);
1415 bool have_b = ! b.isempty ();
1424 std::string rand_dist = octave::rand::distribution ();
1425 octave::rand::distribution (
"uniform");
1427 octave::rand::distribution (rand_dist);
1429 else if (n != resid.
numel ())
1430 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
1433 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
1446 if (k <= 0 || k >= n - 1)
1447 (*current_liboctave_error_handler)
1448 (
"eigs: Invalid number of eigenvalues to extract"
1449 " (must be 0 < k < n-1).\n"
1450 " Use 'eig (full (A))' instead");
1452 if (p <= k || p > n)
1453 (*current_liboctave_error_handler)
1454 (
"eigs: opts.p must be greater than k and less than or equal to n");
1456 if (have_b && cholB && ! permB.
isempty ())
1459 if (permB.
numel () != n)
1463 for (
F77_INT i = 0; i < n; i++)
1467 if (checked(bidx) || bidx < 0 || bidx >= n)
1474 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
1475 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
1477 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
1479 if (typ ==
"LI" || typ ==
"SI" || typ ==
"LR" || typ ==
"SR")
1480 (*current_liboctave_error_handler)
1481 (
"eigs: invalid sigma value for real symmetric problem");
1483 if (typ !=
"SM" && have_b)
1495 else if (! std::abs (sigma))
1509 if (mode == 1 && have_b)
1520 for (
F77_INT i = 0; i < n; i++)
1526 if (! make_cholb (b, bt, permB))
1527 (*current_liboctave_error_handler)
1528 (
"eigs: The matrix B is not positive definite");
1556 if (octave::math::int_multiply_overflow (n, p, &elems))
1557 (*current_liboctave_error_handler)
1558 (
"eigs: array too large for Fortran integers");
1559 if (octave::math::int_multiply_overflow (p, p + 8, &lwork))
1561 (
"eigs: array too large for Fortran integers");
1566 double *presid = resid.
rwdata ();
1570 F77_INT tmp_info = octave::to_f77_int (info);
1573 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1574 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1575 k, tol, presid, p, v, n, iparam,
1576 ipntr, workd, workl, lwork, tmp_info
1577 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1581 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
1585 os <<
"Iteration " << iter - 1 <<
1586 ": a few Ritz values of the " << p <<
"-by-" <<
1590 for (
F77_INT i = 0; i < k; i++)
1591 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1596 for (
F77_INT i = p - k; i < p; i++)
1597 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1607 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
1610 if (ido == -1 || ido == 1 || ido == 2)
1617 for (
F77_INT i = 0; i < n; i++)
1618 mtmp(i, 0) = workd[i + iptr(0) - 1];
1620 mtmp = utsolve (bt, permB, mtmp);
1626 mtmp = ltsolve (b, permB, y);
1628 for (
F77_INT i = 0; i < n; i++)
1629 workd[i+iptr(1)-1] = mtmp(i, 0);
1637 vector_product (b, workd+iptr(0)-1, dtmp);
1641 for (
F77_INT i = 0; i < n; i++)
1649 double *ip2 = workd + iptr(1) - 1;
1650 for (
F77_INT i = 0; i < n; i++)
1654 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
1657 double *ip2 = workd+iptr(2)-1;
1660 for (
F77_INT i = 0; i < n; i++)
1668 ip2 = workd + iptr(1) - 1;
1669 for (
F77_INT i = 0; i < n; i++)
1676 double *ip2 = workd + iptr(0) - 1;
1679 for (
F77_INT i = 0; i < n; i++)
1687 ip2 = workd + iptr(1) - 1;
1688 for (
F77_INT i = 0; i < n; i++)
1695 (*current_liboctave_error_handler)
1696 (
"eigs: error in dsaupd: %s",
1717 double *z = eig_vec.
rwdata ();
1720 double *
d = eig_val.
rwdata ();
1723 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel,
d, z, n, sigma,
1724 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1725 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1726 k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info2
1727 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1731 for (
F77_INT i = ip(4); i < k; i++)
1732 d[i] = octave::numeric_limits<double>::NaN ();
1734 if (mode == 3 || (mode == 1 && typ !=
"SM" && typ !=
"BE"))
1736 for (
F77_INT i = 0; i < k2; i++)
1739 d[i] =
d[ip(4) - i - 1];
1740 d[ip(4) - i - 1] = dtmp;
1746 for (
F77_INT i = ip(4); i < k; i++)
1749 for (
F77_INT j = 0; j < n; j++)
1750 z[off1 + j] = octave::numeric_limits<double>::NaN ();
1752 if (mode == 3 || (mode == 1 && typ !=
"SM" && typ !=
"BE"))
1756 for (
F77_INT i = 0; i < k2; i++)
1759 F77_INT off2 = (ip(4) - i - 1) * n;
1764 for (
F77_INT j = 0; j < n; j++)
1765 dtmp[j] = z[off1 + j];
1767 for (
F77_INT j = 0; j < n; j++)
1768 z[off1 + j] = z[off2 + j];
1770 for (
F77_INT j = 0; j < n; j++)
1771 z[off2 + j] = dtmp[j];
1775 eig_vec = utsolve (bt, permB, eig_vec);
1780 (
"eigs: error in dseupd: %s",
1786template <
typename M>
1793 std::ostream& os,
double tol,
bool rvec,
1794 bool cholB,
int disp,
int maxit)
1796 F77_INT k = octave::to_f77_int (k_arg);
1797 F77_INT p = octave::to_f77_int (p_arg);
1799 F77_INT n = octave::to_f77_int (m.cols ());
1801 bool have_b = ! b.isempty ();
1808 if (m.rows () != m.cols ())
1809 (*current_liboctave_error_handler) (
"eigs: A must be square");
1810 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
1812 (
"eigs: B must be square and the same size as A");
1816 std::string rand_dist = octave::rand::distribution ();
1817 octave::rand::distribution (
"uniform");
1819 octave::rand::distribution (rand_dist);
1821 else if (m.cols () != resid.
numel ())
1822 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
1825 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
1838 if (k <= 0 || k >= n - 1)
1839 (*current_liboctave_error_handler)
1840 (
"eigs: Invalid number of eigenvalues to extract"
1841 " (must be 0 < k < n-1).\n"
1842 " Use 'eig (full (A))' instead");
1844 if (p <= k || p > n)
1845 (*current_liboctave_error_handler)
1846 (
"eigs: opts.p must be greater than k and less than or equal to n");
1848 if (have_b && cholB && ! permB.
isempty ())
1851 if (permB.
numel () != n)
1855 for (
F77_INT i = 0; i < n; i++)
1859 if (checked(bidx) || bidx < 0 || bidx >= n)
1864 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
1865 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
1867 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
1869 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
1870 (*current_liboctave_error_handler)
1871 (
"eigs: invalid sigma value for unsymmetric problem");
1884 for (
F77_INT i = 0; i < n; i++)
1890 if (! make_cholb (b, bt, permB))
1891 (*current_liboctave_error_handler)
1892 (
"eigs: The matrix B is not positive definite");
1920 if (octave::math::int_multiply_overflow (n, p + 1, &elems))
1921 (*current_liboctave_error_handler)
1922 (
"eigs: array too large for Fortran integers");
1923 if (octave::math::int_multiply_overflow (3 * p, p + 2, &lwork))
1925 (
"eigs: array too large for Fortran integers");
1930 double *presid = resid.
rwdata ();
1934 F77_INT tmp_info = octave::to_f77_int (info);
1939 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1940 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1941 k, tol, presid, p, v, n, iparam,
1942 ipntr, workd, workl, lwork, tmp_info
1943 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1948 if (disp > 0 && ! octave::math::isnan(workl[iptr(5)-1]))
1952 os <<
"Iteration " << iter - 1 <<
1953 ": a few Ritz values of the " << p <<
"-by-" <<
1957 os <<
" " << workl[iptr(5)+k] <<
"\n";
1958 for (
F77_INT i = 0; i < k; i++)
1959 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1964 for (
F77_INT i = p - k - 1; i < p; i++)
1965 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1975 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
1978 if (ido == -1 || ido == 1 || ido == 2)
1983 for (
F77_INT i = 0; i < n; i++)
1984 mtmp(i, 0) = workd[i + iptr(0) - 1];
1986 mtmp = ltsolve (b, permB, m * utsolve (bt, permB, mtmp));
1988 for (
F77_INT i = 0; i < n; i++)
1989 workd[i+iptr(1)-1] = mtmp(i, 0);
1991 else if (! vector_product (m, workd + iptr(0) - 1,
1992 workd + iptr(1) - 1))
1998 (*current_liboctave_error_handler)
1999 (
"eigs: error in dnaupd: %s",
2026 Matrix eig_vec2 (n, k + 1, 0.0);
2027 double *z = eig_vec2.
rwdata ();
2032 for (
F77_INT i = 0; i < k+1; i++)
2037 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel, dr, di, z, n, sigmar,
2038 sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2039 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam,
2040 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
2041 F77_CHAR_ARG_LEN(2));
2045 if (! rvec && ip(4) > k)
2053 bool have_cplx_eig =
false;
2054 for (
F77_INT i = 0; i < ip(4); i++)
2060 have_cplx_eig =
true;
2066 for (
F77_INT i = ip(4); i < k; i++)
2067 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
2068 octave::numeric_limits<double>::NaN ());
2072 for (
F77_INT i = ip(4); i < k; i++)
2073 d[i] =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2079 for (
F77_INT i = 0; i < k2; i++)
2082 d[i] =
d[ip(4) - i - 1];
2083 d[ip(4) - i - 1] = dtmp;
2095 if (std::imag (eig_val(i)) == 0)
2097 for (
F77_INT j = 0; j < n; j++)
2098 eig_vec(j, i) =
Complex (z[j+off1], 0.);
2103 for (
F77_INT j = 0; j < n; j++)
2105 eig_vec(j, i) =
Complex (z[j+off1], z[j+off2]);
2107 eig_vec(j, i+1) =
Complex (z[j+off1], -z[j+off2]);
2114 for (
F77_INT ii = ip(4); ii < k; ii++)
2115 for (
F77_INT jj = 0; jj < n; jj++)
2117 =
Complex (octave::numeric_limits<double>::NaN (),
2118 octave::numeric_limits<double>::NaN ());
2122 for (
F77_INT ii = ip(4); ii < k; ii++)
2123 for (
F77_INT jj = 0; jj < n; jj++)
2125 =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2128 eig_vec = utsolve (bt, permB, eig_vec);
2138 (
"eigs: error in dneupd: %s",
2144template <
typename M>
2152 std::ostream& os,
double tol,
bool rvec,
2153 bool cholB,
int disp,
int maxit)
2155 F77_INT k = octave::to_f77_int (k_arg);
2156 F77_INT p = octave::to_f77_int (p_arg);
2158 F77_INT n = octave::to_f77_int (m.cols ());
2160 bool have_b = ! b.isempty ();
2161 std::string typ =
"LM";
2164 if (m.rows () != m.cols ())
2165 (*current_liboctave_error_handler) (
"eigs: A must be square");
2166 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
2168 (
"eigs: B must be square and the same size as A");
2178 std::string rand_dist = octave::rand::distribution ();
2179 octave::rand::distribution (
"uniform");
2181 octave::rand::distribution (rand_dist);
2183 else if (m.cols () != resid.
numel ())
2184 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
2187 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
2200 if (k <= 0 || k >= n - 1)
2201 (*current_liboctave_error_handler)
2202 (
"eigs: Invalid number of eigenvalues to extract"
2203 " (must be 0 < k < n-1).\n"
2204 " Use 'eig (full (A))' instead");
2206 if (p <= k || p > n)
2207 (*current_liboctave_error_handler)
2208 (
"eigs: opts.p must be greater than k and less than or equal to n");
2210 if (have_b && cholB && ! permB.
isempty ())
2213 if (permB.
numel () != n)
2217 for (
F77_INT i = 0; i < n; i++)
2221 if (checked(bidx) || bidx < 0 || bidx >= n)
2257 if (! LuAminusSigmaB (m, b, cholB, permB, sigmar, L, U, P,
Q, r))
2263 if (octave::math::int_multiply_overflow (n, p + 1, &elems))
2264 (*current_liboctave_error_handler)
2265 (
"eigs: array too large for Fortran integers");
2266 if (octave::math::int_multiply_overflow (3 * p, p + 2, &lwork))
2268 (
"eigs: array too large for Fortran integers");
2273 double *presid = resid.
rwdata ();
2277 F77_INT tmp_info = octave::to_f77_int (info);
2282 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2283 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
2284 k, tol, presid, p, v, n, iparam,
2285 ipntr, workd, workl, lwork, tmp_info
2286 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
2291 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
2295 os <<
"Iteration " << iter - 1 <<
2296 ": a few Ritz values of the " << p <<
"-by-" <<
2300 os <<
" " << workl[iptr(5)+k] <<
"\n";
2301 for (
F77_INT i = 0; i < k; i++)
2302 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2307 for (
F77_INT i = p - k - 1; i < p; i++)
2308 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2318 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
2321 if (ido == -1 || ido == 1 || ido == 2)
2329 vector_product (b, workd+iptr(0)-1, dtmp);
2333 for (
F77_INT i = 0; i < n; i++)
2334 tmp(i, 0) = dtmp[P[i]] / r(P[i]);
2336 lusolve (L, U, tmp);
2338 double *ip2 = workd+iptr(1)-1;
2339 for (
F77_INT i = 0; i < n; i++)
2340 ip2[
Q[i]] = tmp(i, 0);
2343 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
2346 double *ip2 = workd+iptr(2)-1;
2349 for (
F77_INT i = 0; i < n; i++)
2350 tmp(i, 0) = ip2[P[i]] / r(P[i]);
2352 lusolve (L, U, tmp);
2354 ip2 = workd+iptr(1)-1;
2355 for (
F77_INT i = 0; i < n; i++)
2356 ip2[
Q[i]] = tmp(i, 0);
2362 double *ip2 = workd+iptr(0)-1;
2365 for (
F77_INT i = 0; i < n; i++)
2366 tmp(i, 0) = ip2[P[i]] / r(P[i]);
2368 lusolve (L, U, tmp);
2370 ip2 = workd+iptr(1)-1;
2371 for (
F77_INT i = 0; i < n; i++)
2372 ip2[
Q[i]] = tmp(i, 0);
2378 (*current_liboctave_error_handler)
2379 (
"eigs: error in dnaupd: %s",
2406 Matrix eig_vec2 (n, k + 1, 0.0);
2407 double *z = eig_vec2.
rwdata ();
2412 for (
F77_INT i = 0; i < k+1; i++)
2417 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel, dr, di, z, n, sigmar,
2418 sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2419 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam,
2420 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
2421 F77_CHAR_ARG_LEN(2));
2425 if (! rvec && ip(4) > k)
2433 bool have_cplx_eig =
false;
2434 for (
F77_INT i = 0; i < ip(4); i++)
2440 have_cplx_eig =
true;
2446 for (
F77_INT i = ip(4); i < k; i++)
2447 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
2448 octave::numeric_limits<double>::NaN ());
2452 for (
F77_INT i = ip(4); i < k; i++)
2453 d[i] =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2460 for (
F77_INT i = 0; i < k2; i++)
2463 d[i] =
d[ip(4) - i - 1];
2464 d[ip(4) - i - 1] = dtmp;
2476 if (std::imag (eig_val(i)) == 0)
2478 for (
F77_INT j = 0; j < n; j++)
2479 eig_vec(j, i) =
Complex (z[j+off1], 0.);
2484 for (
F77_INT j = 0; j < n; j++)
2486 eig_vec(j, i) =
Complex (z[j+off1], z[j+off2]);
2488 eig_vec(j, i+1) =
Complex (z[j+off1], -z[j+off2]);
2495 for (
F77_INT ii = ip(4); ii < k; ii++)
2496 for (
F77_INT jj = 0; jj < n; jj++)
2498 =
Complex (octave::numeric_limits<double>::NaN (),
2499 octave::numeric_limits<double>::NaN ());
2503 for (
F77_INT ii = ip(4); ii < k; ii++)
2504 for (
F77_INT jj = 0; jj < n; jj++)
2506 =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2517 (
"eigs: error in dneupd: %s",
2523template <
typename M>
2526 const std::string& _typ,
double sigmar,
2531 std::ostream& os,
double tol,
bool rvec,
2532 bool cholB,
int disp,
int maxit)
2534 F77_INT n = octave::to_f77_int (n_arg);
2535 F77_INT k = octave::to_f77_int (k_arg);
2536 F77_INT p = octave::to_f77_int (p_arg);
2538 std::string typ (_typ);
2539 bool have_sigma = (sigmar ? true :
false);
2542 bool have_b = ! b.isempty ();
2550 std::string rand_dist = octave::rand::distribution ();
2551 octave::rand::distribution (
"uniform");
2553 octave::rand::distribution (rand_dist);
2555 else if (n != resid.
numel ())
2556 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
2559 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
2572 if (k <= 0 || k >= n - 1)
2573 (*current_liboctave_error_handler)
2574 (
"eigs: Invalid number of eigenvalues to extract"
2575 " (must be 0 < k < n-1).\n"
2576 " Use 'eig (full (A))' instead");
2578 if (p <= k || p > n)
2579 (*current_liboctave_error_handler)
2580 (
"eigs: opts.p must be greater than k and less than or equal to n");
2582 if (have_b && cholB && ! permB.
isempty ())
2585 if (permB.
numel () != n)
2589 for (
F77_INT i = 0; i < n; i++)
2593 if (checked(bidx) || bidx < 0 || bidx >= n)
2600 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
2601 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
2603 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
2605 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
2606 (*current_liboctave_error_handler)
2607 (
"eigs: invalid sigma value for unsymmetric problem");
2609 if (typ !=
"SM" && have_b)
2621 else if (! std::abs (sigmar))
2635 if (mode == 1 && have_b)
2646 for (
F77_INT i = 0; i < n; i++)
2652 if (! make_cholb (b, bt, permB))
2653 (*current_liboctave_error_handler)
2654 (
"eigs: The matrix B is not positive definite");
2682 if (octave::math::int_multiply_overflow (n, p + 1, &elems))
2683 (*current_liboctave_error_handler)
2684 (
"eigs: array too large for Fortran integers");
2685 if (octave::math::int_multiply_overflow (3 * p, p + 2, &lwork))
2687 (
"eigs: array too large for Fortran integers");
2693 double *presid = resid.
rwdata ();
2697 F77_INT tmp_info = octave::to_f77_int (info);
2702 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2703 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
2704 k, tol, presid, p, v, n, iparam,
2705 ipntr, workd, workl, lwork, tmp_info
2706 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
2711 if (disp > 0 && ! octave::math::isnan(workl[iptr(5)-1]))
2715 os <<
"Iteration " << iter - 1 <<
2716 ": a few Ritz values of the " << p <<
"-by-" <<
2720 os <<
" " << workl[iptr(5)+k] <<
"\n";
2721 for (
F77_INT i = 0; i < k; i++)
2722 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2727 for (
F77_INT i = p - k - 1; i < p; i++)
2728 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2738 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
2741 if (ido == -1 || ido == 1 || ido == 2)
2748 for (
F77_INT i = 0; i < n; i++)
2749 mtmp(i, 0) = workd[i + iptr(0) - 1];
2751 mtmp = utsolve (bt, permB, mtmp);
2757 mtmp = ltsolve (b, permB, y);
2759 for (
F77_INT i = 0; i < n; i++)
2760 workd[i+iptr(1)-1] = mtmp(i, 0);
2768 vector_product (b, workd+iptr(0)-1, dtmp);
2772 for (
F77_INT i = 0; i < n; i++)
2780 double *ip2 = workd + iptr(1) - 1;
2781 for (
F77_INT i = 0; i < n; i++)
2785 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
2788 double *ip2 = workd+iptr(2)-1;
2791 for (
F77_INT i = 0; i < n; i++)
2799 ip2 = workd + iptr(1) - 1;
2800 for (
F77_INT i = 0; i < n; i++)
2807 double *ip2 = workd + iptr(0) - 1;
2810 for (
F77_INT i = 0; i < n; i++)
2818 ip2 = workd + iptr(1) - 1;
2819 for (
F77_INT i = 0; i < n; i++)
2826 (*current_liboctave_error_handler)
2827 (
"eigs: error in dnaupd: %s",
2854 Matrix eig_vec2 (n, k + 1, 0.0);
2855 double *z = eig_vec2.
rwdata ();
2860 for (
F77_INT i = 0; i < k+1; i++)
2865 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel, dr, di, z, n, sigmar,
2866 sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2867 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam,
2868 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
2869 F77_CHAR_ARG_LEN(2));
2873 if (! rvec && ip(4) > k)
2881 bool have_cplx_eig =
false;
2882 for (
F77_INT i = 0; i < ip(4); i++)
2888 have_cplx_eig =
true;
2894 for (
F77_INT i = ip(4); i < k; i++)
2895 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
2896 octave::numeric_limits<double>::NaN ());
2900 for (
F77_INT i = ip(4); i < k; i++)
2901 d[i] =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2908 for (
F77_INT i = 0; i < k2; i++)
2911 d[i] =
d[ip(4) - i - 1];
2912 d[ip(4) - i - 1] = dtmp;
2924 if (std::imag (eig_val(i)) == 0)
2926 for (
F77_INT j = 0; j < n; j++)
2927 eig_vec(j, i) =
Complex (z[j+off1], 0.);
2932 for (
F77_INT j = 0; j < n; j++)
2934 eig_vec(j, i) =
Complex (z[j+off1], z[j+off2]);
2936 eig_vec(j, i+1) =
Complex (z[j+off1], -z[j+off2]);
2943 for (
F77_INT ii = ip(4); ii < k; ii++)
2944 for (
F77_INT jj = 0; jj < n; jj++)
2946 =
Complex (octave::numeric_limits<double>::NaN (),
2947 octave::numeric_limits<double>::NaN ());
2951 for (
F77_INT ii = ip(4); ii < k; ii++)
2952 for (
F77_INT jj = 0; jj < n; jj++)
2954 =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2957 eig_vec = utsolve (bt, permB, eig_vec);
2967 (
"eigs: error in dneupd: %s",
2973template <
typename M>
2981 std::ostream& os,
double tol,
bool rvec,
2982 bool cholB,
int disp,
int maxit)
2984 F77_INT k = octave::to_f77_int (k_arg);
2985 F77_INT p = octave::to_f77_int (p_arg);
2987 F77_INT n = octave::to_f77_int (m.cols ());
2989 bool have_b = ! b.isempty ();
2995 if (m.rows () != m.cols ())
2996 (*current_liboctave_error_handler) (
"eigs: A must be square");
2997 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
2999 (
"eigs: B must be square and the same size as A");
3003 std::string rand_dist = octave::rand::distribution ();
3004 octave::rand::distribution (
"uniform");
3008 for (
F77_INT i = 0; i < n; i++)
3009 cresid(i) =
Complex (rr(i), ri(i));
3010 octave::rand::distribution (rand_dist);
3012 else if (m.cols () != cresid.
numel ())
3013 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
3016 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
3029 if (k <= 0 || k >= n - 1)
3030 (*current_liboctave_error_handler)
3031 (
"eigs: Invalid number of eigenvalues to extract"
3032 " (must be 0 < k < n-1).\n"
3033 " Use 'eig (full (A))' instead");
3035 if (p <= k || p > n)
3036 (*current_liboctave_error_handler)
3037 (
"eigs: opts.p must be greater than k and less than or equal to n");
3039 if (have_b && cholB && ! permB.
isempty ())
3042 if (permB.
numel () != n)
3046 for (
F77_INT i = 0; i < n; i++)
3050 if (checked(bidx) || bidx < 0 || bidx >= n)
3055 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
3056 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
3058 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
3060 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
3061 (*current_liboctave_error_handler)
3062 (
"eigs: invalid sigma value for complex problem");
3075 for (
F77_INT i = 0; i < n; i++)
3081 if (! make_cholb (b, bt, permB))
3082 (*current_liboctave_error_handler)
3083 (
"eigs: The matrix B is not positive definite");
3111 if (octave::math::int_multiply_overflow (n, p, &elems))
3112 (*current_liboctave_error_handler)
3113 (
"eigs: array too large for Fortran integers");
3114 if (octave::math::int_multiply_overflow (p, 3 * p + 5, &lwork))
3116 (
"eigs: array too large for Fortran integers");
3126 F77_INT tmp_info = octave::to_f77_int (info);
3129 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3130 F77_CONST_CHAR_ARG2 (typ.c_str (), 2),
3134 tmp_info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3138 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
3142 os <<
"Iteration " << iter - 1 <<
3143 ": a few Ritz values of the " << p <<
"-by-" <<
3147 for (
F77_INT i = 0; i < k; i++)
3148 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3153 for (
F77_INT i = p - k; i < p; i++)
3154 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3164 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
3167 if (ido == -1 || ido == 1 || ido == 2)
3172 for (
F77_INT i = 0; i < n; i++)
3173 mtmp(i, 0) = workd[i + iptr(0) - 1];
3174 mtmp = ltsolve (b, permB, m * utsolve (bt, permB, mtmp));
3175 for (
F77_INT i = 0; i < n; i++)
3176 workd[i+iptr(1)-1] = mtmp(i, 0);
3179 else if (! vector_product (m, workd + iptr(0) - 1,
3180 workd + iptr(1) - 1))
3186 (*current_liboctave_error_handler)
3187 (
"eigs: error %" OCTAVE_IDX_TYPE_FORMAT
" in znaupd: %s",
3219 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3220 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3224 info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3228 for (
F77_INT i = ip(4); i < k; i++)
3229 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
3230 octave::numeric_limits<double>::NaN ());
3233 for (
F77_INT i = 0; i < k2; i++)
3236 d[i] =
d[ip(4) - i - 1];
3237 d[ip(4) - i - 1] = ctmp;
3245 for (
F77_INT i = ip(4); i < k; i++)
3248 for (
F77_INT j = 0; j < n; j++)
3249 z[off1 + j] =
Complex (octave::numeric_limits<double>::NaN (),
3250 octave::numeric_limits<double>::NaN ());
3253 for (
F77_INT i = 0; i < k2; i++)
3256 F77_INT off2 = (ip(4) - i - 1) * n;
3261 for (
F77_INT j = 0; j < n; j++)
3262 ctmp[j] = z[off1 + j];
3264 for (
F77_INT j = 0; j < n; j++)
3265 z[off1 + j] = z[off2 + j];
3267 for (
F77_INT j = 0; j < n; j++)
3268 z[off2 + j] = ctmp[j];
3272 eig_vec = utsolve (bt, permB, eig_vec);
3277 (
"eigs: error in zneupd: %s",
3283template <
typename M>
3292 std::ostream& os,
double tol,
bool rvec,
3293 bool cholB,
int disp,
int maxit)
3295 F77_INT k = octave::to_f77_int (k_arg);
3296 F77_INT p = octave::to_f77_int (p_arg);
3298 F77_INT n = octave::to_f77_int (m.cols ());
3300 bool have_b = ! b.isempty ();
3301 std::string typ =
"LM";
3303 if (m.rows () != m.cols ())
3304 (*current_liboctave_error_handler) (
"eigs: A must be square");
3305 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
3307 (
"eigs: B must be square and the same size as A");
3317 std::string rand_dist = octave::rand::distribution ();
3318 octave::rand::distribution (
"uniform");
3322 for (
F77_INT i = 0; i < n; i++)
3323 cresid(i) =
Complex (rr(i), ri(i));
3324 octave::rand::distribution (rand_dist);
3326 else if (m.cols () != cresid.
numel ())
3327 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
3330 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
3343 if (k <= 0 || k >= n - 1)
3344 (*current_liboctave_error_handler)
3345 (
"eigs: Invalid number of eigenvalues to extract"
3346 " (must be 0 < k < n-1).\n"
3347 " Use 'eig (full (A))' instead");
3349 if (p <= k || p > n)
3350 (*current_liboctave_error_handler)
3351 (
"eigs: opts.p must be greater than k and less than or equal to n");
3353 if (have_b && cholB && ! permB.
isempty ())
3356 if (permB.
numel () != n)
3360 for (
F77_INT i = 0; i < n; i++)
3364 if (checked(bidx) || bidx < 0 || bidx >= n)
3400 if (! LuAminusSigmaB (m, b, cholB, permB, sigma, L, U, P,
Q, r))
3406 if (octave::math::int_multiply_overflow (n, p, &elems))
3407 (*current_liboctave_error_handler)
3408 (
"eigs: array too large for Fortran integers");
3409 if (octave::math::int_multiply_overflow (p, 3 * p + 5, &lwork))
3411 (
"eigs: array too large for Fortran integers");
3421 F77_INT tmp_info = octave::to_f77_int (info);
3424 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3425 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3429 tmp_info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3433 if (disp > 0 && ! octave::math::isnan(workl[iptr(5)-1]))
3437 os <<
"Iteration " << iter - 1 <<
3438 ": a few Ritz values of the " << p <<
"-by-" <<
3442 for (
F77_INT i = 0; i < k; i++)
3443 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3448 for (
F77_INT i = p - k; i < p; i++)
3449 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3459 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
3462 if (ido == -1 || ido == 1 || ido == 2)
3470 vector_product (b, workd+iptr(0)-1, ctmp);
3474 for (
F77_INT i = 0; i < n; i++)
3475 tmp(i, 0) = ctmp[P[i]] / r(P[i]);
3477 lusolve (L, U, tmp);
3479 Complex *ip2 = workd+iptr(1)-1;
3480 for (
F77_INT i = 0; i < n; i++)
3481 ip2[
Q[i]] = tmp(i, 0);
3484 vector_product (b, workd + iptr(0) - 1, workd + iptr(1) - 1);
3487 Complex *ip2 = workd+iptr(2)-1;
3490 for (
F77_INT i = 0; i < n; i++)
3491 tmp(i, 0) = ip2[P[i]] / r(P[i]);
3493 lusolve (L, U, tmp);
3495 ip2 = workd+iptr(1)-1;
3496 for (
F77_INT i = 0; i < n; i++)
3497 ip2[
Q[i]] = tmp(i, 0);
3503 Complex *ip2 = workd+iptr(0)-1;
3506 for (
F77_INT i = 0; i < n; i++)
3507 tmp(i, 0) = ip2[P[i]] / r(P[i]);
3509 lusolve (L, U, tmp);
3511 ip2 = workd+iptr(1)-1;
3512 for (
F77_INT i = 0; i < n; i++)
3513 ip2[
Q[i]] = tmp(i, 0);
3519 (*current_liboctave_error_handler)
3520 (
"eigs: error %" OCTAVE_IDX_TYPE_FORMAT
" in znaupd: %s",
3552 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3553 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3557 info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3561 for (
F77_INT i = ip(4); i < k; i++)
3562 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
3563 octave::numeric_limits<double>::NaN ());
3566 for (
F77_INT i = 0; i < k2; i++)
3569 d[i] =
d[ip(4) - i - 1];
3570 d[ip(4) - i - 1] = ctmp;
3578 for (
F77_INT i = ip(4); i < k; i++)
3581 for (
F77_INT j = 0; j < n; j++)
3582 z[off1 + j] =
Complex (octave::numeric_limits<double>::NaN (),
3583 octave::numeric_limits<double>::NaN ());
3586 for (
F77_INT i = 0; i < k2; i++)
3589 F77_INT off2 = (ip(4) - i - 1) * n;
3594 for (
F77_INT j = 0; j < n; j++)
3595 ctmp[j] = z[off1 + j];
3597 for (
F77_INT j = 0; j < n; j++)
3598 z[off1 + j] = z[off2 + j];
3600 for (
F77_INT j = 0; j < n; j++)
3601 z[off2 + j] = ctmp[j];
3607 (
"eigs: error in zneupd: %s",
3613template <
typename M>
3616 const std::string& _typ,
Complex sigma,
3621 std::ostream& os,
double tol,
bool rvec,
3622 bool cholB,
int disp,
int maxit)
3624 F77_INT n = octave::to_f77_int (n_arg);
3625 F77_INT k = octave::to_f77_int (k_arg);
3626 F77_INT p = octave::to_f77_int (p_arg);
3628 std::string typ (_typ);
3629 bool have_sigma = (std::abs (sigma) ? true :
false);
3631 bool have_b = ! b.isempty ();
3639 std::string rand_dist = octave::rand::distribution ();
3640 octave::rand::distribution (
"uniform");
3644 for (
F77_INT i = 0; i < n; i++)
3645 cresid(i) =
Complex (rr(i), ri(i));
3646 octave::rand::distribution (rand_dist);
3648 else if (n != cresid.
numel ())
3649 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
3652 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
3665 if (k <= 0 || k >= n - 1)
3666 (*current_liboctave_error_handler)
3667 (
"eigs: Invalid number of eigenvalues to extract"
3668 " (must be 0 < k < n-1).\n"
3669 " Use 'eig (full (A))' instead");
3671 if (p <= k || p > n)
3672 (*current_liboctave_error_handler)
3673 (
"eigs: opts.p must be greater than k and less than or equal to n");
3675 if (have_b && cholB && ! permB.
isempty ())
3678 if (permB.
numel () != n)
3682 for (
F77_INT i = 0; i < n; i++)
3686 if (checked(bidx) || bidx < 0 || bidx >= n)
3693 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
3694 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
3696 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
3698 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
3699 (*current_liboctave_error_handler)
3700 (
"eigs: invalid sigma value for complex problem");
3702 if (typ !=
"SM" && have_b)
3714 else if (! std::abs (sigma))
3728 if (mode == 1 && have_b)
3739 for (
F77_INT i = 0; i < n; i++)
3745 if (! make_cholb (b, bt, permB))
3746 (*current_liboctave_error_handler)
3747 (
"eigs: The matrix B is not positive definite");
3775 if (octave::math::int_multiply_overflow (n, p, &elems))
3776 (*current_liboctave_error_handler)
3777 (
"eigs: array too large for Fortran integers");
3778 if (octave::math::int_multiply_overflow (p, 3 * p + 5, &lwork))
3780 (
"eigs: array too large for Fortran integers");
3790 F77_INT tmp_info = octave::to_f77_int (info);
3793 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3794 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3798 tmp_info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3802 if (disp > 0 && ! octave::math::isnan(workl[iptr(5)-1]))
3806 os <<
"Iteration " << iter - 1 <<
3807 ": a few Ritz values of the " << p <<
"-by-" <<
3811 for (
F77_INT i = 0; i < k; i++)
3812 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3817 for (
F77_INT i = p - k; i < p; i++)
3818 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3828 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
3831 if (ido == -1 || ido == 1 || ido == 2)
3838 for (
F77_INT i = 0; i < n; i++)
3839 mtmp(i, 0) = workd[i + iptr(0) - 1];
3841 mtmp = utsolve (bt, permB, mtmp);
3847 mtmp = ltsolve (b, permB, y);
3849 for (
F77_INT i = 0; i < n; i++)
3850 workd[i+iptr(1)-1] = mtmp(i, 0);
3858 vector_product (b, workd+iptr(0)-1, ctmp);
3862 for (
F77_INT i = 0; i < n; i++)
3870 Complex *ip2 = workd+iptr(1)-1;
3871 for (
F77_INT i = 0; i < n; i++)
3875 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
3878 Complex *ip2 = workd+iptr(2)-1;
3881 for (
F77_INT i = 0; i < n; i++)
3889 ip2 = workd + iptr(1) - 1;
3890 for (
F77_INT i = 0; i < n; i++)
3897 Complex *ip2 = workd + iptr(0) - 1;
3900 for (
F77_INT i = 0; i < n; i++)
3908 ip2 = workd + iptr(1) - 1;
3909 for (
F77_INT i = 0; i < n; i++)
3916 (*current_liboctave_error_handler)
3917 (
"eigs: error %" OCTAVE_IDX_TYPE_FORMAT
" in znaupd: %s",
3949 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3950 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3954 info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3958 for (
F77_INT i = ip(4); i < k; i++)
3959 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
3960 octave::numeric_limits<double>::NaN ());
3963 for (
F77_INT i = 0; i < k2; i++)
3966 d[i] =
d[ip(4) - i - 1];
3967 d[ip(4) - i - 1] = ctmp;
3975 for (
F77_INT i = ip(4); i < k; i++)
3978 for (
F77_INT j = 0; j < n; j++)
3979 z[off1 + j] =
Complex (octave::numeric_limits<double>::NaN (),
3980 octave::numeric_limits<double>::NaN ());
3983 for (
F77_INT i = 0; i < k2; i++)
3986 F77_INT off2 = (ip(4) - i - 1) * n;
3991 for (
F77_INT j = 0; j < n; j++)
3992 ctmp[j] = z[off1 + j];
3994 for (
F77_INT j = 0; j < n; j++)
3995 z[off1 + j] = z[off2 + j];
3997 for (
F77_INT j = 0; j < n; j++)
3998 z[off2 + j] = ctmp[j];
4001 eig_vec = utsolve (bt, permB, eig_vec);
4006 (
"eigs: error in zneupd: %s",
4022 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4023 bool cholB,
int disp,
int maxit);
4031 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4032 bool cholB,
int disp,
int maxit);
4041 bool rvec,
bool cholB,
int disp,
int maxit);
4049 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4050 bool cholB,
int disp,
int maxit);
4058 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4059 bool cholB,
int disp,
int maxit);
4068 bool rvec,
bool cholB,
int disp,
int maxit);
4078 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4079 bool cholB,
int disp,
int maxit);
4087 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4088 bool cholB,
int disp,
int maxit);
4097 bool rvec,
bool cholB,
int disp,
int maxit);
4105 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4106 bool cholB,
int disp,
int maxit);
4114 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4115 bool cholB,
int disp,
int maxit);
4124 std::ostream& os,
double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4135 bool rvec,
bool cholB,
int disp,
int maxit);
4144 bool rvec,
bool cholB,
int disp,
int maxit);
4153 std::ostream& os,
double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4164 double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4173 double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4183 bool cholB,
int disp,
int maxit);
N Dimensional Array with copy-on-write semantics.
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type rows() const
octave_idx_type cols() const
bool isempty() const
Size of the specified dimension.
const T * data() const
Size of the specified dimension.
T * rwdata()
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
void resize(octave_idx_type n, const double &rfv=0)
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
void resize(octave_idx_type nr, octave_idx_type nc, const Complex &rfv=Complex(0))
ComplexMatrix hermitian() const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
SparseComplexMatrix hermitian() const
SparseMatrix transpose() const
octave_idx_type cols() const
octave_idx_type rows() const
octave_idx_type * xcidx()
octave_idx_type * xridx()
Vector representing the dimensions (size) of an Array.
template octave_idx_type EigsComplexNonSymmetricFunc< ComplexMatrix >(EigsComplexFunc fcn, 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 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 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)
template octave_idx_type EigsRealSymmetricFunc< Matrix >(EigsFunc fcn, 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)
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)
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)
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 EigsRealSymmetricFunc(EigsFunc fcn, 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)
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)
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 EigsRealNonSymmetricFunc< SparseMatrix >(EigsFunc fcn, 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 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 EigsRealNonSymmetricFunc(EigsFunc fcn, 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)
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)
template octave_idx_type EigsRealSymmetricFunc< SparseMatrix >(EigsFunc fcn, 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)
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)
octave_idx_type EigsComplexNonSymmetricFunc(EigsComplexFunc fcn, 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)
template octave_idx_type EigsComplexNonSymmetricFunc< SparseComplexMatrix >(EigsComplexFunc fcn, 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 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)
template octave_idx_type EigsRealNonSymmetricFunc< Matrix >(EigsFunc fcn, 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)
std::function< ColumnVector(const ColumnVector &x, int &eigs_error)> EigsFunc
std::function< ComplexColumnVector(const ComplexColumnVector &x, int &eigs_error)> EigsComplexFunc
#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)
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_INT const F77_INT const F77_INT const F77_DBLE const F77_DBLE F77_INT & M
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
std::complex< double > Complex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
F77_RET_T F77_FUNC(xerbla, XERBLA)(F77_CONST_CHAR_ARG_DEF(s_arg