10#ifndef ANASAZI_RTR_SOLMGR_HPP
11#define ANASAZI_RTR_SOLMGR_HPP
37#include "Teuchos_TimeMonitor.hpp"
38#include "Teuchos_FancyOStream.hpp"
51template<
class ScalarType,
class MV,
class OP>
57 typedef Teuchos::ScalarTraits<ScalarType> SCT;
58 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
59 typedef Teuchos::ScalarTraits<MagnitudeType> MT;
85 Teuchos::ParameterList &
pl );
104 Teuchos::Array<Teuchos::RCP<Teuchos::Time> >
getTimers()
const {
105 return Teuchos::tuple(_timerSolve);
131 Teuchos::RCP<Eigenproblem<ScalarType,MV,OP> > problem_;
136 MagnitudeType convtol_;
144 Teuchos::RCP<Teuchos::Time> _timerSolve;
145 Teuchos::RCP<OutputManager<ScalarType> > printer_;
146 Teuchos::ParameterList& pl_;
151template<
class ScalarType,
class MV,
class OP>
154 Teuchos::ParameterList &
pl ) :
158 convtol_(MT::
prec()),
170 TEUCHOS_TEST_FOR_EXCEPTION(problem_->getInitVec() == Teuchos::null,std::invalid_argument,
"Problem does not contain initial vectors to clone from.");
174 whch_ = pl_.get(
"Which",
"SR");
176 std::invalid_argument,
"Anasazi::RTRSolMgr: Invalid sorting string. RTR solvers compute only LR or SR.");
179 convtol_ = pl_.get(
"Convergence Tolerance",convtol_);
180 relconvtol_ = pl_.get(
"Relative Convergence Tolerance",relconvtol_);
181 strtmp = pl_.get(
"Convergence Norm",std::string(
"2"));
183 convNorm_ = RES_2NORM;
186 convNorm_ = RES_ORTH;
190 "Anasazi::RTRSolMgr: Invalid Convergence Norm.");
195 maxIters_ = pl_.get(
"Maximum Iterations",maxIters_);
198 skinny_ = pl_.get(
"Skinny Solver",skinny_);
201 numICGS_ = pl_.get(
"Num ICGS",2);
204 blkSize_ = pl_.get(
"Block Size", problem_->getNEV());
208 int osProc =
pl.get(
"Output Processor", 0);
211 Teuchos::RCP<Teuchos::FancyOStream>
osp;
213 if (
pl.isParameter(
"Output Stream")) {
214 osp = Teuchos::getParameter<Teuchos::RCP<Teuchos::FancyOStream> >(
pl,
"Output Stream");
221 if (pl_.isParameter(
"Verbosity")) {
222 if (Teuchos::isParameterType<int>(pl_,
"Verbosity")) {
225 verbosity = (
int)Teuchos::getParameter<Anasazi::MsgType>(pl_,
"Verbosity");
234template<
class ScalarType,
class MV,
class OP>
242 const int nev = problem_->getNEV();
248 Teuchos::RCP<Teuchos::FancyOStream>
249 out = Teuchos::getFancyOStream(Teuchos::rcpFromRef(printer_->stream(
Debug)));
250 out->setShowAllFrontMatter(
false).setShowProcRank(
true);
251 *
out <<
"Entering Anasazi::RTRSolMgr::solve()\n";
261 Teuchos::RCP<StatusTest<ScalarType,MV,OP> >
maxtest;
262 Teuchos::RCP<StatusTest<ScalarType,MV,OP> >
ordertest;
263 Teuchos::RCP<StatusTest<ScalarType,MV,OP> >
combotest;
264 Teuchos::RCP<StatusTest<ScalarType,MV,OP> >
convtest;
278 Teuchos::Array<Teuchos::RCP<StatusTest<ScalarType,MV,OP> > >
alltests;
284 Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP> >
outputtest;
285 if ( printer_->isVerbosity(
Debug) ) {
294 Teuchos::RCP<ICGSOrthoManager<ScalarType,MV,OP> >
ortho
301 if (whch_ ==
"LR" || whch_ ==
"LM") {
305 Teuchos::RCP<RTRBase<ScalarType,MV,OP> >
rtr_solver;
306 if (skinny_ ==
false) {
315 Teuchos::RCP< const MV >
probauxvecs = problem_->getAuxVecs();
321 "Anasazi::RTRSolMgr requires block size >= requested number of eigenvalues.");
329#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
330 Teuchos::TimeMonitor
slvtimer(*_timerSolve);
335 catch (
const std::exception &
e) {
340 problem_->setSolution(
sol);
354 std::vector<Value<ScalarType> >
all =
rtr_solver->getRitzValues();
355 for (
int i=0;
i<
num;
i++) {
362 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
"Anasazi::RTRSolMgr::solve(): solver returned without satisfy status test.");
370 sol.Evals.resize(
sol.numVecs);
371 for (
int i=0;
i<
sol.numVecs;
i++) {
381#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
383 Teuchos::TimeMonitor::summarize( printer_->stream(
TimingDetails ) );
388 problem_->setSolution(
sol);
389 printer_->stream(
Debug) <<
"Returning " <<
sol.numVecs <<
" eigenpairs to eigenproblem." <<
endl;
Basic implementation of the Anasazi::SortManager class.
Anasazi header file which uses auto-configuration information to include necessary C++ headers.
Abstract base class which defines the interface required by an eigensolver and status test class to c...
Basic implementation of the Anasazi::OrthoManager class.
Abstract class definition for Anasazi Output Managers.
Abstract class definition for Anasazi output stream.
Pure virtual base class which describes the basic interface for a solver manager.
Class which provides internal utilities for the Anasazi solvers.
Status test for forming logical combinations of other status tests.
Status test for testing the number of iterations.
Special StatusTest for printing status tests.
A status test for testing the norm of the eigenvectors residuals.
A status test for testing the norm of the eigenvectors residuals along with a set of auxiliary eigenv...
Types and exceptions used within Anasazi solvers and interfaces.
Anasazi's templated virtual class for constructing an operator that can interface with the OperatorTr...
Operator()
Default constructor.
The Anasazi::RTRSolMgr provides a simple solver manager over the RTR eigensolver. For more informatio...
ReturnType solve()
This method performs possibly repeated calls to the underlying eigensolver's iterate() routine until ...
RTRSolMgr(const Teuchos::RCP< Eigenproblem< ScalarType, MV, OP > > &problem, Teuchos::ParameterList &pl)
Basic constructor for RTRSolMgr.
int getNumIters() const
Get the iteration count for the most recent call to solve.
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
const Eigenproblem< ScalarType, MV, OP > & getProblem() const
Return the eigenvalue problem.
virtual ~RTRSolMgr()
Destructor.
The Anasazi::SolverManager is a templated virtual base class that defines the basic interface that an...
Status test for forming logical combinations of other status tests.
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package.
ReturnType
Enumerated type used to pass back information from a solver manager.
ResType
Enumerated type used to specify which residual norm used by residual norm status tests.
Output managers remove the need for the eigensolver to know any information about the required output...