F01LHF (PDF version)
F01 Chapter Contents
F01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document


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

F01LHF factorizes a real almost block diagonal matrix.

2  Specification

REAL (KIND=nag_wp)  A(LENA), TOL

3  Description

F01LHF factorizes a real almost block diagonal matrix, A, by row elimination with alternate row and column pivoting such that no ‘fill-in’ is produced. The code, which is derived from ARCECO described in Diaz et al. (1983), uses Level 1 and Level 2 BLAS. No three successive diagonal blocks may have columns in common and therefore the almost block diagonal matrix must have the form shown in the following diagram:
Figure 1
Figure 1
This routine may be followed by F04LHF, which is designed to solve sets of linear equations AX=B or ATX=B.

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:     N – INTEGERInput
On entry: n, the order of the matrix A.
Constraint: N>0.
2:     NBLOKS – INTEGERInput
On entry: n, the total number of blocks of the matrix A.
Constraint: 0<NBLOKSN.
3:     BLKSTR(3,NBLOKS) – INTEGER arrayInput
On entry: information which describes the block structure of A as follows:
  • BLKSTR1k must contain the number of rows in the kth block, k=1,2,,NBLOKS;
  • BLKSTR2k must contain the number of columns in the kth block, k=1,2,,NBLOKS;
  • BLKSTR3k must contain the number of columns of overlap between the kth and k+1th blocks, k=1,2,,NBLOKS-1. BLKSTR3NBLOKS need not be set.
The following conditions delimit the structure of A:
  • BLKSTR1k,BLKSTR2k>0,  k=1,2,,NBLOKS,
  • BLKSTR3k0,   k=1,2,,NBLOKS-1,
(there must be at least one column and one row in each block and a non-negative number of columns of overlap);
  • BLKSTR3k-1+BLKSTR3kBLKSTR2k,  k=2,3,,NBLOKS-1,
(the total number of columns in overlaps in each block must not exceed the number of columns in that block);
  • BLKSTR21 + k =2 j BLKSTR2 k -BLKSTR3 k -1 k =1 j BLKSTR1 k , j=2,3,,NBLOKS-1 ,
  • k=1jBLKSTR2k-BLKSTR3kk=1jBLKSTR1k,  j=1,2,,NBLOKS-1,
(the index of the first column of the overlap between the jth and j+1th blocks must be  the index of the last row of the jth block, and the index of the last column of overlap must be  the index of the last row of the jth block);
  • k =1 NBLOKS BLKSTR1 k =n ,
  • BLKSTR21 + k =2 NBLOKS BLKSTR2 k -BLKSTR3 k -1 =nk ,
(both the number of rows and the number of columns of A must equal n).
4:     A(LENA) – REAL (KIND=nag_wp) arrayInput/Output
On entry: the elements of the almost block diagonal matrix stored block by block, with each block stored column by column. The sizes of the blocks and the overlaps are defined by the parameter BLKSTR.
If ars is the first element in the kth block, then an arbitrary element aij in the kth block must be stored in the array element:
pk=l= 1 k- 1BLKSTR1l×BLKSTR2l
is the base address of the kth block, and
is the number of rows of the kth block.
See Section 8 for comments on scaling.
On exit: the factorized form of the matrix.
5:     LENA – INTEGERInput
On entry: the dimension of the array A as declared in the (sub)program from which F01LHF is called.
Constraint: LENA k =1 NBLOKS BLKSTR1 k × BLKSTR2 k .
6:     PIVOT(N) – INTEGER arrayOutput
On exit: details of the interchanges.
7:     TOL – REAL (KIND=nag_wp)Input/Output
On entry: a relative tolerance to be used to indicate whether or not the matrix is singular. For a discussion on how TOL is used see Section 8. If TOL is non-positive, then TOL is reset to 10ε, where ε is the machine precision.
On exit: unchanged unless TOL0.0 on entry, in which case it is set to 10ε.
8:     KPIVOT – INTEGEROutput
On exit: if IFAIL=2, KPIVOT contains the value k, where k is the first position on the diagonal of the matrix A where too small a pivot was detected. Otherwise KPIVOT is set to 0.
9:     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:
On entry,N<1,
orLENA is too small,
orillegal values detected in BLKSTR.
The factorization has been completed, but a small pivot has been detected.

7  Accuracy

The accuracy of F01LHF depends on the conditioning of the matrix A.

8  Further Comments

Singularity or near singularity in A is determined by the parameter TOL. If the absolute value of any pivot is less than TOL×amax, where amax is the maximum absolute value of an element of A, then A is said to be singular. The position on the diagonal of A of the first of any such pivots is indicated by the parameter KPIVOT. The factorization, and the test for near singularity, will be more accurate if before entry A is scaled so that the -norms of the rows and columns of A are all of approximately the same order of magnitude. (The -norm is the maximum absolute value of any element in the row or column.)

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

9.1  Program Text

Program Text (f01lhfe.f90)

9.2  Program Data

Program Data (f01lhfe.d)

9.3  Program Results

Program Results (f01lhfe.r)

F01LHF (PDF version)
F01 Chapter Contents
F01 Chapter Introduction
NAG Library Manual

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