hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_sparse_real_symm_precon_ichol_solve (f11jb)

Purpose

nag_sparse_real_symm_precon_ichol_solve (f11jb) solves a system of linear equations involving the incomplete Cholesky preconditioning matrix generated by nag_sparse_real_symm_precon_ichol (f11ja).

Syntax

[x, ifail] = f11jb(a, irow, icol, ipiv, istr, check, y, 'n', n, 'la', la)
[x, ifail] = nag_sparse_real_symm_precon_ichol_solve(a, irow, icol, ipiv, istr, check, y, 'n', n, 'la', la)

Description

nag_sparse_real_symm_precon_ichol_solve (f11jb) solves a system of linear equations
Mx = y
Mx=y
involving the preconditioning matrix M = PLDLTPTM=PLDLTPT, corresponding to an incomplete Cholesky decomposition of a sparse symmetric matrix stored in symmetric coordinate storage (SCS) format (see Section [Symmetric coordinate storage (SCS) format] in the F11 Chapter Introduction), as generated by nag_sparse_real_symm_precon_ichol (f11ja).
In the above decomposition LL is a lower triangular sparse matrix with unit diagonal, DD is a diagonal matrix and PP is a permutation matrix. LL and DD are supplied to nag_sparse_real_symm_precon_ichol_solve (f11jb) through the matrix
C = L + D1I
C=L+D-1-I
which is a lower triangular n by n sparse matrix, stored in SCS format, as returned by nag_sparse_real_symm_precon_ichol (f11ja). The permutation matrix PP is returned from nag_sparse_real_symm_precon_ichol (f11ja) via the array ipiv.
It is envisaged that a common use of nag_sparse_real_symm_precon_ichol_solve (f11jb) will be to carry out the preconditioning step required in the application of nag_sparse_real_symm_basic_solver (f11ge) to sparse symmetric linear systems. nag_sparse_real_symm_precon_ichol_solve (f11jb) is used for this purpose by the Black Box function nag_sparse_real_symm_solve_ichol (f11jc).
nag_sparse_real_symm_precon_ichol_solve (f11jb) may also be used in combination with nag_sparse_real_symm_precon_ichol (f11ja) to solve a sparse symmetric positive definite system of linear equations directly (see Section [Direct Solution of Systems] in (f11ja)). This use of nag_sparse_real_symm_precon_ichol_solve (f11jb) is demonstrated in Section [Example].

References

None.

Parameters

Compulsory Input Parameters

1:     a(la) – double array
The values returned in the array a by a previous call to nag_sparse_real_symm_precon_ichol (f11ja).
2:     irow(la) – int64int32nag_int array
3:     icol(la) – int64int32nag_int array
4:     ipiv(n) – int64int32nag_int array
5:     istr(n + 1n+1) – int64int32nag_int array
The values returned in arrays irow, icol, ipiv and istr by a previous call to nag_sparse_real_symm_precon_ichol (f11ja).
6:     check – string (length ≥ 1)
Specifies whether or not the input data should be checked.
check = 'C'check='C'
Checks are carried out on the values of n, irow, icol, ipiv and istr.
check = 'N'check='N'
No checks are carried out.
Constraint: check = 'C'check='C' or 'N''N'.
7:     y(n) – double array
n, the dimension of the array, must satisfy the constraint n1n1.
The right-hand side vector yy.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The dimension of the arrays ipiv, y. (An error is raised if these dimensions are not equal.)
nn, the order of the matrix MM. This must be the same value as was supplied in the preceding call to nag_sparse_real_symm_precon_ichol (f11ja).
Constraint: n1n1.
2:     la – int64int32nag_int scalar
Default: The dimension of the arrays a, irow, icol. (An error is raised if these dimensions are not equal.)
The dimension of the arrays a, irow and icol as declared in the (sub)program from which nag_sparse_real_symm_precon_ichol_solve (f11jb) is called. This must be the same value returned by the preceding call to nag_sparse_real_symm_precon_ichol (f11ja).

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     x(n) – double array
The solution vector xx.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,check'C'check'C' or 'N''N'.
  ifail = 2ifail=2
On entry,n < 1n<1.
  ifail = 3ifail=3
On entry, the SCS representation of the preconditioning matrix MM is invalid. Further details are given in the error message. Check that the call to nag_sparse_real_symm_precon_ichol_solve (f11jb) has been preceded by a valid call to nag_sparse_real_symm_precon_ichol (f11ja) and that the arrays a, irow, icol, ipiv and istr have not been corrupted between the two calls.

Accuracy

