    Program e01rafe

!     E01RAF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. 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
