29 #ifndef ANASAZI_BLOCKDAVIDSON_SOLMGR_HPP 30 #define ANASAZI_BLOCKDAVIDSON_SOLMGR_HPP 56 # include <Teuchos_FancyOStream.hpp> 112 template<
class ScalarType,
class MV,
class OP>
178 return Teuchos::tuple(_timerSolve, _timerRestarting, _timerLocking);
232 std::string whch_, ortho_;
234 MagnitudeType convtol_, locktol_;
237 bool relconvtol_, rellocktol_;
238 int blockSize_, numBlocks_, numIters_;
242 int numRestartBlocks_;
256 template<
class ScalarType,
class MV,
class OP>
263 convtol_(
MT::prec()),
273 inSituRestart_(false),
275 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
276 , _timerSolve(
Teuchos::TimeMonitor::getNewTimer(
"Anasazi: BlockDavidsonSolMgr::solve()")),
277 _timerRestarting(
Teuchos::TimeMonitor::getNewTimer(
"Anasazi: BlockDavidsonSolMgr restarting")),
278 _timerLocking(
Teuchos::TimeMonitor::getNewTimer(
"Anasazi: BlockDavidsonSolMgr locking"))
284 TEUCHOS_TEST_FOR_EXCEPTION(problem_->getInitVec() == Teuchos::null,std::invalid_argument,
"Problem does not contain initial vectors to clone from.");
289 whch_ = pl.
get(
"Which",whch_);
290 TEUCHOS_TEST_FOR_EXCEPTION(whch_ !=
"SM" && whch_ !=
"LM" && whch_ !=
"SR" && whch_ !=
"LR",std::invalid_argument,
"Invalid sorting string.");
293 ortho_ = pl.
get(
"Orthogonalization",ortho_);
294 if (ortho_ !=
"DGKS" && ortho_ !=
"SVQB") {
299 convtol_ = pl.
get(
"Convergence Tolerance",convtol_);
300 relconvtol_ = pl.
get(
"Relative Convergence Tolerance",relconvtol_);
301 strtmp = pl.
get(
"Convergence Norm",std::string(
"2"));
305 else if (strtmp ==
"M") {
310 "Anasazi::BlockDavidsonSolMgr: Invalid Convergence Norm.");
314 useLocking_ = pl.
get(
"Use Locking",useLocking_);
315 rellocktol_ = pl.
get(
"Relative Locking Tolerance",rellocktol_);
317 locktol_ = convtol_/10;
318 locktol_ = pl.
get(
"Locking Tolerance",locktol_);
319 strtmp = pl.
get(
"Locking Norm",std::string(
"2"));
323 else if (strtmp ==
"M") {
328 "Anasazi::BlockDavidsonSolMgr: Invalid Locking Norm.");
332 maxRestarts_ = pl.
get(
"Maximum Restarts",maxRestarts_);
335 blockSize_ = pl.
get(
"Block Size",problem_->getNEV());
337 "Anasazi::BlockDavidsonSolMgr: \"Block Size\" must be strictly positive.");
338 numBlocks_ = pl.
get(
"Num Blocks",2);
340 "Anasazi::BlockDavidsonSolMgr: \"Num Blocks\" must be >= 1.");
344 maxLocked_ = pl.
get(
"Max Locked",problem_->getNEV());
349 if (maxLocked_ == 0) {
353 "Anasazi::BlockDavidsonSolMgr: \"Max Locked\" must be positive.");
355 std::invalid_argument,
356 "Anasazi::BlockDavidsonSolMgr: Not enough storage space for requested number of eigenpairs.");
358 std::invalid_argument,
359 "Anasazi::BlockDavidsonSolMgr: Potentially impossible orthogonality requests. Reduce basis size or locking size.");
362 lockQuorum_ = pl.
get(
"Locking Quorum",lockQuorum_);
364 std::invalid_argument,
365 "Anasazi::BlockDavidsonSolMgr: \"Locking Quorum\" must be strictly positive.");
369 numRestartBlocks_ = pl.
get(
"Num Restart Blocks",numRestartBlocks_);
371 "Anasazi::BlockDavidsonSolMgr: \"Num Restart Blocks\" must be strictly positive.");
373 "Anasazi::BlockDavidsonSolMgr: \"Num Restart Blocks\" must be strictly less than \"Num Blocks\".");
377 if (Teuchos::isParameterType<bool>(pl,
"In Situ Restarting")) {
378 inSituRestart_ = pl.
get(
"In Situ Restarting",inSituRestart_);
380 inSituRestart_ = ( Teuchos::getParameter<int>(pl,
"In Situ Restarting") != 0 );
385 std::string fntemplate =
"";
386 bool allProcs =
false;
388 if (Teuchos::isParameterType<bool>(pl,
"Output on all processors")) {
389 allProcs = pl.
get(
"Output on all processors",allProcs);
391 allProcs = ( Teuchos::getParameter<int>(pl,
"Output on all processors") != 0 );
394 fntemplate = pl.
get(
"Output filename template",fntemplate);
399 MPI_Initialized(&mpiStarted);
400 if (mpiStarted) MPI_Comm_rank(MPI_COMM_WORLD, &MyPID);
405 if (fntemplate !=
"") {
406 std::ostringstream MyPIDstr;
410 while ( (pos = fntemplate.find(
"%d",start)) != -1 ) {
411 fntemplate.replace(pos,2,MyPIDstr.str());
416 if (fntemplate !=
"") {
417 osp =
Teuchos::rcp(
new std::ofstream(fntemplate.c_str(),std::ios::out | std::ios::app) );
419 osp = Teuchos::rcpFromRef(std::cout);
420 std::cout <<
"Anasazi::BlockDavidsonSolMgr::constructor(): Could not open file for write: " << fntemplate << std::endl;
424 osp = Teuchos::rcpFromRef(std::cout);
429 if (Teuchos::isParameterType<int>(pl,
"Verbosity")) {
430 verbosity = pl.
get(
"Verbosity", verbosity);
432 verbosity = (int)Teuchos::getParameter<Anasazi::MsgType>(pl,
"Verbosity");
447 template<
class ScalarType,
class MV,
class OP>
453 const int nev = problem_->getNEV();
457 out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(printer_->stream(
Debug)));
459 *out <<
"Entering Anasazi::BlockDavidsonSolMgr::solve()\n";
471 if (globalTest_ == Teuchos::null) {
475 convtest = globalTest_;
482 if (lockingTest_ == Teuchos::null) {
486 locktest = lockingTest_;
492 if (locktest != Teuchos::null) alltests.
push_back(locktest);
493 if (debugTest_ != Teuchos::null) alltests.
push_back(debugTest_);
499 if ( printer_->isVerbosity(
Debug) ) {
509 if (ortho_==
"SVQB") {
511 }
else if (ortho_==
"DGKS") {
514 TEUCHOS_TEST_FOR_EXCEPTION(ortho_!=
"SVQB"&&ortho_!=
"DGKS",std::logic_error,
"Anasazi::BlockDavidsonSolMgr::solve(): Invalid orthogonalization type.");
520 plist.
set(
"Block Size",blockSize_);
521 plist.
set(
"Num Blocks",numBlocks_);
529 if (probauxvecs != Teuchos::null) {
537 int curNumLocked = 0;
544 if (maxLocked_ > 0) {
545 lockvecs =
MVT::Clone(*problem_->getInitVec(),maxLocked_);
547 std::vector<MagnitudeType> lockvals;
596 if (inSituRestart_ ==
false) {
598 if (useLocking_==
true || maxRestarts_ > 0) {
599 workMV =
MVT::Clone(*problem_->getInitVec(),(numBlocks_-1)*blockSize_);
603 workMV = Teuchos::null;
612 if (maxRestarts_ > 0) {
613 workMV =
MVT::Clone(*problem_->getInitVec(),1);
616 workMV = Teuchos::null;
629 problem_->setSolution(sol);
635 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 642 bd_solver->iterate();
649 if (debugTest_ != Teuchos::null && debugTest_->getStatus() ==
Passed) {
650 throw AnasaziError(
"Anasazi::BlockDavidsonSolMgr::solve(): User-specified debug status test returned Passed.");
657 else if (ordertest->getStatus() ==
Passed ) {
668 else if ( bd_solver->getCurSubspaceDim() == bd_solver->getMaxSubspaceDim() ) {
670 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 674 if ( numRestarts >= maxRestarts_ ) {
679 printer_->stream(
IterationDetails) <<
" Performing restart number " << numRestarts <<
" of " << maxRestarts_ << std::endl << std::endl;
682 int curdim = state.
curDim;
683 int newdim = numRestartBlocks_*blockSize_;
685 # ifdef TEUCHOS_DEBUG 687 std::vector<Value<ScalarType> > ritzvalues = bd_solver->getRitzValues();
688 *out <<
"Ritz values from solver:\n";
689 for (
unsigned int i=0; i<ritzvalues.size(); i++) {
690 *out << ritzvalues[i].realpart <<
" ";
699 std::vector<MagnitudeType> theta(curdim);
701 # ifdef TEUCHOS_DEBUG 703 std::stringstream os;
704 os <<
"KK before HEEV...\n" 705 << *state.
KK <<
"\n";
709 int info = msutils::directSolver(curdim,*state.
KK,Teuchos::null,S,theta,rank,10);
711 "Anasazi::BlockDavidsonSolMgr::solve(): error calling SolverUtils::directSolver.");
713 "Anasazi::BlockDavidsonSolMgr::solve(): direct solve did not compute all eigenvectors.");
715 # ifdef TEUCHOS_DEBUG 717 std::stringstream os;
718 *out <<
"Ritz values from heev(KK):\n";
719 for (
unsigned int i=0; i<theta.size(); i++) *out << theta[i] <<
" ";
720 os <<
"\nRitz vectors from heev(KK):\n" 729 std::vector<int> order(curdim);
730 sorter->sort(theta,Teuchos::rcpFromRef(order),curdim);
733 msutils::permuteVectors(order,S);
735 # ifdef TEUCHOS_DEBUG 737 std::stringstream os;
738 *out <<
"Ritz values from heev(KK) after sorting:\n";
739 std::copy(theta.begin(), theta.end(), std::ostream_iterator<ScalarType>(*out,
" "));
740 os <<
"\nRitz vectors from heev(KK) after sorting:\n" 748 # ifdef TEUCHOS_DEBUG 750 std::stringstream os;
751 os <<
"Significant primitive Ritz vectors:\n" 766 "Anasazi::BlockDavidsonSolMgr::solve(): Logic error calling SerialDenseMatrix::multiply.");
770 "Anasazi::BlockDavidsonSolMgr::solve(): Logic error calling SerialDenseMatrix::multiply.");
772 for (
int j=0; j<newdim-1; ++j) {
773 for (
int i=j+1; i<newdim; ++i) {
778 # ifdef TEUCHOS_DEBUG 780 std::stringstream os;
790 rstate.
KK = Teuchos::rcpFromRef(newKK);
797 rstate.
KX = state.
KX;
798 rstate.
MX = state.
MX;
800 rstate.
T =
Teuchos::rcp(
new std::vector<MagnitudeType>(theta.begin(),theta.begin()+newdim) );
802 if (inSituRestart_ ==
true) {
803 # ifdef TEUCHOS_DEBUG 804 *out <<
"Beginning in-situ restart...\n";
812 std::vector<ScalarType> tau(newdim), work(newdim);
814 lapack.
GEQRF(curdim,newdim,Sr.
values(),Sr.
stride(),&tau[0],&work[0],work.size(),&geqrf_info);
816 "Anasazi::BlockDavidsonSolMgr::solve(): error calling GEQRF during restarting.");
817 if (printer_->isVerbosity(
Debug)) {
819 for (
int j=0; j<newdim; j++) {
821 for (
int i=j+1; i<newdim; i++) {
825 printer_->stream(
Debug) <<
"||Triangular factor of Sr - I||: " << R.
normFrobenius() << std::endl;
832 std::vector<int> curind(curdim);
833 for (
int i=0; i<curdim; i++) curind[i] = i;
835 msutils::applyHouse(newdim,*oldV,Sr,tau,workMV);
841 rstate.
V = solverbasis;
844 # ifdef TEUCHOS_DEBUG 845 *out <<
"Beginning ex-situ restart...\n";
848 std::vector<int> curind(curdim), newind(newdim);
849 for (
int i=0; i<curdim; i++) curind[i] = i;
850 for (
int i=0; i<newdim; i++) newind[i] = i;
862 bd_solver->initialize(rstate);
869 else if (locktest != Teuchos::null && locktest->getStatus() ==
Passed) {
871 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 878 const int curdim = state.
curDim;
883 "Anasazi::BlockDavidsonSolMgr::solve(): status test mistake: howMany() non-positive.");
885 "Anasazi::BlockDavidsonSolMgr::solve(): status test mistake: howMany() not consistent with whichVecs().");
888 "Anasazi::BlockDavidsonSolMgr::solve(): status test mistake: locking not deactivated.");
891 std::vector<int> tmp_vector_int;
892 if (curNumLocked + locktest->howMany() > maxLocked_) {
894 tmp_vector_int.insert(tmp_vector_int.begin(),locktest->whichVecs().begin(),locktest->whichVecs().begin()+maxLocked_-curNumLocked);
897 tmp_vector_int = locktest->whichVecs();
899 const std::vector<int> lockind(tmp_vector_int);
900 const int numNewLocked = lockind.size();
904 const int numUnlocked = curdim-numNewLocked;
905 tmp_vector_int.resize(curdim);
906 for (
int i=0; i<curdim; i++) tmp_vector_int[i] = i;
907 const std::vector<int> curind(tmp_vector_int);
908 tmp_vector_int.resize(numUnlocked);
909 std::set_difference(curind.begin(),curind.end(),lockind.begin(),lockind.end(),tmp_vector_int.begin());
910 const std::vector<int> unlockind(tmp_vector_int);
911 tmp_vector_int.clear();
915 if (printer_->isVerbosity(
Debug)) {
916 printer_->print(
Debug,
"Locking vectors: ");
917 for (
unsigned int i=0; i<lockind.size(); i++) {printer_->stream(
Debug) <<
" " << lockind[i];}
918 printer_->print(
Debug,
"\n");
919 printer_->print(
Debug,
"Not locking vectors: ");
920 for (
unsigned int i=0; i<unlockind.size(); i++) {printer_->stream(
Debug) <<
" " << unlockind[i];}
921 printer_->print(
Debug,
"\n");
933 std::vector<MagnitudeType> theta(curdim);
936 int info = msutils::directSolver(curdim,*state.
KK,Teuchos::null,S,theta,rank,10);
937 TEUCHOS_TEST_FOR_EXCEPTION(info != 0 ,std::logic_error,
938 "Anasazi::BlockDavidsonSolMgr::solve(): error calling SolverUtils::directSolver.");
939 TEUCHOS_TEST_FOR_EXCEPTION(rank != curdim,std::logic_error,
940 "Anasazi::BlockDavidsonSolMgr::solve(): direct solve did not compute all eigenvectors.");
943 std::vector<int> order(curdim);
944 sorter->sort(theta,Teuchos::rcpFromRef(order),curdim);
947 msutils::permuteVectors(order,S);
954 for (
int i=0; i<numUnlocked; i++) {
955 blas.
COPY(curdim, S[unlockind[i]], 1, Su[i], 1);
969 if (inSituRestart_ ==
true) {
977 std::vector<ScalarType> tau(numUnlocked), work(numUnlocked);
979 lapack.
GEQRF(curdim,numUnlocked,copySu.values(),copySu.stride(),&tau[0],&work[0],work.size(),&info);
980 TEUCHOS_TEST_FOR_EXCEPTION(info != 0,std::logic_error,
981 "Anasazi::BlockDavidsonSolMgr::solve(): error calling GEQRF during restarting.");
982 if (printer_->isVerbosity(
Debug)) {
984 for (
int j=0; j<numUnlocked; j++) {
986 for (
int i=j+1; i<numUnlocked; i++) {
990 printer_->stream(
Debug) <<
"||Triangular factor of Su - I||: " << R.
normFrobenius() << std::endl;
998 msutils::applyHouse(numUnlocked,*oldV,copySu,tau,workMV);
1000 std::vector<int> defind(numUnlocked), augind(numNewLocked);
1001 for (
int i=0; i<numUnlocked ; i++) defind[i] = i;
1002 for (
int i=0; i<numNewLocked; i++) augind[i] = numUnlocked+i;
1008 std::vector<int> defind(numUnlocked), augind(numNewLocked);
1009 for (
int i=0; i<numUnlocked ; i++) defind[i] = i;
1010 for (
int i=0; i<numNewLocked; i++) augind[i] = numUnlocked+i;
1033 if (curNumLocked > 0) {
1034 std::vector<int> curlockind(curNumLocked);
1035 for (
int i=0; i<curNumLocked; i++) curlockind[i] = i;
1039 curlocked = Teuchos::null;
1042 std::vector<int> augtmpind(numNewLocked);
1043 for (
int i=0; i<numNewLocked; i++) augtmpind[i] = curNumLocked+i;
1046 newLocked =
MVT::CloneView(*bd_solver->getRitzVectors(),lockind);
1059 if (probauxvecs != Teuchos::null) against.
push_back(probauxvecs);
1060 if (curlocked != Teuchos::null) against.
push_back(curlocked);
1063 if (problem_->getM() != Teuchos::null) {
1066 ortho->projectAndNormalizeMat(*augV,against,dummyC,Teuchos::null,augTmp);
1085 TEUCHOS_TEST_FOR_EXCEPTION(teuchosRet != 0,std::logic_error,
1086 "Anasazi::BlockDavidsonSolMgr::solve(): Logic error calling SerialDenseMatrix::multiply.");
1089 TEUCHOS_TEST_FOR_EXCEPTION(teuchosRet != 0,std::logic_error,
1090 "Anasazi::BlockDavidsonSolMgr::solve(): Logic error calling SerialDenseMatrix::multiply.");
1095 OPT::Apply(*problem_->getOperator(),*augV,*augTmp);
1097 KK22(
Teuchos::View,newKK,numNewLocked,numNewLocked,numUnlocked,numUnlocked);
1103 defV = Teuchos::null;
1104 augV = Teuchos::null;
1107 for (
int j=0; j<curdim; ++j) {
1108 for (
int i=j+1; i<curdim; ++i) {
1115 augTmp = Teuchos::null;
1117 std::vector<Value<ScalarType> > allvals = bd_solver->getRitzValues();
1118 for (
int i=0; i<numNewLocked; i++) {
1119 lockvals.push_back(allvals[lockind[i]].realpart);
1122 std::vector<int> indlock(numNewLocked);
1123 for (
int i=0; i<numNewLocked; i++) indlock[i] = curNumLocked+i;
1125 newLocked = Teuchos::null;
1127 curNumLocked += numNewLocked;
1128 std::vector<int> curlockind(curNumLocked);
1129 for (
int i=0; i<curNumLocked; i++) curlockind[i] = i;
1136 ordertest->setAuxVals(lockvals);
1139 if (probauxvecs != Teuchos::null) aux.
push_back(probauxvecs);
1141 bd_solver->setAuxVecs(aux);
1143 if (curNumLocked == maxLocked_) {
1145 combotest->removeTest(locktest);
1153 if (inSituRestart_) {
1161 rstate.
KK = Teuchos::rcpFromRef(newKK);
1164 bd_solver->initialize(rstate);
1173 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Anasazi::BlockDavidsonSolMgr::solve(): Invalid return from bd_solver::iterate().");
1178 <<
"Anasazi::BlockDavidsonSolMgr::solve() caught unexpected exception from Anasazi::BlockDavidson::iterate() at iteration " << bd_solver->getNumIters() << std::endl
1179 << err.what() << std::endl
1180 <<
"Anasazi::BlockDavidsonSolMgr::solve() returning Unconverged with no solutions." << std::endl;
1186 workMV = Teuchos::null;
1188 sol.
numVecs = ordertest->howMany();
1193 std::vector<MagnitudeType> vals(sol.
numVecs);
1196 std::vector<int> which = ordertest->whichVecs();
1200 std::vector<int> inlocked(0), insolver(0);
1201 for (
unsigned int i=0; i<which.size(); i++) {
1202 if (which[i] >= 0) {
1203 TEUCHOS_TEST_FOR_EXCEPTION(which[i] >= blockSize_,std::logic_error,
"Anasazi::BlockDavidsonSolMgr::solve(): positive indexing mistake from ordertest.");
1204 insolver.push_back(which[i]);
1208 TEUCHOS_TEST_FOR_EXCEPTION(which[i] < -curNumLocked,std::logic_error,
"Anasazi::BlockDavidsonSolMgr::solve(): negative indexing mistake from ordertest.");
1209 inlocked.push_back(which[i] + curNumLocked);
1213 TEUCHOS_TEST_FOR_EXCEPTION(insolver.size() + inlocked.size() != (
unsigned int)sol.
numVecs,std::logic_error,
"Anasazi::BlockDavidsonSolMgr::solve(): indexing mistake.");
1216 if (insolver.size() > 0) {
1218 int lclnum = insolver.size();
1219 std::vector<int> tosol(lclnum);
1220 for (
int i=0; i<lclnum; i++) tosol[i] = i;
1224 std::vector<Value<ScalarType> > fromsolver = bd_solver->getRitzValues();
1225 for (
unsigned int i=0; i<insolver.size(); i++) {
1226 vals[i] = fromsolver[insolver[i]].realpart;
1231 if (inlocked.size() > 0) {
1232 int solnum = insolver.size();
1234 int lclnum = inlocked.size();
1235 std::vector<int> tosol(lclnum);
1236 for (
int i=0; i<lclnum; i++) tosol[i] = solnum + i;
1240 for (
unsigned int i=0; i<inlocked.size(); i++) {
1241 vals[i+solnum] = lockvals[inlocked[i]];
1247 std::vector<int> order(sol.
numVecs);
1248 sorter->sort(vals,Teuchos::rcpFromRef(order),sol.
numVecs);
1250 for (
int i=0; i<sol.
numVecs; i++) {
1251 sol.
Evals[i].realpart = vals[i];
1264 bd_solver->currentStatus(printer_->stream(
FinalSummary));
1267 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 1273 problem_->setSolution(sol);
1274 printer_->stream(
Debug) <<
"Returning " << sol.
numVecs <<
" eigenpairs to eigenproblem." << std::endl;
1277 numIters_ = bd_solver->getNumIters();
1286 template <
class ScalarType,
class MV,
class OP>
1291 globalTest_ = global;
1294 template <
class ScalarType,
class MV,
class OP>
1301 template <
class ScalarType,
class MV,
class OP>
1309 template <
class ScalarType,
class MV,
class OP>
1316 template <
class ScalarType,
class MV,
class OP>
1321 lockingTest_ = locking;
1324 template <
class ScalarType,
class MV,
class OP>
1328 return lockingTest_;
ScalarType * values() const
Pure virtual base class which describes the basic interface for a solver manager. ...
static void MvRandom(MV &mv)
Replace the vectors in mv with random vectors.
std::vector< Value< ScalarType > > Evals
The computed eigenvalues.
static void MvTimesMatAddMv(const ScalarType alpha, const MV &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, const ScalarType beta, MV &mv)
Update mv with .
An extension of the MultiVecTraits class that adds a new vector length method.This traits class provi...
void setLockingStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &locking)
Set the status test defining locking.
A special StatusTest for printing other status tests.
BlockDavidsonSolMgr(const Teuchos::RCP< Eigenproblem< ScalarType, MV, OP > > &problem, Teuchos::ParameterList &pl)
Basic constructor for BlockDavidsonSolMgr.
This class defines the interface required by an eigensolver and status test class to compute solution...
static ptrdiff_t GetGlobalLength(const MV &mv)
Teuchos::RCP< const MV > R
The current residual vectors.
Teuchos::RCP< const Teuchos::SerialDenseMatrix< int, ScalarType > > KK
The current projected K matrix.
An implementation of the Anasazi::SortManager that performs a collection of common sorting techniques...
basic_FancyOStream & setShowProcRank(const bool showProcRank)
T & get(const std::string &name, T def_value)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
int multiply(ETransp transa, ETransp transb, ScalarType alpha, const SerialDenseMatrix< OrdinalType, ScalarType > &A, const SerialDenseMatrix< OrdinalType, ScalarType > &B, ScalarType beta)
void GEQRF(const OrdinalType m, const OrdinalType n, ScalarType *A, const OrdinalType lda, ScalarType *TAU, ScalarType *WORK, const OrdinalType lwork, OrdinalType *info) const
void COPY(const OrdinalType n, const ScalarType *x, const OrdinalType incx, ScalarType *y, const OrdinalType incy) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Virtual base class which defines basic traits for the operator type.
Teuchos::RCP< MV > Evecs
The computed eigenvectors.
Status test for forming logical combinations of other status tests.
Teuchos::RCP< const MV > KX
The image of the current eigenvectors under K.
The Anasazi::SolverManager is a templated virtual base class that defines the basic interface that an...
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > & getDebugStatusTest() const
Get the status test for debugging.
static void Apply(const OP &Op, const MV &x, MV &y)
Application method which performs operation y = Op*x. An OperatorError exception is thrown if there i...
Basic implementation of the Anasazi::SortManager class.
An implementation of the Anasazi::MatOrthoManager that performs orthogonalization using the SVQB iter...
An exception class parent to all Anasazi exceptions.
This class implements a Block Davidson iteration, a preconditioned iteration for solving linear Hermi...
ScalarTraits< ScalarType >::magnitudeType normFrobenius() const
Implementation of the block Davidson method.
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package...
A status test for testing the norm of the eigenvectors residuals along with a set of auxiliary eigenv...
Anasazi's templated, static class providing utilities for the solvers.
static void summarize(Ptr< const Comm< int > > comm, std::ostream &out=std::cout, const bool alwaysWriteLocal=false, const bool writeGlobalStats=true, const bool writeZeroTimers=true, const ECounterSetOp setOp=Intersection, const std::string &filter="")
bool isParameter(const std::string &name) const
int numVecs
The number of computed eigenpairs.
static void MvTransMv(const ScalarType alpha, const MV &A, const MV &mv, Teuchos::SerialDenseMatrix< int, ScalarType > &B)
Compute a dense matrix B through the matrix-matrix multiply .
static ScalarType conjugate(ScalarType a)
int getNumIters() const
Get the iteration count for the most recent call to solve().
Basic output manager for sending information of select verbosity levels to the appropriate output str...
Teuchos::RCP< MV > Espace
An orthonormal basis for the computed eigenspace.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Anasazi's basic output manager for sending information of select verbosity levels to the appropriate ...
Abstract base class which defines the interface required by an eigensolver and status test class to c...
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
ReturnType
Enumerated type used to pass back information from a solver manager.
Teuchos::RCP< const MV > V
The basis for the Krylov space.
A status test for testing the norm of the eigenvectors residuals.
virtual ~BlockDavidsonSolMgr()
Destructor.
Traits class which defines basic operations on multivectors.
std::vector< int > index
An index into Evecs to allow compressed storage of eigenvectors for real, non-Hermitian problems...
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > & getLockingStatusTest() const
Get the status test defining locking.
basic_FancyOStream & setShowAllFrontMatter(const bool showAllFrontMatter)
Anasazi header file which uses auto-configuration information to include necessary C++ headers...
Orthogonalization manager based on the SVQB technique described in "A Block Orthogonalization Procedu...
static Teuchos::RCP< MV > CloneViewNonConst(MV &mv, const std::vector< int > &index)
Creates a new MV that shares the selected contents of mv (shallow copy).
Struct for storing an eigenproblem solution.
static Teuchos::RCP< const MV > CloneView(const MV &mv, const std::vector< int > &index)
Creates a new const MV that shares the selected contents of mv (shallow copy).
static void SetBlock(const MV &A, const std::vector< int > &index, MV &mv)
Copy the vectors in A to a set of vectors in mv indicated by the indices given in index...
int curDim
The current dimension of the solver.
static magnitudeType magnitude(ScalarType a)
void push_back(const value_type &x)
Structure to contain pointers to BlockDavidson state variables.
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > & getGlobalStatusTest() const
Get the status test defining global convergence.
Special StatusTest for printing status tests.
A status test for testing the norm of the eigenvectors residuals along with a set of auxiliary eigenv...
void setDebugStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &debug)
Set the status test for debugging.
Teuchos::RCP< const MV > X
The current eigenvectors.
Teuchos::RCP< const MV > MX
The image of the current eigenvectors under M, or Teuchos::null if M was not specified.
Status test for forming logical combinations of other status tests.
An implementation of the Anasazi::MatOrthoManager that performs orthogonalization using (potentially)...
Types and exceptions used within Anasazi solvers and interfaces.
The BlockDavidsonSolMgr provides a powerful solver manager over the BlockDavidson eigensolver...
A pure virtual class for defining the status tests for the Anasazi iterative solvers.
A status test for testing the norm of the eigenvectors residuals.
Basic implementation of the Anasazi::OrthoManager class.
void setGlobalStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &global)
Set the status test defining global convergence.
ReturnType solve()
This method performs possibly repeated calls to the underlying eigensolver's iterate() routine until ...
OrdinalType stride() const
const Eigenproblem< ScalarType, MV, OP > & getProblem() const
Return the eigenvalue problem.
static Teuchos::RCP< MV > Clone(const MV &mv, const int numvecs)
Creates a new empty MV containing numvecs columns.
Teuchos::RCP< const std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > > T
The current Ritz values. This vector is a copy of the internal data.
Class which provides internal utilities for the Anasazi solvers.