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_GenerateCrsProblem(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;
165 int sizes[] = {4, 6, 5, 3};
170 Trilinos_Util_GenerateVbrProblem(nx, ny, npoints, xoff, yoff, nsizes, sizes,
171 comm, bmap, Avbr, x, b, xexact);
175 std::cout << *Avbr << std::endl;
176 std::cout <<
"X exact = " << std::endl << *xexact << std::endl;
177 std::cout <<
"B = " << std::endl << *b << std::endl;
184 if (verbose) std::cout <<
"\nTime to create transpose matrix = " << timer.
ElapsedTime() - start << std::endl;
200 if (verbose) std::cout <<
"\nTime to update transpose matrix = " << timer.
ElapsedTime() - start << std::endl;
222 if (n<100) std::cout <<
"A transpose = " << std::endl << *transA << std::endl;
232 if (verbose) std::cout <<
"\nTime to compute b1: matvec with original matrix using transpose flag = " << timer.ElapsedTime() - start << std::endl;
234 if (n<100) std::cout <<
"b1 = " << std::endl << b1 << std::endl;
237 start = timer.ElapsedTime();
239 if (verbose) std::cout <<
"\nTime to compute b2: matvec with transpose matrix = " << timer.ElapsedTime() - start << std::endl;
241 if (n<100) std::cout <<
"b1 = " << std::endl << b1 << std::endl;
246 resid.Update(1.0, b1, -1.0, b2, 0.0);
247 resid.Norm2(&residual);
248 if (verbose) std::cout <<
"Norm of b1 - b2 = " << residual << std::endl;
252 if (residual > 1.0e-10) ierr++;
254 if (ierr!=0 && verbose) std::cerr <<
"Status: Test failed" << std::endl;
255 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 int NumGlobalRows() const =0