C      ________________________________________________________
C     |                                                        |
C     |  ESTIMATE 1-NORM CONDITION OF GENERAL COMPLEX MATRIX   |
C     |                                                        |
C     |    INPUT:                                              |
C     |                                                        |
C     |         A     --CFACT'S OUTPUT                         |
C     |                                                        |
C     |         B     --COMPLEX WORK ARRAY (LENGTH AT LEAST N) |
C     |                                                        |
C     |    OUTPUT:                                             |
C     |                                                        |
C     |         CCON   --CONDITION NUMBER                      |
C     |                 (IF MATRIX IS SINGULAR, CCON = -1)     |
C     |                                                        |
C     |    BUILTIN FUNCTIONS: CABS,CONJG,INT,REAL              |
C     |    PACKAGE SUBROUTINES: CSOLVE,CTRANS                  |
C     |________________________________________________________|
C
      FUNCTION CCON(A,B)
      COMPLEX A(1),B(1)
      REAL C,D,T
      INTEGER I,J,M,N
      I = INT(A(1))
      IF ( IABS(I) .EQ. 1239 ) GOTO 10
      WRITE(6,*) 'ERROR: MUST FACTOR BEFORE ESTIMATING CONDITION'
      STOP
10    IF ( I .LT. 0. ) GOTO 110
      M = 0
      N = INT(A(2))
      C = 1./REAL(A(2))
      DO 20 J = 1,N
20         B(J) = C
      GOTO 50
30    DO 40 J = 1,N
40         B(J) = 0.
      B(M) = 1.
50    CALL CSOLVE(B,A,B)
      C = 0.
      DO 70 J = 1,N
           T = CABS(B(J))
           C = C + T
           IF ( T .NE. 0. ) GOTO 60
           B(J) = 1.
           GOTO 70
60         B(J) = CONJG(B(J))/T
70    CONTINUE
      CALL CTRANS(B,A,B)
      I = 1
      DO 80 J = 1,N
80         IF ( CABS(B(I)) .LT. CABS(B(J)) ) I = J
      IF ( M .EQ. 0 ) GOTO 90
      IF ( M .EQ. I ) GOTO 100
      IF ( D .GE. C ) GOTO 100
90    M = I
      D = C
      GOTO 30
100   C = C*A(3)
      IF ( C .LT. 1. ) C = 1.
      CCON = C
      RETURN
110   CCON = -1.
      RETURN
      END