NAG FL Interface
f11dxf (complex_gen_precon_jacobi)
1
Purpose
f11dxf computes the approximate solution of a complex, Hermitian or non-Hermitian, sparse system of linear equations applying a number of Jacobi iterations. It is expected that f11dxf will be used as a preconditioner for the iterative solution of complex sparse systems of equations.
2
Specification
Fortran Interface
Subroutine f11dxf ( |
store, trans, init, niter, n, nnz, a, irow, icol, check, b, x, diag, work, ifail) |
Integer, Intent (In) |
:: |
niter, n, nnz, irow(nnz), icol(nnz) |
Integer, Intent (Inout) |
:: |
ifail |
Complex (Kind=nag_wp), Intent (In) |
:: |
a(nnz), b(n) |
Complex (Kind=nag_wp), Intent (Inout) |
:: |
diag(n) |
Complex (Kind=nag_wp), Intent (Out) |
:: |
x(n), work(n) |
Character (1), Intent (In) |
:: |
store, trans, init, check |
|
C Header Interface
#include <nag.h>
void |
f11dxf_ (const char *store, const char *trans, const char *init, const Integer *niter, const Integer *n, const Integer *nnz, const Complex a[], const Integer irow[], const Integer icol[], const char *check, const Complex b[], Complex x[], Complex diag[], Complex work[], Integer *ifail, const Charlen length_store, const Charlen length_trans, const Charlen length_init, const Charlen length_check) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
f11dxf_ (const char *store, const char *trans, const char *init, const Integer &niter, const Integer &n, const Integer &nnz, const Complex a[], const Integer irow[], const Integer icol[], const char *check, const Complex b[], Complex x[], Complex diag[], Complex work[], Integer &ifail, const Charlen length_store, const Charlen length_trans, const Charlen length_init, const Charlen length_check) |
}
|
The routine may be called by the names f11dxf or nagf_sparse_complex_gen_precon_jacobi.
3
Description
f11dxf computes the
approximate solution of the complex sparse system of linear equations
using
niter iterations of the Jacobi algorithm (see also
Golub and Van Loan (1996) and
Young (1971)):
where
and
.
f11dxf can be used both for non-Hermitian and Hermitian systems of equations. For Hermitian 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
f11dxf will be used as a preconditioner for the iterative solution of complex sparse systems of equations, using either the suite comprising the routines
f11grf,
f11gsf and
f11gtf, for Hermitian systems, or the suite comprising the routines
f11brf,
f11bsf and
f11btf, for non-Hermitian 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
Arguments
-
1:
– Character(1)
Input
-
On entry: specifies whether the matrix
is stored using symmetric coordinate storage (SCS) (applicable only to a Hermitian matrix
) or coordinate storage (CS) (applicable to both Hermitian and non-Hermitian matrices).
- The complete matrix is stored in CS format.
- The lower triangle of the Hermitian 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 Hermitian 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:
– Integer
Input
-
On entry: the number of Jacobi iterations requested.
Constraint:
.
-
5:
– Integer
Input
-
On entry: , the order of the matrix .
Constraint:
.
-
6:
– Integer
Input
-
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:
– Complex (Kind=nag_wp) array
Input
-
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
f11znf or
f11zpf may be used to reorder the elements in this way for CS and SCS storage, respectively.
-
8:
– Integer array
Input
-
9:
– Integer array
Input
-
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:
– Complex (Kind=nag_wp) array
Input
-
On entry: the right-hand side vector .
-
12:
– Complex (Kind=nag_wp) array
Output
-
On exit: the approximate solution vector .
-
13:
– Complex (Kind=nag_wp) array
Input/Output
-
On entry: if , the diagonal elements of .
On exit: if
, unchanged on exit.
If , the diagonal elements of .
-
14:
– Complex (Kind=nag_wp) array
Workspace
-
-
15:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended.
When the value or 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 : .
On entry, or : .
On entry, .
Constraint: .
On entry, or : .
On entry, or : .
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint:
On entry, and .
Constraint:
-
On entry, is out of order: .
On entry, , and .
Constraint: and .
On entry, , and .
Constraint: and .
On entry, , and .
Constraint: and .
On entry, the location () is a duplicate: .
A nonzero element has been supplied which does not lie within the matrix
, is out of order, or has duplicate row and column indices. Consider calling either
f11zaf or
f11zbf to reorder and sum or remove duplicates when
or
, respectively.
-
On entry, the element is zero: .
-
On entry, the diagonal element of the th row is zero or missing: .
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface 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
f11dxf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f11dxf 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 f11dxf is proportional to .
It is expected that a common use of f11dxf will be as preconditioner for the iterative solution of complex, Hermitian or non-Hermitian, linear systems. In this situation, f11dxf 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 complex sparse non-Hermitian system of equations iteratively using f11dxf as a preconditioner.
10.1
Program Text
10.2
Program Data
10.3
Program Results