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

NAG Library Routine Document

F04LHF

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

F04LHF calculates the approximate solution of a set of real linear equations with multiple right-hand sides, AX=B or ATX=B, where A is an almost block-diagonal matrix which has been factorized by F01LHF.

2  Specification

SUBROUTINE F04LHF ( TRANS, N, NBLOKS, BLKSTR, A, LENA, PIVOT, B, LDB, IR, IFAIL)
INTEGER  N, NBLOKS, BLKSTR(3,NBLOKS), LENA, PIVOT(N), LDB, IR, IFAIL
REAL (KIND=nag_wp)  A(LENA), B(LDB,IR)
CHARACTER(1)  TRANS

3  Description

F04LHF solves a set of real linear equations AX=B or ATX=B, where A is almost block-diagonal. A must first be factorized by F01LHF. F04LHF then computes X by forward and backward substitution over the blocks.

4  References

Diaz J C, Fairweather G and Keast P (1983) Fortran packages for solving certain almost block diagonal linear systems by modified alternate row and column elimination ACM Trans. Math. Software 9 358–375

5  Parameters

1:     TRANS – CHARACTER(1)Input
On entry: specifies the equations to be solved.
TRANS='N'
Solve AX=B.
TRANS='T'
Solve ATX=B.
Constraint: TRANS='N' or 'T'.
2:     N – INTEGERInput
On entry: n, the order of the matrix A.
Constraint: N>0.
3:     NBLOKS – INTEGERInput
On entry: the total number of blocks of the matrix A, as supplied to F04LHF.
Constraint: 0<NBLOKSN.
4:     BLKSTR(3,NBLOKS) – INTEGER arrayInput
On entry: information which describes the block structure of A, as supplied to F04LHF.
5:     A(LENA) – REAL (KIND=nag_wp) arrayInput
On entry: the elements in the factorization of A, as returned by F04LHF.
6:     LENA – INTEGERInput
On entry: the dimension of the array A as declared in the (sub)program from which F04LHF is called.
Constraint: LENAk=1NBLOKSBLKSTR1,k×BLKSTR2,k.
7:     PIVOT(N) – INTEGER arrayInput
On entry: details of the interchanges in the factorization, as returned by F04LHF.
8:     B(LDB,IR) – REAL (KIND=nag_wp) arrayInput/Output
On entry: the n by r right-hand side matrix B.
On exit: B is overwritten by the n by r solution matrix X.
9:     LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F04LHF is called.
Constraint: LDBN.
10:   IR – INTEGERInput
On entry: r, the number of right-hand sides.
Constraint: IR>0.
11:   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,
orNBLOKS<1,
orIR<1,
orLDB<N,
orN<NBLOKS,
orLENA is too small,
orillegal values detected in BLKSTR,
orTRANS'N' or 'T'.

7  Accuracy

The accuracy of the computed solution depends on the conditioning of the original matrix A.

8  Further Comments

None.

9  Example

This example solves the set of linear equations Ax=b where
A= -1.00 -0.98 -0.79 -0.15 -1.00 -0.25 -0.87 0.35 0.78 0.31 -0.85 0.89 -0.69 -0.98 -0.76 -0.82 0.12 -0.01 0.75 0.32 -1.00 -0.53 -0.83 -0.98 -0.58 0.04 0.87 0.38 -1.00 -0.21 -0.93 -0.84 0.37 -0.94 -0.96 -1.00 -0.99 -0.91 -0.28 0.90 0.78 -0.93 -0.76 0.48 -0.87 -0.14 -1.00 -0.59 -0.99 0.21 -0.73 -0.48 -0.93 -0.91 0.10 -0.89 -0.68 -0.09 -0.58 -0.21 0.85 -0.39 0.79 -0.71 0.39 -0.99 -0.12 -0.75 0.17 -1.37 1.29 -1.59 1.10 -1.63 -1.01 -0.27 0.08 0.61 0.54 -0.41 0.16 -0.46 -0.67 0.56 -0.99 0.16 -0.16 0.98 -0.24 -0.41 0.40 -0.93 0.70 0.43 0.71 -0.97 -0.60 -0.30 0.18 -0.47 -0.98 -0.73 0.07 0.04 -0.25 -0.92 -0.52 -0.46 -0.58 0.89 -0.94 -0.54 -1.00 -0.36
and
b= -2.92 -1.17 -1.30 -1.17 -2.10 -4.51 -1.71 -4.59 -4.19 -0.93 -3.31 0.52 -0.12 -0.05 -0.98 -2.07 -2.73 -1.95
The exact solution is
x=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1T.

9.1  Program Text

Program Text (f04lhfe.f90)

9.2  Program Data

Program Data (f04lhfe.d)

9.3  Program Results

Program Results (f04lhfe.r)


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

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