* F07JRF 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 .. INTEGER I, INFO, N * .. Local Arrays .. COMPLEX *16 E(NMAX-1) DOUBLE PRECISION D(NMAX) * .. External Subroutines .. EXTERNAL ZPTTRF * .. Executable Statements .. WRITE (NOUT,*) 'F07JRF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) N IF (N.LE.NMAX) THEN * * Read the lower bidiagonal part of the tridiagonal matrix A from * data file * READ (NIN,*) (D(I),I=1,N) READ (NIN,*) (E(I),I=1,N-1) * * Factorize the tridiagonal matrix A * CALL ZPTTRF(N,D,E,INFO) * IF (INFO.GT.0) THEN WRITE (NOUT,99999) 'The leading minor of order ', INFO, + ' is not positive definite' END IF * * Print details of the factorization * WRITE (NOUT,*) 'Details of factorization' WRITE (NOUT,*) WRITE (NOUT,*) ' The diagonal elements of D' WRITE (NOUT,99998) (D(I),I=1,N) WRITE (NOUT,*) WRITE (NOUT,*) + ' Sub-diagonal elements of the Cholesky factor L' WRITE (NOUT,99998) (E(I),I=1,N-1) * ELSE WRITE (NOUT,*) 'NMAX too small' END IF STOP * 99999 FORMAT (1X,A,I3,A) 99998 FORMAT (1X,8F9.4) 99997 FORMAT (1X,5I9) END