|
EpetraExt
Development
|
Epetra_PETScAIJMatrix: A class for constructing and using real-valued sparse compressed row matrices. More...
#include <EpetraExt_PETScAIJMatrix.h>
Constructors/Destructor | |
| Epetra_PETScAIJMatrix (Mat Amat) | |
| Epetra_PETScAIJMatrix constructor. | |
| virtual | ~Epetra_PETScAIJMatrix () |
| Epetra_PETScAIJMatrix Destructor. | |
Extraction methods | |
| 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 | ExtractDiagonalCopy (Epetra_Vector &Diagonal) const |
| Returns a copy of the main diagonal in a user-provided vector. | |
Computational methods | |
| int | Multiply (bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const |
| Returns the result of a Epetra_PETScAIJMatrix multiplied by a Epetra_MultiVector X in Y. | |
| int | Solve (bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const |
| Returns the result of a Epetra_PETScAIJMatrix multiplied by a Epetra_MultiVector X in Y. | |
| int | InvRowSums (Epetra_Vector &x) const |
| Computes the sum of absolute values of the rows of the Epetra_PETScAIJMatrix, results returned in x. | |
| int | LeftScale (const Epetra_Vector &x) |
| Scales the Epetra_PETScAIJMatrix on the left with a Epetra_Vector x. | |
| int | InvColSums (Epetra_Vector &x) const |
| Computes the sum of absolute values of the columns of the Epetra_PETScAIJMatrix, results returned in x. | |
| int | RightScale (const Epetra_Vector &x) |
| Scales the Epetra_PETScAIJMatrix on the right with a Epetra_Vector x. | |
Matrix Properties Query Methods | |
| bool | Filled () const |
| If FillComplete() has been called, this query returns true, otherwise it returns false. | |
| bool | LowerTriangular () const |
| If matrix is lower triangular, this query returns true, otherwise it returns false. | |
| bool | UpperTriangular () const |
| If matrix is upper triangular, this query returns true, otherwise it returns false. | |
Attribute access functions | |
| Mat | Amat () const |
| Returns a pointer to the PETSc matrix used to create this object. | |
| double | NormInf () const |
| Returns the infinity norm of the global matrix. | |
| double | NormOne () const |
| Returns the one norm of the global matrix. | |
| int | NumGlobalNonzeros () const |
| Returns the number of nonzero entries in the global matrix. | |
| int | NumGlobalRows () const |
| Returns the number of global matrix rows. | |
| int | NumGlobalCols () const |
| Returns the number of global matrix columns. | |
| int | NumGlobalDiagonals () const |
| Returns the number of global nonzero diagonal entries. | |
| long long | NumGlobalNonzeros64 () const |
| Returns the number of nonzero entries in the global matrix. | |
| long long | NumGlobalRows64 () const |
| Returns the number of global matrix rows. | |
| long long | NumGlobalCols64 () const |
| Returns the number of global matrix columns. | |
| long long | NumGlobalDiagonals64 () const |
| Returns the number of global nonzero diagonal entries. | |
| int | NumMyNonzeros () const |
| Returns the number of nonzero entries in the calling processor's portion of the matrix. | |
| int | NumMyRows () const |
| Returns the number of matrix rows owned by the calling processor. | |
| int | NumMyCols () const |
| Returns the number of matrix columns owned by the calling processor. | |
| int | NumMyDiagonals () const |
| Returns the number of local nonzero diagonal entries. | |
| const Epetra_Map & | OperatorDomainMap () const |
| Returns the Epetra_Map object associated with the domain of this operator. | |
| const Epetra_Map & | OperatorRangeMap () const |
| Returns the Epetra_Map object associated with the range of this operator (same as domain). | |
| const Epetra_BlockMap & | Map () const |
| Implement the Epetra_SrcDistObjec::Map() function. | |
| const Epetra_Map & | RowMatrixRowMap () const |
| Returns the Row Map object needed for implementing Epetra_RowMatrix. | |
| const Epetra_Map & | RowMatrixColMap () const |
| Returns the Column Map object needed for implementing Epetra_RowMatrix. | |
| virtual const Epetra_Import * | RowMatrixImporter () const |
| Returns the Epetra_Import object that contains the import operations for distributed operations. | |
| const Epetra_Comm & | Comm () const |
| Returns a pointer to the Epetra_Comm communicator associated with this matrix. | |
I/O Methods | |
| virtual void | Print (std::ostream &os) const |
| Print method. | |
Additional methods required to support the Epetra_Operator interface | |
| const char * | Label () const |
| Returns a character string describing the operator. | |
| int | SetUseTranspose (bool UseTranspose) |
| If set true, transpose of this operator will be applied. | |
| int | Apply (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const |
| Returns the result of a Epetra_Operator applied to 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. | |
| virtual bool | HasNormInf () const |
| Returns true because this class can compute an Inf-norm. | |
| virtual bool | UseTranspose () const |
| Returns the current UseTranspose setting. | |
Additional methods required to implement RowMatrix interface | |
| int | NumMyRowEntries (int MyRow, int &NumEntries) const |
| Return the current number of values stored for the specified local row. | |
| int | MaxNumEntries () const |
| Returns the maximum of NumMyRowEntries() over all rows. | |
Epetra_PETScAIJMatrix: A class for constructing and using real-valued sparse compressed row matrices.
The Epetra_PETScAIJMatrix is a wrapper class for PETSc sequential or parallel AIJ matrices. It is derived from the Epetra_RowMatrix class, and so provides PETSc users access to Trilinos preconditioners. This class is lightweight, i.e., there are no deep copies of matrix data. Whenever possible, class methods utilize callbacks to native PETSc functions. Currently, only sequential and parallel point AIJ PETSc matrix types are supported.
Definition at line 83 of file EpetraExt_PETScAIJMatrix.h.
| Epetra_PETScAIJMatrix::Epetra_PETScAIJMatrix | ( | Mat | Amat | ) |
Epetra_PETScAIJMatrix constructor.
Creates a Epetra_PETScAIJMatrix object by encapsulating an existing PETSc matrix.
| In | Amat - A completely constructed PETSc SEQAIJ or MPIAIJ matrix. |
| virtual Epetra_PETScAIJMatrix::~Epetra_PETScAIJMatrix | ( | ) | [virtual] |
Epetra_PETScAIJMatrix Destructor.
| int Epetra_PETScAIJMatrix::ExtractMyRowCopy | ( | int | MyRow, |
| int | Length, | ||
| int & | NumEntries, | ||
| double * | Values, | ||
| int * | Indices | ||
| ) | const |
Returns a copy of the specified local row in user-provided arrays.
| In | MyRow - Local row to extract. |
| In | Length - Length of Values and Indices. |
| Out | NumEntries - Number of nonzero entries extracted. |
| Out | Values - Extracted values for this row. |
| Out | Indices - Extracted local column indices for the corresponding values. |
| int Epetra_PETScAIJMatrix::ExtractDiagonalCopy | ( | Epetra_Vector & | Diagonal | ) | const |
Returns a copy of the main diagonal in a user-provided vector.
| Out | Diagonal - Extracted main diagonal. |
| int Epetra_PETScAIJMatrix::Multiply | ( | bool | TransA, |
| const Epetra_MultiVector & | X, | ||
| Epetra_MultiVector & | Y | ||
| ) | const |
Returns the result of a Epetra_PETScAIJMatrix multiplied by a Epetra_MultiVector X in Y.
| In | TransA -If true, multiply by the transpose of matrix, otherwise just use matrix. |
| In | X - A Epetra_MultiVector of dimension NumVectors to multiply with matrix. |
| Out | Y -A Epetra_MultiVector of dimension NumVectorscontaining result. |
| int Epetra_PETScAIJMatrix::Solve | ( | bool | Upper, |
| bool | Trans, | ||
| bool | UnitDiagonal, | ||
| const Epetra_MultiVector & | X, | ||
| Epetra_MultiVector & | Y | ||
| ) | const |
Returns the result of a Epetra_PETScAIJMatrix multiplied by a Epetra_MultiVector X in Y.
| In | Upper -If true, solve Ux = y, otherwise solve Lx = y. |
| In | Trans -If true, solve transpose problem. |
| In | UnitDiagonal -If true, assume diagonal is unit (whether it's stored or not). |
| In | X - A Epetra_MultiVector of dimension NumVectors to solve for. |
| Out | Y -A Epetra_MultiVector of dimension NumVectors containing result. |
| int Epetra_PETScAIJMatrix::InvRowSums | ( | Epetra_Vector & | x | ) | const |
Computes the sum of absolute values of the rows of the Epetra_PETScAIJMatrix, results returned in x.
The vector x will return such that x[i] will contain the inverse of sum of the absolute values of the this matrix will be scaled such that A(i,j) = x(i)*A(i,j) where i denotes the global row number of A and j denotes the global column number of A. Using the resulting vector from this function as input to LeftScale() will make the infinity norm of the resulting matrix exactly 1.
| Out | x -A Epetra_Vector containing the row sums of the this matrix. |
| int Epetra_PETScAIJMatrix::LeftScale | ( | const Epetra_Vector & | x | ) |
Scales the Epetra_PETScAIJMatrix on the left with a Epetra_Vector x.
The this matrix will be scaled such that A(i,j) = x(i)*A(i,j) where i denotes the row number of A and j denotes the column number of A.
| In | x -A Epetra_Vector to solve for. |
| int Epetra_PETScAIJMatrix::InvColSums | ( | Epetra_Vector & | x | ) | const |
Computes the sum of absolute values of the columns of the Epetra_PETScAIJMatrix, results returned in x.
The vector x will return such that x[j] will contain the inverse of sum of the absolute values of the this matrix will be sca such that A(i,j) = x(j)*A(i,j) where i denotes the global row number of A and j denotes the global column number of A. Using the resulting vector from this function as input to RighttScale() will make the one norm of the resulting matrix exactly 1.
| Out | x -A Epetra_Vector containing the column sums of the this matrix. |
| int Epetra_PETScAIJMatrix::RightScale | ( | const Epetra_Vector & | x | ) |
Scales the Epetra_PETScAIJMatrix on the right with a Epetra_Vector x.
The this matrix will be scaled such that A(i,j) = x(j)*A(i,j) where i denotes the global row number of A and j denotes the global column number of A.
| In | x -The Epetra_Vector used for scaling this. |
| bool Epetra_PETScAIJMatrix::Filled | ( | ) | const [inline] |
If FillComplete() has been called, this query returns true, otherwise it returns false.
Definition at line 216 of file EpetraExt_PETScAIJMatrix.h.
| bool Epetra_PETScAIJMatrix::LowerTriangular | ( | ) | const [inline] |
If matrix is lower triangular, this query returns true, otherwise it returns false.
Definition at line 219 of file EpetraExt_PETScAIJMatrix.h.
| bool Epetra_PETScAIJMatrix::UpperTriangular | ( | ) | const [inline] |
If matrix is upper triangular, this query returns true, otherwise it returns false.
Definition at line 222 of file EpetraExt_PETScAIJMatrix.h.
| Mat Epetra_PETScAIJMatrix::Amat | ( | ) | const [inline] |
Returns a pointer to the PETSc matrix used to create this object.
Definition at line 230 of file EpetraExt_PETScAIJMatrix.h.
| double Epetra_PETScAIJMatrix::NormInf | ( | ) | const |
Returns the infinity norm of the global matrix.
| double Epetra_PETScAIJMatrix::NormOne | ( | ) | const |
Returns the one norm of the global matrix.
| int Epetra_PETScAIJMatrix::NumGlobalNonzeros | ( | ) | const [inline] |
Returns the number of nonzero entries in the global matrix.
Definition at line 246 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::NumGlobalRows | ( | ) | const [inline] |
Returns the number of global matrix rows.
Definition at line 249 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::NumGlobalCols | ( | ) | const [inline] |
Returns the number of global matrix columns.
Definition at line 252 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::NumGlobalDiagonals | ( | ) | const [inline] |
Returns the number of global nonzero diagonal entries.
Definition at line 255 of file EpetraExt_PETScAIJMatrix.h.
| long long Epetra_PETScAIJMatrix::NumGlobalNonzeros64 | ( | ) | const [inline] |
Returns the number of nonzero entries in the global matrix.
Definition at line 258 of file EpetraExt_PETScAIJMatrix.h.
| long long Epetra_PETScAIJMatrix::NumGlobalRows64 | ( | ) | const [inline] |
Returns the number of global matrix rows.
Definition at line 261 of file EpetraExt_PETScAIJMatrix.h.
| long long Epetra_PETScAIJMatrix::NumGlobalCols64 | ( | ) | const [inline] |
Returns the number of global matrix columns.
Definition at line 264 of file EpetraExt_PETScAIJMatrix.h.
| long long Epetra_PETScAIJMatrix::NumGlobalDiagonals64 | ( | ) | const [inline] |
Returns the number of global nonzero diagonal entries.
Definition at line 267 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::NumMyNonzeros | ( | ) | const [inline] |
Returns the number of nonzero entries in the calling processor's portion of the matrix.
Definition at line 270 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::NumMyRows | ( | ) | const [inline] |
Returns the number of matrix rows owned by the calling processor.
Definition at line 273 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::NumMyCols | ( | ) | const [inline] |
Returns the number of matrix columns owned by the calling processor.
Definition at line 276 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::NumMyDiagonals | ( | ) | const [inline] |
Returns the number of local nonzero diagonal entries.
Definition at line 279 of file EpetraExt_PETScAIJMatrix.h.
| const Epetra_Map& Epetra_PETScAIJMatrix::OperatorDomainMap | ( | ) | const [inline] |
Returns the Epetra_Map object associated with the domain of this operator.
Definition at line 282 of file EpetraExt_PETScAIJMatrix.h.
| const Epetra_Map& Epetra_PETScAIJMatrix::OperatorRangeMap | ( | ) | const [inline] |
Returns the Epetra_Map object associated with the range of this operator (same as domain).
Definition at line 285 of file EpetraExt_PETScAIJMatrix.h.
| const Epetra_BlockMap& Epetra_PETScAIJMatrix::Map | ( | ) | const [inline] |
Implement the Epetra_SrcDistObjec::Map() function.
Definition at line 288 of file EpetraExt_PETScAIJMatrix.h.
| const Epetra_Map& Epetra_PETScAIJMatrix::RowMatrixRowMap | ( | ) | const [inline] |
Returns the Row Map object needed for implementing Epetra_RowMatrix.
Definition at line 291 of file EpetraExt_PETScAIJMatrix.h.
| const Epetra_Map& Epetra_PETScAIJMatrix::RowMatrixColMap | ( | ) | const [inline] |
Returns the Column Map object needed for implementing Epetra_RowMatrix.
Definition at line 294 of file EpetraExt_PETScAIJMatrix.h.
| virtual const Epetra_Import* Epetra_PETScAIJMatrix::RowMatrixImporter | ( | ) | const [inline, virtual] |
Returns the Epetra_Import object that contains the import operations for distributed operations.
Definition at line 297 of file EpetraExt_PETScAIJMatrix.h.
| const Epetra_Comm& Epetra_PETScAIJMatrix::Comm | ( | ) | const [inline] |
Returns a pointer to the Epetra_Comm communicator associated with this matrix.
Definition at line 300 of file EpetraExt_PETScAIJMatrix.h.
| virtual void Epetra_PETScAIJMatrix::Print | ( | std::ostream & | os | ) | const [virtual] |
Print method.
| const char* Epetra_PETScAIJMatrix::Label | ( | ) | const [inline] |
Returns a character string describing the operator.
Definition at line 315 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::SetUseTranspose | ( | bool | UseTranspose | ) | [inline] |
If set true, transpose of this operator will be applied.
This flag allows the transpose of the given operator to be used implicitly. Setting this flag affects only the Apply() and ApplyInverse() methods. If the implementation of this interface does not support transpose use, this method should return a value of -1.
| In | UseTranspose -If true, multiply by the transpose of operator, otherwise just use operator. |
Definition at line 327 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::Apply | ( | const Epetra_MultiVector & | X, |
| Epetra_MultiVector & | Y | ||
| ) | const [inline] |
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector X in Y.
| In | X - A Epetra_MultiVector of dimension NumVectors to multiply with matrix. |
| Out | Y -A Epetra_MultiVector of dimension NumVectors containing result. |
Definition at line 339 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::ApplyInverse | ( | const Epetra_MultiVector & | X, |
| Epetra_MultiVector & | Y | ||
| ) | const [inline] |
Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y.
In this implementation, we use several existing attributes to determine how virtual method ApplyInverse() should call the concrete method Solve(). We pass in the UpperTriangular(), the Epetra_PETScAIJMatrix::UseTranspose(), and NoDiagonal() methods. The most notable warning is that if a matrix has no diagonal values we assume that there is an implicit unit diagonal that should be accounted for when doing a triangular solve.
| In | X - A Epetra_MultiVector of dimension NumVectors to solve for. |
| Out | Y -A Epetra_MultiVector of dimension NumVectors containing result. |
Definition at line 356 of file EpetraExt_PETScAIJMatrix.h.
| virtual bool Epetra_PETScAIJMatrix::HasNormInf | ( | ) | const [inline, virtual] |
Returns true because this class can compute an Inf-norm.
Definition at line 361 of file EpetraExt_PETScAIJMatrix.h.
| virtual bool Epetra_PETScAIJMatrix::UseTranspose | ( | ) | const [inline, virtual] |
Returns the current UseTranspose setting.
Definition at line 364 of file EpetraExt_PETScAIJMatrix.h.
| int Epetra_PETScAIJMatrix::NumMyRowEntries | ( | int | MyRow, |
| int & | NumEntries | ||
| ) | const |
Return the current number of values stored for the specified local row.
Similar to NumMyEntries() except NumEntries is returned as an argument and error checking is done on the input value MyRow.
| In | MyRow - Local row. |
| Out | NumEntries - Number of nonzero values. |
| int Epetra_PETScAIJMatrix::MaxNumEntries | ( | ) | const |
Returns the maximum of NumMyRowEntries() over all rows.
1.7.6.1