33 #ifndef ANASAZI_TRACEMIN_HPP 34 #define ANASAZI_TRACEMIN_HPP 40 #include "Epetra_Operator.h" 45 #include "Teuchos_ScalarTraits.hpp" 50 #include "Teuchos_LAPACK.hpp" 51 #include "Teuchos_BLAS.hpp" 52 #include "Teuchos_SerialDenseMatrix.hpp" 53 #include "Teuchos_SerialDenseSolver.hpp" 54 #include "Teuchos_ParameterList.hpp" 55 #include "Teuchos_TimeMonitor.hpp" 112 template <
class ScalarType,
class MV,
class OP>
159 const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
163 Teuchos::ParameterList ¶ms
173 typedef Teuchos::ScalarTraits<ScalarType> SCT;
174 typedef typename SCT::magnitudeType MagnitudeType;
175 const MagnitudeType ONE;
176 const MagnitudeType ZERO;
177 const MagnitudeType NANVAL;
180 void addToBasis(
const Teuchos::RCP<const MV> Delta);
182 void harmonicAddToBasis(
const Teuchos::RCP<const MV> Delta);
196 template <
class ScalarType,
class MV,
class OP>
199 const Teuchos::RCP<
SortManager<
typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> > &sorter,
203 Teuchos::ParameterList ¶ms
205 TraceMinBase<ScalarType,MV,OP>(problem,sorter,printer,tester,ortho,params),
206 ONE(Teuchos::ScalarTraits<MagnitudeType>::one()),
207 ZERO(Teuchos::ScalarTraits<MagnitudeType>::zero()),
208 NANVAL(Teuchos::ScalarTraits<MagnitudeType>::nan())
213 template <
class ScalarType,
class MV,
class OP>
216 MVT::MvAddMv(ONE,*this->X_,-ONE,*Delta,*this->V_);
220 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 221 Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
223 this->count_ApplyM_+= this->blockSize_;
225 OPT::Apply(*this->MOp_,*this->V_,*this->MV_);
230 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 231 Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
234 if(this->numAuxVecs_ > 0)
236 rank = this->orthman_->projectAndNormalizeMat(*this->V_,this->auxVecs_,
237 Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > >(Teuchos::null)),
238 Teuchos::null,this->MV_,this->MauxVecs_);
242 rank = this->orthman_->normalizeMat(*this->V_,Teuchos::null,this->MV_);
251 if(this->Op_ != Teuchos::null)
253 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 254 Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
256 this->count_ApplyOp_+= this->blockSize_;
257 OPT::Apply(*this->Op_,*this->V_,*this->KV_);
263 template <
class ScalarType,
class MV,
class OP>
264 void TraceMin<ScalarType,MV,OP>::harmonicAddToBasis(
const Teuchos::RCP<const MV> Delta)
267 MVT::MvAddMv(ONE,*this->X_,-ONE,*Delta,*this->V_);
270 if(this->numAuxVecs_ > 0)
272 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 273 Teuchos::TimeMonitor lcltimer( *this->timerOrtho_ );
275 this->orthman_->projectMat(*this->V_,this->auxVecs_);
279 if(this->Op_ != Teuchos::null)
281 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 282 Teuchos::TimeMonitor lcltimer( *this->timerOp_ );
284 this->count_ApplyOp_+= this->blockSize_;
286 OPT::Apply(*this->Op_,*this->V_,*this->KV_);
290 RCP< Teuchos::SerialDenseMatrix<int,ScalarType> > gamma = rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>(this->blockSize_,this->blockSize_));
291 int rank = this->orthman_->normalizeMat(*this->KV_,gamma);
296 Teuchos::SerialDenseSolver<int,ScalarType> SDsolver;
297 SDsolver.setMatrix(gamma);
299 RCP<MV> tempMV = MVT::CloneCopy(*this->V_);
300 MVT::MvTimesMatAddMv(ONE,*tempMV,*gamma,ZERO,*this->V_);
305 #ifdef ANASAZI_TEUCHOS_TIME_MONITOR 306 Teuchos::TimeMonitor lcltimer( *this->timerMOp_ );
308 this->count_ApplyM_+= this->blockSize_;
310 OPT::Apply(*this->MOp_,*this->V_,*this->MV_);
Abstract base class for trace minimization eigensolvers.
This class implements a TraceMIN iteration, a preconditioned iteration for solving linear symmetric p...
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.
Virtual base class which defines basic traits for the operator type.
TraceMin(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)
TraceMin constructor with eigenproblem, solver utilities, and parameter list of solver options...
Basic implementation of the Anasazi::SortManager class.
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...
Anasazi's templated, static class providing utilities for the solvers.
Anasazi's templated virtual class for providing routines for orthogonalization and orthonormalization...
Output managers remove the need for the eigensolver to know any information about the required output...
Traits class which defines basic operations on multivectors.
Virtual base class which defines basic traits for the operator type.
Types and exceptions used within Anasazi solvers and interfaces.
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.
Class which provides internal utilities for the Anasazi solvers.