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)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


nag_linsys_real_posdef_vband_solve (f04mc) computes the approximate solution of a system of real linear equations with multiple right-hand sides, AX=B, where A 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.


[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)


The normal use of this function is the solution of the systems AX=B, following a call of nag_matop_real_vband_posdef_fac (f01mc) to determine the Cholesky factorization A=LDLT of the symmetric positive definite variable-bandwidth matrix A.
However, the function may be used to solve any one of the following systems of linear algebraic equations:
1. LDLTX=B (usual system),
2. LDX=B (lower triangular system),
3. DLTX=B (upper triangular system),
5. LX=B (unit lower triangular system),
6. LTX=B (unit upper triangular system).
L denotes a unit lower triangular variable-bandwidth matrix of order n, D a diagonal matrix of order n, and B a set of right-hand sides.
The matrix L is represented by the elements lying within its envelope, i.e., between the first nonzero of each row and the diagonal (see Example for an example). The width nrowi of the ith row is the number of elements between the first nonzero element and the element on the diagonal inclusive.


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


Compulsory Input Parameters

1:     allal – double array
The elements within the envelope of the lower triangular matrix L, taken in row by row order, as returned by nag_matop_real_vband_posdef_fac (f01mc). The unit diagonal elements of L must be stored explicitly.
2:     d: – double array
The dimension of the array d must be at least 1 if iselct4, and at least n otherwise
The diagonal elements of the diagonal matrix D. d is not referenced if iselct4.
3:     nrown int64int32nag_int array
nrowi must contain the width of row i of L, i.e., the number of elements between the first (leftmost) nonzero element and the element on the diagonal, inclusive.
Constraint: 1nrowii.
4:     bldbir – double array
ldb, the first dimension of the array, must satisfy the constraint ldbn.
The n by r right-hand side matrix B. See also Further Comments.
5:     iselct int64int32nag_int scalar
Must specify the type of system to be solved, as follows:
Solve LDLTX=B.
Solve LDX=B.
Solve DLTX=B.
Solve LLTX=B.
Solve LX=B.
Solve LTX=B.
Constraint: iselct=1, 2, 3, 4, 5 or 6.

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.)
n, the order of the matrix L.
Constraint: n1.
2:     lal int64int32nag_int scalar
Default: the dimension of the array al.
The dimension of the array al.
Constraint: lalnrow1+nrow2++nrown.
3:     ir int64int32nag_int scalar
Default: the second dimension of the array b.
r, the number of right-hand sides.
Constraint: ir1.

Output Parameters

1:     xldxir – double array
The n by r solution matrix X. See also Further Comments.
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:
On entry,n<1,
orfor some i, nrowi<1 or nrowi>i,
orlal<nrow1+nrow2++ nrown .
On entry,ir<1,
On entry,iselct<1,
The diagonal matrix D is singular, i.e., at least one of the elements of d is zero. This can only occur if iselct3.
At least one of the diagonal elements of L is not equal to unity.
An unexpected error has been triggered by this routine. Please contact NAG.
Your licence key may have expired or may not have been installed correctly.
Dynamic memory allocation failed.


The usual backward error analysis of the solution of triangular system applies: each computed solution vector is exact for slightly perturbed matrices L and D, 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 pr, where p=nrow1+nrow2++nrown.


This example solves the system of equations AX=B, where
A= 1 2 0 0 5 0 2 5 3 0 14 0 0 3 13 0 18 0 0 0 0 16 8 24 5 14 18 8 55 17 0 0 0 24 17 77   and  B= 6 -10 15 -21 11 -3 0 24 51 -39 46 67  
Here A is symmetric and positive definite and must first be factorized by nag_matop_real_vband_posdef_fac (f01mc).
function f04mc_example

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

a = [1;
     2;     5;
            3;     13;
     5;    14;     18;      8;     55;
                   24;     17;     77];
nrow = [int64(1);  2; 2; 1; 5; 3];

% Factorize
[L, D, ifail] = f01mc(a, nrow);

% Solve Ax = b
b = [  6.0 -10.0;
      15.0 -21.0;
      11.0  -3.0;
       0.0  24.0;
      51.0 -39.0;
      46.0  67.0];
iselct = int64(1);
[x, ifail] = f04mc(L, D, nrow, b, iselct);


f04mc example results

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

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