63 #include "Trilinos_Util.h"
68 int main(
int argc,
char *argv[])
74 MPI_Init(&argc,&argv);
85 if (argc>1)
if (argv[1][0]==
'-' && argv[1][1]==
'v') verbose =
true;
87 if (!verbose) comm.SetTracebackMode(0);
89 if (verbose) std::cout << comm << std::endl << std::flush;
91 if (verbose) verbose = (comm.
MyPID()==0);
107 int xoff[] = {-1, 0, 1, -1, 0, 1, 0};
108 int yoff[] = {-1, -1, -1, 0, 0, 0, 1};
114 Trilinos_Util_GenerateCrsProblem64(nx, ny, npoints, xoff, yoff, comm, map, A, x, b, xexact);
118 std::cout << *A << std::endl;
119 std::cout <<
"X exact = " << std::endl << *xexact << std::endl;
120 std::cout <<
"B = " << std::endl << *b << std::endl;
131 if (verbose) std::cout <<
"\nTime to construct transposer = " << timer.
ElapsedTime() - start << std::endl;
136 if (verbose) std::cout <<
"\nTime to create transpose matrix = " << timer.
ElapsedTime() - start << std::endl;
152 if (verbose) std::cout <<
"\nTime to update transpose matrix = " << timer.
ElapsedTime() - start << std::endl;
162 if (verbose) std::cout << std::endl <<
"Checking transposer for VbrMatrix objects" << std::endl<< std::endl;
167 int sizes[] = {4, 6, 5, 3};
172 Trilinos_Util_GenerateVbrProblem64(nx, ny, npoints, xoff, yoff, nsizes, sizes,
173 comm, bmap, Avbr, x, b, xexact);
176 std::cout << *Avbr << std::endl;
177 std::cout <<
"X exact = " << std::endl << *xexact << std::endl;
178 std::cout <<
"B = " << std::endl << *b << std::endl;
185 if (verbose) std::cout <<
"\nTime to create transpose matrix = " << timer.
ElapsedTime() - start << std::endl;
201 if (verbose) std::cout <<
"\nTime to update transpose matrix = " << timer.
ElapsedTime() - start << std::endl;
224 if (n<100) std::cout <<
"A transpose = " << std::endl << *transA << std::endl;
234 if (verbose) std::cout <<
"\nTime to compute b1: matvec with original matrix using transpose flag = " << timer.ElapsedTime() - start << std::endl;
236 if (n<100) std::cout <<
"b1 = " << std::endl << b1 << std::endl;
239 start = timer.ElapsedTime();
241 if (verbose) std::cout <<
"\nTime to compute b2: matvec with transpose matrix = " << timer.ElapsedTime() - start << std::endl;
243 if (n<100) std::cout <<
"b1 = " << std::endl << b1 << std::endl;
248 resid.Update(1.0, b1, -1.0, b2, 0.0);
249 resid.Norm2(&residual);
250 if (verbose) std::cout <<
"Norm of b1 - b2 = " << residual << std::endl;
254 if (residual > 1.0e-10) ierr++;
256 if (ierr!=0 && verbose) std::cerr <<
"Status: Test failed" << std::endl;
257 else if (verbose) std::cerr <<
"Status: Test passed" << std::endl;
virtual int SetUseTranspose(bool UseTranspose)=0
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
double ElapsedTime(void) const
std::string EpetraExt_Version()
virtual const Epetra_Map & OperatorDomainMap() const =0
virtual int LeftScale(const Epetra_Vector &x)=0
const Epetra_Map & OperatorDomainMap() const
Transform to form the explicit transpose of a Epetra_RowMatrix.
virtual int InvRowSums(Epetra_Vector &x) const =0
int main(int argc, char **argv)
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
virtual const Epetra_Map & OperatorRangeMap() const =0
virtual const Epetra_Comm & Comm() const =0
int checkResults(Epetra_RowMatrix *A, Epetra_CrsMatrix *transA, Epetra_Vector *xexact, bool verbose)
int SumIntoMyValues(int MyRow, int NumEntries, const double *Values, const int *Indices)
const Epetra_Map & OperatorRangeMap() const
bool fwd()
Foward Data Migration.
virtual long long NumGlobalRows64() const =0