    PROGRAM e01rafe

!      E01RAF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : e01raf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: n = 5, nin = 5, nout = 6
!      .. Local Scalars ..
       INTEGER                         :: i, ifail, m
!      .. Local Arrays ..
       REAL (KIND=nag_wp)              :: a(n), f(n), u(n), x(n)
       INTEGER                         :: iw(n)
!      .. Executable Statements ..
       WRITE (nout,*) 'E01RAF Example Program Results'

!      Skip heading in data file
       READ (nin,*)

       READ (nin,*) (x(i),i=1,n)
       READ (nin,*) (f(i),i=1,n)

       ifail = 0
       CALL e01raf(n,x,f,m,a,u,iw,ifail)

       WRITE (nout,*)
       WRITE (nout,*) 'The values of U(J) are'
       WRITE (nout,99999) (u(i),i=1,m-1)
       WRITE (nout,*)
       WRITE (nout,*) 'The Thiele coefficients A(J) are'
       WRITE (nout,99999) (a(i),i=1,m)

99999  FORMAT (1X,1P,4E12.4)
    END PROGRAM e01rafe
