14 #ifndef ANASAZI_TRACEMIN_DAVIDSON_HPP
15 #define ANASAZI_TRACEMIN_DAVIDSON_HPP
31 namespace Experimental {
47 template <
class ScalarType,
class MV,
class OP>
94 template <
class ScalarType,
class MV,
class OP>
103 TraceMinBase<ScalarType,MV,OP>(problem,sorter,printer,tester,ortho,params)
113 template <
class ScalarType,
class MV,
class OP>
118 "Anasazi::TraceMinDavidson::addToBasis(): Delta does not have blockSize_ columns");
122 std::vector<int> curind(this->curDim_), newind(this->blockSize_);
129 for(
int i=0; i<this->curDim_; i++)
131 lclV = MVT::CloneViewNonConst(*this->V_,curind);
135 for (
int i=0; i<this->blockSize_; ++i)
136 newind[i] = this->curDim_ + i;
137 lclV = MVT::CloneViewNonConst(*this->V_,newind);
140 MVT::SetBlock(*Delta,newind,*this->V_);
141 this->curDim_ += this->blockSize_;
148 lclMV = MVT::CloneViewNonConst(*this->MV_,curind);
152 lclMV = MVT::CloneViewNonConst(*this->MV_,newind);
154 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
157 this->count_ApplyM_+= this->blockSize_;
158 OPT::Apply(*this->MOp_,*lclV,*lclMV);
162 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
167 rank = this->orthman_->projectAndNormalizeMat(*lclV,projVecs,
169 Teuchos::null,lclMV,MprojVecs);
176 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
181 rank = this->orthman_->projectAndNormalizeMat(*lclV,projVecs);
187 "Anasazi::TraceMinDavidson::addToBasis(): Couldn't generate basis of full rank.");
190 if(this->Op_ != Teuchos::null)
192 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
195 this->count_ApplyOp_+= this->blockSize_;
197 lclKV = MVT::CloneViewNonConst(*this->KV_,newind);
198 OPT::Apply(*this->Op_,*lclV,*lclKV);
209 template <
class ScalarType,
class MV,
class OP>
214 "Anasazi::TraceMinDavidson::addToBasis(): Delta does not have blockSize_ columns");
218 std::vector<int> curind(this->curDim_), newind(this->blockSize_);
224 for(
int i=0; i<this->curDim_; i++)
226 projVecs = MVT::CloneViewNonConst(*this->V_,curind);
228 if(this->Op_ != Teuchos::null)
230 lclKV = MVT::CloneViewNonConst(*this->KV_,curind);
235 for (
int i=0; i<this->blockSize_; ++i)
236 newind[i] = this->curDim_ + i;
237 lclV = MVT::CloneViewNonConst(*this->V_,newind);
240 MVT::SetBlock(*Delta,newind,*this->V_);
241 this->curDim_ += this->blockSize_;
244 if(this->auxVecs_.size() > 0)
245 this->orthman_->projectMat(*lclV,this->auxVecs_);
248 if(this->Op_ != Teuchos::null)
250 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
253 this->count_ApplyOp_+= this->blockSize_;
255 lclKV = MVT::CloneViewNonConst(*this->KV_,newind);
256 OPT::Apply(*this->Op_,*lclV,*lclKV);
262 int nauxVecs = MVT::GetNumberVecs(*projVecs);
265 this->orthman_->innerProdMat(*KprojVecs,*lclKV,*gamma);
268 MVT::MvTimesMatAddMv(-this->ONE,*KprojVecs,*gamma,this->ONE,*lclKV);
271 MVT::MvTimesMatAddMv(-this->ONE,*projVecs,*gamma,this->ONE,*lclV);
275 rank = this->orthman_->normalizeMat(*lclKV,gamma2);
281 RCP<MV> tempMV = MVT::CloneCopy(*lclV);
282 MVT::MvTimesMatAddMv(this->ONE,*tempMV,*gamma2,this->ZERO,*lclV);
285 "Anasazi::TraceMinDavidson::addToBasis(): Couldn't generate basis of full rank.");
290 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR
293 this->count_ApplyM_+= this->blockSize_;
295 lclMV = MVT::CloneViewNonConst(*this->MV_,newind);
296 OPT::Apply(*this->MOp_,*lclV,*lclMV);
Abstract base class for trace minimization eigensolvers.
Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based ...
This class defines the interface required by an eigensolver and status test class to compute solution...
Declaration of basic traits for the multivector type.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Virtual base class which defines basic traits for the operator type.
Pure virtual base class which describes the basic interface to the iterative eigensolver.
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)
Output managers remove the need for the eigensolver to know any information about the required output...
TraceMinDavidson(const Teuchos::RCP< Eigenproblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< SortManager< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > > &sorter, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &tester, const Teuchos::RCP< MatOrthoManager< ScalarType, MV, OP > > &ortho, Teuchos::ParameterList ¶ms)
TraceMinBase constructor with eigenproblem, solver utilities, and parameter list of solver options...
Traits class which defines basic operations on multivectors.
Virtual base class which defines basic traits for the operator type.
Anasazi header file which uses auto-configuration information to include necessary C++ headers...
void push_back(const value_type &x)
This class implements a TraceMin-Davidson iteration for solving symmetric generalized eigenvalue prob...
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.
int setMatrix(const RCP< SerialDenseMatrix< OrdinalType, ScalarType > > &A)