|
Ifpack2 Templated Preconditioning Package
Version 1.0
|
ILU(k) (incomplete LU with fill level k) factorization of a given Tpetra::RowMatrix. More...
#include <Ifpack2_RILUK_decl.hpp>

Public Types | |
| typedef MatrixType::scalar_type | scalar_type |
| The type of the entries of the input MatrixType. More... | |
| typedef MatrixType::local_ordinal_type | local_ordinal_type |
| The type of local indices in the input MatrixType. More... | |
| typedef MatrixType::global_ordinal_type | global_ordinal_type |
| The type of global indices in the input MatrixType. More... | |
| typedef MatrixType::node_type | node_type |
| The type of the Kokkos Node used by the input MatrixType. More... | |
| typedef Teuchos::ScalarTraits < scalar_type >::magnitudeType | magnitude_type |
| The type of the magnitude (absolute value) of a matrix entry. More... | |
Public Member Functions | |
| RILUK (const Teuchos::RCP< const MatrixType > &A_in) | |
| RILUK constuctor with variable number of indices per row. More... | |
| virtual | ~RILUK () |
| Ifpack2_RILUK Destructor. More... | |
| void | SetRelaxValue (magnitude_type RelaxValue) |
| Set RILU(k) relaxation parameter. More... | |
| void | SetAbsoluteThreshold (magnitude_type Athresh) |
| Set absolute threshold value. More... | |
| void | SetRelativeThreshold (magnitude_type Rthresh) |
| Set relative threshold value. More... | |
| void | SetOverlapMode (Tpetra::CombineMode OverlapMode) |
| Set overlap mode type. More... | |
| void | setParameters (const Teuchos::ParameterList ¶ms) |
| void | initialize () |
| Initialize by computing the symbolic incomplete factorization. More... | |
| bool | isInitialized () const |
| Whether initialize() has been called. More... | |
| int | getNumInitialize () const |
| How many times initialize() has been called for this object. More... | |
| void | compute () |
| Compute the (numeric) incomplete factorization. More... | |
| bool | isComputed () const |
| Whether compute() has been called. More... | |
| int | getNumCompute () const |
| How many times compute() has been called for this object. More... | |
| int | getNumApply () const |
| How many times apply() has been called for this object. More... | |
| double | getInitializeTime () const |
| Returns the time spent in initialize(). More... | |
| double | getComputeTime () const |
| Returns the time spent in compute(). More... | |
| double | getApplyTime () const |
| Returns the time spent in apply(). More... | |
| 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 |
| Apply the (inverse of the) incomplete factorization to X, resulting in Y. More... | |
| int | Multiply (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) const |
| Apply the incomplete factorization (as a product) to X, resulting in Y. More... | |
| magnitude_type | computeCondEst (Teuchos::ETransp mode) const |
| Returns the maximum over all the condition number estimate for each local ILU set of factors. More... | |
| magnitude_type | computeCondEst (CondestType CT=Ifpack2::Cheap, local_ordinal_type MaxIters=1550, magnitude_type Tol=1e-9, const Teuchos::Ptr< const Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > &Matrix=Teuchos::null) |
| Computes the condition number estimate and returns its value. More... | |
| magnitude_type | getCondEst () const |
| Returns the computed condition number estimate, or -1.0 if not computed. More... | |
| Teuchos::RCP< const Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > | getMatrix () const |
| Returns a pointer to the input matrix. More... | |
| magnitude_type | GetRelaxValue () const |
| Get RILU(k) relaxation parameter. More... | |
| magnitude_type | getAbsoluteThreshold () const |
| Get absolute threshold value. More... | |
| magnitude_type | getRelativeThreshold () const |
| Get relative threshold value. More... | |
| Tpetra::CombineMode | getOverlapMode () |
| Get overlap mode type. More... | |
| int | getGlobalNumEntries () const |
| Returns the number of nonzero entries in the global graph. More... | |
| const Teuchos::RCP < Ifpack2::IlukGraph < local_ordinal_type, global_ordinal_type, node_type > > & | getGraph () const |
| Returns the Ifpack2::IlukGraph associated with this factored matrix. More... | |
| const MatrixType & | getL () const |
| Returns the L factor associated with this factored matrix. More... | |
| const Tpetra::Vector < scalar_type, local_ordinal_type, global_ordinal_type, node_type > & | getD () const |
| Returns the D factor associated with this factored matrix. More... | |
| const MatrixType & | getU () const |
| Returns the U factor associated with this factored matrix. More... | |
| const Teuchos::RCP< const Tpetra::Map < local_ordinal_type, global_ordinal_type, node_type > > & | getDomainMap () const |
| Returns the Tpetra::Map object associated with the domain of this operator. More... | |
| const Teuchos::RCP< const Tpetra::Map < local_ordinal_type, global_ordinal_type, node_type > > & | getRangeMap () const |
| Returns the Tpetra::Map object associated with the range of this operator. More... | |
Public Member Functions inherited from Ifpack2::Preconditioner< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > | |
| virtual | ~Preconditioner () |
| Destructor. More... | |
Public Attributes | |
| TEUCHOS_DEPRECATED typedef MatrixType::scalar_type | Scalar |
| Preserved only for backwards compatibility. Please use "scalar_type". More... | |
| TEUCHOS_DEPRECATED typedef MatrixType::local_ordinal_type | LocalOrdinal |
| Preserved only for backwards compatibility. Please use "local_ordinal_type". More... | |
| TEUCHOS_DEPRECATED typedef MatrixType::global_ordinal_type | GlobalOrdinal |
| Preserved only for backwards compatibility. Please use "global_ordinal_type". More... | |
| TEUCHOS_DEPRECATED typedef MatrixType::node_type | Node |
| Preserved only for backwards compatibility. Please use "node_type". More... | |
| TEUCHOS_DEPRECATED typedef Teuchos::ScalarTraits < scalar_type >::magnitudeType | magnitudeType |
| Preserved only for backwards compatibility. Please use "magnitude_type". More... | |
ILU(k) (incomplete LU with fill level k) factorization of a given Tpetra::RowMatrix.
| MatrixType | A specialization of Tpetra::RowMatrix. |
This class implements a "relaxed" incomplete ILU (ILU) factorization with level k fill.
For a complete list of valid parameters, see the documentation of setParameters().
The computed factorization is a function of several parameters:
The pattern of the matrix - All fill is derived from the original matrix nonzero structure. Level zero fill is defined as the original matrix pattern (nonzero structure), even if the matrix value at an entry is stored as a zero. (Thus it is possible to add entries to the ILU factors by adding zero entries to the original matrix.)
Level of fill - Starting with the original matrix pattern as level fill of zero, the next level of fill is determined by analyzing the graph of the previous level and determining nonzero fill that is a result of combining entries that were from previous level only (not the current level). This rule limits fill to entries that are direct decendents from the previous level graph. Fill for level k is determined by applying this rule recursively. For sufficiently large values of k, the fill would eventually be complete and an exact LU factorization would be computed.
Level of overlap - All Ifpack2 preconditioners work on parallel distributed-memory computers by using the row partitioning the user input matrix to determine the partitioning for local ILU factors. If the level of overlap is set to zero, the rows of the user matrix that are stored on a given processor are treated as a self-contained local matrix and all column entries that reach to off-processor entries are ignored. Setting the level of overlap to one tells Ifpack to increase the size of the local matrix by adding rows that are reached to by rows owned by this processor. Increasing levels of overlap are defined recursively in the same way. For sufficiently large levels of overlap, the entire matrix would be part of each processor's local ILU factorization process. Level of overlap is defined during the construction of the Ifpack2_IlukGraph object.
Once the factorization is computed, applying the factorization (LUy = x) results in redundant approximations for any elements of y that correspond to rows that are part of more than one local ILU factor. The OverlapMode (changed by calling SetOverlapMode()) defines how these redundancies are handled using the Tpetra::CombineMode enum. The default is to zero out all values of y for rows that were not part of the original matrix row distribution.
Fraction of relaxation - Ifpack2_RILUK computes the ILU factorization row-by-row. As entries at a given row are computed, some number of them will be dropped because they do match the prescribed sparsity pattern. The relaxation factor determines how these dropped values will be handled. If the RelaxValue (changed by calling setRelaxValue()) is zero, then these extra entries will by dropped. This is a classical ILU approach. If the RelaxValue is 1, then the sum of the extra entries will be added to the diagonal. This is a classical Modified ILU (MILU) approach. If RelaxValue is between 0 and 1, then RelaxValue times the sum of extra entries will be added to the diagonal.
For most situations, RelaxValue should be set to zero. For certain kinds of problems, e.g., reservoir modeling, there is a conservation principle involved such that any operator should obey a zero row-sum property. MILU was designed for these cases and you should set the RelaxValue to 1. For other situations, setting RelaxValue to some nonzero value may improve the stability of factorization, and can be used if the computed ILU factors are poorly conditioned.
For ill-conditioned matrices, we often have difficulty computing usable incomplete factorizations. The most common source of problems is that the factorization may encounter a small or zero pivot. In that case, the factorization may fail. Even if the factorization succeeds, the factors may be so poorly conditioned that use of them in the iterative phase produces meaningless results. Before we can fix this problem, we must be able to detect it. To this end, we use a simple but effective condition number estimate for \((LU)^{-1}\).
The condition number of a matrix \(B\), called \(cond_p(B)\), is defined as \(cond_p(B) = \|B\|_p\|B^{-1}\|_p\) in some appropriate norm \(p\). \(cond_p(B)\) gives some indication of how many accurate floating point digits can be expected from operations involving the matrix and its inverse. A condition number approaching the accuracy of a given floating point number system, about 15 decimal digits in IEEE double precision, means that any results involving \(B\) or \(B^{-1}\) may be meaningless.
The \(\infty\)-norm of a vector \(y\) is defined as the maximum of the absolute values of the vector entries, and the \(\infty\)-norm of a matrix C is defined as \(\|C\|_\infty = \max_{\|y\|_\infty = 1} \|Cy\|_\infty\). A crude lower bound for the \(cond_\infty(C)\) is \(\|C^{-1}e\|_\infty\) where \(e = (1, 1, \ldots, 1)^T\). It is a lower bound because \(cond_\infty(C) = \|C\|_\infty\|C^{-1}\|_\infty \ge \|C^{-1}\|_\infty \ge |C^{-1}e\|_\infty\).
For our purposes, we want to estimate \(cond_\infty(LU)\), where \(L\) and \(U\) are our incomplete factors. Edmond in his Ph.D. thesis demonstrates that \(\|(LU)^{-1}e\|_\infty\) provides an effective estimate for \(cond_\infty(LU)\). Furthermore, since finding \(z\) such that \(LUz = y\) is a basic kernel for applying the preconditioner, computing this estimate of \(cond_\infty(LU)\) is performed by setting \(y = e\), calling the solve kernel to compute \(z\) and then computing \(\|z\|_\infty\).
If we detect using the above method that our factorization is too ill-conditioned, we can improve the conditioning by perturbing the matrix diagonal and restarting the factorization using this more diagonally dominant matrix. In order to apply perturbation, prior to starting the factorization, we compute a diagonal perturbation of our matrix \(A\) and perform the factorization on this perturbed matrix. The overhead cost of perturbing the diagonal is minimal since the first step in computing the incomplete factors is to copy the matrix \(A\) into the memory space for the incomplete factors. We simply compute the perturbed diagonal at this point.
The actual perturbation values we use are the diagonal values \((d_1, d_2, \ldots, d_n)\) with \(d_i = sgn(d_i)\alpha + d_i\rho\), \(i=1, 2, \ldots, n\), where \(n\) is the matrix dimension and \(sgn(d_i)\) returns the sign of the diagonal entry. This has the effect of forcing the diagonal values to have minimal magnitude of \(\alpha\) and to increase each by an amount proportional to \(\rho\), and still keep the sign of the original diagonal entry.
Every Ifpack2 preconditioner has the following phases of computation:
RILUK constructs the symbolic incomplete factorization (that is, the structure of the incomplete factors) in the initialize() phase. It computes the numerical incomplete factorization (that is, it fills in the factors' entries with their correct values) in the compute() phase. The apply() phase applies the incomplete factorization to a given multivector using two triangular solves.
Each RILUK object keeps track of both the time required for various operations, and the number of times those operations have been applied for that object. The operations tracked include:
The getNum* methods return the number of times that operation was called. The get*Time methods return the number of seconds spent in all invocations of that operation. For example, getApplyTime() returns the number of seconds spent in all apply() calls. For an average time per apply() call, divide by getNumApply(), the total number of calls to apply().
| typedef MatrixType::scalar_type Ifpack2::RILUK< MatrixType >::scalar_type |
The type of the entries of the input MatrixType.
| typedef MatrixType::local_ordinal_type Ifpack2::RILUK< MatrixType >::local_ordinal_type |
The type of local indices in the input MatrixType.
| typedef MatrixType::global_ordinal_type Ifpack2::RILUK< MatrixType >::global_ordinal_type |
The type of global indices in the input MatrixType.
| typedef MatrixType::node_type Ifpack2::RILUK< MatrixType >::node_type |
The type of the Kokkos Node used by the input MatrixType.
| typedef Teuchos::ScalarTraits<scalar_type>::magnitudeType Ifpack2::RILUK< MatrixType >::magnitude_type |
The type of the magnitude (absolute value) of a matrix entry.
| Ifpack2::RILUK< MatrixType >::RILUK | ( | const Teuchos::RCP< const MatrixType > & | A_in | ) |
|
virtual |
Ifpack2_RILUK Destructor.
|
inline |
Set RILU(k) relaxation parameter.
|
inline |
Set absolute threshold value.
|
inline |
Set relative threshold value.
|
inline |
Set overlap mode type.
|
virtual |
Set parameters for the incomplete factorization.
This preconditioner supports the following parameters:
It will eventually also support the following parameter, although it currently does not:
|
virtual |
Initialize by computing the symbolic incomplete factorization.
|
inlinevirtual |
Whether initialize() has been called.
|
inlinevirtual |
How many times initialize() has been called for this object.
|
virtual |
Compute the (numeric) incomplete factorization.
This function computes the RILU(k) factors L and U using the current:
initialize() must be called first, before this method may be called.
|
inlinevirtual |
Whether compute() has been called.
|
inlinevirtual |
How many times compute() has been called for this object.
|
inlinevirtual |
How many times apply() has been called for this object.
|
inlinevirtual |
Returns the time spent in initialize().
|
inlinevirtual |
Returns the time spent in compute().
|
inlinevirtual |
Returns the time spent in apply().
|
virtual |
Apply the (inverse of the) incomplete factorization to X, resulting in Y.
In Matlab(tm) notation, if the incomplete factorization is \(A \approx LDU\), this method computes Y = beta*Y + alpha*(U \ (D \ (L \ X))) if mode=Teuchos::NO_TRANS, or Y = beta*Y + alpha*(L^T \ (D^T \ (U^T \ X))) if mode=Teuchos::TRANS, or Y = beta*Y + alpha*(L^* \ (D^* \ (U^* \ X))) if mode=Teuchos::CONJ_TRANS.
| X | [in] The input multivector. |
| Y | [in/out] The output multivector. |
| mode | [in] If Teuchos::TRANS resp. Teuchos::CONJ_TRANS, apply the transpose resp. conjugate transpose of the incomplete factorization. Otherwise, don't apply the tranpose. |
| alpha | [in] Scaling factor for the result of applying the preconditioner. |
| beta | [in] Scaling factor for the initial value of Y. |
| int Ifpack2::RILUK< MatrixType >::Multiply | ( | 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 |
||
| ) | const |
Apply the incomplete factorization (as a product) to X, resulting in Y.
In Matlab(tm) notation, if the incomplete factorization is \(A \approx LDU\), this method computes Y = beta*Y + alpha*(L \ (D \ (U \ X))) mode=Teuchos::NO_TRANS, or Y = beta*Y + alpha*(U^T \ (D^T \ (L^T \ X))) if mode=Teuchos::TRANS, or Y = beta*Y + alpha*(U^* \ (D^* \ (L^* \ X))) if mode=Teuchos::CONJ_TRANS.
| X | [in] The input multivector. |
| Y | [in/out] The output multivector. |
| mode | [in] If Teuchos::TRANS resp. Teuchos::CONJ_TRANS, apply the transpose resp. conjugate transpose of the incomplete factorization. Otherwise, don't apply the tranpose. |
| Teuchos::ScalarTraits< typename MatrixType::scalar_type >::magnitudeType Ifpack2::RILUK< MatrixType >::computeCondEst | ( | Teuchos::ETransp | mode | ) | const |
Returns the maximum over all the condition number estimate for each local ILU set of factors.
This functions computes a local condition number estimate on each processor and return the maximum over all processors of the estimate.
| In | Trans -If true, solve transpose problem. |
| Out | ConditionNumberEstimate - The maximum across all processors of the infinity-norm estimate of the condition number of the inverse of LDU. |
|
inlinevirtual |
Computes the condition number estimate and returns its value.
|
inlinevirtual |
Returns the computed condition number estimate, or -1.0 if not computed.
|
inlinevirtual |
Returns a pointer to the input matrix.
|
inline |
Get RILU(k) relaxation parameter.
|
inline |
Get absolute threshold value.
|
inline |
Get relative threshold value.
|
inline |
Get overlap mode type.
|
inline |
Returns the number of nonzero entries in the global graph.
|
inline |
Returns the Ifpack2::IlukGraph associated with this factored matrix.
|
inline |
Returns the L factor associated with this factored matrix.
|
inline |
Returns the D factor associated with this factored matrix.
|
inline |
Returns the U factor associated with this factored matrix.
|
inlinevirtual |
Returns the Tpetra::Map object associated with the domain of this operator.
|
inlinevirtual |
Returns the Tpetra::Map object associated with the range of this operator.
| TEUCHOS_DEPRECATED typedef MatrixType::scalar_type Ifpack2::RILUK< MatrixType >::Scalar |
Preserved only for backwards compatibility. Please use "scalar_type".
| TEUCHOS_DEPRECATED typedef MatrixType::local_ordinal_type Ifpack2::RILUK< MatrixType >::LocalOrdinal |
Preserved only for backwards compatibility. Please use "local_ordinal_type".
| TEUCHOS_DEPRECATED typedef MatrixType::global_ordinal_type Ifpack2::RILUK< MatrixType >::GlobalOrdinal |
Preserved only for backwards compatibility. Please use "global_ordinal_type".
| TEUCHOS_DEPRECATED typedef MatrixType::node_type Ifpack2::RILUK< MatrixType >::Node |
Preserved only for backwards compatibility. Please use "node_type".
| TEUCHOS_DEPRECATED typedef Teuchos::ScalarTraits<scalar_type>::magnitudeType Ifpack2::RILUK< MatrixType >::magnitudeType |
Preserved only for backwards compatibility. Please use "magnitude_type".
1.8.5