The computed solution xx is the exact solution of a perturbed system of equations (M + δM)x = y(M+δM)x=y, where
|δM|c(n)εP|L||D||LT|PT,
|δM|c(n)εP|L||D||LT|PT,
c(n)c(n) is a modest linear function of nn, and εε is the machine precision.

Further Comments

Timing

The time taken for a call to nag_sparse_real_symm_precon_ichol_solve (f11jb) is proportional to the value of nnzc returned from nag_sparse_real_symm_precon_ichol (f11ja).

Use of check

It is expected that a common use of nag_sparse_real_symm_precon_ichol_solve (f11jb) will be to carry out the preconditioning step required in the application of nag_sparse_real_symm_basic_solver (f11ge) to sparse symmetric linear systems. In this situation nag_sparse_real_symm_precon_ichol_solve (f11jb) is likely to be called many times with the same matrix MM. In the interests of both reliability and efficiency, you are recommended to set check = 'C'check='C' for the first of such calls, and to set check = 'N'check='N' for all subsequent calls.

Example

function nag_sparse_real_symm_precon_ichol_solve_example
nz = int64(23);
a = zeros(3*nz, 1);
a(1:nz) = [4; -1; 6; 1; 2; 3; 2; 4; 1; 2; 6; -4; 1; -1; 6; -1; -1; 3; ...
            1; 1; -1; 1; 4];
irow = zeros(3*nz, 1, 'int64');
irow(1:nz) = [int64(1); 2; 2; 3; 3; 4; 5; 5; 6; 6; 6; 7; 7; 7; 7; 8; ...
               8; 8; 9; 9; 9; 9; 9];
icol = zeros(3*nz, 1, 'int64');
icol(1:nz) = [int64(1); 1; 2; 2; 3; 4; 1; 5; 3; 4; 6; 2; 5; 6; 7; 4; ...
               6; 8; 1; 5; 6; 8; 9];
ipiv = zeros(9, 1, 'int64');
lfill = int64(-1);
dtol = 0;
mic = 'N';
dscale = 0;
pstrat = 'M';
check = 'C';
y = [4.1; -2.94; 1.41; 2.53; 4.35; 1.29; 5.01; 0.52; 4.57];
% Calculate incomplete Cholesky factorization
[a, irow, icol, ipiv, istr, nnzc, npivm, ifail] = ...
    nag_sparse_real_symm_precon_ichol(nz, a, irow, icol, lfill, dtol, mic, ...
                                      dscale, ipiv);

if npivm ~= 0
  fprintf('\nFactorization is not complete.\n');
else
  % Solve P L D L^T P^T x = y
  [x, ifail] = nag_sparse_real_symm_precon_ichol_solve(a, irow, icol, ipiv, ...
                                                       istr, check, y);

  fprintf('\nSolution of linear system:\n');
  disp(x);
end
 

Solution of linear system:
    0.7000
    0.1600
    0.5200
    0.7700
    0.2800
    0.2100
    0.9300
    0.2000
    0.9000


function f11jb_example
nz = int64(23);
a = zeros(3*nz, 1);
a(1:nz) = [4; -1; 6; 1; 2; 3; 2; 4; 1; 2; 6; -4; 1; -1; 6; -1; -1; 3; ...
            1; 1; -1; 1; 4];
irow = zeros(3*nz, 1, 'int64');
irow(1:nz) = [int64(1); 2; 2; 3; 3; 4; 5; 5; 6; 6; 6; 7; 7; 7; 7; 8; ...
               8; 8; 9; 9; 9; 9; 9];
icol = zeros(3*nz, 1, 'int64');
icol(1:nz) = [int64(1); 1; 2; 2; 3; 4; 1; 5; 3; 4; 6; 2; 5; 6; 7; 4; ...
               6; 8; 1; 5; 6; 8; 9];
ipiv = zeros(9, 1, 'int64');
lfill = int64(-1);
dtol = 0;
mic = 'N';
dscale = 0;
pstrat = 'M';
check = 'C';
y = [4.1; -2.94; 1.41; 2.53; 4.35; 1.29; 5.01; 0.52; 4.57];
% Calculate incomplete Cholesky factorization
[a, irow, icol, ipiv, istr, nnzc, npivm, ifail] = ...
    f11ja(nz, a, irow, icol, lfill, dtol, mic, dscale, ipiv);

if npivm ~= 0
  fprintf('\nFactorization is not complete.\n');
else
  % Solve P L D L^T P^T x = y
  [x, ifail] = f11jb(a, irow, icol, ipiv, istr, check, y);

  fprintf('\nSolution of linear system:\n');
  disp(x);
end
 

Solution of linear system:
    0.7000
    0.1600
    0.5200
    0.7700
    0.2800
    0.2100
    0.9300
    0.2000
    0.9000



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013