IBM Books

Engineering and Scientific Subroutine Library for AIX Version 3 Release 3: Guide and Reference

SGTNP, DGTNP, CGTNP, and ZGTNP--General Tridiagonal Matrix Combined Factorization and Solve with No Pivoting

These subroutines solve the tridiagonal system Ax = b using Gaussian elimination, where tridiagonal matrix A is stored in tridiagonal storage mode.

Table 111. Data Types

c, d, e, b, x Subroutine
Short-precision real SGTNP
Long-precision real DGTNP
Short-precision complex CGTNP
Long-precision complex ZGTNP
Note:
In general, these subroutines provide better performance than the _GTNPF and _GTNPS subroutines; however, in the following instances, you get better performance by using _GTNPF and _GTNPS:

Syntax

Fortran CALL SGTNP | DGTNP | CGTNP | ZGTNP (n, c, d, e, bx)
C and C++ sgtnp | dgtnp | cgtnp | zgtnp (n, c, d, e, bx);
PL/I CALL SGTNP | DGTNP | CGTNP | ZGTNP (n, c, d, e, bx);

On Entry

n
is the order n of tridiagonal matrix A. Specified as: a fullword integer; n >= 0.

c
is the vector c, containing the lower subdiagonal of matrix A in positions 2 through n in an array, referred to as C. Specified as: a one-dimensional array of (at least) length n, containing numbers of the data type indicated in Table 111. On output, C is overwritten; that is, the original input is not preserved.

d
is the vector d, containing the main diagonal of matrix A in positions 1 through n in an array, referred to as D. Specified as: a one-dimensional array of (at least) length n, containing numbers of the data type indicated in Table 111. On output, D is overwritten; that is, the original input is not preserved.

e
is the vector e, containing the upper subdiagonal of matrix A in positions 1 through n-1 in an array, referred to as E. Specified as: a one-dimensional array of (at least) length n, containing numbers of the data type indicated in Table 111. On output, E is overwritten; that is, the original input is not preserved.

bx
is the vector b, containing the right-hand side of the system in the first n positions in an array, referred to as BX. Specified as: a one-dimensional array of (at least) length n, containing numbers of the data type indicated in Table 111.

On Return

bx
is the solution vector x of length n, containing the solution of the tridiagonal system in the first n positions in an array, referred to as BX. Returned as: a one-dimensional array, containing numbers of the data type indicated in Table 111.

Note

For a description of how tridiagonal matrices are stored, see General Tridiagonal Matrix.

Function

The solution of the tridiagonal system Ax = b is computed by Gaussian elimination.

No pivoting is done. Therefore, these subroutines should not be used when pivoting is necessary to maintain the numerical accuracy of the solution. Overflow may occur if small main diagonal elements are generated. Underflow or accuracy loss may occur if large main diagonal elements are generated.

For performance reasons, complex divides are done without scaling. Computing the inverse in this way restricts the range of numbers for which the ZGTNP subroutine works properly.

For performance reasons, divides are done in a way that reduces the effective exponent range for which DGTNP and ZGTNP work properly; therefore, you may want to scale your problem, such that the diagonal elements are close to 1.0 for DGTNP and (1.0, 0.0) for ZGTNP.

Error Conditions

Computational Errors

None

Input-Argument Errors

n < 0

Example 1

This example shows a factorization of the real tridiagonal matrix A, of order 4:

                         *                     *
                         | 7.0  4.0  0.0   0.0 |
                         | 1.0  8.0  5.0   0.0 |
                         | 0.0  2.0  9.0   6.0 |
                         | 0.0  0.0  3.0  10.0 |
                         *                     *

It then finds the solution of the tridiagonal system Ax = b, where b is:

                        (11.0, 14.0, 17.0, 13.0)

and x is:

                        (1.0, 1.0, 1.0, 1.0)

On output, arrays C, D, and E are overwritten.

Call Statement and Input
            N   C   D   E   BX
            |   |   |   |   |
CALL DGTNP( 4 , C , D , E , BX )
 
C        =  ( . , 1.0, 2.0, 3.0)
D        =  (7.0, 8.0, 9.0, 10.0)
E        =  (4.0, 5.0, 6.0, . )
BX       =  (11.0, 14.0, 17.0, 13.0)

Output
BX       =  (1.0, 1.0, 1.0, 1.0)

Example 2

This example shows a factorization of the complex tridiagonal matrix A, of order 4:

         *                                                       *
         | (7.0,  7.0)  (4.0,  4.0)  (0.0,  0.0)   (0.0,  0.0)   |
         | (1.0,  1.0)  (8.0,  8.0)  (5.0,  5.0)   (0.0,  0.0)   |
         | (0.0,  0.0)  (2.0,  2.0)  (9.0,  9.0)   (6.0,  6.0)   |
         | (0.0,  0.0)  (0.0,  0.0)  (3.0,  3.0)  (10.0, 10.0)   |
         *                                                       *

It then finds the solution of the tridiagonal system Ax = b, where b is:

          ((-11.0,19.0), (-14.0,50.0), (-17.0,93.0), (-13.0,85.0))

and x is:

          ((1.0,-1.0), (2.0,-2.0), (3.0,-3.0), (4.0,-4.0))

On output, arrays C, D, and E are overwritten.

Call Statement and Input
            N   C   D   E   BX
            |   |   |   |   |
CALL ZGTNP( 4 , C , D , E , BX )
 
C        =  ( . , (1.0, 1.0), (2.0, 2.0), (3.0, 3.0))
D        =  ((7.0, 7.0), (8.0, 8.0), (9.0, 9.0), (10.0, 10.0))
E        =  ((4.0, 4.0), (5.0, 5.0), (6.0, 6.0), . )
BX       =  ((-11.0, 19.0), (-14.0, 50.0), (-17.0, 93.0), (-13.0, 85.0))

Output
BX       =  ((0.0, 1.0), (1.0, 2.0), (2.0, 3.0), (3.0, 4.0))


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]