    PROGRAM d05byfe

!      D05BYF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : d05byf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: iorder = 4, iq = 3
       INTEGER, PARAMETER              :: itiq = 2**(iq+1)
       INTEGER, PARAMETER              :: itpmt = 2*iorder - 1
       INTEGER, PARAMETER              :: ldsw = itiq + itpmt
       INTEGER, PARAMETER              :: lenfw = 2*itiq
       INTEGER, PARAMETER              :: lwk = 4*itiq
       INTEGER, PARAMETER              :: nout = 6
!      .. Local Scalars ..
       INTEGER                         :: i, ifail
!      .. Local Arrays ..
       REAL (KIND=nag_wp)              :: sw(ldsw,itpmt), work(lwk), wt(lenfw)
!      .. Executable Statements ..
       WRITE (nout,*) 'D05BYF Example Program Results'

       ifail = 0
       CALL d05byf(iorder,iq,lenfw,wt,sw,ldsw,work,lwk,ifail)

       WRITE (nout,*)
       WRITE (nout,*) 'Fractional convolution weights'
       WRITE (nout,*)

       DO i = 1, itiq
          WRITE (nout,99999) i - 1, wt(i)
       END DO

       WRITE (nout,*)
       WRITE (nout,*) 'Fractional starting weights'
       WRITE (nout,*)

       DO i = 1, ldsw
          WRITE (nout,99999) i - 1, sw(i,1:itpmt)
       END DO

99999  FORMAT (1X,I5,7F9.4)
    END PROGRAM d05byfe
