Previous Next Contents Generated Index Doc Set Home



Reciprocal Condition Number of an LU-Factored Tridiagonal Matrix

The subroutines described in this section estimate the reciprocal condition number, in either the 1-norm or the -norm, of a tridiagonal matrix A, which has been LU-factored by xGTTRF.

Calling Sequence

CALL DGTCON 
(NORM, N, DLOW, DDIAG, DUP1, DUP2, IPIVOT, DANORM, 
DRCOND, DWORK, IWORK2, INFO)
CALL SGTCON 
(NORM, N, SLOW, SDIAG, SUP1, SUP2, IPIVOT, SANORM, 
SRCOND, SWORK, IWORK2, INFO)
CALL ZGTCON 
(NORM, N, ZLOW, ZDIAG, ZUP1, ZUP2, IPIVOT, DANORM, 
DRCOND, ZWORK, INFO)
CALL CGTCON 
(NORM, N, CLOW, CDIAG, CUP1, CUP2, IPIVOT, SANORM, 
SRCOND, CWORK, INFO)






void dgtcon 
(char norm, int n, double *dlow, double *ddiag, double 
*dup1, double *dup2, int *ipivot, double danorm, double 
*drcond, int *info)
void sgtcon 
(char norm, int n, float *slow, float *sdiag, float 
*sup1, float *sup2, int *ipivot, float sanorm, float 
*srcond, int *info)
void zgtcon 
(char norm, int n, doublecomplex *zlow, doublecomplex 
*zdiag, doublecomplex *zup1, doublecomplex *zup2, int 
*ipivot, double danorm, double *drcond, int *info)
void cgtcon 
(char norm, int n, complex *clow, complex *cdiag, 
complex *cup1, complex *cup2, int *ipivot, float 
sanorm, float *srcond, int *info)

Arguments

NORM

Indicates whether the 1-norm condition number or the -norm condition number is required. The legal values for NORM are listed below. Any values not listed below are illegal.

'O', 'o', or '1'

1-norm condition number is required.

'I' or 'i'

-norm condition number is required.

N

Order of the matrix A. N 0.

xLOW

The N-1 multipliers that define the matrix L from the LU factorization of A, as computed by xGTTRF.

xDIAG

The N diagonal elements of the upper triangular matrix U from the LU factorization of A, as computed by xGTTRF.

xUP1

The N-1 elements of the first superdiagonal of U from the LU factorization of A, as computed by xGTTRF.

xUP2

The N-2 elements of the second superdiagonal of U from the LU factorization of A, as computed by xGTTRF.

IPIVOT

Pivot indices as computed by xGTTRF.

xANORM

The 1-norm of matrix A.

xRCOND

On exit, the estimated reciprocal of the condition number of the matrix A where the reciprocal condition number of A is defined to be 1 / (ANORM × ||A-1||). The reciprocal of the condition number is estimated instead of the condition number itself to avoid overflow or division by zero. If RCOND is less than machine precision (in particular, if RCOND = 0) then A is singular to working precision.

xWORK

Scratch array with a dimension of 2 × N.

IWORK2

Scratch array with a dimension of N for real subroutines.

INFO

On exit:

INFO = 0

Subroutine completed normally.

INFO < 0

The ith argument, where i = |INFO|, had an illegal value.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LDB, LDIWRK, LDWORK, N, NRHS
      PARAMETER        (N = 5)
      PARAMETER        (LDB = N)
      PARAMETER        (LDIWRK = N)
      PARAMETER        (LDWORK = 2 * N)
      PARAMETER        (NRHS = 1)
C
      DOUBLE PRECISION  ANORM, B(LDB,NRHS), DIAG(N), DLOWER(N-1)
      DOUBLE PRECISION  DUP1(N-1), DUP2(N-2), RCOND, WORK(LDWORK)
      INTEGER           ICOL, INFO, IPIVOT(N), IROW, IWORK(LDIWRK)
C
      EXTERNAL          DGTCON, DGTTRF, DGTTRS
      INTRINSIC         ABS
C
C     Initialize the arrays DLOWER, DIAG, and DUP1 to store
C     the first subdiagonal, the diagonal, and the first 
C     superdiagonal of the coefficient matrix A shown below. 
C     Initialize the array B to store the right hand side 
C     matrix b shown below.
C
C         -3   1                      6
C          1  -2   1                 12
C     A =      1  -2   1         b = 18
C                  1  -2   1         12
C                      1  -1          6
C
      DATA DLOWER / 1.0D0, 1.0D0, 1.0D0, 1.0D0 /
      DATA DIAG / -3.0D0, -2.0D0, -2.0D0, -2.0D0, -1.0D0 /
      DATA DUP1 / 1.0D0, 1.0D0, 1.0D0, 1.0D0 /
      DATA B / 6.0D0, 1.2D1, 1.8D1, 1.2D1, 6.0D0 /
C
      PRINT 1000
      DO 100, IROW = 1, N
        PRINT 1010, (0.0D0, ICOL = 1, IROW - 2),
     $        (DLOWER(ICOL + 1), ICOL = ABS(IROW - 2), IROW - 2),
     $        DIAG(IROW),
     $        (DUP1(IROW), ICOL = 1, MIN(1, N - IROW)),
     $        (0.0D0, ICOL = IROW + 2, N)
  100 CONTINUE
      PRINT 1020
      PRINT 1030, B
C
      CALL DGTTRF (N, DLOWER, DIAG, DUP1, DUP2, IPIVOT, INFO)
      IF (INFO .NE. 0) THEN
        PRINT 1040, INFO
        STOP 1
      END IF
      ANORM = 4.0D0
      CALL DGTCON ('ONE-NORM', N, DLOWER, DIAG, DUP1, DUP2,
     $             IPIVOT, ANORM, RCOND, WORK, IWORK, INFO)
      IF (INFO .NE. 0) THEN
        PRINT 1050, ABS (INFO)
        STOP 2
      END IF
      PRINT 1060, 1.0D0 / RCOND
      CALL DGTTRS ('NO TRANSPOSE A', N, NRHS, DLOWER, DIAG, DUP1,
     $             DUP2, IPIVOT, B, LDB, INFO)
      IF (INFO .NE. 0) THEN
        PRINT 1070, INFO
        STOP 3
      END IF
      PRINT 1080
      PRINT 1030, B
C
 1000 FORMAT (1X, 'A:')
 1010 FORMAT (5(3X, F5.2))
 1020 FORMAT (/1X, 'b:')
 1030 FORMAT (1X, F8.2)
 1040 FORMAT (1X, 'Error factoring A, INFO = ', I5)
 1050 FORMAT (1X, 'Illegal argument to DGTCON, argument #', I2)
 1060 FORMAT (/1X, 'Estimated condition number of A: ', F6.2)
 1070 FORMAT (1X, 'Error solving Ax=b, INFO = ', I5)
 1080 FORMAT (/1X, 'x:')
C
      END
 

Sample Output

 
 A:
   -3.00    1.00    0.00    0.00    0.00
    1.00   -2.00    1.00    0.00    0.00
    0.00    1.00   -2.00    1.00    0.00
    0.00    0.00    1.00   -2.00    1.00
    0.00    0.00    0.00    1.00   -1.00



 b:
     6.00
    12.00
    18.00
    12.00
     6.00



 Estimated condition number of A:  50.00



 x:
   -27.00
   -75.00
  -111.00
  -129.00
  -135.00






Previous Next Contents Generated Index Doc Set Home