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_linsys_real_posdef_vband_solve (f04mc)

Purpose

nag_linsys_real_posdef_vband_solve (f04mc) computes the approximate solution of a system of real linear equations with multiple right-hand sides, AX = BAX=B, where AA is a symmetric positive definite variable-bandwidth matrix, which has previously been factorized by nag_matop_real_vband_posdef_fac (f01mc). Related systems may also be solved.

Syntax

[x, ifail] = f04mc(al, d, nrow, b, iselct, 'n', n, 'lal', lal, 'ir', ir)
[x, ifail] = nag_linsys_real_posdef_vband_solve(al, d, nrow, b, iselct, 'n', n, 'lal', lal, 'ir', ir)

Description

The normal use of this function is the solution of the systems AX = BAX=B, following a call of nag_matop_real_vband_posdef_fac (f01mc) to determine the Cholesky factorization A = LDLTA=LDLT of the symmetric positive definite variable-bandwidth matrix AA.
However, the function may be used to solve any one of the following systems of linear algebraic equations:
  1. LDLTX = BLDLTX=B (usual system),
  2. LDX = BLDX=B (lower triangular system),
  3. DLTX = BDLTX=B (upper triangular system),
  4. LLTX = BLLTX=B
  5. LX = BLX=B (unit lower triangular system),
  6. LTX = BLTX=B (unit upper triangular system).
LL denotes a unit lower triangular variable-bandwidth matrix of order nn, DD a diagonal matrix of order nn, and BB a set of right-hand sides.
The matrix LL is represented by the elements lying within its envelope, i.e., between the first nonzero of each row and the diagonal (see Section [Example] for an example). The width nrow(i)nrowi of the iith row is the number of elements between the first nonzero element and the element on the diagonal inclusive.

References

Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag

Parameters

Compulsory Input Parameters

1:     al(lal) – double array
lal, the dimension of the array, must satisfy the constraint lalnrow(1) + nrow(2) + + nrow(n)lalnrow1+nrow2++nrown.
The elements within the envelope of the lower triangular matrix LL, taken in row by row order, as returned by nag_matop_real_vband_posdef_fac (f01mc). The unit diagonal elements of LL must be stored explicitly.
2:     d( : :) – double array
Note: the dimension of the array d must be at least 11 if iselct4iselct4, and at least nn otherwise.
The diagonal elements of the diagonal matrix DD. d is not referenced if iselct4iselct4.
3:     nrow(n) – int64int32nag_int array
n, the dimension of the array, must satisfy the constraint n1n1.
nrow(i)nrowi must contain the width of row ii of LL, i.e., the number of elements between the first (leftmost) nonzero element and the element on the diagonal, inclusive.
Constraint: 1nrow(i)i1nrowii.
4:     b(ldb,ir) – double array
ldb, the first dimension of the array, must satisfy the constraint ldbnldbn.
The nn by rr right-hand side matrix BB. See also Section [Further Comments].
5:     iselct – int64int32nag_int scalar
Must specify the type of system to be solved, as follows:
iselct = 1iselct=1
Solve LDLTX = BLDLTX=B.
iselct = 2iselct=2
Solve LDX = BLDX=B.
iselct = 3iselct=3
Solve DLTX = BDLTX=B.
iselct = 4iselct=4
Solve LLTX = BLLTX=B.
iselct = 5iselct=5
Solve LX = BLX=B.
iselct = 6iselct=6
Solve LTX = BLTX=B.
Constraint: iselct = 1iselct=1, 22, 33, 44, 55 or 66.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The dimension of the array nrow and the first dimension of the array b. (An error is raised if these dimensions are not equal.)
nn, the order of the matrix LL.
Constraint: n1n1.
2:     lal – int64int32nag_int scalar
Default: The dimension of the array al.
The dimension of the array al as declared in the (sub)program from which nag_linsys_real_posdef_vband_solve (f04mc) is called.
Constraint: lalnrow(1) + nrow(2) + + nrow(n)lalnrow1+nrow2++nrown.
3:     ir – int64int32nag_int scalar
Default: The second dimension of the array b.
rr, the number of right-hand sides.
Constraint: ir1ir1.

Input Parameters Omitted from the MATLAB Interface

ldb ldx

Output Parameters

1:     x(ldx,ir) – double array
ldxnldxn.
The nn by rr solution matrix XX. See also Section [Further Comments].
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,n < 1n<1,
orfor some ii, nrow(i) < 1nrowi<1 or nrow(i) > inrowi>i,
orlal < nrow(1) + nrow(2) + + nrow(n)lal<nrow1+nrow2++nrow(n).
  ifail = 2ifail=2
On entry,ir < 1ir<1,
orldb < nldb<n,
orldx < nldx<n.
  ifail = 3ifail=3
On entry,iselct < 1iselct<1,
oriselct > 6iselct>6.
  ifail = 4ifail=4
The diagonal matrix DD is singular, i.e., at least one of the elements of d is zero. This can only occur if iselct3iselct3.
  ifail = 5ifail=5
At least one of the diagonal elements of LL is not equal to unity.

Accuracy

The usual backward error analysis of the solution of triangular system applies: each computed solution vector is exact for slightly perturbed matrices LL and DD, as appropriate (see pages 25–27 and 54–55 of Wilkinson and Reinsch (1971)).

Further Comments

The time taken by nag_linsys_real_posdef_vband_solve (f04mc) is approximately proportional to prpr, where p = nrow(1) + nrow(2) + + nrow(n)p=nrow1+nrow2++nrown.

Example

function nag_linsys_real_posdef_vband_solve_example
al = [1;
     2;
     1;
     3;
     1;
     1;
     5;
     4;
     1.5;
     0.5;
     1;
     1.5;
     5;
     1];
d = [1;
     1;
     4;
     16;
     1;
     16];
nrow = [int64(1);2;2;1;5;3];
b = [6, -10;
     15, -21;
     11, -3;
     0, 24;
     51, -39;
     46, 67];
iselct = int64(1);
[x, ifail] = nag_linsys_real_posdef_vband_solve(al, d, nrow, b, iselct)
 

x =

    -3     4
     2    -2
    -1     3
    -2     1
     1    -2
     1     1


ifail =

                    0


function f04mc_example
al = [1;
     2;
     1;
     3;
     1;
     1;
     5;
     4;
     1.5;
     0.5;
     1;
     1.5;
     5;
     1];
d = [1;
     1;
     4;
     16;
     1;
     16];
nrow = [int64(1);2;2;1;5;3];
b = [6, -10;
     15, -21;
     11, -3;
     0, 24;
     51, -39;
     46, 67];
iselct = int64(1);
[x, ifail] = f04mc(al, d, nrow, b, iselct)
 

x =

    -3     4
     2    -2
    -1     3
    -2     1
     1    -2
     1     1


ifail =

                    0



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