20 #ifndef SELDON_FILE_ARPACKSOLVER_CXX
22 #include "ArpackSolver.hxx"
24 #ifndef SELDON_WITH_COMPILED_LIBRARY
32 template<
class T,
class Y>
39 template<
class T,
class Y>
63 template<
class T,
class Y>
65 ::Init(
int n,
int nev,
int ncv,
int maxit, T tol,
66 string solver_type,
int mode,
string which,
67 char bmat,
char HowMny,
bool with_arpack_verbose)
74 solver_type_ = solver_type;
93 lworkl_ = ncv_ * (ncv_ + 8);
102 if (with_arpack_verbose)
108 template<
class T,
class Y>
111 if (solver_type_ !=
"symmetric" &&
112 solver_type_ !=
"non-symmetric" &&
113 solver_type_ !=
"complex-single" &&
114 solver_type_ !=
"complex-double")
115 throw Error(
"ArpackSolver::Continue",
116 "Unsupported solver type \"" + solver_type_ +
"\".");
121 template<
class T,
class Y>
133 template<
class T,
class Y>
136 v_ =
new Y[ldv_ * ncv_];
137 workl_ =
new Y[ncv_ * (ncv_ + 8)];
138 workd_ =
new Y[3 * n_];
140 eig_val_ =
new Y[ncv_];
143 pselect_ =
new int[ncv_];
148 template<
class T,
class Y>
152 if (workl_)
delete[] workl_;
153 if (workd_)
delete[] workd_;
155 if (eig_val_)
delete[] eig_val_;
156 if (resid_)
delete[] resid_;
158 if (pselect_)
delete[] pselect_;
163 template<
class T,
class Y>
166 SetArpackVerbose(solver_type_);
171 template<
class T,
class Y>
174 if (solver_type ==
"symmetric")
186 else if (solver_type ==
"non-symmetric")
199 else if (solver_type ==
"complex-single" ||
200 solver_type ==
"complex-double")
217 template<
class T,
class Y>
248 template<
class T,
class Y>
251 return workd_ + ipntr_[0] - 1;
256 template<
class T,
class Y>
259 return workd_ + ipntr_[1] - 1;
267 template<
class T,
class Y>
270 return v_ + index * ldv_;
278 template<
class T,
class Y>
281 return eig_val_[index];
286 template<
class T,
class Y>
297 template<
class T,
class Y>
305 template<
class T,
class Y>
316 template<
class T,
class Y>
324 template<
class T,
class Y>
332 template<
class T,
class Y>
335 #ifdef SELDON_WITH_MPI
337 if (solver_type_ ==
"symmetric")
338 saupd(comm, ido_, bmat_, n_, (
char *)which_.c_str(), nev_, tol_, resid_, ncv_,
339 v_, ldv_, iparam_, ipntr_, workd_, workl_, lworkl_, info_);
341 if (solver_type_ ==
"symmetric")
342 saupd(ido_, bmat_, n_, (
char *)which_.c_str(), nev_, tol_, resid_, ncv_,
343 v_, ldv_, iparam_, ipntr_, workd_, workl_, lworkl_, info_);
351 template<
class T,
class Y>
354 bool i_success = (info_ >= 0);
360 #ifdef SELDON_WITH_MPI
362 seupd(comm,
int(rvec_),
'A', pselect_, eig_val_, v_, ldv_,
363 sigma_, bmat_, n_, (
char *) which_.c_str(), nev_, tol_,
364 resid_, ncv_, v_, ldv_, iparam_, ipntr_, workd_, workl_,
367 seupd(
int(rvec_),
'A', pselect_, eig_val_, v_, ldv_,
368 sigma_, bmat_, n_, (
char *) which_.c_str(), nev_, tol_,
369 resid_, ncv_, v_, ldv_, iparam_, ipntr_, workd_, workl_,
374 bool p_success = (ierr_ == 0);
379 return (i_success && p_success);
385 #define SELDON_FILE_ARPACKSOLVER_CXX