32 const bool UseTranspose,
33 const std::string prefix)
const
37 int NumVectors = X.NumVectors();
39 for (
int i = 0 ; i < NumVectors ; ++i)
41 Matrix.
Multiply(UseTranspose, *X(i), Ax);
42 Ax.Update(1.0, *B(i), -1.0);
46 std::cout << prefix <<
" : vector " << i <<
", ||Ax - b|| = "
54 const std::string prefix)
const
58 int NumVectors = X.NumVectors();
60 for (
int i = 0 ; i < NumVectors ; ++i)
62 X(i)->Norm2(&NormLHS);
63 B(i)->Norm2(&NormRHS);
64 if (X.Comm().MyPID() == 0)
65 std::cout << prefix <<
" : vector " << i <<
", ||x|| = " << NormLHS
66 <<
", ||b|| = " << NormRHS << std::endl;
73 std::cout <<
"--------------------------------------------";
74 std::cout <<
"--------------------------------" << std::endl;
81 switch(MaxProcesses) {
83 MaxProcesses = MaxProcs;
86 MaxProcesses = (int) sqrt(1.0 * MaxProcs);
94 if (MaxProcesses <= 0) MaxProcesses = 1;
95 if (MaxProcesses > MaxProcs) MaxProcesses = MaxProcs;
void PrintLine() const
Prints line on std::cout.
void SetMaxProcesses(int &MaxProcesses, const Epetra_RowMatrix &A)
virtual int MyPID() const =0
Amesos_Utils()
Default constructor.
~Amesos_Utils()
Default destructor.
virtual const Epetra_Comm & Comm() const =0
virtual const Epetra_BlockMap & Map() const =0
virtual long long NumGlobalNonzeros64() const =0
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
virtual int NumProc() const =0
void ComputeTrueResidual(const Epetra_RowMatrix &Matrix, const Epetra_MultiVector &X, const Epetra_MultiVector &B, const bool UseTranspose, const std::string prefix) const
Computes the true residual, B - Matrix * X, and prints the results.
virtual long long NumGlobalRows64() const =0
void ComputeVectorNorms(const Epetra_MultiVector &X, const Epetra_MultiVector &B, const std::string prefix) const
Computes the norms of X and B and print the results.
Amesos_Utils: Collections of basic utilities.