|
NAG[f11jec] NAG[nag_sparse_sym_sol] - Solver with Jacobi, SSOR, or no preconditioning (symmetric)
|
|
Calling Sequence
f11jec(method, precon, a, irow, icol, omega, b, tol, maxitn, x, rnorm, itn, comm, 'n'=n, 'nnz'=nnz, 'fail'=fail)
nag_sparse_sym_sol(. . .)
Parameters
|
method - String;
|
|
|
On entry: specifies the iterative method to be used.
|
|
The conjugate gradient method is used.
|
|
The Lanczos method (SYMMLQ) is used.
|
|
Constraint: "Nag_SparseSym_CG" or "Nag_SparseSym_Lanczos". .
|
|
|
precon - String;
|
|
|
On entry: specifies the type of preconditioning to be used.
|
|
No preconditioning is used.
|
|
Symmetric successive-over-relaxation is used.
|
|
Jacobi preconditioning is used.
|
|
Constraint: "Nag_SparseSym_NoPrec", "Nag_SparseSym_SSORPrec" or "Nag_SparseSym_JacPrec". .
|
|
|
a - Vector(1..nnz, datatype=float[8]);
|
|
|
On entry: the non-zero elements of the lower triangular part of 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 f11zbc (nag_sparse_sym_sort) may be used to order the elements in this way.
|
|
|
irow - Vector(1..nnz, datatype=integer[kernelopts('wordsize')/8]);
icol - Vector(1..nnz, datatype=integer[kernelopts('wordsize')/8]);
|
|
|
On entry: the row and column indices of the non-zero elements supplied in .
|
|
|
omega - float;
|
|
|
On entry: if , omega is the relaxation argument to be used in the SSOR method. Otherwise omega need not be initialized.
|
|
Constraint: . .
|
|
|
b - Vector(1..n, datatype=float[8]);
|
|
|
On entry: the right-hand side vector .
|
|
|
tol - float;
|
|
|
Constraint: . .
|
|
|
maxitn - integer;
|
|
|
On entry: the maximum number of iterations allowed.
|
|
Constraint: . .
|
|
|
x - Vector(1..n, datatype=float[8]);
|
|
|
On entry: an initial approximation of the solution vector .
|
|
On exit: an improved approximation to the solution vector .
|
|
|
rnorm - assignable;
|
|
|
Note: On exit the variable rnorm will have a value of type float.
|
|
On exit: the final value of the residual norm , where is the output value of itn.
|
|
|
itn - assignable;
|
|
|
Note: On exit the variable itn will have a value of type integer.
|
|
On exit: the number of iterations carried out.
|
|
|
comm - Vector;
|
|
|
A Maple Vector, which should be generated using NAG[Nag_Sparse_Comm], corresponding to the Nag_Sparse_Comm structure.
|
|
|
'n'=n - integer; (optional)
|
|
|
Default value: the first dimension of the arrays b, x.
|
|
On entry: the order of the matrix .
|
|
Constraint: . .
|
|
|
'nnz'=nnz - integer; (optional)
|
|
|
Default value: the first dimension of the arrays a, irow, icol.
|
|
On entry: the number of non-zero elements in the lower triangular part of the matrix .
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_sparse_sym_sol (f11jec) solves a real sparse symmetric system of linear equations, represented in symmetric coordinate storage format, using a conjugate gradient or Lanczos method, without preconditioning, with Jacobi or with SSOR preconditioning.
|
|
Description
|
|
nag_sparse_sym_sol (f11jec) solves a real sparse symmetric linear system of equations:
using a preconditioned conjugate gradient method (see Barrett et al. (1994)), or a preconditioned Lanczos method based on the algorithm SYMMLQ (Paige and Saunders (1975)). The conjugate gradient method is more efficient if is positive-definite, but may fail to converge for indefinite matrices. In this case the Lanczos method should be used instead. For further details see Barrett et al. (1994).
The function allows the following choices for the preconditioner:
|
Jacobi preconditioning (see Young (1971);
|
|
symmetric successive-over-relaxation (SSOR) preconditioning (see Young (1971)).
|
For incomplete Cholesky (IC) preconditioning see f11jcc (nag_sparse_sym_chol_sol).
The matrix is represented in symmetric coordinate storage (SCS) format (see the f11 Chapter Introduction) in the arrays a, irow and icol. The array a holds the non-zero entries in the lower triangular part of the matrix, while irow and icol hold the corresponding row and column indices.
|
|
Error Indicators and Warnings
|
|
"NE_ACC_LIMIT"
The required accuracy could not be obtained. However, a reasonable accuracy has been obtained and further iterations cannot improve the result.
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument method had an illegal value.
On entry, argument precon had an illegal value.
"NE_COEFF_NOT_POS_DEF"
The matrix of coefficients appears not to be positive-definite (conjugate gradient method only).
"NE_INT_2"
On entry, , . Constraint: .
"NE_INT_ARG_LT"
On entry, maxitn must not be less than 1: .
On entry, n must not be less than 1: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_NOT_REQ_ACC"
The required accuracy has not been obtained in maxitn iterations.
"NE_PRECOND_NOT_POS_DEF"
The preconditioner appears not to be positive-definite.
"NE_REAL"
On entry, . Constraint: .
"NE_REAL_ARG_GE"
On entry, tol must not be greater than or equal to 1.0: .
"NE_SYMM_MATRIX_DUP"
A non-zero element has been supplied which does not lie in the lower triangular part of the matrix , is out of order, or has duplicate row and column indices, i.e., one or more of the following constraints has been violated:
Call f11zbc (nag_sparse_sym_sort) to reorder and sum or remove duplicates.
"NE_ZERO_DIAGONAL_ELEM"
The matrix has a zero diagonal element. Jacobi and SSOR preconditioners are not appropriate for this problem.
|
|
Accuracy
|
|
On successful termination, the final residual , where , satisfies the termination criterion
The value of the final residual norm is returned in rnorm.
|
|
Further Comments
|
|
The time taken by nag_sparse_sym_sol (f11jec) for each iteration is roughly proportional to nnz. One iteration with the Lanczos method (SYMMLQ) requires a slightly larger number of operations than one iteration with the conjugate gradient method.
The number of iterations required to achieve a prescribed accuracy cannot be easily determined a priori, as it can depend dramatically on the conditioning and spectrum of the preconditioned matrix of the coefficients .
|
|
|
Examples
|
|
>
|
method := "Nag_SparseSym_CG":
precon := "Nag_SparseSym_SSORPrec":
n := 7:
nnz := 16:
omega := 1.1:
tol := 1e-06:
maxitn := 100:
comm := NAG:-Nag_Sparse_Comm():
a := Vector([4, 1, 5, 2, 2, 3, -1, 1, 4, 1, -2, 3, 2, -1, -2, 5], datatype=float[8]):
irow := Vector([1, 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7], datatype=integer[kernelopts('wordsize')/8]):
icol := Vector([1, 1, 2, 3, 2, 4, 1, 4, 5, 2, 5, 6, 1, 2, 3, 7], datatype=integer[kernelopts('wordsize')/8]):
b := Vector([15, 18, -8, 21, 11, 10, 29], datatype=float[8]):
x := Vector([0, 0, 0, 0, 0, 0, 0], datatype=float[8]):
NAG:-f11jec(method, precon, a, irow, icol, omega, b, tol, maxitn, x, rnorm, itn, comm, 'n' = n, 'nnz' = nnz):
|
|
|
See Also
|
|
Barrett R, Berry M, Chan T F, Demmel J, Donato J, Dongarra J, Eijkhout V, Pozo R, Romine C and Van der Vorst H (1994) Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods SIAM, Philadelphia
Paige C C and Saunders M A (1975) Solution of sparse indefinite systems of linear equations SIAM J. Numer. Anal. 12 617–629
Young D (1971) Iterative Solution of Large Linear Systems Academic Press, New York
f11 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|