188 const RCP<Eigenproblem<ScalarType,MV,OP> > &problem,
203 maxRestarts_ = pl.get(
"Maximum Restarts", 50);
204 TEUCHOS_TEST_FOR_EXCEPTION(maxRestarts_ <= 0, std::invalid_argument,
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);
213 TEUCHOS_TEST_FOR_EXCEPTION(this->blockSize_ <= 0, std::invalid_argument,
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_);
218 TEUCHOS_TEST_FOR_EXCEPTION(this->numRestartBlocks_ <= 0, std::invalid_argument,
219 "Anasazi::TraceMinDavidsonSolMgr::constructor(): \"Num Restart Blocks\" must be strictly positive.");
221 this->numBlocks_ = pl.get(
"Num Blocks", 3*this->numRestartBlocks_);
222 TEUCHOS_TEST_FOR_EXCEPTION(this->numBlocks_ <= 1, std::invalid_argument,
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.");
225 TEUCHOS_TEST_FOR_EXCEPTION(this->numRestartBlocks_ >= this->numBlocks_, std::invalid_argument,
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()) <<
".";
230 TEUCHOS_TEST_FOR_EXCEPTION(
static_cast<ptrdiff_t
>(this->numBlocks_)*this->blockSize_ + this->maxLocked_ >
MVT::GetGlobalLength(*this->problem_->getInitVec()),
231 std::invalid_argument, ss.str());
233 TEUCHOS_TEST_FOR_EXCEPTION(this->maxLocked_ + this->blockSize_ < this->problem_->getNEV(), std::invalid_argument,
234 "Anasazi::TraceMinDavidsonSolMgr: Not enough storage space for requested number of eigenpairs.");