25 std::vector<double> Norm;
27 Norm.resize(NumVectors);
29 A.Multiply(
false,x,Ax);
32 bool TestPassed =
false;
33 double TotalNorm = 0.0;
34 for (
int i = 0 ; i < NumVectors ; ++i) {
37 if (
A.Comm().MyPID() == 0)
38 std::cout <<
"||Ax - b|| = " << TotalNorm << std::endl;
39 if (TotalNorm < 1e-5 )
44 Ax.
Update (1.0,x,-1.0,x_exact,0.0);
46 for (
int i = 0 ; i < NumVectors ; ++i) {
49 if (
A.Comm().MyPID() == 0)
50 std::cout <<
"||Ax - b|| = " << TotalNorm << std::endl;
51 #ifdef HAVE_AMESOS_SMUMPS 52 if (TotalNorm < 1e-2 )
54 if (TotalNorm < 1e-5 )
64 int main(
int argc,
char *argv[]) {
67 MPI_Init(&argc, &argv);
73 int NumGlobalElements = 100;
80 int* part =
new int[NumGlobalElements];
82 if (
Comm.MyPID() == 0) {
85 for(
int i=0 ; i<NumGlobalElements ; ++i ) {
87 part[i] = r%(
Comm.NumProc());
91 Comm.Broadcast(part,NumGlobalElements,0);
94 int NumMyElements = 0;
95 for (
int i = 0 ; i < NumGlobalElements ; ++i) {
96 if (part[i] ==
Comm.MyPID())
101 int* MyGlobalElements =
new int[NumMyElements];
103 for (
int i = 0 ; i < NumGlobalElements ; ++i) {
104 if (part[i] ==
Comm.MyPID() )
105 MyGlobalElements[count++] = i;
108 Epetra_Map Map(NumGlobalElements,NumMyElements,MyGlobalElements,
119 int* Indices =
new int[NumGlobalElements];
120 double* Values =
new double[NumGlobalElements];
122 for (
int i = 0 ; i < NumGlobalElements ; ++i)
125 for (
int i = 0 ; i < NumMyElements ; ++i) {
126 int iGlobal = MyGlobalElements[i];
127 for (
int jGlobal = 0 ; jGlobal < NumGlobalElements ; ++jGlobal) {
128 if (iGlobal >= jGlobal)
129 Values[jGlobal] = 1.0 * (jGlobal + 1);
131 Values[jGlobal] = 1.0 * (iGlobal + 1);
134 NumGlobalElements, Values, Indices);
152 A.Multiply(
false,x_exact,b);
166 List.
set(
"MaxProcs",2);
173 bool TestPassed =
true;
175 TestPassed = TestPassed &&
186 return(EXIT_SUCCESS);
int Norm2(double *Result) const
void SetLHS(Epetra_MultiVector *X)
void SetOperator(Epetra_RowMatrix *A)
Amesos_Mumps: An object-oriented wrapper for the double precision version of MUMPS.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
Amesos_TestRowMatrix: a class to test Epetra_RowMatrix based codes.
int FillComplete(bool OptimizeDataStorage=true)
bool CheckError(const Epetra_RowMatrix &A, const Epetra_MultiVector &x, const Epetra_MultiVector &b, const Epetra_MultiVector &x_exact)
int main(int argc, char *argv[])
#define AMESOS_CHK_ERR(a)
void SetRHS(Epetra_MultiVector *B)
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)