Ifpack2 Templated Preconditioning Package Version 1.0
|
Wraps a Tpetra::RowMatrix in a filter that reorders local rows and columns. More...
#include <Ifpack2_ReorderFilter_decl.hpp>
Public Member Functions | |
Constructor & destructor methods | |
ReorderFilter (const Teuchos::RCP< const row_matrix_type > &A, const Teuchos::ArrayRCP< local_ordinal_type > &perm, const Teuchos::ArrayRCP< local_ordinal_type > &reverseperm) | |
Constructor. | |
virtual | ~ReorderFilter () |
Destructor. | |
Matrix query methods | |
virtual Teuchos::RCP< const Teuchos::Comm< int > > | getComm () const |
The matrix's communicator. | |
virtual Teuchos::RCP< const map_type > | getRowMap () const |
Returns the Map that describes the row distribution in this matrix. | |
virtual Teuchos::RCP< const map_type > | getColMap () const |
Returns the Map that describes the column distribution in this matrix. | |
virtual Teuchos::RCP< const map_type > | getDomainMap () const |
Returns the Map that describes the domain distribution in this matrix. | |
virtual Teuchos::RCP< const map_type > | getRangeMap () const |
Returns the Map that describes the range distribution in this matrix. | |
virtual Teuchos::RCP< const Tpetra::RowGraph< local_ordinal_type, global_ordinal_type, node_type > > | getGraph () const |
Returns the RowGraph associated with this matrix. | |
virtual global_size_t | getGlobalNumRows () const |
Returns the number of global rows in this matrix. | |
virtual global_size_t | getGlobalNumCols () const |
Returns the number of global columns in this matrix. | |
virtual size_t | getLocalNumRows () const |
Returns the number of rows owned on the calling node. | |
virtual size_t | getLocalNumCols () const |
Returns the number of columns needed to apply the forward operator on this node, i.e., the number of elements listed in the column map. | |
virtual global_ordinal_type | getIndexBase () const |
Returns the index base for global indices for this matrix. | |
virtual global_size_t | getGlobalNumEntries () const |
Returns the global number of entries in this matrix. | |
virtual size_t | getLocalNumEntries () const |
Returns the local number of entries in this matrix. | |
virtual size_t | getNumEntriesInGlobalRow (global_ordinal_type globalRow) const |
The current number of entries in this matrix, stored on the calling process, in the row whose global index is globalRow . | |
virtual size_t | getNumEntriesInLocalRow (local_ordinal_type localRow) const |
The current number of entries in this matrix, stored on the calling process, in the row whose local index is globalRow . | |
virtual size_t | getGlobalMaxNumRowEntries () const |
Returns the maximum number of entries across all rows/columns on all nodes. | |
virtual size_t | getLocalMaxNumRowEntries () const |
Returns the maximum number of entries across all rows/columns on this node. | |
virtual bool | hasColMap () const |
Indicates whether this matrix has a well-defined column map. | |
virtual bool | isLocallyIndexed () const |
If matrix indices are in the local range, this function returns true. Otherwise, this function returns false. */. | |
virtual bool | isGloballyIndexed () const |
If matrix indices are in the global range, this function returns true. Otherwise, this function returns false. */. | |
virtual bool | isFillComplete () const |
Returns true if fillComplete() has been called. | |
virtual bool | supportsRowViews () const |
Returns true if RowViews are supported. | |
Extraction Methods | |
virtual void | getGlobalRowCopy (global_ordinal_type GlobalRow, nonconst_global_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const |
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage. | |
virtual void | getLocalRowCopy (local_ordinal_type LocalRow, nonconst_local_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const |
Extract a list of entries in a specified local row of the graph. Put into storage allocated by calling routine. | |
virtual void | getGlobalRowView (global_ordinal_type GlobalRow, global_inds_host_view_type &indices, values_host_view_type &values) const |
Extract a const, non-persisting view of global indices in a specified row of the matrix. | |
virtual void | getLocalRowView (local_ordinal_type LocalRow, local_inds_host_view_type &indices, values_host_view_type &values) const |
Extract a const, non-persisting view of local indices in a specified row of the matrix. | |
virtual void | getLocalDiagCopy (Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &diag) const |
Get a copy of the diagonal entries owned by this node, with local row indices. | |
![]() | |
virtual | ~RowMatrix ()=default |
Destructor (virtual for memory safety of derived classes) | |
Mathematical Methods | |
virtual void | leftScale (const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &x) |
Scales the RowMatrix on the left with the Vector x. | |
virtual void | rightScale (const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &x) |
Scales the RowMatrix on the right with the Vector x. | |
virtual mag_type | getFrobeniusNorm () const |
Returns the Frobenius norm of the matrix. | |
virtual void | apply (const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const |
\( Y := \beta Y + \alpha Op(A) X \), where Op(A) is either A, \(A^T\), or \(A^H\). | |
virtual bool | hasTransposeApply () const |
Whether apply() can apply the transpose or conjugate transpose. | |
virtual void | permuteOriginalToReordered (const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &originalX, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &reorderedY) const |
Permute multivector: original-to-reordered. | |
template<class DomainScalar , class RangeScalar > | |
void | permuteOriginalToReorderedTempl (const Tpetra::MultiVector< DomainScalar, local_ordinal_type, global_ordinal_type, node_type > &originalX, Tpetra::MultiVector< RangeScalar, local_ordinal_type, global_ordinal_type, node_type > &reorderedY) const |
virtual void | permuteReorderedToOriginal (const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &reorderedX, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &originalY) const |
Permute multivector: reordered-to-original. | |
template<class DomainScalar , class RangeScalar > | |
void | permuteReorderedToOriginalTempl (const Tpetra::MultiVector< DomainScalar, local_ordinal_type, global_ordinal_type, node_type > &reorderedX, Tpetra::MultiVector< RangeScalar, local_ordinal_type, global_ordinal_type, node_type > &originalY) const |
Additional Inherited Members | |
![]() | |
using | scalar_type = typename MatrixType::scalar_type |
using | local_ordinal_type = typename MatrixType::local_ordinal_type |
using | global_ordinal_type = typename MatrixType::global_ordinal_type |
using | node_type = typename MatrixType::node_type |
Wraps a Tpetra::RowMatrix in a filter that reorders local rows and columns.
MatrixType | A specialization of Tpetra::RowMatrix. |
This class is used in AdditiveSchwarz to reorder (if required by the user) the localized matrix. As the localized matrix is defined on a serial communicator only, all maps are trivial (as all elements reside on the same process). This class does not attemp to define properly reordered maps, hence it should not be used for distributed matrices.
To improve the performance of Ifpack2::AdditiveSchwarz, some operations are not performed in the construction phase (like for instance the computation of the 1-norm and infinite-norm, of check whether the reordered matrix is lower/upper triangular or not).
Ifpack2::ReorderFilter< MatrixType >::ReorderFilter | ( | const Teuchos::RCP< const row_matrix_type > & | A, |
const Teuchos::ArrayRCP< local_ordinal_type > & | perm, | ||
const Teuchos::ArrayRCP< local_ordinal_type > & | reverseperm | ||
) |
Constructor.
A | [in] The matrix to which to apply the filter. |
perm | [in] Forward permutation of A's rows and columns. |
reverseperm | [in] Reverse permutation of A's rows and columns. |
It must make sense to apply the given permutation to both the rows and columns. This means that the row and column Maps must have the same numbers of entries on all processes, and must have the same order of GIDs on all processes.
perm[i] gives the where OLD index i shows up in the NEW ordering. revperm[i] gives the where NEW index i shows up in the OLD ordering. Note that perm is actually the "inverse permutation," in Zoltan2 terms.
|
virtual |
Destructor.
|
virtual |
The matrix's communicator.
|
virtual |
Returns the Map that describes the row distribution in this matrix.
|
virtual |
Returns the Map that describes the column distribution in this matrix.
|
virtual |
Returns the Map that describes the domain distribution in this matrix.
|
virtual |
Returns the Map that describes the range distribution in this matrix.
|
virtual |
Returns the RowGraph associated with this matrix.
|
virtual |
Returns the number of global rows in this matrix.
|
virtual |
Returns the number of global columns in this matrix.
|
virtual |
Returns the number of rows owned on the calling node.
|
virtual |
Returns the number of columns needed to apply the forward operator on this node, i.e., the number of elements listed in the column map.
|
virtual |
Returns the index base for global indices for this matrix.
|
virtual |
Returns the global number of entries in this matrix.
|
virtual |
Returns the local number of entries in this matrix.
|
virtual |
The current number of entries in this matrix, stored on the calling process, in the row whose global index is globalRow
.
|
virtual |
The current number of entries in this matrix, stored on the calling process, in the row whose local index is globalRow
.
|
virtual |
Returns the maximum number of entries across all rows/columns on all nodes.
|
virtual |
Returns the maximum number of entries across all rows/columns on this node.
|
virtual |
Indicates whether this matrix has a well-defined column map.
|
virtual |
If matrix indices are in the local range, this function returns true. Otherwise, this function returns false. */.
|
virtual |
If matrix indices are in the global range, this function returns true. Otherwise, this function returns false. */.
|
virtual |
Returns true
if fillComplete() has been called.
|
virtual |
Returns true
if RowViews are supported.
|
virtual |
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage.
GlobalRow | - (In) Global row number for which indices are desired. |
Indices | - (Out) Global column indices corresponding to values. |
Values | - (Out) Matrix values. |
NumEntries | - (Out) Number of indices. |
Note: A std::runtime_error exception is thrown if either Indices
or Values
is not large enough to hold the data associated with row GlobalRow
. If GlobalRow
does not belong to this node, then Indices
and Values
are unchanged and NumIndices
is returned as Teuchos::OrdinalTraits<size_t>::invalid().
|
virtual |
Extract a list of entries in a specified local row of the graph. Put into storage allocated by calling routine.
LocalRow | - (In) Local row number for which indices are desired. |
Indices | - (Out) Local column indices corresponding to values. |
Values | - (Out) Matrix values. |
NumIndices | - (Out) Number of indices. |
Note: A std::runtime_error exception is thrown if either Indices
or Values
is not large enough to hold the data associated with row LocalRow
. If LocalRow
is not valid for this node, then Indices
and Values
are unchanged and NumIndices
is returned as Teuchos::OrdinalTraits<size_t>::invalid().
|
virtual |
Extract a const, non-persisting view of global indices in a specified row of the matrix.
GlobalRow | - (In) Global row number for which indices are desired. |
Indices | - (Out) Global column indices corresponding to values. |
Values | - (Out) Row values |
indices.size() == getNumEntriesInGlobalRow(GlobalRow)
isLocallyIndexed() == false
Note: If GlobalRow
does not belong to this node, then indices
is set to null.
|
virtual |
Extract a const, non-persisting view of local indices in a specified row of the matrix.
LocalRow | - (In) Local row number for which indices are desired. |
Indices | - (Out) Global column indices corresponding to values. |
Values | - (Out) Row values |
isGloballyIndexed() == false
indices.size() == getNumEntriesInDropRow(LocalRow)
Note: If LocalRow
does not belong to this node, then indices
is set to null.
|
virtual |
Get a copy of the diagonal entries owned by this node, with local row indices.
Returns a distributed Vector object partitioned according to this matrix's row map, containing the the zero and non-zero diagonals owned by this node.
|
virtual |
Scales the RowMatrix on the left with the Vector x.
This matrix will be scaled such that A(i,j) = x(i)*A(i,j) where i denoes the global row number of A and j denotes the global column number of A.
x | A vector to left scale this matrix. |
|
virtual |
Scales the RowMatrix on the right with the Vector x.
This matrix will be scaled such that A(i,j) = x(j)*A(i,j) where i denoes the global row number of A and j denotes the global column number of A.
x | A vector to right scale this matrix. |
|
virtual |
Returns the Frobenius norm of the matrix.
Computes and returns the Frobenius norm of the matrix, defined as: \( \|A\|_F = \sqrt{\sum_{i,j} \|\a_{ij}\|^2} \)
|
virtual |
\( Y := \beta Y + \alpha Op(A) X \), where Op(A) is either A, \(A^T\), or \(A^H\).
Apply the reordered version of the matrix (or its transpose or conjugate transpose) to the given multivector X, producing Y.
beta == 0
, apply() must overwrite Y
, so that any values in Y
(including NaNs) are ignored.alpha == 0
, apply() may short-circuit the matrix, so that any values in X
(including NaNs) are ignored.This method assumes that X and Y are in the reordered order.
If hasTransposeApply() returns false, then the only valid value of mode
is Teuchos::NO_TRANS (the default). Otherwise, it accepts the following values:
|
virtual |
Whether apply() can apply the transpose or conjugate transpose.
|
virtual |
Permute multivector: original-to-reordered.
|
virtual |
Permute multivector: reordered-to-original.