43#include <Teuchos_DefaultComm.hpp>
44#include <Teuchos_CommandLineProcessor.hpp>
45#include <Teuchos_GlobalMPISession.hpp>
46#include <Teuchos_oblackholestream.hpp>
47#include <Teuchos_ParameterList.hpp>
50main (
int argc,
char *argv[])
56 using Teuchos::CommandLineProcessor;
61 typedef double scalar_type;
62 typedef Teuchos::ScalarTraits<scalar_type> STS;
63 typedef Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
64 typedef Teuchos::ScalarTraits<magnitude_type> STM;
66 Teuchos::oblackholestream blackHole;
70 Teuchos::GlobalMPISession mpiSession (&argc, &argv, &blackHole);
71 const int myRank = mpiSession.getRank();
73 std::ostream& out = (myRank == 0) ? std::cout : blackHole;
76 std::string robustnessLevel (
"None");
77 bool testBlockGivens =
false;
78 bool testGivensRotations =
false;
81 int testProblemSize = 10;
84 CommandLineProcessor cmdp (
false,
true);
85 cmdp.setOption (
"robustness", &robustnessLevel,
86 "Robustness level: \"None\", \"Some\", or \"Lots\".");
87 cmdp.setOption (
"testGivensRotations",
"dontTestGivensRotations",
89 "Test the implementation of Givens rotations.");
90 cmdp.setOption (
"testBlockGivens",
"dontTestBlockGivens", &testBlockGivens,
91 "Test the panel version of the Givens rotations - based "
93 cmdp.setOption (
"verbose",
"quiet", &verbose,
"Print messages and results.");
94 cmdp.setOption (
"debug",
"release", &debug,
"Print copious debug output.");
95 cmdp.setOption (
"testProblemSize", &testProblemSize,
96 "Number of columns in the projected least-squares test "
98 if (cmdp.parse (argc,argv) != CommandLineProcessor::PARSE_SUCCESSFUL) {
99 out <<
"End Result: TEST FAILED" << endl;
104 std::ostream& verboseOut = verbose ? out : blackHole;
107 const ERobustness robustness = robustnessStringToEnum (robustnessLevel);
108 verboseOut <<
"-- Robustness level: " << robustnessLevel << endl;
115 ProjectedLeastSquaresSolver<scalar_type> solver (out, robustness);
117 if (testGivensRotations) {
118 solver.testGivensRotations (verboseOut);
120 if (testProblemSize > 0) {
121 const bool extraVerbose = debug;
123 solver.testUpdateColumn (verboseOut, testProblemSize,
124 testBlockGivens, extraVerbose);
126 solver.testTriangularSolves (verboseOut, testProblemSize,
127 robustness, extraVerbose);
131 out <<
"End Result: TEST PASSED" << endl;
134 out <<
"End Result: TEST FAILED" << endl;
Methods for solving GMRES' projected least-squares problem.
Methods for solving GMRES' projected least-squares problem.
ERobustness
Robustness level of projected least-squares solver operations.
ERobustness robustnessStringToEnum(const std::string &x)
Convert the given robustness string value to an ERobustness enum.
std::string robustnessEnumToString(const ERobustness x)
Convert the given ERobustness enum value to a string.
int main(int argc, char *argv[])