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_complex_herm_precon_ssor_solve (f11jr)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_sparse_complex_herm_precon_ssor_solve (f11jr) solves a system of linear equations involving the preconditioning matrix corresponding to SSOR applied to a complex sparse Hermitian matrix, represented in symmetric coordinate storage format.

Syntax

[x, ifail] = f11jr(a, irow, icol, rdiag, omega, check, y, 'n', n, 'nz', nz)
[x, ifail] = nag_sparse_complex_herm_precon_ssor_solve(a, irow, icol, rdiag, omega, check, y, 'n', n, 'nz', nz)

Description

nag_sparse_complex_herm_precon_ssor_solve (f11jr) solves a system of equations
Mx=y  
involving the preconditioning matrix
M=1ω2-ω D+ω L D-1 D+ω LH  
corresponding to symmetric successive-over-relaxation (SSOR) (see Young (1971)) on a linear system Ax=b, where A is a sparse complex Hermitian matrix stored in symmetric coordinate storage (SCS) format (see Symmetric coordinate storage (SCS) format in the F11 Chapter Introduction).
In the definition of M given above D is the diagonal part of A, L is the strictly lower triangular part of A and ω is a user-defined relaxation parameter. Note that since A is Hermitian the matrix D is necessarily real.

References

Young D (1971) Iterative Solution of Large Linear Systems Academic Press, New York

Parameters

Compulsory Input Parameters

1:     anz – complex array
The nonzero elements in the lower triangular part of the matrix A, 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 nag_sparse_complex_herm_sort (f11zp) may be used to order the elements in this way.
2:     irownz int64int32nag_int array
3:     icolnz int64int32nag_int array
The row and column indices of the nonzero elements supplied in array a.
Constraints:
irow and icol must satisfy the following constraints (which may be imposed by a call to nag_sparse_complex_herm_sort (f11zp)):
  • 1irowin and 1icoliirowi, for i=1,2,,nz;
  • irowi-1<irowi or irowi-1=irowi and icoli-1<icoli, for i=2,3,,nz.
4:     rdiagn – double array
The elements of the diagonal matrix D-1, where D is the diagonal part of A. Note that since A is Hermitian the elements of D-1 are necessarily real.
5:     omega – double scalar
The relaxation parameter ω.
Constraint: 0.0<omega<2.0.
6:     check – string (length ≥ 1)
Specifies whether or not the input data should be checked.
check='C'
Checks are carried out on the values of n, nz, irow, icol and omega.
check='N'
None of these checks are carried out.
Constraint: check='C' or 'N'.
7:     yn – complex array
The right-hand side vector y.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the dimension of the arrays rdiag, y. (An error is raised if these dimensions are not equal.)
n, the order of the matrix A.
Constraint: n1.
2:     nz int64int32nag_int scalar
Default: the dimension of the arrays a, irow, icol. (An error is raised if these dimensions are not equal.)
The number of nonzero elements in the lower triangular part of the matrix A.
Constraint: 1nzn×n+1/2.

Output Parameters

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

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry,check'C' or 'N'.
   ifail=2
On entry,n<1,
ornz<1,
ornz>n×n+1/2,
oromega lies outside the interval 0.0,2.0.
   ifail=3
On entry, the arrays irow and icol fail to satisfy the following constraints:
  • 1irowin and 1icoliirowi, for i=1,2,,nz;
  • irowi-1<irowi or irowi-1=irowi and icoli-1<icoli, for i=2,3,,nz.
Therefore a nonzero element has been supplied which does not lie in the lower triangular part of A, is out of order, or has duplicate row and column indices. Call nag_sparse_complex_herm_sort (f11zp) to reorder and sum or remove duplicates.
   ifail=4
On entry,a row of A has no diagonal entry.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

The computed solution x is the exact solution of a perturbed system of equations M+δMx=y, where
δMcnεD+ωLD-1D+ωLT,  
cn is a modest linear function of n, and ε is the machine precision.

Further Comments

Timing

The time taken for a call to nag_sparse_complex_herm_precon_ssor_solve (f11jr) is proportional to nz.

Example

This example program solves the preconditioning equation Mx=y for a 9 by 9 sparse complex Hermitian matrix A, given in symmetric coordinate storage (SCS) format.
function f11jr_example


fprintf('f11jr example results\n\n');

% Solve SSOR preconditioning problem Mx = y for Hermitian A

% Sparse matrix A and y
nz = int64(23);
n  = int64(9);
a = [ 6 + 0.i; -1 + 1.i;  6 + 0.i;  0 + 1.i;
      5 + 0.i;  5 + 0.i;  2 - 2.i;  4 + 0.i;
      1 + 1.i;  2 + 0.i;  6 + 0.i; -4 + 3.i;
      0 + 1.i; -1 + 0.i;  6 + 0.i; -1 - 1.i;
      0 - 1.i;  9 + 0.i;  1 + 3.i;  1 + 2.i;
      -1 + 0.i;  1 + 4.i;  9 + 0.i];
y = [ 8 + 54i;-10 - 92i; 25 + 27i; 26 - 28i;
      54 + 12i; 26 - 22i; 47 + 65i; 71 - 57i;
      60 + 70i];
irow = 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 = int64([1;1;2;2;3;4;1;5;3;4;6;2;5;6;7;4;6;8;1;5;6;8;9]);


% Fill in the diagonal part for SSOR
rdiag = zeros(n, 1);
for i=1:nz
  if irow(i) == icol(i)
    rdiag(irow(i)) = 1/real(a(i));
  end
end

% Solve Mx = b
omega = 1.1;
check = 'C';
[x, ifail] = f11jr( ...
                    a, irow, icol, rdiag, omega, check, y);

disp('Solution of Mx = y');
disp(x);


f11jr example results

Solution of Mx = y
   1.0977 + 5.9139i
   0.2230 -14.0850i
   2.2315 + 7.0868i
   4.8164 - 6.1807i
   6.7632 + 1.5690i
   3.3531 - 4.7849i
   0.6699 - 1.4646i
   8.8315 - 3.6326i
   4.7685 + 0.1213i


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–2015