* F04FFF Example Program Text * Mark 15 Release. NAG Copyright 1991. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX PARAMETER (NMAX=100) * .. Local Scalars .. INTEGER I, IFAIL, N LOGICAL WANTP * .. Local Arrays .. DOUBLE PRECISION B(NMAX), P(NMAX-1), T(0:NMAX-1), + WORK(2*(NMAX-1)), X(NMAX) * .. External Subroutines .. EXTERNAL F04FFF * .. Executable Statements .. WRITE (NOUT,*) 'F04FFF Example Program Results' * Skip heading in data file READ (NIN,*) READ (NIN,*) N WRITE (NOUT,*) IF ((N.LT.0) .OR. (N.GT.NMAX)) THEN WRITE (NOUT,99999) 'N is out of range. N = ', N ELSE READ (NIN,*) (T(I),I=0,N-1) READ (NIN,*) (B(I),I=1,N) WANTP = .TRUE. * IFAIL = -1 * CALL F04FFF(N,T,B,X,WANTP,P,WORK,IFAIL) * IF (IFAIL.EQ.0) THEN WRITE (NOUT,*) WRITE (NOUT,*) 'Solution vector' WRITE (NOUT,99998) (X(I),I=1,N) IF (WANTP) THEN WRITE (NOUT,*) WRITE (NOUT,*) 'Reflection coefficients' WRITE (NOUT,99998) (P(I),I=1,N-1) END IF ELSE IF (IFAIL.GT.0) THEN WRITE (NOUT,*) WRITE (NOUT,99999) 'Solution for system of order', IFAIL - 1 WRITE (NOUT,99998) (X(I),I=1,IFAIL-1) IF (WANTP) THEN WRITE (NOUT,*) WRITE (NOUT,*) 'Reflection coefficients' WRITE (NOUT,99998) (P(I),I=1,IFAIL-1) END IF END IF END IF STOP * 99999 FORMAT (1X,A,I5) 99998 FORMAT (1X,5F9.4) END