PROGRAM f04fefe ! F04FEF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : f04fef, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: vlast INTEGER :: ifail, n LOGICAL :: wantp, wantv ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: p(:), t(:), v(:), work(:), x(:) ! .. Executable Statements .. WRITE (nout,*) 'F04FEF Example Program Results' ! Skip heading in data file READ (nin,*) READ (nin,*) n WRITE (nout,*) ALLOCATE (p(n),t(0:n),v(n),work(n-1),x(n)) READ (nin,*) t(0:n) wantp = .TRUE. wantv = .TRUE. ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 1 CALL f04fef(n,t,x,wantp,p,wantv,v,vlast,work,ifail) IF (ifail==0) THEN WRITE (nout,*) WRITE (nout,*) 'Solution vector' WRITE (nout,99998) x(1:n) IF (wantp) THEN WRITE (nout,*) WRITE (nout,*) 'Reflection coefficients' WRITE (nout,99998) p(1:n) END IF IF (wantv) THEN WRITE (nout,*) WRITE (nout,*) 'Mean square prediction errors' WRITE (nout,99998) v(1:n) END IF ELSE IF (ifail>0) THEN WRITE (nout,*) WRITE (nout,99999) 'Solution for system of order', ifail WRITE (nout,99998) x(1:ifail) IF (wantp) THEN WRITE (nout,*) WRITE (nout,*) 'Reflection coefficients' WRITE (nout,99998) p(1:ifail) END IF IF (wantv) THEN WRITE (nout,*) WRITE (nout,*) 'Mean square prediction errors' WRITE (nout,99998) v(1:ifail) END IF ELSE WRITE (nout,99997) ifail END IF 99999 FORMAT (1X,A,I5) 99998 FORMAT (1X,5F9.4) 99997 FORMAT (1X,' ** F04FEF returned with IFAIL = ',I5) END PROGRAM f04fefe