45 #include <Teuchos_oblackholestream.hpp> 50 #include <Tpetra_MatrixIO.hpp> 52 #include "Tpetra_Power_Method.hpp" 54 #include "Tpetra_DefaultPlatform.hpp" 55 #include "Tpetra_Version.hpp" 56 #include "Tpetra_Map.hpp" 57 #include "Tpetra_MultiVector.hpp" 58 #include "Tpetra_Vector.hpp" 59 #include "Tpetra_CrsMatrix.hpp" 61 int main(
int argc,
char *argv[]) {
68 typedef double Scalar;
81 RCP<const Teuchos::Comm<int> > comm = platform.getComm();
82 RCP<Node> node = platform.getNode();
83 const int myRank = comm->getRank();
88 bool printMatrix =
false;
89 bool verbose = (myRank==0);
91 Magnitude tolerance = 1.0e-2;
92 std::string filename(
"bcsstk14.hb");
94 cmdp.setOption(
"verbose",
"quiet",&verbose,
"Print messages and results.");
95 cmdp.setOption(
"filename",&filename,
"Filename for Harwell-Boeing test matrix.");
96 cmdp.setOption(
"tolerance",&tolerance,
"Relative residual tolerance used for solver.");
97 cmdp.setOption(
"iterations",&niters,
"Maximum number of iterations.");
98 cmdp.setOption(
"printMatrix",
"noPrintMatrix",&printMatrix,
"Print the full matrix after reading it.");
107 std::cout <<
"\n" << Tpetra::version() << std::endl << std::endl;
109 std::cout <<
"Comm info: " << *comm;
115 Tpetra::Utils::readHBMatrix(filename,comm,node,A);
117 RCP<Teuchos::FancyOStream> fos = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
121 std::cout << std::endl << A->description() << std::endl << std::endl;
127 TpetraExamples::powerMethod<Scalar,Ordinal>(A, niters, tolerance, verbose);
130 std::cout <<
"\nEnd Result: TEST PASSED" << std::endl;
Sparse matrix that presents a compressed sparse row interface.