42 #ifndef __Belos_OrthoManagerFactory_hpp 43 #define __Belos_OrthoManagerFactory_hpp 46 #ifdef HAVE_BELOS_TSQR 48 #endif // HAVE_BELOS_TSQR 55 #include <Teuchos_StandardCatchMacros.hpp> 81 template<
class Scalar,
class MV,
class OP>
90 #ifdef HAVE_BELOS_TSQR 94 #endif // HAVE_BELOS_TSQR 103 #ifdef HAVE_BELOS_TSQR 105 return (name ==
"TSQR");
108 #endif // HAVE_BELOS_TSQR 118 #ifdef HAVE_BELOS_TSQR 120 #endif // HAVE_BELOS_TSQR 132 const std::vector<std::string>&
147 TEUCHOS_TEST_FOR_EXCEPTION(numValid <= 0, std::logic_error,
148 "Invalid number " << numValid <<
" of valid MatOrtho" 149 "Manager names. Please report this bug to the Belos " 152 for (
int k = 0; k < numValid - 1; ++k)
153 out <<
"\"" <<
theList_[k] <<
"\", ";
156 out <<
"\"" <<
theList_[numValid-1] <<
"\"";
167 std::ostringstream os;
189 Teuchos::RCP<const Teuchos::ParameterList>
192 if (name ==
"DGKS") {
193 return Belos::getDGKSDefaultParameters<Scalar, MV, OP> ();
195 #ifdef HAVE_BELOS_TSQR 196 else if (name ==
"TSQR") {
200 #endif // HAVE_BELOS_TSQR 201 else if (name ==
"ICGS") {
202 return Belos::getICGSDefaultParameters<Scalar, MV, OP> ();
204 else if (name ==
"IMGS") {
205 return Belos::getIMGSDefaultParameters<Scalar, MV, OP> ();
207 else if (name ==
"Simple") {
212 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
213 "Invalid orthogonalization manager name \"" << name
215 <<
". For many of the test executables, the " 216 "orthogonalization manager name often corresponds " 217 "to the \"ortho\" command-line argument.");
220 TEUCHOS_UNREACHABLE_RETURN(Teuchos::null);
237 Teuchos::RCP<const Teuchos::ParameterList>
240 if (name ==
"DGKS") {
241 return Belos::getDGKSFastParameters<Scalar, MV, OP> ();
243 #ifdef HAVE_BELOS_TSQR 244 else if (name ==
"TSQR") {
248 #endif // HAVE_BELOS_TSQR 249 else if (name ==
"ICGS") {
250 return Belos::getICGSFastParameters<Scalar, MV, OP> ();
252 else if (name ==
"IMGS") {
253 return Belos::getIMGSFastParameters<Scalar, MV, OP> ();
255 else if (name ==
"Simple") {
260 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
261 "Invalid orthogonalization manager name \"" << name
263 <<
". For many of the test executables, the " 264 "orthogonalization manager name often corresponds " 265 "to the \"ortho\" command-line argument.");
268 TEUCHOS_UNREACHABLE_RETURN(Teuchos::null);
291 Teuchos::RCP<Belos::MatOrthoManager<Scalar, MV, OP> >
293 const Teuchos::RCP<const OP>& M,
295 const std::string& label,
296 const Teuchos::RCP<Teuchos::ParameterList>& params)
298 #ifdef HAVE_BELOS_TSQR 300 #endif // HAVE_BELOS_TSQR 307 if (ortho ==
"DGKS") {
309 return rcp (
new ortho_type (params, label, M));
311 #ifdef HAVE_BELOS_TSQR 312 else if (ortho ==
"TSQR") {
314 return rcp (
new ortho_type (params, label, M));
316 #endif // HAVE_BELOS_TSQR 317 else if (ortho ==
"ICGS") {
319 return rcp (
new ortho_type (params, label, M));
321 else if (ortho ==
"IMGS") {
323 return rcp (
new ortho_type (params, label, M));
325 else if (ortho ==
"Simple") {
326 TEUCHOS_TEST_FOR_EXCEPTION(ortho ==
"Simple", std::logic_error,
327 "SimpleOrthoManager does not yet support " 328 "the MatOrthoManager interface");
330 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
331 "Invalid orthogonalization manager name: Valid names" 333 "the test executables, the orthogonalization manager" 334 " name often corresponds to the \"ortho\" command-" 336 TEUCHOS_UNREACHABLE_RETURN(Teuchos::null);
355 Teuchos::RCP<Belos::OrthoManager<Scalar, MV> >
357 const Teuchos::RCP<const OP>& M,
359 const std::string& label,
360 const Teuchos::RCP<Teuchos::ParameterList>& params)
362 #ifdef HAVE_BELOS_TSQR 364 #endif // HAVE_BELOS_TSQR 367 if (ortho ==
"Simple") {
368 TEUCHOS_TEST_FOR_EXCEPTION(! M.is_null(), std::logic_error,
369 "SimpleOrthoManager is not yet supported " 370 "when the operator M is nontrivial (i.e., " 374 #ifdef HAVE_BELOS_TSQR 383 else if (ortho ==
"TSQR" && M.is_null()) {
386 #endif // HAVE_BELOS_TSQR 396 #endif // __Belos_OrthoManagerFactory_hpp Belos's basic output manager for sending information of select verbosity levels to the appropriate ou...
const std::vector< std::string > & validNames() const
List of MatOrthoManager subclasses this factory recognizes.
Teuchos::RCP< Belos::OrthoManager< Scalar, MV > > makeOrthoManager(const std::string &ortho, const Teuchos::RCP< const OP > &M, const Teuchos::RCP< OutputManager< Scalar > > &outMan, const std::string &label, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Return an instance of the specified OrthoManager subclass.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Get a default list of parameters.
Class which manages the output and verbosity of the Belos solvers.
static bool isRankRevealing(const std::string &name)
Is the given MatOrthoManager subclass rank-reealing?
Teuchos::RCP< const Teuchos::ParameterList > getFastParameters()
Get "fast" parameters for TsqrMatOrthoManager.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Get default parameters for TsqrMatOrthoManager.
static int numOrthoManagers()
Number of MatOrthoManager subclasses this factory recognizes.
std::ostream & printValidNames(std::ostream &out) const
Print all recognized MatOrthoManager names to the given ostream.
Iterated Modified Gram-Schmidt (IMGS) implementation of the Belos::OrthoManager class.
Simple OrthoManager implementation for benchmarks.
OrthoManagerFactory()
Constructor.
std::string validNamesString() const
List (as a string) of recognized MatOrthoManager names.
std::vector< std::string > theList_
List of valid OrthoManager names.
Classical Gram-Schmidt (with DGKS correction) implementation of the Belos::OrthoManager class...
Teuchos::RCP< const Teuchos::ParameterList > getFastParameters()
Get a "fast" list of parameters.
Simple OrthoManager implementation for benchmarks.
const std::string & defaultName() const
Name of the "default" MatOrthoManager subclass.
Teuchos::RCP< const Teuchos::ParameterList > getDefaultParameters(const std::string &name) const
Default parameters for the given MatOrthoManager subclass.
Enumeration of all valid Belos (Mat)OrthoManager classes.
Teuchos::RCP< const Teuchos::ParameterList > getFastParameters(const std::string &name) const
"Fast" parameters for the given MatOrthoManager subclass.
bool isValidName(const std::string &name) const
Whether this factory recognizes the MatOrthoManager with the given name.
Iterated Classical Gram-Schmidt (ICGS) implementation of the Belos::OrthoManager class.
An implementation of the Belos::MatOrthoManager that performs orthogonalization using multiple steps ...
An implementation of the Belos::MatOrthoManager that performs orthogonalization using multiple steps ...
An implementation of the Belos::MatOrthoManager that performs orthogonalization using (potentially) m...
Orthogonalization manager based on Tall Skinny QR (TSQR)
MatOrthoManager subclass using TSQR or DGKS.
Belos header file which uses auto-configuration information to include necessary C++ headers...
TSQR-based OrthoManager subclass.
Teuchos::RCP< Belos::MatOrthoManager< Scalar, MV, OP > > makeMatOrthoManager(const std::string &ortho, const Teuchos::RCP< const OP > &M, const Teuchos::RCP< OutputManager< Scalar > > &, const std::string &label, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Return an instance of the specified MatOrthoManager subclass.