42#include "Teuchos_UnitTestHarness.hpp"
43#include "HYPRE_IJ_mv.h"
60#include "Teuchos_ParameterList.hpp"
61#include "Teuchos_ParameterEntry.hpp"
62#include "Teuchos_ParameterListExceptions.hpp"
63#include "Teuchos_Array.hpp"
72const double tol = 1E-6;
79 TEST_EQUALITY(Matrix->
Filled(),
true);
81 for(
int i = 0; i < Matrix->
NumMyRows(); i++){
84 TEST_EQUALITY(entries, 1);
86 Teuchos::Array<double> Values; Values.resize(entries);
87 Teuchos::Array<int> Indices; Indices.resize(entries);
88 ierr += Matrix->
ExtractMyRowCopy(i, entries, numentries, &Values[0], &Indices[0]);
89 TEST_EQUALITY(ierr, 0);
90 TEST_EQUALITY(numentries,1);
91 for(
int j = 0; j < numentries; j++){
92 TEST_FLOATING_EQUALITY(Values[j],1.0,
tol);
93 TEST_EQUALITY(Indices[j],i);
108 ierr += Matrix->
Multiply(
false, X, Y);
111 TEST_EQUALITY(ierr, 0);
127 ierr += Matrix->
Multiply(
false, X, Y1);
128 ierr += TestMat->Multiply(
false, X, Y2);
132 ierr += Matrix->
Multiply(
false, Y1, X);
133 ierr += TestMat->Multiply(
false, Y1, Y2);
137 ierr += Matrix->
Multiply(
false, Y2, X);
138 ierr += TestMat->Multiply(
false, Y2, Y1);
141 TEST_EQUALITY_CONST(ierr, 0);
158 ierr += Matrix->
Multiply(
true, X, Y1);
159 ierr += TestMat->Multiply(
true, X, Y2);
162 TEST_EQUALITY(ierr, 0);
178 ierr += TestMat->LeftScale(X);
180 TEST_EQUALITY(ierr, 0);
194 ierr += TestMat->RightScale(X);
197 TEST_EQUALITY(ierr, 0);
212 ierr += TestMat->ExtractDiagonalCopy(Y);
215 TEST_EQUALITY(ierr, 0);
230 ierr += TestMat->InvRowSums(Y);
233 TEST_EQUALITY(ierr, 0);
248 ierr += TestMat->InvColSums(Y);
251 TEST_EQUALITY(ierr, 0);
261 double norm1 = Matrix->
NormInf();
262 double norm2 = TestMat->NormInf();
264 TEST_FLOATING_EQUALITY(norm1, norm2,
tol);
273 double norm1 = Matrix->
NormOne();
274 double norm2 = TestMat->NormOne();
276 TEST_FLOATING_EQUALITY(norm1, norm2,
tol);
287 int nnz2 = TestMat->NumGlobalNonzeros();
289 TEST_EQUALITY(nnz1, nnz2);
300 int rows2 = TestMat->NumGlobalRows();
302 TEST_EQUALITY(rows1, rows2);
313 int cols2 = TestMat->NumGlobalCols();
315 TEST_EQUALITY(cols1, cols2);
326 int Ediag2 = TestMat->NumGlobalDiagonals();
328 TEST_EQUALITY(hdiag1, Ediag2);
339 int nnz2 = TestMat->NumMyNonzeros();
341 TEST_EQUALITY(nnz1, nnz2);
352 int rows2 = TestMat->NumMyRows();
354 TEST_EQUALITY(rows1, rows2);
365 int cols2 = TestMat->NumMyCols();
367 TEST_EQUALITY(cols1, cols2);
378 int diag2 = TestMat->NumMyDiagonals();
380 TEST_EQUALITY(diag1, diag2);
391 int ent2 = TestMat->MaxNumEntries();
393 TEST_EQUALITY(ent1, ent2);
409 TestMat->ApplyInverse(X,Y2);
427 TestMat->Multiply(
false,X2,X2);
464 Matrix->
Solve(
false,
false,
false, RHS, X);
int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a EpetraExt_HypreIJMatrix multiplied by a Epetra_MultiVector X in Y.
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y.
int LeftScale(const Epetra_Vector &X)
Scales the EpetraExt_HypreIJMatrix on the left with a Epetra_Vector x.
int SetParameter(Hypre_Chooser chooser, int(*pt2Func)(HYPRE_Solver, int), int parameter)
Set a parameter that takes a single int.
int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a EpetraExt_HypreIJMatrix solving a Epetra_MultiVector X in Y.
int NumMyRowEntries(int MyRow, int &NumEntries) const
Return the current number of values stored for the specified local row.
int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const
Returns a copy of the specified local row in user-provided arrays.
int RightScale(const Epetra_Vector &X)
Scales the EpetraExt_HypreIJMatrix on the right with a Epetra_Vector x.
virtual int InvColSums(Epetra_Vector &x) const
virtual int NumGlobalDiagonals() const
virtual int NumMyDiagonals() const
virtual int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const
virtual int NumMyNonzeros() const
virtual const Epetra_Map & RowMatrixColMap() const
virtual int InvRowSums(Epetra_Vector &x) const
virtual int NumMyCols() const
virtual double NormInf() const
virtual int MaxNumEntries() const
virtual int NumGlobalCols() const
virtual int NumMyRows() const
virtual double NormOne() const
virtual int NumGlobalRows() const
virtual const Epetra_Map & RowMatrixRowMap() const
virtual bool Filled() const
virtual int NumGlobalNonzeros() const
bool EquivalentVectors(Epetra_MultiVector &Y1, Epetra_MultiVector &Y2, const double tol)
Epetra_CrsMatrix * newCrsMatrix(EpetraExt_HypreIJMatrix &Matrix)
EpetraExt_HypreIJMatrix * newHypreMatrix(const int N, const int type)
bool EquivalentMatrices(Epetra_RowMatrix &HypreMatrix, Epetra_RowMatrix &CrsMatrix, const double tol)
EpetraExt::BlockCrsMatrix: A class for constructing a distributed block matrix.
TEUCHOS_UNIT_TEST(EpetraExt_hypre, Construct)