F04MCF (PDF version)
F04 Chapter Contents
F04 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

F04MCF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

F04MCF 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 F01MCF. Related systems may also be solved.

2  Specification

SUBROUTINE F04MCF ( N, AL, LAL, D, NROW, IR, B, LDB, ISELCT, X, LDX, IFAIL)
INTEGER  N, LAL, NROW(N), IR, LDB, ISELCT, LDX, IFAIL
REAL (KIND=nag_wp)  AL(LAL), D(*), B(LDB,IR), X(LDX,IR)

3  Description

The normal use of this routine is the solution of the systems AX=B, following a call of F01MCF to determine the Cholesky factorization A=LDLT of the symmetric positive definite variable-bandwidth matrix A.
However, the routine 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),
4. LLTX=B
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 Section 10 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.

4  References

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

5  Parameters

1:     N – INTEGERInput
On entry: n, the order of the matrix L.
Constraint: N1.
2:     ALLAL – REAL (KIND=nag_wp) arrayInput
On entry: the elements within the envelope of the lower triangular matrix L, taken in row by row order, as returned by F01MCF. The unit diagonal elements of L must be stored explicitly.
3:     LAL – INTEGERInput
On entry: the dimension of the array AL as declared in the (sub)program from which F04MCF is called.
Constraint: LALNROW1+NROW2++NROWn.
4:     D* – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array D must be at least 1 if ISELCT4, and at least N otherwise.
On entry: the diagonal elements of the diagonal matrix D. D is not referenced if ISELCT4.
5:     NROWN – INTEGER arrayInput
On entry: 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.
6:     IR – INTEGERInput
On entry: r, the number of right-hand sides.
Constraint: IR1.
7:     BLDBIR – REAL (KIND=nag_wp) arrayInput
On entry: the n by r right-hand side matrix B. See also Section 9.
8:     LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F04MCF is called.
Constraint: LDBN.
9:     ISELCT – INTEGERInput
On entry: must specify the type of system to be solved, as follows:
ISELCT=1
Solve LDLTX=B.
ISELCT=2
Solve LDX=B.
ISELCT=3
Solve DLTX=B.
ISELCT=4
Solve LLTX=B.
ISELCT=5
Solve LX=B.
ISELCT=6
Solve LTX=B.
Constraint: ISELCT=1, 2, 3, 4, 5 or 6.
10:   XLDXIR – REAL (KIND=nag_wp) arrayOutput
On exit: the n by r solution matrix X. See also Section 9.
11:   LDX – INTEGERInput
On entry: the first dimension of the array X as declared in the (sub)program from which F04MCF is called.
Constraint: LDXN.
12:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,N<1,
orfor some i, NROWi<1 or NROWi>i,
orLAL<NROW1+NROW2++ NROWN .
IFAIL=2
On entry,IR<1,
orLDB<N,
orLDX<N.
IFAIL=3
On entry,ISELCT<1,
orISELCT>6.
IFAIL=4
The diagonal matrix D is singular, i.e., at least one of the elements of D is zero. This can only occur if ISELCT3.
IFAIL=5
At least one of the diagonal elements of L is not equal to unity.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

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

8  Parallelism and Performance

Not applicable.

9  Further Comments

The time taken by F04MCF is approximately proportional to pr, where p=NROW1+NROW2++NROWn.
Unless otherwise stated in the Users' Note for your implementation, the routine may be called with the same actual array supplied for the parameters B and X, in which case the solution matrix will overwrite the right-hand side matrix. However this is not standard Fortran and may not work in all implementations.

10  Example

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 F01MCF.

10.1  Program Text

Program Text (f04mcfe.f90)

10.2  Program Data

Program Data (f04mcfe.d)

10.3  Program Results

Program Results (f04mcfe.r)


F04MCF (PDF version)
F04 Chapter Contents
F04 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015