NAG Library Routine Document
F11DKF
1 Purpose
F11DKF computes the approximate solution of a real, symmetric or nonsymmetric, sparse system of linear equations applying a number of Jacobi iterations. It is expected that F11DKF will be used as a preconditioner for the iterative solution of real sparse systems of equations.
2 Specification
SUBROUTINE F11DKF ( |
STORE, TRANS, INIT, NITER, N, NNZ, A, IROW, ICOL, CHECK, B, X, DIAG, WORK, IFAIL) |
INTEGER |
NITER, N, NNZ, IROW(NNZ), ICOL(NNZ), IFAIL |
REAL (KIND=nag_wp) |
A(NNZ), B(N), X(N), DIAG(N), WORK(N) |
CHARACTER(1) |
STORE, TRANS, INIT, CHECK |
|
3 Description
F11DKF computes the
approximate solution of the real sparse system of linear equations
using
NITER iterations of the Jacobi algorithm (see also
Golub and Van Loan (1996) and
Young (1971)):
where
and
.
F11DKF can be used both for nonsymmetric and symmetric systems of equations. For symmetric matrices, either all nonzero elements of the matrix
can be supplied using coordinate storage (CS), or only the nonzero elements of the lower triangle of
, using symmetric coordinate storage (SCS) (see the
F11 Chapter Introduction).
It is expected that F11DKF will be used as a preconditioner for the iterative solution of real sparse systems of equations, using either the suite comprising the routines
F11GDF,
F11GEF and
F11GFF, for symmetric systems, or the suite comprising the routines
F11BDF,
F11BEF and
F11BFF, for nonsymmetric systems of equations.
4 References
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Young D (1971) Iterative Solution of Large Linear Systems Academic Press, New York
5 Parameters
- 1: – CHARACTER(1)Input
-
On entry: specifies whether the matrix
is stored using symmetric coordinate storage (SCS) (applicable only to a symmetric matrix
) or coordinate storage (CS) (applicable to both symmetric and non-symmetric matrices).
- The complete matrix is stored in CS format.
- The lower triangle of the symmetric matrix is stored in SCS format.
Constraint:
or .
- 2: – CHARACTER(1)Input
-
On entry: if
, specifies whether the approximate solution of
or of
is required.
- The approximate solution of is calculated.
- The approximate solution of is calculated.
Suggested value:
if the matrix is symmetric and stored in CS format, it is recommended that for reasons of efficiency.
Constraint:
or .
- 3: – CHARACTER(1)Input
-
On entry: on first entry,
INIT should be set to 'I', unless the diagonal elements of
are already stored in the array
DIAG. If
DIAG already contains the diagonal of
, it must be set to 'N'.
- DIAG must contain the diagonal of .
- DIAG will store the diagonal of on exit.
Suggested value:
on first entry;
, subsequently, unless
DIAG has been overwritten.
Constraint:
or .
- 4: – INTEGERInput
-
On entry: the number of Jacobi iterations requested.
Constraint:
.
- 5: – INTEGERInput
-
On entry: , the order of the matrix .
Constraint:
.
- 6: – INTEGERInput
-
On entry: if
, the number of nonzero elements in the matrix
.
If , the number of nonzero elements in the lower triangle of the matrix .
Constraints:
- if , ;
- if , .
- 7: – REAL (KIND=nag_wp) arrayInput
-
On entry: if
, the nonzero elements in the matrix
(CS format).
If , the nonzero elements in the lower triangle of the matrix (SCS format).
In both cases, the elements of either
or of its lower triangle must be ordered by increasing row index and by increasing column index within each row. Multiple entries for the same row and columns indices are not permitted. The routine
F11ZAF or
F11ZBF may be used to reorder the elements in this way for CS and SCS storage, respectively.
- 8: – INTEGER arrayInput
- 9: – INTEGER arrayInput
-
On entry: if
, the row and column indices of the nonzero elements supplied in
A.
If
, the row and column indices of the nonzero elements of the lower triangle of the matrix
supplied in
A.
Constraints:
- , for ;
- if , , for ;
- if , , for ;
- either or both and , for .
- 10: – CHARACTER(1)Input
-
On entry: specifies whether or not the CS or SCS representation of the matrix
should be checked.
- Checks are carried out on the values of N, NNZ, IROW, ICOL; if , DIAG is also checked.
- None of these checks are carried out.
Constraint:
or .
- 11: – REAL (KIND=nag_wp) arrayInput
-
On entry: the right-hand side vector .
- 12: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the approximate solution vector .
- 13: – REAL (KIND=nag_wp) arrayInput/Output
-
On entry: if , the diagonal elements of .
On exit: if
, unchanged on exit.
If , the diagonal elements of .
- 14: – REAL (KIND=nag_wp) arrayWorkspace
-
- 15: – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
On entry, | or , |
or | or , |
or | or , |
or | or , |
or | . |
-
On entry, | , |
or | , |
or | , if , |
or | , if . |
-
On entry, the arrays
IROW and
ICOL fail to satisfy the following constraints:
- and
- if then , or
- if then , for .
- or and , for .
Therefore a nonzero element has been supplied which does not lie within the matrix
, is out of order, or has duplicate row and column indices. Call either
F11ZAF or
F11ZBF to reorder and sum or remove duplicates when
or
, respectively.
-
On entry,
and some diagonal elements of
stored in
DIAG are zero.
-
On entry, and some diagonal elements of are zero.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
7 Accuracy
In general, the Jacobi method cannot be used on its own to solve systems of linear equations. The rate of convergence is bound by its spectral properties (see, for example,
Golub and Van Loan (1996)) and as a solver, the Jacobi method can only be applied to a limited set of matrices. One condition that guarantees convergence is strict diagonal dominance.
However, the Jacobi method can be used successfully as a preconditioner to a wider class of systems of equations. The Jacobi method has good vector/parallel properties, hence it can be applied very efficiently. Unfortunately, it is not possible to provide criteria which define the applicability of the Jacobi method as a preconditioner, and its usefulness must be judged for each case.
8 Parallelism and Performance
F11DKF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
F11DKF makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
The time taken for a call to F11DKF is proportional to .
It is expected that a common use of F11DKF will be as preconditioner for the iterative solution of real, symmetric or nonsymmetric, linear systems. In this situation, F11DKF is likely to be called many times. In the interests of both reliability and efficiency, you are recommended to set for the first of such calls, and to set for all subsequent calls.
10 Example
This example solves the real sparse nonsymmetric system of equations iteratively using F11DKF as a preconditioner.
10.1 Program Text
Program Text (f11dkfe.f90)
10.2 Program Data
Program Data (f11dkfe.d)
10.3 Program Results
Program Results (f11dkfe.r)