25 std::vector<double> Norm;
26 int NumVectors = x.NumVectors();
27 Norm.resize(NumVectors);
30 Ax.Update(1.0,b,-1.0);
32 bool TestPassed =
false;
33 double TotalNorm = 0.0;
34 for (
int i = 0 ; i < NumVectors ; ++i) {
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) {
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 ) {
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);
166 List.
set(
"MaxProcs",2);
173 bool TestPassed =
true;
175 TestPassed = TestPassed &&
186 return(EXIT_SUCCESS);
void SetLHS(Epetra_MultiVector *X)
void SetOperator(Epetra_RowMatrix *A)
int Solve()
Solves A X = B (or AT x = B)
int NumericFactorization()
Performs NumericFactorization on the matrix A.
Amesos_Mumps: An object-oriented wrapper for the double precision version of MUMPS.
int SymbolicFactorization()
Performs SymbolicFactorization on the matrix A.
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
Amesos_TestRowMatrix: a class to test Epetra_RowMatrix based codes.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
int SetParameters(Teuchos::ParameterList &ParameterList)
Updates internal variables.
virtual int MyPID() const =0
int FillComplete(bool OptimizeDataStorage=true)
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_RowMatrix multiplied by a Epetra_MultiVector X in Y.
virtual const Epetra_Comm & Comm() const =0
#define AMESOS_CHK_ERR(a)
int main(int argc, char *argv[])
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
void SetRHS(Epetra_MultiVector *B)
bool CheckError(const std::string SolverType, const std::string Descriptor, const Epetra_RowMatrix &A, const Epetra_MultiVector &x, const Epetra_MultiVector &b, const Epetra_MultiVector &x_exact)
int Broadcast(double *MyVals, int Count, int Root) const