42 #ifndef ANASAZI_GENERALIZED_DAVIDSON_HPP 43 #define ANASAZI_GENERALIZED_DAVIDSON_HPP 51 #include "Teuchos_RCPDecl.hpp" 52 #include "Teuchos_ParameterList.hpp" 53 #include "Teuchos_SerialDenseMatrix.hpp" 54 #include "Teuchos_SerialDenseVector.hpp" 55 #include "Teuchos_Array.hpp" 56 #include "Teuchos_BLAS.hpp" 57 #include "Teuchos_LAPACK.hpp" 75 template <
class ScalarType,
class MV>
90 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >
VAV;
93 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >
VBV;
96 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >
S;
99 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >
T;
102 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >
Q;
105 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >
Z;
108 std::vector< Value<ScalarType> >
eVals;
111 BV(Teuchos::null), VAV(Teuchos::null),
112 VBV(Teuchos::null), S(Teuchos::null),
113 T(Teuchos::null), Q(Teuchos::null),
114 Z(Teuchos::null), eVals(0) {}
139 template <
class ScalarType,
class MV,
class OP>
146 typedef Teuchos::ScalarTraits<ScalarType> ST;
147 typedef typename ST::magnitudeType MagnitudeType;
148 typedef Teuchos::ScalarTraits<MagnitudeType> MT;
177 Teuchos::ParameterList &pl);
215 if( !d_ritzVectorsValid )
216 computeRitzVectors();
223 std::vector< Value<ScalarType> > getRitzValues();
230 if( !d_ritzIndexValid )
242 return d_expansionIndices;
248 std::vector<MagnitudeType> getResNorms();
253 std::vector<MagnitudeType> getResNorms(
int numWanted);
286 RCP<StatusTest<ScalarType,MV,OP> >
getStatusTest()
const {
return d_tester; }
301 void setBlockSize(
int blockSize);
306 void setSize(
int blockSize,
int maxSubDim);
311 Teuchos::Array< RCP<const MV> >
getAuxVecs()
const {
return d_auxVecs; }
320 void setAuxVecs(
const Teuchos::Array< RCP<const MV> > &auxVecs );
330 void currentStatus( std::ostream &myout );
340 void sortProblem(
int numWanted );
345 void expandSearchSpace();
348 void applyOperators();
351 void updateProjections();
354 void solveProjectedEigenproblem();
357 void computeProjectedEigenvectors( Teuchos::SerialDenseMatrix<int,ScalarType> &X );
360 void scaleEigenvectors(
const Teuchos::SerialDenseMatrix<int,ScalarType> &X,
361 Teuchos::SerialDenseMatrix<int,ScalarType> &X_alpha,
362 Teuchos::SerialDenseMatrix<int,ScalarType> &X_beta );
365 void sortValues( std::vector<MagnitudeType> &realParts,
366 std::vector<MagnitudeType> &imagParts,
367 std::vector<int> &permVec,
371 void computeResidual();
374 void computeRitzIndex();
377 void computeRitzVectors();
380 RCP<Eigenproblem<ScalarType,MV,OP> > d_problem;
381 Teuchos::ParameterList d_pl;
390 int d_maxSubspaceDim;
393 std::string d_initType;
395 bool d_relativeConvergence;
398 RCP<OutputManager<ScalarType> > d_outputMan;
399 RCP<OrthoManager<ScalarType,MV> > d_orthoMan;
400 RCP<SortManager<MagnitudeType> > d_sortMan;
401 RCP<StatusTest<ScalarType,MV,OP> > d_tester;
404 std::vector< Value<ScalarType> > d_eigenvalues;
408 std::vector<MagnitudeType> d_resNorms;
414 RCP<MV> d_ritzVecSpace;
416 Teuchos::Array< RCP<const MV> > d_auxVecs;
419 RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > d_VAV;
420 RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > d_VBV;
421 RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > d_S;
422 RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > d_T;
423 RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > d_Q;
424 RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > d_Z;
427 std::vector<MagnitudeType> d_alphar;
428 std::vector<MagnitudeType> d_alphai;
429 std::vector<MagnitudeType> d_betar;
430 std::vector<int> d_ritzIndex;
431 std::vector<int> d_convergedIndices;
432 std::vector<int> d_expansionIndices;
445 std::string d_testSpace;
453 bool d_ritzIndexValid;
454 bool d_ritzVectorsValid;
461 template <
class MagnitudeType,
class MV,
class OP>
466 typedef std::complex<MagnitudeType> ScalarType;
473 Teuchos::ParameterList &pl)
476 MagnitudeType::this_class_is_missing_a_specialization();
487 template <
class ScalarType,
class MV,
class OP>
494 Teuchos::ParameterList &pl )
496 TEUCHOS_TEST_FOR_EXCEPTION( problem == Teuchos::null, std::invalid_argument,
"No Eigenproblem given to solver." );
497 TEUCHOS_TEST_FOR_EXCEPTION( outputman == Teuchos::null, std::invalid_argument,
"No OutputManager given to solver." );
498 TEUCHOS_TEST_FOR_EXCEPTION( orthoman == Teuchos::null, std::invalid_argument,
"No OrthoManager given to solver." );
499 TEUCHOS_TEST_FOR_EXCEPTION( sortman == Teuchos::null, std::invalid_argument,
"No SortManager given to solver." );
500 TEUCHOS_TEST_FOR_EXCEPTION( tester == Teuchos::null, std::invalid_argument,
"No StatusTest given to solver." );
501 TEUCHOS_TEST_FOR_EXCEPTION( !problem->isProblemSet(), std::invalid_argument,
"Problem has not been set." );
505 TEUCHOS_TEST_FOR_EXCEPTION( problem->getA()==Teuchos::null && problem->getOperator()==Teuchos::null,
506 std::invalid_argument,
"Either A or Operator must be non-null on Eigenproblem");
507 d_A = problem->getA()!=Teuchos::null ? problem->getA() : problem->getOperator();
508 d_B = problem->getM();
509 d_P = problem->getPrec();
511 d_outputMan = outputman;
513 d_orthoMan = orthoman;
516 d_NEV = d_problem->getNEV();
517 d_initType = d_pl.get<std::string>(
"Initial Guess",
"Random");
518 d_numToPrint = d_pl.get<
int>(
"Print Number of Ritz Values",-1);
519 d_useLeading = d_pl.get<
bool>(
"Use Leading Vectors",
false);
521 if( d_B != Teuchos::null )
526 if( d_P != Teuchos::null )
531 d_testSpace = d_pl.get<std::string>(
"Test Space",
"V");
532 TEUCHOS_TEST_FOR_EXCEPTION( d_testSpace!=
"V" && d_testSpace!=
"AV" && d_testSpace!=
"BV", std::invalid_argument,
533 "Anasazi::GeneralizedDavidson: Test Space must be V, AV, or BV" );
534 TEUCHOS_TEST_FOR_EXCEPTION( d_testSpace==
"V" ?
false : !d_haveB, std::invalid_argument,
535 "Anasazi::GeneralizedDavidson: Test Space must be V for standard eigenvalue problem" );
538 int blockSize = d_pl.get<
int>(
"Block Size",1);
539 int maxSubDim = d_pl.get<
int>(
"Maximum Subspace Dimension",3*d_NEV*blockSize);
541 d_maxSubspaceDim = -1;
542 setSize( blockSize, maxSubDim );
543 d_relativeConvergence = d_pl.get<
bool>(
"Relative Convergence Tolerance",
false);
546 TEUCHOS_TEST_FOR_EXCEPTION( d_blockSize <= 0, std::invalid_argument,
"Block size must be positive");
547 TEUCHOS_TEST_FOR_EXCEPTION( d_maxSubspaceDim <= 0, std::invalid_argument,
"Maximum Subspace Dimension must be positive" );
548 TEUCHOS_TEST_FOR_EXCEPTION( d_problem->getNEV()+2 > pl.get<
int>(
"Maximum Subspace Dimension"),
549 std::invalid_argument,
"Maximum Subspace Dimension must be strictly greater than NEV");
550 TEUCHOS_TEST_FOR_EXCEPTION( d_maxSubspaceDim > MVT::GetGlobalLength(*problem->getInitVec()),
551 std::invalid_argument,
"Maximum Subspace Dimension cannot exceed problem size");
557 d_ritzIndexValid =
false;
558 d_ritzVectorsValid =
false;
565 template <
class ScalarType,
class MV,
class OP>
571 d_outputMan->stream(
Warnings) <<
"WARNING: GeneralizedDavidson::iterate called without first calling initialize" << std::endl;
572 d_outputMan->stream(
Warnings) <<
" Default initialization will be performed" << std::endl;
577 if( d_outputMan->isVerbosity(
Debug) )
579 currentStatus( d_outputMan->stream(
Debug) );
586 while( d_tester->getStatus() !=
Passed && d_curDim+d_expansionSize <= d_maxSubspaceDim )
596 solveProjectedEigenproblem();
601 int numToSort = std::max(d_blockSize,d_NEV);
602 numToSort = std::min(numToSort,d_curDim);
603 sortProblem( numToSort );
608 if( d_outputMan->isVerbosity(
Debug) )
610 currentStatus( d_outputMan->stream(
Debug) );
622 template <
class ScalarType,
class MV,
class OP>
636 state.
eVals = getRitzValues();
643 template <
class ScalarType,
class MV,
class OP>
646 setSize(blockSize,d_maxSubspaceDim);
652 template <
class ScalarType,
class MV,
class OP>
655 if( blockSize != d_blockSize || maxSubDim != d_maxSubspaceDim )
657 d_blockSize = blockSize;
658 d_maxSubspaceDim = maxSubDim;
659 d_initialized =
false;
661 d_outputMan->stream(
Debug) <<
" >> Anasazi::GeneralizedDavidson: Allocating eigenproblem" 662 <<
" state with block size of " << d_blockSize
663 <<
" and maximum subspace dimension of " << d_maxSubspaceDim << std::endl;
666 d_alphar.resize(d_maxSubspaceDim);
667 d_alphai.resize(d_maxSubspaceDim);
668 d_betar.resize(d_maxSubspaceDim);
671 int msd = d_maxSubspaceDim;
674 RCP<const MV> initVec = d_problem->getInitVec();
677 d_V = MVT::Clone(*initVec, msd);
678 d_AV = MVT::Clone(*initVec, msd);
681 d_VAV = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(msd,msd) );
682 d_S = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(msd,msd) );
683 d_Q = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(msd,msd) );
684 d_Z = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(msd,msd) );
689 d_BV = MVT::Clone(*initVec, msd);
690 d_VBV = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(msd,msd) );
691 d_T = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(msd,msd) );
702 d_R = MVT::Clone(*initVec,std::max(d_blockSize,d_NEV)+1);
703 d_ritzVecSpace = MVT::Clone(*initVec,std::max(d_blockSize,d_NEV)+1);
718 template <
class ScalarType,
class MV,
class OP>
723 d_curDim = (state.
curDim > 0 ? state.
curDim : d_blockSize );
725 d_outputMan->stream(
Debug) <<
" >> Anasazi::GeneralizedDavidson: Initializing state" 726 <<
" with subspace dimension " << d_curDim << std::endl;
729 std::vector<int> initInds(d_curDim);
730 for(
int i=0; i<d_curDim; ++i )
734 RCP<MV> V1 = MVT::CloneViewNonConst(*d_V,initInds);
737 bool reset_V =
false;;
738 if( state.
curDim > 0 && state.
V != Teuchos::null && MVT::GetNumberVecs(*state.
V) >= d_curDim )
741 MVT::SetBlock(*state.
V,initInds,*V1);
745 else if( MVT::GetNumberVecs(*d_problem->getInitVec()) < d_blockSize || d_initType ==
"Random" )
753 RCP<const MV> initVec = MVT::CloneView(*d_problem->getInitVec(),initInds);
754 MVT::SetBlock(*initVec,initInds,*V1);
761 int rank = d_orthoMan->projectAndNormalize( *V1, d_auxVecs );
762 TEUCHOS_TEST_FOR_EXCEPTION( rank < d_blockSize, std::logic_error,
763 "Anasazi::GeneralizedDavidson::initialize(): Error generating initial orthonormal basis" );
766 if( d_outputMan->isVerbosity(
Debug) )
768 d_outputMan->stream(
Debug) <<
" >> Anasazi::GeneralizedDavidson: Error in V^T V == I: " 769 << d_orthoMan->orthonormError( *V1 ) << std::endl;
773 RCP<MV> AV1 = MVT::CloneViewNonConst(*d_AV,initInds);
777 if( !reset_V && state.
AV != Teuchos::null && MVT::GetNumberVecs(*state.
AV) >= d_curDim )
779 if( state.
AV != d_AV )
780 MVT::SetBlock(*state.
AV,initInds,*AV1);
785 OPT::Apply( *d_A, *V1, *AV1 );
786 d_opApplies += MVT::GetNumberVecs( *V1 );
790 Teuchos::SerialDenseMatrix<int,ScalarType> VAV1( Teuchos::View, *d_VAV, d_curDim, d_curDim );
793 if( !reset_V && state.
VAV != Teuchos::null && state.
VAV->numRows() >= d_curDim && state.
VAV->numCols() >= d_curDim )
795 if( state.
VAV != d_VAV )
797 Teuchos::SerialDenseMatrix<int,ScalarType> state_VAV( Teuchos::View, *state.
VAV, d_curDim, d_curDim );
798 VAV1.assign( state_VAV );
804 if( d_testSpace ==
"V" )
806 MVT::MvTransMv( ST::one(), *V1, *AV1, VAV1 );
808 else if( d_testSpace ==
"AV" )
810 MVT::MvTransMv( ST::one(), *AV1, *AV1, VAV1 );
812 else if( d_testSpace ==
"BV" )
814 RCP<MV> BV1 = MVT::CloneViewNonConst(*d_BV,initInds);
815 MVT::MvTransMv( ST::one(), *BV1, *AV1, VAV1 );
822 RCP<MV> BV1 = MVT::CloneViewNonConst(*d_BV,initInds);
826 if( !reset_V && state.
BV != Teuchos::null && MVT::GetNumberVecs(*state.
BV) >= d_curDim )
828 if( state.
BV != d_BV )
829 MVT::SetBlock(*state.
BV,initInds,*BV1);
834 OPT::Apply( *d_B, *V1, *BV1 );
838 Teuchos::SerialDenseMatrix<int,ScalarType> VBV1( Teuchos::View, *d_VBV, d_curDim, d_curDim );
841 if( !reset_V && state.
VBV != Teuchos::null && state.
VBV->numRows() >= d_curDim && state.
VBV->numCols() >= d_curDim )
843 if( state.
VBV != d_VBV )
845 Teuchos::SerialDenseMatrix<int,ScalarType> state_VBV( Teuchos::View, *state.
VBV, d_curDim, d_curDim );
846 VBV1.assign( state_VBV );
852 if( d_testSpace ==
"V" )
854 MVT::MvTransMv( ST::one(), *V1, *BV1, VBV1 );
856 else if( d_testSpace ==
"AV" )
858 MVT::MvTransMv( ST::one(), *AV1, *BV1, VBV1 );
860 else if( d_testSpace ==
"BV" )
862 MVT::MvTransMv( ST::one(), *BV1, *BV1, VBV1 );
868 solveProjectedEigenproblem();
871 int numToSort = std::max(d_blockSize,d_NEV);
872 numToSort = std::min(numToSort,d_curDim);
873 sortProblem( numToSort );
879 d_initialized =
true;
885 template <
class ScalarType,
class MV,
class OP>
895 template <
class ScalarType,
class MV,
class OP>
896 std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>
899 return getResNorms(d_residualSize);
905 template <
class ScalarType,
class MV,
class OP>
906 std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>
909 std::vector<int> resIndices(numWanted);
910 for(
int i=0; i<numWanted; ++i )
913 RCP<const MV> R_checked = MVT::CloneView( *d_R, resIndices );
915 std::vector<MagnitudeType> resNorms;
916 d_orthoMan->norm( *R_checked, resNorms );
924 template <
class ScalarType,
class MV,
class OP>
927 std::vector< Value<ScalarType> > ritzValues;
928 for(
int ival=0; ival<d_curDim; ++ival )
931 thisVal.
realpart = d_alphar[ival] / d_betar[ival];
932 if( d_betar[ival] != MT::zero() )
933 thisVal.
imagpart = d_alphai[ival] / d_betar[ival];
937 ritzValues.push_back( thisVal );
952 template <
class ScalarType,
class MV,
class OP>
954 const Teuchos::Array< RCP<const MV> > &auxVecs )
959 typename Teuchos::Array< RCP<const MV> >::const_iterator arrItr;
961 for( arrItr=auxVecs.begin(); arrItr!=auxVecs.end(); ++arrItr )
963 numAuxVecs += MVT::GetNumberVecs( *(*arrItr) );
966 d_initialized =
false;
972 template <
class ScalarType,
class MV,
class OP>
976 std::vector<MagnitudeType> realRitz(d_curDim), imagRitz(d_curDim);
977 std::vector< Value<ScalarType> > ritzVals = getRitzValues();
978 for(
int i=0; i<d_curDim; ++i )
980 realRitz[i] = ritzVals[i].realpart;
981 imagRitz[i] = ritzVals[i].imagpart;
984 std::vector<int> permVec;
985 sortValues( realRitz, imagRitz, permVec, d_curDim );
987 std::vector<int> sel(d_curDim,0);
988 for(
int ii=0; ii<numWanted; ++ii )
989 sel[ permVec[ii] ]=1;
996 int work_size=10*d_maxSubspaceDim+16;
997 std::vector<ScalarType> work(work_size);
1003 Teuchos::LAPACK<int,ScalarType> lapack;
1004 lapack.TGSEN( ijob, wantq, wantz, &sel[0], d_curDim, d_S->values(), d_S->stride(), d_T->values(), d_T->stride(),
1005 &d_alphar[0], &d_alphai[0], &d_betar[0], d_Q->values(), d_Q->stride(), d_Z->values(), d_Z->stride(),
1006 &sdim, 0, 0, 0, &work[0], work_size, &iwork, iwork_size, &info );
1008 d_ritzIndexValid =
false;
1009 d_ritzVectorsValid =
false;
1011 std::stringstream ss;
1012 ss <<
"Anasazi::GeneralizedDavidson: TGSEN returned error code " << info << std::endl;
1013 TEUCHOS_TEST_FOR_EXCEPTION( info<0, std::runtime_error, ss.str() );
1019 d_outputMan->stream(
Warnings) <<
"WARNING: " << ss.str() << std::endl;
1020 d_outputMan->stream(
Warnings) <<
" Problem may not be correctly sorted" << std::endl;
1024 char getCondNum =
'N';
1027 int work_size = d_curDim;
1028 std::vector<ScalarType> work(work_size);
1033 Teuchos::LAPACK<int,ScalarType> lapack;
1034 lapack.TRSEN (getCondNum, getQ, &sel[0], d_curDim, d_S->values (),
1035 d_S->stride (), d_Z->values (), d_Z->stride (),
1036 &d_alphar[0], &d_alphai[0], &subDim, 0, 0, &work[0],
1037 work_size, &iwork, iwork_size, &info );
1039 std::fill( d_betar.begin(), d_betar.end(), ST::one() );
1041 d_ritzIndexValid =
false;
1042 d_ritzVectorsValid =
false;
1044 TEUCHOS_TEST_FOR_EXCEPTION(
1045 info < 0, std::runtime_error,
"Anasazi::GeneralizedDavidson::" 1046 "sortProblem: LAPACK routine TRSEN returned error code INFO = " 1047 << info <<
" < 0. This indicates that argument " << -info
1048 <<
" (counting starts with one) of TRSEN had an illegal value.");
1054 TEUCHOS_TEST_FOR_EXCEPTION(
1055 info == 1, std::runtime_error,
"Anasazi::GeneralizedDavidson::" 1056 "sortProblem: LAPACK routine TRSEN returned error code INFO = 1. " 1057 "This indicates that the reordering failed because some eigenvalues " 1058 "are too close to separate (the problem is very ill-conditioned).");
1060 TEUCHOS_TEST_FOR_EXCEPTION(
1061 info > 1, std::logic_error,
"Anasazi::GeneralizedDavidson::" 1062 "sortProblem: LAPACK routine TRSEN returned error code INFO = " 1063 << info <<
" > 1. This should not be possible. It may indicate an " 1064 "error either in LAPACK itself, or in Teuchos' LAPACK wrapper.");
1076 template <
class ScalarType,
class MV,
class OP>
1081 std::vector<int> newIndices(d_expansionSize);
1082 for(
int i=0; i<d_expansionSize; ++i )
1084 newIndices[i] = d_curDim+i;
1088 std::vector<int> curIndices(d_curDim);
1089 for(
int i=0; i<d_curDim; ++i )
1093 RCP<MV> V_new = MVT::CloneViewNonConst( *d_V, newIndices);
1094 RCP<const MV> V_cur = MVT::CloneView( *d_V, curIndices);
1095 RCP<const MV> R_active = MVT::CloneView( *d_R, d_expansionIndices);
1100 OPT::Apply( *d_P, *R_active, *V_new );
1105 MVT::SetBlock( *R_active, newIndices, *d_V );
1109 Teuchos::Array< RCP<const MV> > against = d_auxVecs;
1110 against.push_back( V_cur );
1111 int rank = d_orthoMan->projectAndNormalize(*V_new,against);
1113 if( d_outputMan->isVerbosity(
Debug) )
1115 std::vector<int> allIndices(d_curDim+d_expansionSize);
1116 for(
int i=0; i<d_curDim+d_expansionSize; ++i )
1119 RCP<const MV> V_all = MVT::CloneView( *d_V, allIndices );
1121 d_outputMan->stream(
Debug) <<
" >> Anasazi::GeneralizedDavidson: Error in V^T V == I: " 1122 << d_orthoMan->orthonormError( *V_all ) << std::endl;
1125 TEUCHOS_TEST_FOR_EXCEPTION( rank != d_expansionSize, std::runtime_error,
1126 "Anasazi::GeneralizedDavidson::ExpandSearchSpace(): Orthonormalization of new vectors failed" );
1133 template <
class ScalarType,
class MV,
class OP>
1137 std::vector<int> newIndices(d_expansionSize);
1138 for(
int i=0; i<d_expansionSize; ++i )
1139 newIndices[i] = d_curDim+i;
1142 RCP<const MV> V_new = MVT::CloneView( *d_V, newIndices );
1143 RCP<MV> AV_new = MVT::CloneViewNonConst( *d_AV, newIndices );
1146 OPT::Apply( *d_A, *V_new, *AV_new );
1147 d_opApplies += MVT::GetNumberVecs( *V_new );
1152 RCP<MV> BV_new = MVT::CloneViewNonConst( *d_BV, newIndices );
1153 OPT::Apply( *d_B, *V_new, *BV_new );
1160 template <
class ScalarType,
class MV,
class OP>
1164 std::vector<int> newIndices(d_expansionSize);
1165 for(
int i=0; i<d_expansionSize; ++i )
1166 newIndices[i] = d_curDim+i;
1168 std::vector<int> curIndices(d_curDim);
1169 for(
int i=0; i<d_curDim; ++i )
1172 std::vector<int> allIndices(d_curDim+d_expansionSize);
1173 for(
int i=0; i<d_curDim+d_expansionSize; ++i )
1177 RCP<const MV> W_new, W_all;
1178 if( d_testSpace ==
"V" )
1180 W_new = MVT::CloneView(*d_V, newIndices );
1181 W_all = MVT::CloneView(*d_V, allIndices );
1183 else if( d_testSpace ==
"AV" )
1185 W_new = MVT::CloneView(*d_AV, newIndices );
1186 W_all = MVT::CloneView(*d_AV, allIndices );
1188 else if( d_testSpace ==
"BV" )
1190 W_new = MVT::CloneView(*d_BV, newIndices );
1191 W_all = MVT::CloneView(*d_BV, allIndices );
1195 RCP<const MV> AV_new = MVT::CloneView(*d_AV, newIndices);
1196 RCP<const MV> AV_current = MVT::CloneView(*d_AV, curIndices);
1199 Teuchos::SerialDenseMatrix<int,ScalarType> VAV_lastrow( Teuchos::View, *d_VAV, d_expansionSize, d_curDim, d_curDim, 0 );
1200 MVT::MvTransMv( ST::one(), *W_new, *AV_current, VAV_lastrow );
1203 Teuchos::SerialDenseMatrix<int,ScalarType> VAV_lastcol( Teuchos::View, *d_VAV, d_curDim+d_expansionSize, d_expansionSize, 0, d_curDim );
1204 MVT::MvTransMv( ST::one(), *W_all, *AV_new, VAV_lastcol );
1209 RCP<const MV> BV_new = MVT::CloneView(*d_BV, newIndices);
1210 RCP<const MV> BV_current = MVT::CloneView(*d_BV, curIndices);
1213 Teuchos::SerialDenseMatrix<int,ScalarType> VBV_lastrow( Teuchos::View, *d_VBV, d_expansionSize, d_curDim, d_curDim, 0 );
1214 MVT::MvTransMv( ST::one(), *W_new, *BV_current, VBV_lastrow );
1217 Teuchos::SerialDenseMatrix<int,ScalarType> VBV_lastcol( Teuchos::View, *d_VBV, d_curDim+d_expansionSize, d_expansionSize, 0, d_curDim );
1218 MVT::MvTransMv( ST::one(), *W_all, *BV_new, VBV_lastcol );
1222 d_curDim += d_expansionSize;
1224 d_ritzIndexValid =
false;
1225 d_ritzVectorsValid =
false;
1231 template <
class ScalarType,
class MV,
class OP>
1239 d_S->assign(*d_VAV);
1240 d_T->assign(*d_VBV);
1243 char leftVecs =
'V';
1244 char rightVecs =
'V';
1245 char sortVals =
'N';
1248 Teuchos::LAPACK<int,ScalarType> lapack;
1252 std::vector<ScalarType> work(1);
1253 lapack.GGES( leftVecs, rightVecs, sortVals, NULL, d_curDim, d_S->values(), d_S->stride(),
1254 d_T->values(), d_T->stride(), &sdim, &d_alphar[0], &d_alphai[0], &d_betar[0],
1255 d_Q->values(), d_Q->stride(), d_Z->values(), d_Z->stride(), &work[0], work_size, 0, &info );
1257 work_size = work[0];
1258 work.resize(work_size);
1259 lapack.GGES( leftVecs, rightVecs, sortVals, NULL, d_curDim, d_S->values(), d_S->stride(),
1260 d_T->values(), d_T->stride(), &sdim, &d_alphar[0], &d_alphai[0], &d_betar[0],
1261 d_Q->values(), d_Q->stride(), d_Z->values(), d_Z->stride(), &work[0], work_size, 0, &info );
1263 d_ritzIndexValid =
false;
1264 d_ritzVectorsValid =
false;
1266 std::stringstream ss;
1267 ss <<
"Anasazi::GeneralizedDavidson: GGES returned error code " << info << std::endl;
1268 TEUCHOS_TEST_FOR_EXCEPTION( info!=0, std::runtime_error, ss.str() );
1274 d_S->assign(*d_VAV);
1279 int work_size = 3*d_curDim;
1280 std::vector<ScalarType> work(work_size);
1283 Teuchos::LAPACK<int,ScalarType> lapack;
1284 lapack.GEES( vecs, d_curDim, d_S->values(), d_S->stride(), &sdim, &d_alphar[0], &d_alphai[0],
1285 d_Z->values(), d_Z->stride(), &work[0], work_size, 0, 0, &info);
1287 std::fill( d_betar.begin(), d_betar.end(), ST::one() );
1289 d_ritzIndexValid =
false;
1290 d_ritzVectorsValid =
false;
1292 std::stringstream ss;
1293 ss <<
"Anasazi::GeneralizedDavidson: GEES returned error code " << info << std::endl;
1294 TEUCHOS_TEST_FOR_EXCEPTION( info!=0, std::runtime_error, ss.str() );
1306 template <
class ScalarType,
class MV,
class OP>
1309 if( d_ritzIndexValid )
1312 d_ritzIndex.resize( d_curDim );
1314 while( i < d_curDim )
1316 if( d_alphai[i] == ST::zero() )
1324 d_ritzIndex[i+1] = -1;
1328 d_ritzIndexValid =
true;
1339 template <
class ScalarType,
class MV,
class OP>
1342 if( d_ritzVectorsValid )
1349 std::vector<int> checkedIndices(d_residualSize);
1350 for(
int ii=0; ii<d_residualSize; ++ii )
1351 checkedIndices[ii] = ii;
1354 Teuchos::SerialDenseMatrix<int,ScalarType> X(Teuchos::Copy,*d_Z,d_curDim,d_curDim);
1355 computeProjectedEigenvectors( X );
1358 Teuchos::SerialDenseMatrix<int,ScalarType> X_wanted(Teuchos::View,X,d_curDim,d_residualSize);
1361 d_ritzVecs = MVT::CloneViewNonConst( *d_ritzVecSpace, checkedIndices );
1363 std::vector<int> curIndices(d_curDim);
1364 for(
int i=0; i<d_curDim; ++i )
1367 RCP<const MV> V_current = MVT::CloneView( *d_V, curIndices );
1370 MVT::MvTimesMatAddMv(ST::one(),*V_current,X_wanted,ST::zero(),*d_ritzVecs);
1373 std::vector<MagnitudeType> scale(d_residualSize);
1374 MVT::MvNorm( *d_ritzVecs, scale );
1375 Teuchos::LAPACK<int,ScalarType> lapack;
1376 for(
int i=0; i<d_residualSize; ++i )
1378 if( d_ritzIndex[i] == 0 )
1380 scale[i] = 1.0/scale[i];
1382 else if( d_ritzIndex[i] == 1 )
1384 MagnitudeType nrm = lapack.LAPY2(scale[i],scale[i+1]);
1386 scale[i+1] = 1.0/nrm;
1389 MVT::MvScale( *d_ritzVecs, scale );
1391 d_ritzVectorsValid =
true;
1398 template <
class ScalarType,
class MV,
class OP>
1400 std::vector<MagnitudeType> &imagParts,
1401 std::vector<int> &permVec,
1406 TEUCHOS_TEST_FOR_EXCEPTION( (
int) realParts.size()<N, std::runtime_error,
1407 "Anasazi::GeneralizedDavidson::SortValues: Number of requested sorted values greater than vector length." );
1408 TEUCHOS_TEST_FOR_EXCEPTION( (
int) imagParts.size()<N, std::runtime_error,
1409 "Anasazi::GeneralizedDavidson::SortValues: Number of requested sorted values greater than vector length." );
1411 RCP< std::vector<int> > rcpPermVec = Teuchos::rcpFromRef(permVec);
1413 d_sortMan->sort( realParts, imagParts, rcpPermVec, N );
1415 d_ritzIndexValid =
false;
1416 d_ritzVectorsValid =
false;
1430 template <
class ScalarType,
class MV,
class OP>
1432 Teuchos::SerialDenseMatrix<int,ScalarType> &X )
1434 int N = X.numRows();
1437 Teuchos::SerialDenseMatrix<int,ScalarType>
S(Teuchos::Copy, *d_S, N, N);
1438 Teuchos::SerialDenseMatrix<int,ScalarType>
T(Teuchos::Copy, *d_T, N, N);
1439 Teuchos::SerialDenseMatrix<int,ScalarType> VL(Teuchos::Copy, *d_Q, N, N);
1441 char whichVecs =
'R';
1443 int work_size = 6*d_maxSubspaceDim;
1444 std::vector<ScalarType> work(work_size,ST::zero());
1448 Teuchos::LAPACK<int,ScalarType> lapack;
1449 lapack.TGEVC( whichVecs, howMany, 0, N, S.values(), S.stride(), T.values(), T.stride(),
1450 VL.values(), VL.stride(), X.values(), X.stride(), N, &M, &work[0], &info );
1452 std::stringstream ss;
1453 ss <<
"Anasazi::GeneralizedDavidson: TGEVC returned error code " << info << std::endl;
1454 TEUCHOS_TEST_FOR_EXCEPTION( info!=0, std::runtime_error, ss.str() );
1458 Teuchos::SerialDenseMatrix<int,ScalarType>
S(Teuchos::Copy, *d_S, N, N);
1459 Teuchos::SerialDenseMatrix<int,ScalarType> VL(Teuchos::Copy, *d_Z, N, N);
1461 char whichVecs =
'R';
1464 std::vector<ScalarType> work(3*N);
1468 Teuchos::LAPACK<int,ScalarType> lapack;
1470 lapack.TREVC( whichVecs, howMany, &sel, N, S.values(), S.stride(), VL.values(), VL.stride(),
1471 X.values(), X.stride(), N, &m, &work[0], &info );
1473 std::stringstream ss;
1474 ss <<
"Anasazi::GeneralizedDavidson: TREVC returned error code " << info << std::endl;
1475 TEUCHOS_TEST_FOR_EXCEPTION( info!=0, std::runtime_error, ss.str() );
1482 template <
class ScalarType,
class MV,
class OP>
1484 const Teuchos::SerialDenseMatrix<int,ScalarType> &X,
1485 Teuchos::SerialDenseMatrix<int,ScalarType> &X_alpha,
1486 Teuchos::SerialDenseMatrix<int,ScalarType> &X_beta )
1488 int Nr = X.numRows();
1489 int Nc = X.numCols();
1491 TEUCHOS_TEST_FOR_EXCEPTION( Nr>d_curDim, std::logic_error,
1492 "Anasazi::GeneralizedDavidson::ScaleEigenvectors: Matrix size exceeds current dimension");
1493 TEUCHOS_TEST_FOR_EXCEPTION( Nc>d_curDim, std::logic_error,
1494 "Anasazi::GeneralizedDavidson::ScaleEigenvectors: Matrix size exceeds current dimension");
1495 TEUCHOS_TEST_FOR_EXCEPTION( X_alpha.numRows()!=Nr, std::logic_error,
1496 "Anasazi::GeneralizedDavidson::ScaleEigenvectors: number of rows in Xalpha does not match X");
1497 TEUCHOS_TEST_FOR_EXCEPTION( X_alpha.numCols()!=Nc, std::logic_error,
1498 "Anasazi::GeneralizedDavidson::ScaleEigenvectors: number of cols in Xalpha does not match X");
1499 TEUCHOS_TEST_FOR_EXCEPTION( X_beta.numRows()!=Nr, std::logic_error,
1500 "Anasazi::GeneralizedDavidson::ScaleEigenvectors: number of rows in Xbeta does not match X");
1501 TEUCHOS_TEST_FOR_EXCEPTION( X_beta.numCols()!=Nc, std::logic_error,
1502 "Anasazi::GeneralizedDavidson::ScaleEigenvectors: number of cols in Xbeta does not match X");
1506 Teuchos::SerialDenseMatrix<int,ScalarType> Alpha(Nc,Nc,
true);
1507 Teuchos::SerialDenseMatrix<int,ScalarType> Beta(Nc,Nc,
true);
1511 for(
int i=0; i<Nc; ++i )
1513 if( d_ritzIndex[i] == 0 )
1515 Alpha(i,i) = d_alphar[i];
1516 Beta(i,i) = d_betar[i];
1518 else if( d_ritzIndex[i] == 1 )
1520 Alpha(i,i) = d_alphar[i];
1521 Alpha(i,i+1) = d_alphai[i];
1522 Beta(i,i) = d_betar[i];
1526 Alpha(i,i-1) = d_alphai[i];
1527 Alpha(i,i) = d_alphar[i];
1528 Beta(i,i) = d_betar[i];
1535 err = X_alpha.multiply( Teuchos::NO_TRANS, Teuchos::NO_TRANS, ST::one(), X, Alpha, ST::zero() );
1536 std::stringstream astream;
1537 astream <<
"GeneralizedDavidson::ScaleEigenvectors: multiply returned error code " << err;
1538 TEUCHOS_TEST_FOR_EXCEPTION( err!=0, std::runtime_error, astream.str() );
1541 err = X_beta.multiply( Teuchos::NO_TRANS, Teuchos::NO_TRANS, ST::one(), X, Beta, ST::zero() );
1542 std::stringstream bstream;
1543 bstream <<
"GeneralizedDavidson::ScaleEigenvectors: multiply returned error code " << err;
1544 TEUCHOS_TEST_FOR_EXCEPTION( err!=0, std::runtime_error, bstream.str() );
1550 template <
class ScalarType,
class MV,
class OP>
1556 d_residualSize = std::max( d_blockSize, d_NEV );
1557 if( d_curDim < d_residualSize )
1559 d_residualSize = d_curDim;
1561 else if( d_ritzIndex[d_residualSize-1] == 1 )
1567 std::vector<int> residualIndices(d_residualSize);
1568 for(
int i=0; i<d_residualSize; ++i )
1569 residualIndices[i] = i;
1572 Teuchos::SerialDenseMatrix<int,ScalarType> X(Teuchos::Copy,*d_Z,d_curDim,d_curDim);
1575 computeProjectedEigenvectors( X );
1578 Teuchos::SerialDenseMatrix<int,ScalarType> X_alpha(d_curDim,d_residualSize);
1579 Teuchos::SerialDenseMatrix<int,ScalarType> X_beta(d_curDim,d_residualSize);
1582 Teuchos::SerialDenseMatrix<int,ScalarType> X_wanted(Teuchos::View, X, d_curDim, d_residualSize);
1585 scaleEigenvectors( X_wanted, X_alpha, X_beta );
1588 RCP<MV> R_active = MVT::CloneViewNonConst( *d_R, residualIndices );
1591 std::vector<int> activeIndices(d_curDim);
1592 for(
int i=0; i<d_curDim; ++i )
1596 RCP<const MV> AV_active = MVT::CloneView( *d_AV, activeIndices );
1597 MVT::MvTimesMatAddMv(ST::one(),*AV_active, X_beta, ST::zero(),*R_active);
1601 RCP<const MV> BV_active = MVT::CloneView( *d_BV, activeIndices );
1602 MVT::MvTimesMatAddMv(ST::one(),*BV_active, X_alpha,-ST::one(), *R_active);
1606 RCP<const MV> V_active = MVT::CloneView( *d_V, activeIndices );
1607 MVT::MvTimesMatAddMv(ST::one(),*V_active, X_alpha,-ST::one(), *R_active);
1622 Teuchos::LAPACK<int,ScalarType> lapack;
1623 Teuchos::BLAS<int,ScalarType> blas;
1624 std::vector<MagnitudeType> resScaling(d_residualSize);
1625 for(
int icol=0; icol<d_residualSize; ++icol )
1627 if( d_ritzIndex[icol] == 0 )
1629 MagnitudeType Xnrm = blas.NRM2( d_curDim, X_wanted[icol], 1);
1630 MagnitudeType ABscaling = d_relativeConvergence ? d_alphar[icol] : d_betar[icol];
1631 resScaling[icol] = MT::one() / (Xnrm * ABscaling);
1633 else if( d_ritzIndex[icol] == 1 )
1635 MagnitudeType Xnrm1 = blas.NRM2( d_curDim, X_wanted[icol], 1 );
1636 MagnitudeType Xnrm2 = blas.NRM2( d_curDim, X_wanted[icol+1], 1 );
1637 MagnitudeType Xnrm = lapack.LAPY2(Xnrm1,Xnrm2);
1638 MagnitudeType ABscaling = d_relativeConvergence ? lapack.LAPY2(d_alphar[icol],d_alphai[icol])
1640 resScaling[icol] = MT::one() / (Xnrm * ABscaling);
1641 resScaling[icol+1] = MT::one() / (Xnrm * ABscaling);
1644 MVT::MvScale( *R_active, resScaling );
1647 d_resNorms.resize(d_residualSize);
1648 MVT::MvNorm(*R_active,d_resNorms);
1655 for(
int i=0; i<d_residualSize; ++i )
1657 if( d_ritzIndex[i] == 1 )
1659 MagnitudeType nrm = lapack.LAPY2(d_resNorms[i],d_resNorms[i+1]);
1660 d_resNorms[i] = nrm;
1661 d_resNorms[i+1] = nrm;
1666 d_tester->checkStatus(
this);
1669 if( d_useLeading || d_blockSize >= d_NEV )
1671 d_expansionSize=d_blockSize;
1672 if( d_ritzIndex[d_blockSize-1]==1 )
1675 d_expansionIndices.resize(d_expansionSize);
1676 for(
int i=0; i<d_expansionSize; ++i )
1677 d_expansionIndices[i] = i;
1681 std::vector<int> convergedVectors = d_tester->whichVecs();
1685 for( startVec=0; startVec<d_residualSize; ++startVec )
1687 if( std::find(convergedVectors.begin(),convergedVectors.end(),startVec)==convergedVectors.end() )
1693 int endVec = startVec + d_blockSize - 1;
1694 if( endVec > (d_residualSize-1) )
1696 endVec = d_residualSize-1;
1697 startVec = d_residualSize-d_blockSize;
1701 if( d_ritzIndex[startVec]==-1 )
1707 if( d_ritzIndex[endVec]==1 )
1710 d_expansionSize = 1+endVec-startVec;
1711 d_expansionIndices.resize(d_expansionSize);
1712 for(
int i=0; i<d_expansionSize; ++i )
1713 d_expansionIndices[i] = startVec+i;
1720 template <
class ScalarType,
class MV,
class OP>
1725 myout.setf(std::ios::scientific, std::ios::floatfield);
1728 myout <<
"================================================================================" << endl;
1730 myout <<
" GeneralizedDavidson Solver Solver Status" << endl;
1732 myout <<
"The solver is "<<(d_initialized ?
"initialized." :
"not initialized.") << endl;
1733 myout <<
"The number of iterations performed is " << d_iteration << endl;
1734 myout <<
"The number of operator applies performed is " << d_opApplies << endl;
1735 myout <<
"The block size is " << d_expansionSize << endl;
1736 myout <<
"The current basis size is " << d_curDim << endl;
1737 myout <<
"The number of requested eigenvalues is " << d_NEV << endl;
1738 myout <<
"The number of converged values is " << d_tester->howMany() << endl;
1741 myout.setf(std::ios_base::right, std::ios_base::adjustfield);
1745 myout <<
"CURRENT RITZ VALUES" << endl;
1747 myout << std::setw(24) <<
"Ritz Value" 1748 << std::setw(30) <<
"Residual Norm" << endl;
1749 myout <<
"--------------------------------------------------------------------------------" << endl;
1750 if( d_residualSize > 0 )
1752 std::vector<MagnitudeType> realRitz(d_curDim), imagRitz(d_curDim);
1753 std::vector< Value<ScalarType> > ritzVals = getRitzValues();
1754 for(
int i=0; i<d_curDim; ++i )
1756 realRitz[i] = ritzVals[i].realpart;
1757 imagRitz[i] = ritzVals[i].imagpart;
1759 std::vector<int> permvec;
1760 sortValues( realRitz, imagRitz, permvec, d_curDim );
1762 int numToPrint = std::max( d_numToPrint, d_NEV );
1763 numToPrint = std::min( d_curDim, numToPrint );
1770 if( d_ritzIndex[permvec[numToPrint-1]] != 0 )
1774 while( i<numToPrint )
1776 if( imagRitz[i] == ST::zero() )
1778 myout << std::setw(15) << realRitz[i];
1779 myout <<
" + i" << std::setw(15) << ST::magnitude( imagRitz[i] );
1780 if( i < d_residualSize )
1781 myout << std::setw(20) << d_resNorms[permvec[i]] << endl;
1783 myout <<
" Not Computed" << endl;
1790 myout << std::setw(15) << realRitz[i];
1791 myout <<
" + i" << std::setw(15) << ST::magnitude( imagRitz[i] );
1792 if( i < d_residualSize )
1793 myout << std::setw(20) << d_resNorms[permvec[i]] << endl;
1795 myout <<
" Not Computed" << endl;
1798 myout << std::setw(15) << realRitz[i];
1799 myout <<
" - i" << std::setw(15) << ST::magnitude( imagRitz[i] );
1800 if( i < d_residualSize )
1801 myout << std::setw(20) << d_resNorms[permvec[i]] << endl;
1803 myout <<
" Not Computed" << endl;
1811 myout << std::setw(20) <<
"[ NONE COMPUTED ]" << endl;
1815 myout <<
"================================================================================" << endl;
1821 #endif // ANASAZI_GENERALIZED_DAVIDSON_HPP void sortProblem(int numWanted)
void setStatusTest(RCP< StatusTest< ScalarType, MV, OP > > tester)
Set status test.
RCP< MV > V
Orthonormal basis for search subspace.
RCP< MV > AV
Image of V under A.
std::vector< MagnitudeType > getRitzRes2Norms()
Get the current Ritz residual norms (2-norm)
RCP< StatusTest< ScalarType, MV, OP > > getStatusTest() const
Get status test.
Teuchos::ScalarTraits< ScalarType >::magnitudeType imagpart
The imaginary component of the eigenvalue.
This class defines the interface required by an eigensolver and status test class to compute solution...
int getBlockSize() const
Get block size.
Solves eigenvalue problem using generalized Davidson method.
std::vector< Value< ScalarType > > getRitzValues()
Get the current Ritz values.
RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > T
Right quasi upper triangular matrix from QZ decomposition of (VAV,VBV)
Virtual base class which defines basic traits for the operator type.
GeneralizedDavidsonState< ScalarType, MV > getState()
Get the current state of the eigensolver.
RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > VAV
Projection of A onto V.
void setBlockSize(int blockSize)
Set block size.
int curDim
The current subspace dimension.
std::vector< int > getRitzIndex()
Get the current Ritz index vector.
const Eigenproblem< ScalarType, MV, OP > & getProblem() const
Get eigenproblem.
Pure virtual base class which describes the basic interface to the iterative eigensolver.
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package...
void iterate()
Solves the eigenvalue problem.
std::vector< MagnitudeType > getRes2Norms()
Get the current residual norms (2-norm)
RCP< MV > BV
Image of V under B.
Structure to contain pointers to GeneralizedDavidson state variables.
Abstract class definition for Anasazi Output Managers.
std::vector< Value< ScalarType > > eVals
Vector of generalized eigenvalues.
void setSize(int blockSize, int maxSubDim)
Set problem size.
Abstract base class which defines the interface required by an eigensolver and status test class to c...
Output managers remove the need for the eigensolver to know any information about the required output...
Teuchos::Array< RCP< const MV > > getAuxVecs() const
Get the auxilliary vectors.
std::vector< MagnitudeType > getResNorms()
Get the current residual norms (w.r.t. norm defined by OrthoManager)
Templated virtual class for providing orthogonalization/orthonormalization methods.
RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Q
Left generalized Schur vectors from QZ decomposition of (VAV,VBV)
Traits class which defines basic operations on multivectors.
This struct is used for storing eigenvalues and Ritz values, as a pair of real values.
Anasazi header file which uses auto-configuration information to include necessary C++ headers...
Virtual base class which defines the interface between an eigensolver and a class whose job is the so...
bool isInitialized() const
Query if the solver is in an initialized state.
GeneralizedDavidson(const RCP< Eigenproblem< ScalarType, MV, OP > > &problem, const RCP< SortManager< MagnitudeType > > &sortman, const RCP< OutputManager< ScalarType > > &outputman, const RCP< StatusTest< ScalarType, MV, OP > > &tester, const RCP< OrthoManager< ScalarType, MV > > &orthoman, Teuchos::ParameterList &pl)
Constructor.
int getCurSubspaceDim() const
Get current subspace dimension.
RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > S
Left quasi upper triangular matrix from QZ decomposition of (VAV,VBV)
RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > VBV
Projection of B onto V.
void initialize()
Initialize the eigenvalue problem.
int getNumIters() const
Get number of iterations.
RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > Z
Right generalized Schur vectors from QZ decomposition of (VAV,VBV)
void setAuxVecs(const Teuchos::Array< RCP< const MV > > &auxVecs)
Set auxilliary vectors.
Types and exceptions used within Anasazi solvers and interfaces.
Anasazi's templated virtual class for providing routines for orthogonalization and orthonormalization...
Anasazi's templated pure virtual class for managing the sorting of approximate eigenvalues computed b...
RCP< const MV > getRitzVectors()
Get the current Ritz vectors.
void currentStatus(std::ostream &myout)
Print current status of solver.
Teuchos::ScalarTraits< ScalarType >::magnitudeType realpart
The real component of the eigenvalue.
Common interface of stopping criteria for Anasazi's solvers.
std::vector< int > getBlockIndex() const
Get indices of current block.
The Eigensolver is a templated virtual base class that defines the basic interface that any eigensolv...
int getMaxSubspaceDim() const
Get maximum subspace dimension.
Declaration and definition of Anasazi::StatusTest.
void resetNumIters()
Reset the number of iterations.