48 #ifndef ANASAZI_TRACEMIN_DAVIDSON_SOLMGR_HPP
49 #define ANASAZI_TRACEMIN_DAVIDSON_SOLMGR_HPP
74 namespace Experimental {
109 template<
class ScalarType,
class MV,
class OP>
158 return (solver->getCurSubspaceDim() == solver->getMaxSubspaceDim());
181 template <
class MagnitudeType,
class MV,
class OP>
186 typedef std::complex<MagnitudeType> ScalarType;
192 MagnitudeType::this_class_is_missing_a_specialization();
198 template<
class ScalarType,
class MV,
class OP>
203 maxRestarts_ = pl.
get(
"Maximum Restarts", 50);
205 "Anasazi::TraceMinDavidsonSolMgr::constructor(): \"Maximum Restarts\" must be strictly positive.");
207 this->useHarmonic_ = pl.
get(
"Use Harmonic Ritz Values",
false);
209 TEUCHOS_TEST_FOR_EXCEPTION(this->useHarmonic_ && problem->getM() != Teuchos::null, std::invalid_argument,
"Anasazi::TraceMinDavidsonSolMgr::constructor(): Harmonic Ritz values do not currently work with generalized eigenvalue problems. Please disable \"Use Harmonic Ritz Values\".");
212 this->blockSize_ = pl.
get(
"Block Size", 1);
214 "Anasazi::TraceMinDavidsonSolMgr::constructor(): \"Block Size\" must be strictly positive.");
216 this->numRestartBlocks_ = (int)std::ceil(this->problem_->getNEV() / this->blockSize_);
217 this->numRestartBlocks_ = pl.
get(
"Num Restart Blocks", this->numRestartBlocks_);
219 "Anasazi::TraceMinDavidsonSolMgr::constructor(): \"Num Restart Blocks\" must be strictly positive.");
221 this->numBlocks_ = pl.
get(
"Num Blocks", 3*this->numRestartBlocks_);
223 "Anasazi::TraceMinDavidsonSolMgr::constructor(): \"Num Blocks\" must be greater than 1. If you only wish to use one block, please use TraceMinSolMgr instead of TraceMinDavidsonSolMgr.");
226 "Anasazi::TraceMinDavidsonSolMgr::constructor(): \"Num Blocks\" must be strictly greater than \"Num Restart Blocks\".");
228 std::stringstream ss;
229 ss <<
"Anasazi::TraceMinDavidsonSolMgr::constructor(): Potentially impossible orthogonality requests. Reduce basis size (" <<
static_cast<ptrdiff_t
>(this->numBlocks_)*this->blockSize_ <<
") or locking size (" << this->maxLocked_ <<
") because " << static_cast<ptrdiff_t>(this->numBlocks_) <<
"*" << this->blockSize_ <<
" + " << this->maxLocked_ <<
" > " <<
MVT::GetGlobalLength(*this->problem_->getInitVec()) <<
".";
231 std::invalid_argument, ss.str());
234 "Anasazi::TraceMinDavidsonSolMgr: Not enough storage space for requested number of eigenpairs.");
240 template <
class ScalarType,
class MV,
class OP>
243 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
247 if ( numRestarts >= maxRestarts_ ) {
252 this->printer_->stream(
IterationDetails) <<
" Performing restart number " << numRestarts <<
" of " << maxRestarts_ << std::endl << std::endl;
254 TraceMinBaseState<ScalarType,MV> oldstate = solver->getState();
255 TraceMinBaseState<ScalarType,MV> newstate;
256 int newdim = this->numRestartBlocks_*this->blockSize_;
257 std::vector<int> indToCopy(newdim);
258 for(
int i=0; i<newdim; i++) indToCopy[i] = i;
262 if(this->useHarmonic_)
264 newstate.V = MVT::CloneView(*solver->getRitzVectors(),indToCopy);
265 newstate.curDim = newdim;
270 this->copyPartOfState (oldstate, newstate, indToCopy);
274 newstate.NEV = oldstate.NEV;
275 solver->initialize(newstate);
static ptrdiff_t GetGlobalLength(const MV &mv)
Return the number of rows in the given multivector mv.
This class defines the interface required by an eigensolver and status test class to compute solution...
T & get(const std::string &name, T def_value)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Virtual base class which defines basic traits for the operator type.
TraceMinDavidsonSolMgr(const Teuchos::RCP< Eigenproblem< ScalarType, MV, OP > > &problem, Teuchos::ParameterList &pl)
Basic constructor for TraceMinDavidsonSolMgr.
The Anasazi::TraceMinBaseSolMgr provides an abstract base class for the TraceMin series of solver man...
Anasazi's templated virtual class for providing routines for orthogonalization and orthonormalization...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Traits class which defines basic operations on multivectors.
Anasazi header file which uses auto-configuration information to include necessary C++ headers...
The Anasazi::TraceMinBaseSolMgr provides an abstract base class for the TraceMin series of solver man...
The Anasazi::TraceMinDavidsonSolMgr provides a flexible solver manager over the TraceMinDavidson eige...
This class implements a TraceMin-Davidson iteration for solving symmetric generalized eigenvalue prob...
Implementation of the TraceMin-Davidson method.
This is an abstract base class for the trace minimization eigensolvers.
Anasazi's templated pure virtual class for managing the sorting of approximate eigenvalues computed b...
Common interface of stopping criteria for Anasazi's solvers.