85 template<
class ScalarType,
class MV,
class OP>
87 Teuchos::RCP<SolverManager<ScalarType,MV,OP> >
88 create (
const std::string& solverType,
89 const Teuchos::RCP<Eigenproblem<ScalarType,MV,OP> > problem,
90 Teuchos::ParameterList &pl ) {
93 std::string type = solverType;
94 std::transform(type.begin(), type.end(), type.begin(), ::tolower);
96 if (type ==
"block_davidson" || type ==
"block davidson")
97 return rcp(
new BlockDavidsonSolMgr<ScalarType,MV,OP>(problem, pl));
99 else if (type ==
"block_krylov_schur" || type ==
"block krylov schur")
100 return rcp(
new BlockKrylovSchurSolMgr<ScalarType,MV,OP>(problem, pl));
102 else if (type ==
"lobpcg")
103 return rcp(
new LOBPCGSolMgr<ScalarType,MV,OP>(problem, pl));
105 else if (type ==
"rtr")
106 return rcp(
new RTRSolMgr<ScalarType,MV,OP>(problem, pl));
108 else if (type ==
"simple_lobpcg" || type ==
"simple lobpcg")
109 return rcp(
new SimpleLOBPCGSolMgr<ScalarType,MV,OP>(problem, pl));
112 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
113 "Anasazi::Factory::create: Invalid solver type \"" << solverType <<
"\".");
116 template<
class MV,
class OP>
118 Teuchos::RCP<SolverManager<double,MV,OP> >
119 create (
const std::string& solverType,
120 const Teuchos::RCP<Eigenproblem<double,MV,OP> > problem,
121 Teuchos::ParameterList &pl ) {
123 using ScalarType = double;
125 std::string type = solverType;
126 std::transform(type.begin(), type.end(), type.begin(), ::tolower);
128 if (type ==
"block_davidson" || type ==
"block davidson")
129 return rcp(
new BlockDavidsonSolMgr<ScalarType,MV,OP>(problem, pl));
131 else if (type ==
"block_krylov_schur" || type ==
"block krylov schur")
132 return rcp(
new BlockKrylovSchurSolMgr<ScalarType,MV,OP>(problem, pl));
134 else if (type ==
"generalized_davidson" || type ==
"generalized davidson")
135 return rcp(
new GeneralizedDavidsonSolMgr<ScalarType,MV,OP>(problem, pl));
137 else if (type ==
"lobpcg")
138 return rcp(
new LOBPCGSolMgr<ScalarType,MV,OP>(problem, pl));
140 else if (type ==
"rtr")
141 return rcp(
new RTRSolMgr<ScalarType,MV,OP>(problem, pl));
143 else if (type ==
"simple_lobpcg" || type ==
"simple lobpcg")
144 return rcp(
new SimpleLOBPCGSolMgr<ScalarType,MV,OP>(problem, pl));
146 else if (type ==
"TRACE_MIN" || type ==
"trace min")
149 else if (type ==
"trace_min_davidson" || type ==
"trace min davidson")
153 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
154 "Anasazi::Factory::create: Invalid solverType type \"" << solverType <<
"\".");
158 template<
class ScalarType,
class MV,
class OP>
160 Teuchos::RCP<SolverManager<ScalarType,MV,OP> >
162 const Teuchos::RCP<BasicEigenproblem<ScalarType,MV,OP> > &problem,
163 Teuchos::ParameterList &pl ) {
164 Teuchos::RCP<Eigenproblem<ScalarType,MV,OP>> eproblem =
165 Teuchos::rcp_static_cast<Eigenproblem<ScalarType,MV,OP>>(problem);
166 return create(solverType, eproblem, pl);
static Teuchos::RCP< SolverManager< ScalarType, MV, OP > > create(const std::string &solverType, const Teuchos::RCP< Eigenproblem< ScalarType, MV, OP > > problem, Teuchos::ParameterList &pl)
Create an instance of Anasazi::SolverManager given the string name of the solver type.
static Teuchos::RCP< SolverManager< ScalarType, MV, OP > > create(const std::string &solverType, const Teuchos::RCP< BasicEigenproblem< ScalarType, MV, OP > > &problem, Teuchos::ParameterList &pl)
Specialize create for BasicEigenproblem type.