Previous Next Contents Generated Index Doc Set Home



Solution to a Triangular System in Banded Storage of Linear Equations

The subroutines described in this section compute one of the following results for a triangular matrix A in banded storage and a vector y:



Calling Sequence

CALL DTBSV 
(UPLO, TRANSA, DIAG, N, NDIAG, DA, LDA, DY, INCY)
CALL STBSV 
(UPLO, TRANSA, DIAG, N, NDIAG, SA, LDA, SY, INCY)
CALL ZTBSV 
(UPLO, TRANSA, DIAG, N, NDIAG, ZA, LDA, ZY, INCY)
CALL CTBSV 
(UPLO, TRANSA, DIAG, N, NDIAG, CA, LDA, CY, INCY)






void dtbsv 
(char uplo, char trans, char diag, int n, int ndiag, 
double *da, int lda, double *dx, int incx)
void stbsv 
(char uplo, char trans, char diag, int n, int ndiag, 
float *sa, int lda, float *sx, int incx)
void ztbsv 
(char uplo, char trans, char diag, int n, int ndiag, 
doublecomplex *za, int lda, doublecomplex *zx, int 
incx)
void ctbsv 
(char uplo, char trans, char diag, int n, int ndiag, 
complex *ca, int lda, complex *cx, int incx)

Arguments

UPLO

Indicates whether the values in a matrix reside in the upper or lower triangle of the array in which the matrix is stored. The legal values for UPLO are listed below. Any value not listed below is illegal.

'L' or 'l'

Only the lower triangle of the array will be referenced.

'U' or 'u'

Only the upper triangle of the array will be referenced.

TRANSA

Indicates how to use the matrix stored in the array argument. The legal values for TRANSA are listed below. Any value not listed below is illegal.

'N' or 'n'

Use the matrix as it is stored in the array.

'T' or 't'

Use the transpose of the matrix.

'C' or 'c'

Use the conjugate transpose of the matrix.

DIAG

Indicates whether or not a triangular matrix is unit triangular. If the matrix is unit triangular then none of the diagonal elements of the array will be accessed. The legal values for DIAG are listed below. Any value not listed below is illegal.

'N' or 'n'

The matrix is not unit triangular.

'U' or 'u'

The matrix is unit triangular.

N

Size of a matrix with N rows and N columns. N 0.

NDIAG

Bandwidth of a matrix with NDIAG superdiagonals or subdiagonals. N-1 NDIAG 0 but if N = 0 then NDIAG = 0.

xA

Two-dimensional array that contains the input matrix.

LDA

Leading dimension of the array A as specified in a dimension or type statement. LDA NDIAG + 1.

xY

Y and INCY describe a vector of length N.

On entry, an input vector.

On exit, a result vector.

INCY

Scalar that contains the storage spacing between successive elements of the vector Y. INCY 0.

If INCY is one then elements of the vector are contiguous in memory. INCY may take on values besides 1 to allow the programmer to extract from a matrix a vector that is not stored in contiguous memory locations.

If Y is a one-dimensional array and INCY = -1 then the array will be accessed in reverse order.

If Y is a two-dimensional array and INCY = LDA then the vector will be a row of the array.

If Y is a two-dimensional array and INCY = LDA+1 then the vector will be a diagonal of the array.

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      DOUBLE PRECISION  ZERO
      INTEGER           LDA, N, NDIAG
      PARAMETER        (N = 4)
      PARAMETER        (NDIAG = 1)
      PARAMETER        (LDA = NDIAG + 1)
      PARAMETER        (ZERO = 0.0D0)
C
      DOUBLE PRECISION  A(LDA,N), B(N)
      INTEGER           I, J
C
      EXTERNAL          DTBSV
C
C     Initialize the array A to store in triangular banded form
C     the triangular banded matrix A shown below.  Initialize
C     the array B to store the vector b shown below.
C
C         1                   8
C     A = 2  3          b =  43
C            4  5            86
C               6  7        137
C
      DATA A / 1.0D0, 2.0D0, 3.0D0, 4.0D0, 5.0D0, 6.0D0, 7.0D0, 
     $         8D8 /
      DATA B / 8.0D0, 4.3D1, 8.6D1, 1.37D2 /
C
      PRINT 1000
      PRINT 1010, A(1,1)
      PRINT 1010, A(2,1), A(1,2)
      PRINT 1020,         A(2,2), A(1,3)
      PRINT 1030,                 A(2,3), A(1,4)
      PRINT 1040
      DO 10, I = 1, LDA
        PRINT 1010, (A(I,J), J = 1, N)
   10 CONTINUE
      PRINT 1050
      PRINT 1060, B
      CALL DTBSV ('LOWER TRIANGULAR A', 'NOT TRANSPOSED A',
     $            'NOT UNIT DIAGONAL A', N, 1, A, LDA, B, 1)
      PRINT 1070
      PRINT 1060, B
C
 1000 FORMAT (1X, 'A in full form:')
 1010 FORMAT (1X, 4(2X, F5.1))
 1020 FORMAT (8X, 2(2X, F5.1))
 1030 FORMAT (15X, 2(2X, F5.1))
 1040 FORMAT (/1X, 'A in triangular banded form:  ',
     $        '(* in unused elements)')
 1050 FORMAT (/1X, 'b:')
 1060 FORMAT (3X, F5.1)
 1070 FORMAT (/1X, 'A**(-1) * b:')
C
      END
 

Sample Output

 
 A in full form:
     1.0
     2.0    3.0
            4.0    5.0
                   6.0    7.0



 A in triangular banded form:  (* in unused elements)
     1.0    3.0    5.0    7.0
     2.0    4.0    6.0  *****



 b:
     8.0
    43.0
    86.0
   137.0



 A**(-1) * b:
     8.0
     9.0
    10.0
    11.0






Previous Next Contents Generated Index Doc Set Home