|
Anasazi
Version of the Day
|
Go to the documentation of this file.
42 #ifndef ANASAZI_BASIC_EIGENPROBLEM_H
43 #define ANASAZI_BASIC_EIGENPROBLEM_H
60 template<
class ScalarType,
class MV,
class OP>
72 BasicEigenproblem(
const Teuchos::RCP<const OP>& Op,
const Teuchos::RCP<MV>& InitVec );
75 BasicEigenproblem(
const Teuchos::RCP<const OP>& Op,
const Teuchos::RCP<const OP>& B,
const Teuchos::RCP<MV>& InitVec );
166 Teuchos::RCP<const OP>
getA()
const {
return(
_AOp ); };
169 Teuchos::RCP<const OP>
getM()
const {
return(
_MOp ); };
221 Teuchos::RCP<const OP>
_Op;
257 template <
class ScalarType,
class MV,
class OP>
267 template <
class ScalarType,
class MV,
class OP>
279 template <
class ScalarType,
class MV,
class OP>
281 const Teuchos::RCP<MV>& InitVec ) :
293 template <
class ScalarType,
class MV,
class OP>
298 _Prec(Problem._Prec),
299 _InitVec(Problem._InitVec),
301 _isSym(Problem._isSym),
302 _isSet(Problem._isSet),
311 template <
class ScalarType,
class MV,
class OP>
318 if ( !_AOp.get() && !_Op.get() ) {
return false; }
321 if ( !_InitVec.get() ) {
return false; }
324 if (_nev == 0) {
return false; }
327 if (_AOp.get() && !_Op.get()) { _Op = _AOp; }
341 template <
class ScalarType,
class MV,
class OP>
346 TEUCHOS_TEST_FOR_EXCEPTION(!isHermitian(), std::invalid_argument,
347 "BasicEigenproblem::computeCurrResVec: This method is not currently "
348 "implemented for non-Hermitian problems. Sorry for any inconvenience.");
353 return Teuchos::null;
356 RCP<MV> X = sol.
Evecs;
357 std::vector<ScalarType> Lambda(sol.
numVecs);
358 for(
int i = 0; i < sol.
numVecs; i++)
359 Lambda[i] = sol.
Evals[i].realpart;
362 RCP<MV> AX = MVT::Clone(*X,sol.
numVecs);
363 if(_AOp != Teuchos::null)
364 OPT::Apply(*_AOp,*X,*AX);
366 OPT::Apply(*_Op,*X,*AX);
370 if(_MOp != Teuchos::null)
372 MX = MVT::Clone(*X,sol.
numVecs);
373 OPT::Apply(*_MOp,*X,*MX);
377 MX = MVT::CloneCopy(*X);
381 RCP<MV> R = MVT::Clone(*X,sol.
numVecs);
382 MVT::MvScale(*MX,Lambda);
383 MVT::MvAddMv(1.0,*AX,-1.0,*MX,*R);
Declaration of basic traits for the multivector type.
void setM(const Teuchos::RCP< const OP > &M)
Set the operator M of the eigenvalue problem .
void setNEV(int nev)
Specify the number of eigenvalues (NEV) that are requested.
int getNEV() const
Get the number of eigenvalues (NEV) that are required by this eigenproblem.
Traits class which defines basic operations on multivectors.
Teuchos::RCP< MV > Evecs
The computed eigenvectors.
int _nev
Number of eigenvalues requested.
void setInitVec(const Teuchos::RCP< MV > &InitVec)
Set the initial guess.
std::vector< Value< ScalarType > > Evals
The computed eigenvalues.
Abstract base class which defines the interface required by an eigensolver and status test class to c...
Teuchos::RCP< const OP > getM() const
Get a pointer to the operator M of the eigenproblem .
Teuchos::RCP< const OP > _Op
Reference-counted pointer for the operator of the eigenproblem .
bool isHermitian() const
Get the symmetry information for this eigenproblem.
Teuchos::RCP< const MV > _AuxVecs
Reference-counted pointer for the auxiliary vector of the eigenproblem .
Teuchos::RCP< const OP > getOperator() const
Get a pointer to the operator for which eigenvalues will be computed.
bool _isSym
Symmetry of the eigenvalue problem.
const Eigensolution< ScalarType, MV > & getSolution() const
Get the solution to the eigenproblem.
void setSolution(const Eigensolution< ScalarType, MV > &sol)
Set the solution to the eigenproblem.
Teuchos::RCP< MV > _InitVec
Reference-counted pointer for the initial vector of the eigenproblem .
virtual ~BasicEigenproblem()
Destructor.
Teuchos::RCP< const OP > getA() const
Get a pointer to the operator A of the eigenproblem .
Virtual base class which defines basic traits for the operator type.
Virtual base class which defines basic traits for the operator type.
void setPrec(const Teuchos::RCP< const OP > &Prec)
Set the preconditioner for this eigenvalue problem .
bool isProblemSet() const
If the problem has been set, this method will return true.
void setAuxVecs(const Teuchos::RCP< const MV > &AuxVecs)
Set auxiliary vectors.
void setHermitian(bool isSym)
Specify the symmetry of this eigenproblem.
Teuchos::RCP< const MV > computeCurrResVec() const
Returns the residual vector corresponding to the computed solution.
Teuchos::RCP< const OP > getPrec() const
Get a pointer to the preconditioner of the eigenproblem .
This provides a basic implementation for defining standard or generalized eigenvalue problems.
Teuchos::RCP< const MV > getInitVec() const
Get a pointer to the initial vector.
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package.
bool _isSet
Sanity Check Flag.
This class defines the interface required by an eigensolver and status test class to compute solution...
Teuchos::RCP< const OP > _MOp
Reference-counted pointer for M of the eigenproblem .
int numVecs
The number of computed eigenpairs.
void setA(const Teuchos::RCP< const OP > &A)
Set the operator A of the eigenvalue problem .
Teuchos::RCP< const OP > _AOp
Reference-counted pointer for A of the eigenproblem .
Teuchos::RCP< const MV > getAuxVecs() const
Get a pointer to the auxiliary vector.
bool setProblem()
Specify that this eigenproblem is fully defined.
Eigensolution< ScalarType, MV > _sol
Solution to problem.
BasicEigenproblem()
Empty constructor - allows Anasazi::BasicEigenproblem to be described at a later time through "Set Me...
Struct for storing an eigenproblem solution.
Teuchos::RCP< const OP > _Prec
Reference-counted pointer for the preconditioner of the eigenproblem .
MultiVecTraits< ScalarType, MV > MVT
Type-definition for the MultiVecTraits class corresponding to the MV type.
OperatorTraits< ScalarType, MV, OP > OPT
Type-definition for the OperatorTraits class corresponding to the OP type.
void setOperator(const Teuchos::RCP< const OP > &Op)
Set the operator for which eigenvalues will be computed.