Previous Next Contents Generated Index Doc Set Home



Reciprocal Condition Number of an LU-Factored General Matrix

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

Calling Sequence

CALL DGECON 
(NORM, N, DA, LDA, DANORM, DRCOND, DWORK, IWORK2, INFO)
CALL SGECON 
(NORM, N, SA, LDA, SANORM, SRCOND, SWORK, IWORK2, INFO)
CALL ZGECON 
(NORM, N, ZA, LDA, DANORM, DRCOND, ZWORK, DWORK2, INFO)
CALL CGECON 
(NORM, N, CA, LDA, SANORM, SRCOND, CWORK, SWORK2, INFO)






void dgecon 
(char norm, int n, double *da, int lda, double danorm, 
double *drcond, int *info)
void sgecon 
(char norm, int n, float *sa, int lda, float sanorm, 
float *srcond, int *info)
void zgecon 
(char norm, int n, doublecomplex *za, int lda, double 
danorm, double *drcond, int *info)
void cgecon 
(char norm, int n, complex *ca, int lda, 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.

xA

LU factorization of the matrix A, as computed by xGETRF.

LDA

Leading dimension of the array A as specified in a dimension or type statement. LDA max(1, N).

xANORM

On entry, if NORM = 'O', 'o', or '1', then ANORM contains the 1-norm of the original matrix A; if NORM = 'I' or 'i' then ANORM contains the -norm of the original 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 4 × N for real subroutines or 2 × N for complex subroutines.

xWORK2

Scratch array with a dimension of N for real subroutines or 2 × N for complex 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           LDA, M, N, NRHS
      PARAMETER        (M = 3)
      PARAMETER        (N = 3)
      PARAMETER        (NRHS = 1)
      PARAMETER        (LDA = M)
C
      DOUBLE PRECISION  A(LDA,N), ANORM, RCOND, WORK(4*N)
      INTEGER           ICOL, INFO, IROW, IPIVOT(N), IWORK(N)
C
      EXTERNAL          DGECON, DGETRF
C
C     Initialize the array A to store the coefficient matrix A
C     shown below.
C
C         1  2  2
C     A = 2  1  2
C         2  2  1
C
      DATA A / 1.0D0, 3*2.0D0, 1.0D0, 3*2.0D0, 1.0D0 /
C
C     Print the initial value of A.
C
      PRINT 1000
      PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, M)
C
C     LU factor A, then use the factorization to compute the
C     condition number.
C
      CALL DGETRF (M, N, A, LDA, IPIVOT, INFO)
      IF (INFO .EQ. 0) THEN
        ANORM = 5.0D0
        CALL DGECON ('ONE-NORM', N, A, LDA, ANORM, RCOND,
     $               WORK, IWORK, INFO)
        IF (INFO .EQ. 0) THEN
          PRINT 1020, 1.0D0 / RCOND
        ELSE
          PRINT 1030, INFO
        END IF
      ELSE
        PRINT 1040, INFO
      END IF
C
 1000 FORMAT (1X, 'A:')
 1010 FORMAT (3(3X, F4.1))
 1020 FORMAT (/1X, 'Estimated condition number: ', F9.6)
 1030 FORMAT (1X, 'Error computing condition number, INFO = ', I6)
 1040 FORMAT (1X, 'Factorization failed with INFO = ', I6)
C
      END
 

Sample Output

 
 A:
    1.0    2.0    2.0
    2.0    1.0    2.0
    2.0    2.0    1.0



 Estimated condition number:  7.000000






Previous Next Contents Generated Index Doc Set Home