NAG Library Routine Document

f04lef  (real_tridiag_fac_solve)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

f04lef solves a system of tridiagonal equations following the factorization by f01lef. This routine is intended for applications such as inverse iteration as well as straightforward linear equation applications.

2
Specification

Fortran Interface
Subroutine f04lef ( job, n, a, b, c, d, ipiv, y, tol, ifail)
Integer, Intent (In):: job, n, ipiv(n)
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: a(n), b(n), c(n), d(n)
Real (Kind=nag_wp), Intent (Inout):: y(n), tol
C Header Interface
#include nagmk26.h
void  f04lef_ ( const Integer *job, const Integer *n, const double a[], const double b[], const double c[], const double d[], const Integer ipiv[], double y[], double *tol, Integer *ifail)

3
Description

Following the factorization of the n by n tridiagonal matrix T-λI as
T-λI=PLU  
by f01lef, f04lef may be used to solve any of the equations
T-λ Ix=y,   T-λ ITx=y,   Ux=y  
for x, the choice of equation being controlled by the argument job. In each case there is an option to perturb zero or very small diagonal elements of U, this option being intended for use in applications such as inverse iteration.

4
References

Wilkinson J H (1965) The Algebraic Eigenvalue Problem Oxford University Press, Oxford
Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag

5
Arguments

1:     job – IntegerInput
On entry: must specify the equations to be solved.
job=1
The equations T-λIx=y are to be solved, but diagonal elements of U are not to be perturbed.
job=-1
The equations T-λIx=y are to be solved and, if overflow would otherwise occur, diagonal elements of U are to be perturbed. See argument tol.
job=2
The equations T-λITx=y are to be solved, but diagonal elements of U are not to be perturbed.
job=-2
The equations T-λITx=y are to be solved and, if overflow would otherwise occur, diagonal elements of U are to be perturbed. See argument tol.
job=3
The equations Ux=y are to be solved, but diagonal elements of U are not to be perturbed.
job=-3
The equations Ux=y are to be solved and, if overflow would otherwise occur, diagonal elements of U are to be perturbed. See argument tol.
2:     n – IntegerInput
On entry: n, the order of the matrix T.
Constraint: n1.
3:     an – Real (Kind=nag_wp) arrayInput
On entry: the diagonal elements of U as returned by f04lef.
4:     bn – Real (Kind=nag_wp) arrayInput
On entry: the elements of the first superdiagonal of U as returned by f04lef.
5:     cn – Real (Kind=nag_wp) arrayInput
On entry: the subdiagonal elements of L as returned by f04lef.
6:     dn – Real (Kind=nag_wp) arrayInput
On entry: the elements of the second superdiagonal of U as returned by f04lef.
7:     ipivn – Integer arrayInput
On entry: details of the matrix P as returned by f01lef.
8:     yn – Real (Kind=nag_wp) arrayInput/Output
On entry: the right-hand side vector y.
On exit: y is overwritten by the solution vector x.
9:     tol – Real (Kind=nag_wp)Input/Output
On entry: the minimum perturbation to be made to very small diagonal elements of U. tol is only referenced when job is negative. tol should normally be chosen as about εU, where ε is the machine precision, but if tol is supplied as non-positive, it is reset to εmaxuij.
On exit: if on entry tol is non-positive, it is reset as just described. Otherwise tol is unchanged.
10:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation 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 argument, 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, job=value.
Constraint: job0 and job-3 and job3.
On entry, n=value.
Constraint: n1.
ifail>1
Overflow would occur computing the element I in the solution. I=value.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

The computed solution of the equations T-λIx=y, say x-, will satisfy an equation of the form
T-λI+Ex-=y,  
where E can be expected to satisfy a bound of the form
EαεT-λI,  
α being a modest constant and ε being the machine precision. The computed solution of the equations T-λITx=y and Ux=y will satisfy similar results. The above result implies that the relative error in x- satisfies
x--x x- cT-λIαε,  
where cT-λI is the condition number of T-λI with respect to inversion. Thus if T-λI is nearly singular, x- can be expected to have a large relative error. Note that f01lef incorporates a test for near singularity.

8
Parallelism and Performance

f04lef is not threaded in any implementation.

9
Further Comments

The time taken by f04lef is approximately proportional to n.
If you have single systems of tridiagonal equations to solve you are advised that f07caf (dgtsv) requires less storage and will normally be faster than the combination of f01lef and f04lef, but f07caf (dgtsv) does not incorporate a test for near singularity.

10
Example

This example solves the two sets of tridiagonal equations
Tx=y  and  TTx=y  
where
T= 3.0 2.1 0 0 0 3.4 2.3 -1.0 0 0 0 3.6 -5.0 1.9 0 0 0 7.0 -0.9 8.0 0 0 0 -6.0 7.1   and   y = 2.7 -0.5 2.6 0.6 2.7 .  
The example program first calls f01lef to factorize T and then two calls are made to f04lef, one to solve Tx=y and the second to solve TTx=y.

10.1
Program Text

Program Text (f04lefe.f90)

10.2
Program Data

Program Data (f04lefe.d)

10.3
Program Results

Program Results (f04lefe.r)

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