* F07CUF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX PARAMETER (NMAX=50) * .. Local Scalars .. DOUBLE PRECISION ANORM, RCOND INTEGER I, INFO, N * .. Local Arrays .. COMPLEX *16 D(NMAX), DL(NMAX-1), DU(NMAX-1), DU2(NMAX-2), + WORK(2*NMAX) INTEGER IPIV(NMAX) * .. External Functions .. DOUBLE PRECISION F06UNF, X02AJF EXTERNAL F06UNF, X02AJF * .. External Subroutines .. EXTERNAL ZGTCON, ZGTTRF * .. Executable Statements .. WRITE (NOUT,*) 'F07CUF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) N IF (N.LE.NMAX) THEN * * Read the tridiagonal matrix A from data file * READ (NIN,*) (DU(I),I=1,N-1) READ (NIN,*) (D(I),I=1,N) READ (NIN,*) (DL(I),I=1,N-1) * * Compute the 1-norm of A * ANORM = F06UNF('1-norm',N,DL,D,DU) * * Factorize the tridiagonal matrix A * CALL ZGTTRF(N,DL,D,DU,DU2,IPIV,INFO) * IF (INFO.EQ.0) THEN * * Estimate the condition number of A * CALL ZGTCON('1-norm',N,DL,D,DU,DU2,IPIV,ANORM,RCOND,WORK, + INFO) * * Print the estimated condition number * IF (RCOND.GE.X02AJF()) THEN WRITE (NOUT,99999) 'Estimate of condition number = ', + 1.0D0/RCOND ELSE WRITE (NOUT,99999) + 'A is singular to working precision. RCOND = ', RCOND END IF * ELSE WRITE (NOUT,99998) 'The (', INFO, ',', INFO, ')', + ' element of the factor U is zero' END IF ELSE WRITE (NOUT,*) 'NMAX too small' END IF * 99999 FORMAT (1X,A,1P,E10.2) 99998 FORMAT (1X,A,I3,A,I3,A,A) END