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.";
160 msg +=
" Consider changing tolerance (TOL), maximum iterations (MAXIT), number of Lanzcos basis vectors (P), or starting vector (V0) in OPTS structure.";
165 if (fcn_name.compare (
"dseupd") == 0)
166 msg =
"HOWMNY must be one of 'A' or 'S' if RVEC = .true.";
171 if (fcn_name.compare (
"dseupd") == 0)
172 msg =
"HOWMNY = 'S' not yet implemented";
177 if (fcn_name.compare (
"dnaupd") == 0)
178 msg =
"Could not build an Arnoldi factorization. IPARAM(5) returns the size of the current Arnoldi factorization";
183 if (fcn_name.compare (
"dneupd") == 0)
184 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.";
185 else if (fcn_name.compare (
"dnaupd") == 0
186 || fcn_name.compare (
"znaupd") == 0
187 || fcn_name.compare (
"dsaupd") == 0)
188 msg =
"Maximum number of iterations taken. All possible eigenvalues of OP has been found. IPARAM(5) returns the number of wanted converged Ritz values";
189 else if (fcn_name.compare (
"znaupd") == 0)
190 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.";
195 if (fcn_name.compare (
"dnaupd") == 0
196 || fcn_name.compare (
"znaupd") == 0
197 || fcn_name.compare (
"dsaupd") == 0)
198 msg =
"No longer an informational error. Deprecated starting with release 2 of ARPACK.";
203 if (fcn_name.compare (
"dnaupd") == 0
204 || fcn_name.compare (
"znaupd") == 0
205 || fcn_name.compare (
"dsaupd") == 0)
206 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.";
212 if ((errnum != -9) && (errnum != -14) && (errnum != -9999))
213 msg.append (bug_msg);
218template <
typename M,
typename SM>
220lusolve (
const SM& L,
const SM& U,
M& m)
228 m = L.solve (ltyp, m, err, rcond,
nullptr);
232 m = U.solve (utyp, m, err, rcond,
nullptr);
237template <
typename SM,
typename M>
248 const double *qv =
Q.data ();
254 return L.solve (ltyp, retval, err, rcond,
nullptr);
257template <
typename SM,
typename M>
267 M tmp = U.solve (utyp, m, err, rcond,
nullptr);
269 const double *qv =
Q.data ();
273 retval.resize (n, b_nc);
286vector_product (
const SparseMatrix& m,
const double *
x,
double *y)
301vector_product (
const Matrix& m,
const double *
x,
double *y)
306 F77_XFCN (dgemv, DGEMV, (F77_CONST_CHAR_ARG2 (
"N", 1),
307 nr, nc, 1.0, m.
data (), nr,
309 F77_CHAR_ARG_LEN (1)));
336 F77_XFCN (zgemv, ZGEMV, (F77_CONST_CHAR_ARG2 (
"N", 1),
341 F77_CHAR_ARG_LEN (1)));
350 octave::math::chol<Matrix> fact (b, info);
357 bt = fact.chol_matrix ();
370 octave::math::sparse_chol<SparseMatrix> fact (b, info,
false);
378 permB = fact.perm () - 1.0;
387 octave::math::chol<ComplexMatrix> fact (b, info);
394 bt = fact.chol_matrix ();
408 octave::math::sparse_chol<SparseComplexMatrix> fact (b, info,
false);
416 permB = fact.perm () - 1.0;
451 AminusSigmaB -= sigma * tmp *
455 AminusSigmaB -= sigma * b.
transpose () * b;
458 AminusSigmaB -= sigma * b;
465 sigmat.xcidx (0) = 0;
468 sigmat.xdata (i) = sigma;
469 sigmat.xridx (i) = i;
470 sigmat.xcidx (i+1) = i + 1;
473 AminusSigmaB -= sigmat;
477 octave::math::sparse_lu<SparseMatrix> fact (AminusSigmaB,
Matrix (),
true);
495 double minU = octave::numeric_limits<double>::NaN ();
496 double maxU = octave::numeric_limits<double>::NaN ();
504 if (octave::math::isnan (minU) ||
d < minU)
507 if (octave::math::isnan (maxU) ||
d > maxU)
511 double rcond = (minU / maxU);
513 double rcond_plus_one = rcond + 1.0;
515 if (rcond_plus_one == 1.0 || octave::math::isnan (rcond))
541 const double *pB = permB.
data ();
542 double *p = AminusSigmaB.rwdata ();
557 AminusSigmaB -= sigma * b;
561 double *p = AminusSigmaB.rwdata ();
568 octave::math::lu<Matrix> fact (AminusSigmaB);
582 double minU = octave::numeric_limits<double>::NaN ();
583 double maxU = octave::numeric_limits<double>::NaN ();
586 double d = std::abs (U.
xelem (j, j));
587 if (octave::math::isnan (minU) ||
d < minU)
590 if (octave::math::isnan (maxU) ||
d > maxU)
594 double rcond = (minU / maxU);
596 double rcond_plus_one = rcond + 1.0;
598 if (rcond_plus_one == 1.0 || octave::math::isnan (rcond))
617 if (std::real (sigma) != 0.0 || std::imag (sigma) != 0.0)
634 AminusSigmaB -= tmp * b.
hermitian () * b *
638 AminusSigmaB -= sigma * b.
hermitian () * b;
641 AminusSigmaB -= sigma * b;
648 sigmat.xcidx (0) = 0;
651 sigmat.xdata (i) = sigma;
652 sigmat.xridx (i) = i;
653 sigmat.xcidx (i+1) = i + 1;
656 AminusSigmaB -= sigmat;
660 octave::math::sparse_lu<SparseComplexMatrix> fact (AminusSigmaB,
Matrix(),
679 double minU = octave::numeric_limits<double>::NaN ();
680 double maxU = octave::numeric_limits<double>::NaN ();
688 if (octave::math::isnan (minU) ||
d < minU)
691 if (octave::math::isnan (maxU) ||
d > maxU)
695 double rcond = (minU / maxU);
697 double rcond_plus_one = rcond + 1.0;
699 if (rcond_plus_one == 1.0 || octave::math::isnan (rcond))
718 if (std::real (sigma) != 0.0 || std::imag (sigma) != 0.0)
725 const double *pB = permB.
data ();
726 Complex *p = AminusSigmaB.rwdata ();
741 AminusSigmaB -= sigma * b;
752 octave::math::lu<ComplexMatrix> fact (AminusSigmaB);
766 double minU = octave::numeric_limits<double>::NaN ();
767 double maxU = octave::numeric_limits<double>::NaN ();
770 double d = std::abs (U.
xelem (j, j));
771 if (octave::math::isnan (minU) ||
d < minU)
774 if (octave::math::isnan (maxU) ||
d > maxU)
778 double rcond = (minU / maxU);
780 double rcond_plus_one = rcond + 1.0;
782 if (rcond_plus_one == 1.0 || octave::math::isnan (rcond))
795 std::ostream& os,
double tol,
bool rvec,
796 bool cholB,
int disp,
int maxit)
798 F77_INT k = octave::to_f77_int (k_arg);
799 F77_INT p = octave::to_f77_int (p_arg);
801 F77_INT n = octave::to_f77_int (m.cols ());
803 bool have_b = ! b.isempty ();
809 if (m.rows () != m.cols ())
810 (*current_liboctave_error_handler) (
"eigs: A must be square");
811 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
813 (
"eigs: B must be square and the same size as A");
817 std::string rand_dist = octave::rand::distribution ();
818 octave::rand::distribution (
"uniform");
820 octave::rand::distribution (rand_dist);
822 else if (m.cols () != resid.
numel ())
823 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
826 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
839 if (k < 1 || k > n - 2)
840 (*current_liboctave_error_handler)
841 (
"eigs: Invalid number of eigenvalues to extract"
842 " (must be 0 < k < n-1-1).\n"
843 " Use 'eig (full (A))' instead");
846 (*current_liboctave_error_handler)
847 (
"eigs: opts.p must be greater than k and less than or equal to n");
849 if (have_b && cholB && ! permB.
isempty ())
852 if (permB.
numel () != n)
856 for (
F77_INT i = 0; i < n; i++)
860 if (checked(bidx) || bidx < 0 || bidx >= n
861 || octave::math::x_nint (bidx) != bidx)
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");
924 double *presid = resid.
rwdata ();
928 F77_INT tmp_info = octave::to_f77_int (info);
931 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
932 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
933 k, tol, presid, p, v, n, iparam,
934 ipntr, workd, workl, lwork, tmp_info
935 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
939 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
943 os <<
"Iteration " << iter - 1 <<
944 ": a few Ritz values of the " << p <<
"-by-" <<
948 for (
F77_INT i = 0; i < k; i++)
949 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
954 for (
F77_INT i = p - k; i < p; i++)
955 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
965 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
968 if (ido == -1 || ido == 1 || ido == 2)
973 for (
F77_INT i = 0; i < n; i++)
974 mtmp(i, 0) = workd[i + iptr(0) - 1];
976 mtmp = ltsolve (b, permB, m * utsolve (bt, permB, mtmp));
978 for (
F77_INT i = 0; i < n; i++)
979 workd[i+iptr(1)-1] = mtmp(i, 0);
981 else if (! vector_product (m, workd + iptr(0) - 1,
982 workd + iptr(1) - 1))
988 (*current_liboctave_error_handler)
989 (
"eigs: error in dsaupd: %s",
1010 double *z = eig_vec.
rwdata ();
1013 double *
d = eig_val.
rwdata ();
1016 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel,
d, z, n, sigma,
1017 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1018 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam,
1019 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
1020 F77_CHAR_ARG_LEN(2));
1024 for (
F77_INT i = ip(4); i < k; i++)
1025 d[i] = octave::numeric_limits<double>::NaN ();
1027 if (typ !=
"SM" && typ !=
"BE" && ! (typ ==
"SA" && rvec))
1029 for (
F77_INT i = 0; i < k2; i++)
1032 d[i] =
d[ip(4) - i - 1];
1033 d[ip(4) - i - 1] = dtmp;
1039 for (
F77_INT i = ip(4); i < k; i++)
1042 for (
F77_INT j = 0; j < n; j++)
1043 z[off1 + j] = octave::numeric_limits<double>::NaN ();
1045 if (typ !=
"SM" && typ !=
"BE" && typ !=
"SA")
1049 for (
F77_INT i = 0; i < k2; i++)
1052 F77_INT off2 = (ip(4) - i - 1) * n;
1057 for (
F77_INT j = 0; j < n; j++)
1058 dtmp[j] = z[off1 + j];
1060 for (
F77_INT j = 0; j < n; j++)
1061 z[off1 + j] = z[off2 + j];
1063 for (
F77_INT j = 0; j < n; j++)
1064 z[off2 + j] = dtmp[j];
1069 eig_vec = utsolve (bt, permB, eig_vec);
1074 (
"eigs: error in dseupd: %s",
1080template <
typename M>
1087 std::ostream& os,
double tol,
bool rvec,
1088 bool cholB,
int disp,
int maxit)
1090 F77_INT k = octave::to_f77_int (k_arg);
1091 F77_INT p = octave::to_f77_int (p_arg);
1093 F77_INT n = octave::to_f77_int (m.cols ());
1095 bool have_b = ! b.isempty ();
1096 std::string typ =
"LM";
1098 if (m.rows () != m.cols ())
1099 (*current_liboctave_error_handler) (
"eigs: A must be square");
1100 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
1102 (
"eigs: B must be square and the same size as A");
1112 std::string rand_dist = octave::rand::distribution ();
1113 octave::rand::distribution (
"uniform");
1115 octave::rand::distribution (rand_dist);
1117 else if (m.cols () != resid.
numel ())
1118 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
1121 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
1123 if (k <= 0 || k >= n - 1)
1124 (*current_liboctave_error_handler)
1125 (
"eigs: Invalid number of eigenvalues to extract"
1126 " (must be 0 < k < n-1-1).\n"
1127 " Use 'eig (full (A))' instead");
1140 if (p <= k || p > n)
1141 (*current_liboctave_error_handler)
1142 (
"eigs: opts.p must be greater than k and less than or equal to n");
1144 if (have_b && cholB && ! permB.
isempty ())
1147 if (permB.
numel () != n)
1151 for (
F77_INT i = 0; i < n; i++)
1155 if (checked(bidx) || bidx < 0 || bidx >= n
1156 || octave::math::x_nint (bidx) != bidx)
1192 if (! LuAminusSigmaB (m, b, cholB, permB, sigma, L, U, P,
Q, r))
1200 double *presid = resid.
rwdata ();
1204 F77_INT tmp_info = octave::to_f77_int (info);
1207 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1208 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1209 k, tol, presid, p, v, n, iparam,
1210 ipntr, workd, workl, lwork, tmp_info
1211 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1214 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
1218 os <<
"Iteration " << iter - 1 <<
1219 ": a few Ritz values of the " << p <<
"-by-" <<
1223 for (
F77_INT i = 0; i < k; i++)
1224 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1229 for (
F77_INT i = p - k; i < p; i++)
1230 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1240 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
1243 if (ido == -1 || ido == 1 || ido == 2)
1251 vector_product (b, workd+iptr(0)-1, dtmp);
1255 for (
F77_INT i = 0; i < n; i++)
1256 tmp(i, 0) = dtmp[P[i]] / r(P[i]);
1258 lusolve (L, U, tmp);
1260 double *ip2 = workd+iptr(1)-1;
1261 for (
F77_INT i = 0; i < n; i++)
1262 ip2[
Q[i]] = tmp(i, 0);
1265 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
1268 double *ip2 = workd+iptr(2)-1;
1271 for (
F77_INT i = 0; i < n; i++)
1272 tmp(i, 0) = ip2[P[i]] / r(P[i]);
1274 lusolve (L, U, tmp);
1276 ip2 = workd+iptr(1)-1;
1277 for (
F77_INT i = 0; i < n; i++)
1278 ip2[
Q[i]] = tmp(i, 0);
1284 double *ip2 = workd+iptr(0)-1;
1287 for (
F77_INT i = 0; i < n; i++)
1288 tmp(i, 0) = ip2[P[i]] / r(P[i]);
1290 lusolve (L, U, tmp);
1292 ip2 = workd+iptr(1)-1;
1293 for (
F77_INT i = 0; i < n; i++)
1294 ip2[
Q[i]] = tmp(i, 0);
1300 (*current_liboctave_error_handler)
1301 (
"eigs: error in dsaupd: %s",
1322 double *z = eig_vec.
rwdata ();
1325 double *
d = eig_val.
rwdata ();
1328 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel,
d, z, n, sigma,
1329 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1330 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1331 k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info2
1332 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1336 for (
F77_INT i = ip(4); i < k; i++)
1337 d[i] = octave::numeric_limits<double>::NaN ();
1339 for (
F77_INT i = 0; i < k2; i++)
1342 d[i] =
d[ip(4) - i - 1];
1343 d[ip(4) - i - 1] = dtmp;
1350 for (
F77_INT i = ip(4); i < k; i++)
1353 for (
F77_INT j = 0; j < n; j++)
1354 z[off1 + j] = octave::numeric_limits<double>::NaN ();
1356 for (
F77_INT i = 0; i < k2; i++)
1359 F77_INT off2 = (ip(4) - i - 1) * n;
1364 for (
F77_INT j = 0; j < n; j++)
1365 dtmp[j] = z[off1 + j];
1367 for (
F77_INT j = 0; j < n; j++)
1368 z[off1 + j] = z[off2 + j];
1370 for (
F77_INT j = 0; j < n; j++)
1371 z[off2 + j] = dtmp[j];
1377 (
"eigs: error in dseupd: %s",
1383template <
typename M>
1386 const std::string& _typ,
double sigma,
1391 std::ostream& os,
double tol,
bool rvec,
1392 bool cholB,
int disp,
int maxit)
1394 F77_INT n = octave::to_f77_int (n_arg);
1395 F77_INT k = octave::to_f77_int (k_arg);
1396 F77_INT p = octave::to_f77_int (p_arg);
1398 std::string typ (_typ);
1399 bool have_sigma = (sigma ? true :
false);
1400 bool have_b = ! b.isempty ();
1409 std::string rand_dist = octave::rand::distribution ();
1410 octave::rand::distribution (
"uniform");
1412 octave::rand::distribution (rand_dist);
1414 else if (n != resid.
numel ())
1415 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
1418 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
1431 if (k <= 0 || k >= n - 1)
1432 (*current_liboctave_error_handler)
1433 (
"eigs: Invalid number of eigenvalues to extract"
1434 " (must be 0 < k < n-1).\n"
1435 " Use 'eig (full (A))' instead");
1437 if (p <= k || p > n)
1438 (*current_liboctave_error_handler)
1439 (
"eigs: opts.p must be greater than k and less than or equal to n");
1441 if (have_b && cholB && ! permB.
isempty ())
1444 if (permB.
numel () != n)
1448 for (
F77_INT i = 0; i < n; i++)
1452 if (checked(bidx) || bidx < 0 || bidx >= n
1453 || octave::math::x_nint (bidx) != bidx)
1460 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
1461 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
1463 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
1465 if (typ ==
"LI" || typ ==
"SI" || typ ==
"LR" || typ ==
"SR")
1466 (*current_liboctave_error_handler)
1467 (
"eigs: invalid sigma value for real symmetric problem");
1469 if (typ !=
"SM" && have_b)
1481 else if (! std::abs (sigma))
1495 if (mode == 1 && have_b)
1506 for (
F77_INT i = 0; i < n; i++)
1512 if (! make_cholb (b, bt, permB))
1513 (*current_liboctave_error_handler)
1514 (
"eigs: The matrix B is not positive definite");
1544 double *presid = resid.
rwdata ();
1548 F77_INT tmp_info = octave::to_f77_int (info);
1551 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1552 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1553 k, tol, presid, p, v, n, iparam,
1554 ipntr, workd, workl, lwork, tmp_info
1555 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1559 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
1563 os <<
"Iteration " << iter - 1 <<
1564 ": a few Ritz values of the " << p <<
"-by-" <<
1568 for (
F77_INT i = 0; i < k; i++)
1569 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1574 for (
F77_INT i = p - k; i < p; i++)
1575 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1585 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
1588 if (ido == -1 || ido == 1 || ido == 2)
1595 for (
F77_INT i = 0; i < n; i++)
1596 mtmp(i, 0) = workd[i + iptr(0) - 1];
1598 mtmp = utsolve (bt, permB, mtmp);
1604 mtmp = ltsolve (b, permB, y);
1606 for (
F77_INT i = 0; i < n; i++)
1607 workd[i+iptr(1)-1] = mtmp(i, 0);
1615 vector_product (b, workd+iptr(0)-1, dtmp);
1619 for (
F77_INT i = 0; i < n; i++)
1627 double *ip2 = workd + iptr(1) - 1;
1628 for (
F77_INT i = 0; i < n; i++)
1632 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
1635 double *ip2 = workd+iptr(2)-1;
1638 for (
F77_INT i = 0; i < n; i++)
1646 ip2 = workd + iptr(1) - 1;
1647 for (
F77_INT i = 0; i < n; i++)
1654 double *ip2 = workd + iptr(0) - 1;
1657 for (
F77_INT i = 0; i < n; i++)
1665 ip2 = workd + iptr(1) - 1;
1666 for (
F77_INT i = 0; i < n; i++)
1673 (*current_liboctave_error_handler)
1674 (
"eigs: error in dsaupd: %s",
1695 double *z = eig_vec.
rwdata ();
1698 double *
d = eig_val.
rwdata ();
1701 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel,
d, z, n, sigma,
1702 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1703 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1704 k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info2
1705 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1709 for (
F77_INT i = ip(4); i < k; i++)
1710 d[i] = octave::numeric_limits<double>::NaN ();
1712 if (mode == 3 || (mode == 1 && typ !=
"SM" && typ !=
"BE"))
1714 for (
F77_INT i = 0; i < k2; i++)
1717 d[i] =
d[ip(4) - i - 1];
1718 d[ip(4) - i - 1] = dtmp;
1724 for (
F77_INT i = ip(4); i < k; i++)
1727 for (
F77_INT j = 0; j < n; j++)
1728 z[off1 + j] = octave::numeric_limits<double>::NaN ();
1730 if (mode == 3 || (mode == 1 && typ !=
"SM" && typ !=
"BE"))
1734 for (
F77_INT i = 0; i < k2; i++)
1737 F77_INT off2 = (ip(4) - i - 1) * n;
1742 for (
F77_INT j = 0; j < n; j++)
1743 dtmp[j] = z[off1 + j];
1745 for (
F77_INT j = 0; j < n; j++)
1746 z[off1 + j] = z[off2 + j];
1748 for (
F77_INT j = 0; j < n; j++)
1749 z[off2 + j] = dtmp[j];
1753 eig_vec = utsolve (bt, permB, eig_vec);
1758 (
"eigs: error in dseupd: %s",
1764template <
typename M>
1771 std::ostream& os,
double tol,
bool rvec,
1772 bool cholB,
int disp,
int maxit)
1774 F77_INT k = octave::to_f77_int (k_arg);
1775 F77_INT p = octave::to_f77_int (p_arg);
1777 F77_INT n = octave::to_f77_int (m.cols ());
1779 bool have_b = ! b.isempty ();
1786 if (m.rows () != m.cols ())
1787 (*current_liboctave_error_handler) (
"eigs: A must be square");
1788 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
1790 (
"eigs: B must be square and the same size as A");
1794 std::string rand_dist = octave::rand::distribution ();
1795 octave::rand::distribution (
"uniform");
1797 octave::rand::distribution (rand_dist);
1799 else if (m.cols () != resid.
numel ())
1800 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
1803 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
1816 if (k <= 0 || k >= n - 1)
1817 (*current_liboctave_error_handler)
1818 (
"eigs: Invalid number of eigenvalues to extract"
1819 " (must be 0 < k < n-1).\n"
1820 " Use 'eig (full (A))' instead");
1822 if (p <= k || p > n)
1823 (*current_liboctave_error_handler)
1824 (
"eigs: opts.p must be greater than k and less than or equal to n");
1826 if (have_b && cholB && ! permB.
isempty ())
1829 if (permB.
numel () != n)
1833 for (
F77_INT i = 0; i < n; i++)
1837 if (checked(bidx) || bidx < 0 || bidx >= n
1838 || octave::math::x_nint (bidx) != bidx)
1843 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
1844 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
1846 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
1848 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
1849 (*current_liboctave_error_handler)
1850 (
"eigs: invalid sigma value for unsymmetric problem");
1863 for (
F77_INT i = 0; i < n; i++)
1869 if (! make_cholb (b, bt, permB))
1870 (*current_liboctave_error_handler)
1871 (
"eigs: The matrix B is not positive definite");
1896 F77_INT lwork = 3 * p * (p + 2);
1901 double *presid = resid.
rwdata ();
1905 F77_INT tmp_info = octave::to_f77_int (info);
1910 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
1911 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
1912 k, tol, presid, p, v, n, iparam,
1913 ipntr, workd, workl, lwork, tmp_info
1914 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
1919 if (disp > 0 && ! octave::math::isnan(workl[iptr(5)-1]))
1923 os <<
"Iteration " << iter - 1 <<
1924 ": a few Ritz values of the " << p <<
"-by-" <<
1928 os <<
" " << workl[iptr(5)+k] <<
"\n";
1929 for (
F77_INT i = 0; i < k; i++)
1930 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1935 for (
F77_INT i = p - k - 1; i < p; i++)
1936 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
1946 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
1949 if (ido == -1 || ido == 1 || ido == 2)
1954 for (
F77_INT i = 0; i < n; i++)
1955 mtmp(i, 0) = workd[i + iptr(0) - 1];
1957 mtmp = ltsolve (b, permB, m * utsolve (bt, permB, mtmp));
1959 for (
F77_INT i = 0; i < n; i++)
1960 workd[i+iptr(1)-1] = mtmp(i, 0);
1962 else if (! vector_product (m, workd + iptr(0) - 1,
1963 workd + iptr(1) - 1))
1969 (*current_liboctave_error_handler)
1970 (
"eigs: error in dnaupd: %s",
1997 Matrix eig_vec2 (n, k + 1, 0.0);
1998 double *z = eig_vec2.
rwdata ();
2003 for (
F77_INT i = 0; i < k+1; i++)
2008 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel, dr, di, z, n, sigmar,
2009 sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2010 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam,
2011 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
2012 F77_CHAR_ARG_LEN(2));
2016 if (! rvec && ip(4) > k)
2024 bool have_cplx_eig =
false;
2025 for (
F77_INT i = 0; i < ip(4); i++)
2031 have_cplx_eig =
true;
2037 for (
F77_INT i = ip(4); i < k; i++)
2038 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
2039 octave::numeric_limits<double>::NaN ());
2043 for (
F77_INT i = ip(4); i < k; i++)
2044 d[i] =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2050 for (
F77_INT i = 0; i < k2; i++)
2053 d[i] =
d[ip(4) - i - 1];
2054 d[ip(4) - i - 1] = dtmp;
2066 if (std::imag (eig_val(i)) == 0)
2068 for (
F77_INT j = 0; j < n; j++)
2069 eig_vec(j, i) =
Complex (z[j+off1], 0.);
2074 for (
F77_INT j = 0; j < n; j++)
2076 eig_vec(j, i) =
Complex (z[j+off1], z[j+off2]);
2078 eig_vec(j, i+1) =
Complex (z[j+off1], -z[j+off2]);
2085 for (
F77_INT ii = ip(4); ii < k; ii++)
2086 for (
F77_INT jj = 0; jj < n; jj++)
2088 =
Complex (octave::numeric_limits<double>::NaN (),
2089 octave::numeric_limits<double>::NaN ());
2093 for (
F77_INT ii = ip(4); ii < k; ii++)
2094 for (
F77_INT jj = 0; jj < n; jj++)
2096 =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2099 eig_vec = utsolve (bt, permB, eig_vec);
2109 (
"eigs: error in dneupd: %s",
2115template <
typename M>
2123 std::ostream& os,
double tol,
bool rvec,
2124 bool cholB,
int disp,
int maxit)
2126 F77_INT k = octave::to_f77_int (k_arg);
2127 F77_INT p = octave::to_f77_int (p_arg);
2129 F77_INT n = octave::to_f77_int (m.cols ());
2131 bool have_b = ! b.isempty ();
2132 std::string typ =
"LM";
2135 if (m.rows () != m.cols ())
2136 (*current_liboctave_error_handler) (
"eigs: A must be square");
2137 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
2139 (
"eigs: B must be square and the same size as A");
2149 std::string rand_dist = octave::rand::distribution ();
2150 octave::rand::distribution (
"uniform");
2152 octave::rand::distribution (rand_dist);
2154 else if (m.cols () != resid.
numel ())
2155 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
2158 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
2171 if (k <= 0 || k >= n - 1)
2172 (*current_liboctave_error_handler)
2173 (
"eigs: Invalid number of eigenvalues to extract"
2174 " (must be 0 < k < n-1).\n"
2175 " Use 'eig (full (A))' instead");
2177 if (p <= k || p > n)
2178 (*current_liboctave_error_handler)
2179 (
"eigs: opts.p must be greater than k and less than or equal to n");
2181 if (have_b && cholB && ! permB.
isempty ())
2184 if (permB.
numel () != n)
2188 for (
F77_INT i = 0; i < n; i++)
2192 if (checked(bidx) || bidx < 0 || bidx >= n
2193 || octave::math::x_nint (bidx) != bidx)
2229 if (! LuAminusSigmaB (m, b, cholB, permB, sigmar, L, U, P,
Q, r))
2232 F77_INT lwork = 3 * p * (p + 2);
2237 double *presid = resid.
rwdata ();
2241 F77_INT tmp_info = octave::to_f77_int (info);
2246 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2247 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
2248 k, tol, presid, p, v, n, iparam,
2249 ipntr, workd, workl, lwork, tmp_info
2250 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
2255 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
2259 os <<
"Iteration " << iter - 1 <<
2260 ": a few Ritz values of the " << p <<
"-by-" <<
2264 os <<
" " << workl[iptr(5)+k] <<
"\n";
2265 for (
F77_INT i = 0; i < k; i++)
2266 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2271 for (
F77_INT i = p - k - 1; i < p; i++)
2272 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2282 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
2285 if (ido == -1 || ido == 1 || ido == 2)
2293 vector_product (b, workd+iptr(0)-1, dtmp);
2297 for (
F77_INT i = 0; i < n; i++)
2298 tmp(i, 0) = dtmp[P[i]] / r(P[i]);
2300 lusolve (L, U, tmp);
2302 double *ip2 = workd+iptr(1)-1;
2303 for (
F77_INT i = 0; i < n; i++)
2304 ip2[
Q[i]] = tmp(i, 0);
2307 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
2310 double *ip2 = workd+iptr(2)-1;
2313 for (
F77_INT i = 0; i < n; i++)
2314 tmp(i, 0) = ip2[P[i]] / r(P[i]);
2316 lusolve (L, U, tmp);
2318 ip2 = workd+iptr(1)-1;
2319 for (
F77_INT i = 0; i < n; i++)
2320 ip2[
Q[i]] = tmp(i, 0);
2326 double *ip2 = workd+iptr(0)-1;
2329 for (
F77_INT i = 0; i < n; i++)
2330 tmp(i, 0) = ip2[P[i]] / r(P[i]);
2332 lusolve (L, U, tmp);
2334 ip2 = workd+iptr(1)-1;
2335 for (
F77_INT i = 0; i < n; i++)
2336 ip2[
Q[i]] = tmp(i, 0);
2342 (*current_liboctave_error_handler)
2343 (
"eigs: error in dnaupd: %s",
2370 Matrix eig_vec2 (n, k + 1, 0.0);
2371 double *z = eig_vec2.
rwdata ();
2376 for (
F77_INT i = 0; i < k+1; i++)
2381 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel, dr, di, z, n, sigmar,
2382 sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2383 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam,
2384 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
2385 F77_CHAR_ARG_LEN(2));
2389 if (! rvec && ip(4) > k)
2397 bool have_cplx_eig =
false;
2398 for (
F77_INT i = 0; i < ip(4); i++)
2404 have_cplx_eig =
true;
2410 for (
F77_INT i = ip(4); i < k; i++)
2411 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
2412 octave::numeric_limits<double>::NaN ());
2416 for (
F77_INT i = ip(4); i < k; i++)
2417 d[i] =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2424 for (
F77_INT i = 0; i < k2; i++)
2427 d[i] =
d[ip(4) - i - 1];
2428 d[ip(4) - i - 1] = dtmp;
2440 if (std::imag (eig_val(i)) == 0)
2442 for (
F77_INT j = 0; j < n; j++)
2443 eig_vec(j, i) =
Complex (z[j+off1], 0.);
2448 for (
F77_INT j = 0; j < n; j++)
2450 eig_vec(j, i) =
Complex (z[j+off1], z[j+off2]);
2452 eig_vec(j, i+1) =
Complex (z[j+off1], -z[j+off2]);
2459 for (
F77_INT ii = ip(4); ii < k; ii++)
2460 for (
F77_INT jj = 0; jj < n; jj++)
2462 =
Complex (octave::numeric_limits<double>::NaN (),
2463 octave::numeric_limits<double>::NaN ());
2467 for (
F77_INT ii = ip(4); ii < k; ii++)
2468 for (
F77_INT jj = 0; jj < n; jj++)
2470 =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2481 (
"eigs: error in dneupd: %s",
2487template <
typename M>
2490 const std::string& _typ,
double sigmar,
2495 std::ostream& os,
double tol,
bool rvec,
2496 bool cholB,
int disp,
int maxit)
2498 F77_INT n = octave::to_f77_int (n_arg);
2499 F77_INT k = octave::to_f77_int (k_arg);
2500 F77_INT p = octave::to_f77_int (p_arg);
2502 std::string typ (_typ);
2503 bool have_sigma = (sigmar ? true :
false);
2506 bool have_b = ! b.isempty ();
2514 std::string rand_dist = octave::rand::distribution ();
2515 octave::rand::distribution (
"uniform");
2517 octave::rand::distribution (rand_dist);
2519 else if (n != resid.
numel ())
2520 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
2523 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
2536 if (k <= 0 || k >= n - 1)
2537 (*current_liboctave_error_handler)
2538 (
"eigs: Invalid number of eigenvalues to extract"
2539 " (must be 0 < k < n-1).\n"
2540 " Use 'eig (full (A))' instead");
2542 if (p <= k || p > n)
2543 (*current_liboctave_error_handler)
2544 (
"eigs: opts.p must be greater than k and less than or equal to n");
2546 if (have_b && cholB && ! permB.
isempty ())
2549 if (permB.
numel () != n)
2553 for (
F77_INT i = 0; i < n; i++)
2557 if (checked(bidx) || bidx < 0 || bidx >= n
2558 || octave::math::x_nint (bidx) != bidx)
2565 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
2566 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
2568 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
2570 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
2571 (*current_liboctave_error_handler)
2572 (
"eigs: invalid sigma value for unsymmetric problem");
2574 if (typ !=
"SM" && have_b)
2586 else if (! std::abs (sigmar))
2600 if (mode == 1 && have_b)
2611 for (
F77_INT i = 0; i < n; i++)
2617 if (! make_cholb (b, bt, permB))
2618 (*current_liboctave_error_handler)
2619 (
"eigs: The matrix B is not positive definite");
2644 F77_INT lwork = 3 * p * (p + 2);
2649 double *presid = resid.
rwdata ();
2653 F77_INT tmp_info = octave::to_f77_int (info);
2658 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2659 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
2660 k, tol, presid, p, v, n, iparam,
2661 ipntr, workd, workl, lwork, tmp_info
2662 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
2667 if (disp > 0 && ! octave::math::isnan(workl[iptr(5)-1]))
2671 os <<
"Iteration " << iter - 1 <<
2672 ": a few Ritz values of the " << p <<
"-by-" <<
2676 os <<
" " << workl[iptr(5)+k] <<
"\n";
2677 for (
F77_INT i = 0; i < k; i++)
2678 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2683 for (
F77_INT i = p - k - 1; i < p; i++)
2684 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
2694 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
2697 if (ido == -1 || ido == 1 || ido == 2)
2704 for (
F77_INT i = 0; i < n; i++)
2705 mtmp(i, 0) = workd[i + iptr(0) - 1];
2707 mtmp = utsolve (bt, permB, mtmp);
2713 mtmp = ltsolve (b, permB, y);
2715 for (
F77_INT i = 0; i < n; i++)
2716 workd[i+iptr(1)-1] = mtmp(i, 0);
2724 vector_product (b, workd+iptr(0)-1, dtmp);
2728 for (
F77_INT i = 0; i < n; i++)
2736 double *ip2 = workd + iptr(1) - 1;
2737 for (
F77_INT i = 0; i < n; i++)
2741 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
2744 double *ip2 = workd+iptr(2)-1;
2747 for (
F77_INT i = 0; i < n; i++)
2755 ip2 = workd + iptr(1) - 1;
2756 for (
F77_INT i = 0; i < n; i++)
2763 double *ip2 = workd + iptr(0) - 1;
2766 for (
F77_INT i = 0; i < n; i++)
2774 ip2 = workd + iptr(1) - 1;
2775 for (
F77_INT i = 0; i < n; i++)
2782 (*current_liboctave_error_handler)
2783 (
"eigs: error in dnaupd: %s",
2810 Matrix eig_vec2 (n, k + 1, 0.0);
2811 double *z = eig_vec2.
rwdata ();
2816 for (
F77_INT i = 0; i < k+1; i++)
2821 (rvec, F77_CONST_CHAR_ARG2 (
"A", 1), sel, dr, di, z, n, sigmar,
2822 sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
2823 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam,
2824 ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1)
2825 F77_CHAR_ARG_LEN(2));
2829 if (! rvec && ip(4) > k)
2837 bool have_cplx_eig =
false;
2838 for (
F77_INT i = 0; i < ip(4); i++)
2844 have_cplx_eig =
true;
2850 for (
F77_INT i = ip(4); i < k; i++)
2851 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
2852 octave::numeric_limits<double>::NaN ());
2856 for (
F77_INT i = ip(4); i < k; i++)
2857 d[i] =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2864 for (
F77_INT i = 0; i < k2; i++)
2867 d[i] =
d[ip(4) - i - 1];
2868 d[ip(4) - i - 1] = dtmp;
2880 if (std::imag (eig_val(i)) == 0)
2882 for (
F77_INT j = 0; j < n; j++)
2883 eig_vec(j, i) =
Complex (z[j+off1], 0.);
2888 for (
F77_INT j = 0; j < n; j++)
2890 eig_vec(j, i) =
Complex (z[j+off1], z[j+off2]);
2892 eig_vec(j, i+1) =
Complex (z[j+off1], -z[j+off2]);
2899 for (
F77_INT ii = ip(4); ii < k; ii++)
2900 for (
F77_INT jj = 0; jj < n; jj++)
2902 =
Complex (octave::numeric_limits<double>::NaN (),
2903 octave::numeric_limits<double>::NaN ());
2907 for (
F77_INT ii = ip(4); ii < k; ii++)
2908 for (
F77_INT jj = 0; jj < n; jj++)
2910 =
Complex (octave::numeric_limits<double>::NaN (), 0.);
2913 eig_vec = utsolve (bt, permB, eig_vec);
2923 (
"eigs: error in dneupd: %s",
2929template <
typename M>
2937 std::ostream& os,
double tol,
bool rvec,
2938 bool cholB,
int disp,
int maxit)
2940 F77_INT k = octave::to_f77_int (k_arg);
2941 F77_INT p = octave::to_f77_int (p_arg);
2943 F77_INT n = octave::to_f77_int (m.cols ());
2945 bool have_b = ! b.isempty ();
2951 if (m.rows () != m.cols ())
2952 (*current_liboctave_error_handler) (
"eigs: A must be square");
2953 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
2955 (
"eigs: B must be square and the same size as A");
2959 std::string rand_dist = octave::rand::distribution ();
2960 octave::rand::distribution (
"uniform");
2964 for (
F77_INT i = 0; i < n; i++)
2965 cresid(i) =
Complex (rr(i), ri(i));
2966 octave::rand::distribution (rand_dist);
2968 else if (m.cols () != cresid.
numel ())
2969 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
2972 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
2985 if (k <= 0 || k >= n - 1)
2986 (*current_liboctave_error_handler)
2987 (
"eigs: Invalid number of eigenvalues to extract"
2988 " (must be 0 < k < n-1).\n"
2989 " Use 'eig (full (A))' instead");
2991 if (p <= k || p > n)
2992 (*current_liboctave_error_handler)
2993 (
"eigs: opts.p must be greater than k and less than or equal to n");
2995 if (have_b && cholB && ! permB.
isempty ())
2998 if (permB.
numel () != n)
3002 for (
F77_INT i = 0; i < n; i++)
3006 if (checked(bidx) || bidx < 0 || bidx >= n
3007 || octave::math::x_nint (bidx) != bidx)
3012 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
3013 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
3015 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
3017 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
3018 (*current_liboctave_error_handler)
3019 (
"eigs: invalid sigma value for complex problem");
3032 for (
F77_INT i = 0; i < n; i++)
3038 if (! make_cholb (b, bt, permB))
3039 (*current_liboctave_error_handler)
3040 (
"eigs: The matrix B is not positive definite");
3065 F77_INT lwork = p * (3 * p + 5);
3075 F77_INT tmp_info = octave::to_f77_int (info);
3078 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3079 F77_CONST_CHAR_ARG2 (typ.c_str (), 2),
3083 tmp_info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3087 if (disp > 0 && ! octave::math::isnan (workl[iptr (5)-1]))
3091 os <<
"Iteration " << iter - 1 <<
3092 ": a few Ritz values of the " << p <<
"-by-" <<
3096 for (
F77_INT i = 0; i < k; i++)
3097 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3102 for (
F77_INT i = p - k; i < p; i++)
3103 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3113 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
3116 if (ido == -1 || ido == 1 || ido == 2)
3121 for (
F77_INT i = 0; i < n; i++)
3122 mtmp(i, 0) = workd[i + iptr(0) - 1];
3123 mtmp = ltsolve (b, permB, m * utsolve (bt, permB, mtmp));
3124 for (
F77_INT i = 0; i < n; i++)
3125 workd[i+iptr(1)-1] = mtmp(i, 0);
3128 else if (! vector_product (m, workd + iptr(0) - 1,
3129 workd + iptr(1) - 1))
3135 (*current_liboctave_error_handler)
3136 (
"eigs: error %" OCTAVE_IDX_TYPE_FORMAT
" in znaupd: %s",
3168 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3169 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3173 info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3177 for (
F77_INT i = ip(4); i < k; i++)
3178 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
3179 octave::numeric_limits<double>::NaN ());
3182 for (
F77_INT i = 0; i < k2; i++)
3185 d[i] =
d[ip(4) - i - 1];
3186 d[ip(4) - i - 1] = ctmp;
3194 for (
F77_INT i = ip(4); i < k; i++)
3197 for (
F77_INT j = 0; j < n; j++)
3198 z[off1 + j] =
Complex (octave::numeric_limits<double>::NaN (),
3199 octave::numeric_limits<double>::NaN ());
3202 for (
F77_INT i = 0; i < k2; i++)
3205 F77_INT off2 = (ip(4) - i - 1) * n;
3210 for (
F77_INT j = 0; j < n; j++)
3211 ctmp[j] = z[off1 + j];
3213 for (
F77_INT j = 0; j < n; j++)
3214 z[off1 + j] = z[off2 + j];
3216 for (
F77_INT j = 0; j < n; j++)
3217 z[off2 + j] = ctmp[j];
3221 eig_vec = utsolve (bt, permB, eig_vec);
3226 (
"eigs: error in zneupd: %s",
3232template <
typename M>
3241 std::ostream& os,
double tol,
bool rvec,
3242 bool cholB,
int disp,
int maxit)
3244 F77_INT k = octave::to_f77_int (k_arg);
3245 F77_INT p = octave::to_f77_int (p_arg);
3247 F77_INT n = octave::to_f77_int (m.cols ());
3249 bool have_b = ! b.isempty ();
3250 std::string typ =
"LM";
3252 if (m.rows () != m.cols ())
3253 (*current_liboctave_error_handler) (
"eigs: A must be square");
3254 if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ()))
3256 (
"eigs: B must be square and the same size as A");
3266 std::string rand_dist = octave::rand::distribution ();
3267 octave::rand::distribution (
"uniform");
3271 for (
F77_INT i = 0; i < n; i++)
3272 cresid(i) =
Complex (rr(i), ri(i));
3273 octave::rand::distribution (rand_dist);
3275 else if (m.cols () != cresid.
numel ())
3276 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
3279 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
3292 if (k <= 0 || k >= n - 1)
3293 (*current_liboctave_error_handler)
3294 (
"eigs: Invalid number of eigenvalues to extract"
3295 " (must be 0 < k < n-1).\n"
3296 " Use 'eig (full (A))' instead");
3298 if (p <= k || p > n)
3299 (*current_liboctave_error_handler)
3300 (
"eigs: opts.p must be greater than k and less than or equal to n");
3302 if (have_b && cholB && ! permB.
isempty ())
3305 if (permB.
numel () != n)
3309 for (
F77_INT i = 0; i < n; i++)
3313 if (checked(bidx) || bidx < 0 || bidx >= n
3314 || octave::math::x_nint (bidx) != bidx)
3350 if (! LuAminusSigmaB (m, b, cholB, permB, sigma, L, U, P,
Q, r))
3353 F77_INT lwork = p * (3 * p + 5);
3363 F77_INT tmp_info = octave::to_f77_int (info);
3366 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3367 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3371 tmp_info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3375 if (disp > 0 && ! octave::math::isnan(workl[iptr(5)-1]))
3379 os <<
"Iteration " << iter - 1 <<
3380 ": a few Ritz values of the " << p <<
"-by-" <<
3384 for (
F77_INT i = 0; i < k; i++)
3385 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3390 for (
F77_INT i = p - k; i < p; i++)
3391 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3401 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
3404 if (ido == -1 || ido == 1 || ido == 2)
3412 vector_product (b, workd+iptr(0)-1, ctmp);
3416 for (
F77_INT i = 0; i < n; i++)
3417 tmp(i, 0) = ctmp[P[i]] / r(P[i]);
3419 lusolve (L, U, tmp);
3421 Complex *ip2 = workd+iptr(1)-1;
3422 for (
F77_INT i = 0; i < n; i++)
3423 ip2[
Q[i]] = tmp(i, 0);
3426 vector_product (b, workd + iptr(0) - 1, workd + iptr(1) - 1);
3429 Complex *ip2 = workd+iptr(2)-1;
3432 for (
F77_INT i = 0; i < n; i++)
3433 tmp(i, 0) = ip2[P[i]] / r(P[i]);
3435 lusolve (L, U, tmp);
3437 ip2 = workd+iptr(1)-1;
3438 for (
F77_INT i = 0; i < n; i++)
3439 ip2[
Q[i]] = tmp(i, 0);
3445 Complex *ip2 = workd+iptr(0)-1;
3448 for (
F77_INT i = 0; i < n; i++)
3449 tmp(i, 0) = ip2[P[i]] / r(P[i]);
3451 lusolve (L, U, tmp);
3453 ip2 = workd+iptr(1)-1;
3454 for (
F77_INT i = 0; i < n; i++)
3455 ip2[
Q[i]] = tmp(i, 0);
3461 (*current_liboctave_error_handler)
3462 (
"eigs: error %" OCTAVE_IDX_TYPE_FORMAT
" in znaupd: %s",
3494 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3495 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3499 info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3503 for (
F77_INT i = ip(4); i < k; i++)
3504 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
3505 octave::numeric_limits<double>::NaN ());
3508 for (
F77_INT i = 0; i < k2; i++)
3511 d[i] =
d[ip(4) - i - 1];
3512 d[ip(4) - i - 1] = ctmp;
3520 for (
F77_INT i = ip(4); i < k; i++)
3523 for (
F77_INT j = 0; j < n; j++)
3524 z[off1 + j] =
Complex (octave::numeric_limits<double>::NaN (),
3525 octave::numeric_limits<double>::NaN ());
3528 for (
F77_INT i = 0; i < k2; i++)
3531 F77_INT off2 = (ip(4) - i - 1) * n;
3536 for (
F77_INT j = 0; j < n; j++)
3537 ctmp[j] = z[off1 + j];
3539 for (
F77_INT j = 0; j < n; j++)
3540 z[off1 + j] = z[off2 + j];
3542 for (
F77_INT j = 0; j < n; j++)
3543 z[off2 + j] = ctmp[j];
3549 (
"eigs: error in zneupd: %s",
3555template <
typename M>
3558 const std::string& _typ,
Complex sigma,
3563 std::ostream& os,
double tol,
bool rvec,
3564 bool cholB,
int disp,
int maxit)
3566 F77_INT n = octave::to_f77_int (n_arg);
3567 F77_INT k = octave::to_f77_int (k_arg);
3568 F77_INT p = octave::to_f77_int (p_arg);
3570 std::string typ (_typ);
3571 bool have_sigma = (std::abs (sigma) ? true :
false);
3573 bool have_b = ! b.isempty ();
3581 std::string rand_dist = octave::rand::distribution ();
3582 octave::rand::distribution (
"uniform");
3586 for (
F77_INT i = 0; i < n; i++)
3587 cresid(i) =
Complex (rr(i), ri(i));
3588 octave::rand::distribution (rand_dist);
3590 else if (n != cresid.
numel ())
3591 (*current_liboctave_error_handler) (
"eigs: opts.v0 must be n-by-1");
3594 (*current_liboctave_error_handler) (
"eigs: n must be at least 3");
3607 if (k <= 0 || k >= n - 1)
3608 (*current_liboctave_error_handler)
3609 (
"eigs: Invalid number of eigenvalues to extract"
3610 " (must be 0 < k < n-1).\n"
3611 " Use 'eig (full (A))' instead");
3613 if (p <= k || p > n)
3614 (*current_liboctave_error_handler)
3615 (
"eigs: opts.p must be greater than k and less than or equal to n");
3617 if (have_b && cholB && ! permB.
isempty ())
3620 if (permB.
numel () != n)
3624 for (
F77_INT i = 0; i < n; i++)
3628 if (checked(bidx) || bidx < 0 || bidx >= n
3629 || octave::math::x_nint (bidx) != bidx)
3636 if (typ !=
"LM" && typ !=
"SM" && typ !=
"LA" && typ !=
"SA"
3637 && typ !=
"BE" && typ !=
"LR" && typ !=
"SR" && typ !=
"LI"
3639 (*current_liboctave_error_handler) (
"eigs: unrecognized sigma value");
3641 if (typ ==
"LA" || typ ==
"SA" || typ ==
"BE")
3642 (*current_liboctave_error_handler)
3643 (
"eigs: invalid sigma value for complex problem");
3645 if (typ !=
"SM" && have_b)
3657 else if (! std::abs (sigma))
3671 if (mode == 1 && have_b)
3682 for (
F77_INT i = 0; i < n; i++)
3688 if (! make_cholb (b, bt, permB))
3689 (*current_liboctave_error_handler)
3690 (
"eigs: The matrix B is not positive definite");
3715 F77_INT lwork = p * (3 * p + 5);
3725 F77_INT tmp_info = octave::to_f77_int (info);
3728 (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3729 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3733 tmp_info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3737 if (disp > 0 && ! octave::math::isnan(workl[iptr(5)-1]))
3741 os <<
"Iteration " << iter - 1 <<
3742 ": a few Ritz values of the " << p <<
"-by-" <<
3746 for (
F77_INT i = 0; i < k; i++)
3747 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3752 for (
F77_INT i = p - k; i < p; i++)
3753 os <<
" " << workl[iptr(5)+i-1] <<
"\n";
3763 workl[iptr(5)-1] = octave::numeric_limits<double>::NaN ();
3766 if (ido == -1 || ido == 1 || ido == 2)
3773 for (
F77_INT i = 0; i < n; i++)
3774 mtmp(i, 0) = workd[i + iptr(0) - 1];
3776 mtmp = utsolve (bt, permB, mtmp);
3782 mtmp = ltsolve (b, permB, y);
3784 for (
F77_INT i = 0; i < n; i++)
3785 workd[i+iptr(1)-1] = mtmp(i, 0);
3793 vector_product (b, workd+iptr(0)-1, ctmp);
3797 for (
F77_INT i = 0; i < n; i++)
3805 Complex *ip2 = workd+iptr(1)-1;
3806 for (
F77_INT i = 0; i < n; i++)
3810 vector_product (b, workd+iptr(0)-1, workd+iptr(1)-1);
3813 Complex *ip2 = workd+iptr(2)-1;
3816 for (
F77_INT i = 0; i < n; i++)
3824 ip2 = workd + iptr(1) - 1;
3825 for (
F77_INT i = 0; i < n; i++)
3832 Complex *ip2 = workd + iptr(0) - 1;
3835 for (
F77_INT i = 0; i < n; i++)
3843 ip2 = workd + iptr(1) - 1;
3844 for (
F77_INT i = 0; i < n; i++)
3851 (*current_liboctave_error_handler)
3852 (
"eigs: error %" OCTAVE_IDX_TYPE_FORMAT
" in znaupd: %s",
3884 F77_CONST_CHAR_ARG2 (&bmat, 1), n,
3885 F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2),
3889 info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
3893 for (
F77_INT i = ip(4); i < k; i++)
3894 d[i] =
Complex (octave::numeric_limits<double>::NaN (),
3895 octave::numeric_limits<double>::NaN ());
3898 for (
F77_INT i = 0; i < k2; i++)
3901 d[i] =
d[ip(4) - i - 1];
3902 d[ip(4) - i - 1] = ctmp;
3910 for (
F77_INT i = ip(4); i < k; i++)
3913 for (
F77_INT j = 0; j < n; j++)
3914 z[off1 + j] =
Complex (octave::numeric_limits<double>::NaN (),
3915 octave::numeric_limits<double>::NaN ());
3918 for (
F77_INT i = 0; i < k2; i++)
3921 F77_INT off2 = (ip(4) - i - 1) * n;
3926 for (
F77_INT j = 0; j < n; j++)
3927 ctmp[j] = z[off1 + j];
3929 for (
F77_INT j = 0; j < n; j++)
3930 z[off1 + j] = z[off2 + j];
3932 for (
F77_INT j = 0; j < n; j++)
3933 z[off2 + j] = ctmp[j];
3936 eig_vec = utsolve (bt, permB, eig_vec);
3941 (
"eigs: error in zneupd: %s",
3957 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
3958 bool cholB,
int disp,
int maxit);
3966 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
3967 bool cholB,
int disp,
int maxit);
3976 bool rvec,
bool cholB,
int disp,
int maxit);
3984 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
3985 bool cholB,
int disp,
int maxit);
3993 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
3994 bool cholB,
int disp,
int maxit);
4003 bool rvec,
bool cholB,
int disp,
int maxit);
4013 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4014 bool cholB,
int disp,
int maxit);
4022 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4023 bool cholB,
int disp,
int maxit);
4032 bool rvec,
bool cholB,
int disp,
int maxit);
4040 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4041 bool cholB,
int disp,
int maxit);
4049 ColumnVector& resid, std::ostream& os,
double tol,
bool rvec,
4050 bool cholB,
int disp,
int maxit);
4059 std::ostream& os,
double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4070 bool rvec,
bool cholB,
int disp,
int maxit);
4079 bool rvec,
bool cholB,
int disp,
int maxit);
4088 std::ostream& os,
double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4099 double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4108 double tol,
bool rvec,
bool cholB,
int disp,
int maxit);
4118 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)
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
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
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)
F77_RET_T F77_FUNC(xerbla, XERBLA)(F77_CONST_CHAR_ARG_DEF(s_arg