Previous Next Contents Generated Index Doc Set Home



Condition Number of a Triangular Matrix

The subroutines described in this section estimate the condition number of a triangular matrix A. It is typical to follow a call to xTRCO with a call to xTRSL to solve Ax = b or to xTRDI to compute the determinant and inverse of A.

Calling Sequence

CALL DTRCO 
(DA, LDA, N, DRCOND, DWORK, JOB)
CALL STRCO 
(SA, LDA, N, SRCOND, SWORK, JOB)
CALL ZTRCO 
(ZA, LDA, N, DRCOND, ZWORK, JOB)
CALL CTRCO 
(CA, LDA, N, SRCOND, CWORK, JOB)






void dtrco 
(double *da, int lda, int n, double *drcond, int job)
void strco 
(float *sa, int lda, int n, float *srcond, int job)
void ztrco 
(doublecomplex *za, int lda, int n, double *drcond, int 
job)
void ctrco 
(complex *ca, int lda, int n, float *srcond, int job)

Arguments

xA

Matrix A.

LDA

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

N

Order of the matrix A. N 0.

xRCOND

On exit, an estimate of the reciprocal condition number of A.
0.0 RCOND 1.0. As the value of RCOND gets smaller, operations with A such as solving Ax = b may become less stable. If RCOND satisfies RCOND + 1.0 = 1.0 then A may be singular to working precision.

xWORK

Scratch array with a dimension of N.

JOB

If JOB = 0, then A is lower triangular; otherwise A is upper triangular.

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           ILOWER, LDA, N
      PARAMETER        (ILOWER = 0)
      PARAMETER        (N = 5)
      PARAMETER        (LDA = N)
C
      DOUBLE PRECISION  A(LDA,N), RCOND, WORK(N)
      INTEGER           ICOL, IROW, JOB
C
      EXTERNAL          DTRCO
C
C     Initialize the array A to store the 5x5 triangular matrix A
C     shown below.
C
C         1
C         1  1
C     A = 1  1  1
C         1  1  1  1
C         1  1  1  1  1
C
      DATA A / 5*1.0D0, 8D8, 4*1.0D0, 2*8D8, 3*1.0D0, 3*8D8,
     $         2*1.0D0, 4*8D8, 1.0D0 / 
C
C     Print the initial values of the arrays.
C
      PRINT 1000
      DO 100, IROW = 1, N
        PRINT 1010, (A(IROW,ICOL), ICOL = 1, IROW)
  100 CONTINUE
      PRINT 1020
      PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, LDA)
C
C     Estimate the condition number of the matrix.
C
      JOB = ILOWER
      CALL DTRCO (A, LDA, N, RCOND, WORK, JOB)
      PRINT 1030, RCOND
C
 1000 FORMAT (1X, 'A in full form:')
 1010 FORMAT (5(3X, F4.1))
 1020 FORMAT (/1X, 'A in triangular form: (* in unused elements)')
 1030 FORMAT (/1X, 'Reciprocal of the condition number:', F4.1)
C
      END
 

Sample Output

 
 A in full form:
    1.0
    1.0    1.0
    1.0    1.0    1.0
    1.0    1.0    1.0    1.0
    1.0    1.0    1.0    1.0    1.0



 A in triangular form: (* in unused elements)
    1.0   ****   ****   ****   ****
    1.0    1.0   ****   ****   ****
    1.0    1.0    1.0   ****   ****
    1.0    1.0    1.0    1.0   ****
    1.0    1.0    1.0    1.0    1.0



 Reciprocal of the condition number: 0.1






Previous Next Contents Generated Index Doc Set Home