naginterfaces.library.sparse.real_gen_precon_ilu¶
- naginterfaces.library.sparse.real_gen_precon_ilu(nnz, a, irow, icol, n=None, lfill=0, dtol=0.0, pstrat='C', milu='N', ipivp=None, ipivq=None)[source]¶
real_gen_precon_ilu
computes an incomplete factorization of a real sparse nonsymmetric matrix, represented in coordinate storage format. This factorization may be used as a preconditioner in combination withreal_gen_solve_ilu()
orreal_gen_basic_solver()
.For full information please refer to the NAG Library document for f11da
https://www.nag.com/numeric/nl/nagdoc_28.6/flhtml/f11/f11daf.html
- Parameters
- nnzint
The number of nonzero elements in the matrix .
- afloat, array-like, shape
The nonzero elements in the matrix , ordered by increasing row index, and by increasing column index within each row. Multiple entries for the same row and column indices are not permitted. The function
real_gen_sort()
may be used to order the elements in this way.- irowint, array-like, shape
The row indices of the nonzero elements supplied in .
- icolint, array-like, shape
The column indices of the nonzero elements supplied in .
- nNone or int, optional
Note: if this argument is None then a default value will be used, determined as follows: .
, the order of the matrix .
- lfillint, optional
If its value is the maximum level of fill allowed in the decomposition (see Further Comments). A negative value of indicates that will be used to control the fill instead.
- dtolfloat, optional
If , is used as a drop tolerance to control the fill-in (see Further Comments); otherwise is not referenced.
- pstratstr, length 1, optional
Specifies the pivoting strategy to be adopted.
No pivoting is carried out.
Pivoting is carried out according to the user-defined input values of and .
Partial pivoting by columns for stability is carried out.
Complete pivoting by rows for sparsity, and by columns for stability, is carried out.
- milustr, length 1, optional
Indicates whether or not the factorization should be modified to preserve row-sums (see Choice of Arguments).
The factorization is modified.
The factorization is not modified.
- ipivpNone or int, array-like, shape , optional
If , and must specify the row and column indices of the element used as a pivot at elimination stage . Otherwise and need not be initialized.
- ipivqNone or int, array-like, shape , optional
If , and must specify the row and column indices of the element used as a pivot at elimination stage . Otherwise and need not be initialized.
- Returns
- afloat, ndarray, shape
The first entries of contain the nonzero elements of and the next entries contain the elements of the matrix . Matrix elements are ordered by increasing row index, and by increasing column index within each row.
- irowint, ndarray, shape
The row indices of the nonzero elements returned in .
- icolint, ndarray, shape
The column indices of the nonzero elements returned in .
- ipivpint, ndarray, shape
The pivot indices. If and then the element in row and column was used as the pivot at elimination stage .
- ipivqint, ndarray, shape
The pivot indices. If and then the element in row and column was used as the pivot at elimination stage .
- istrint, ndarray, shape
, for , is the starting address in the arrays , and of row of the matrix . is the address of the last nonzero element in plus one.
- idiagint, ndarray, shape
, for , holds the index of arrays , and which holds the diagonal element in row of the matrix .
- nnzcint
The number of nonzero elements in the matrix .
- npivmint
If it gives the number of pivots which were modified during the factorization to ensure that exists.
If no pivot modifications were required, but a local restart occurred (see Algorithmic Details).
The quality of the preconditioner will generally depend on the returned value of .
If is large the preconditioner may not be satisfactory.
In this case it may be advantageous to call
real_gen_precon_ilu
again with an increased value of , a reduced value of , or set .See also Further Comments.
- Raises
- NagValueError
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: or .
- (errno )
On entry, .
Constraint: , , or .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, the location is a duplicate: .
- (errno )
On entry, is out of order: .
- (errno )
On entry, , and .
Constraint: and .
- (errno )
On entry, , and .
Constraint: and .
- (errno )
On entry, a user-supplied value of is repeated.
- (errno )
On entry, a user-supplied value of lies outside the range .
- (errno )
On entry, a user-supplied value of is repeated.
- (errno )
On entry, a user-supplied value of lies outside the range .
- (errno )
The number of nonzero entries in the decomposition is too large. The decomposition has been terminated before completion. Either increase , or reduce the fill by reducing , or increasing .
- (errno )
A serious error has occurred in an internal call to an auxiliary function. Check all function calls and array sizes. Seek expert help.
- (errno )
Either or the pair and , and not all three, must be provided.
- Notes
In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.
real_gen_precon_ilu
computes an incomplete factorization (see Meijerink and Van der Vorst (1977) and Meijerink and Van der Vorst (1981)) of a real sparse nonsymmetric matrix . The factorization is intended primarily for use as a preconditioner with one of the iterative solversreal_gen_solve_ilu()
orreal_gen_basic_solver()
.The decomposition is written in the form
where
and is lower triangular with unit diagonal elements, is diagonal, is upper triangular with unit diagonals, and are permutation matrices, and is a remainder matrix.
The amount of fill-in occurring in the factorization can vary from zero to complete fill, and can be controlled by specifying either the maximum level of fill , or the drop tolerance .
The argument defines the pivoting strategy to be used. The options currently available are no pivoting, user-defined pivoting, partial pivoting by columns for stability, and complete pivoting by rows for sparsity and by columns for stability. The factorization may optionally be modified to preserve the row-sums of the original matrix.
The sparse matrix is represented in coordinate storage (CS) format (see the F11 Introduction). The array stores all the nonzero elements of the matrix , while arrays and store the corresponding row and column indices respectively. Multiple nonzero elements may not be specified for the same row and column index.
The preconditioning matrix is returned in terms of the CS representation of the matrix
Further algorithmic details are given in Algorithmic Details.
- References
Meijerink, J and Van der Vorst, H, 1977, An iterative solution method for linear systems of which the coefficient matrix is a symmetric M-matrix, Math. Comput. (31), 148–162
Meijerink, J and Van der Vorst, H, 1981, Guidelines for the usage of incomplete decompositions in solving sets of linear equations as they occur in practical problems, J. Comput. Phys. (44), 134–155
Salvini, S A and Shaw, G J, 1996, An evaluation of new NAG Library solvers for large sparse unsymmetric linear systems, NAG Technical Report TR2/96