Example description
    Program g13cgfe

!     G13CGF Example Program Text

!     Mark 27.0 Release. NAG Copyright 2019.

!     .. Use Statements ..
      Use nag_library, Only: g13cgf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: erlw, erup, rfse
      Integer                          :: i, ifail, j, l, n, ng
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: er(:), rf(:), xg(:), xyig(:),        &
                                          xyrg(:), yg(:)
      Real (Kind=nag_wp)               :: stats(4)
!     .. Executable Statements ..
      Write (nout,*) 'G13CGF Example Program Results'
      Write (nout,*)

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

!     Read in the problem size
      Read (nin,*) ng, l, n

      Allocate (xg(ng),yg(ng),xyrg(ng),xyig(ng),er(ng),rf(l))

!     Read in the statistics
      Read (nin,*)(stats(i),i=1,4)

!     Read in data
      Read (nin,*)(xg(i),yg(i),xyrg(i),xyig(i),i=1,ng)

!     Calculate noise spectrum
      ifail = -1
      Call g13cgf(xg,yg,xyrg,xyig,ng,stats,l,n,er,erlw,erup,rf,rfse,ifail)
      If (ifail/=0) Then
        If (ifail<2) Then
          Go To 100
        End If
      End If

!     Display results
      Write (nout,*) '           Noise spectrum'
      Write (nout,99999)(j-1,er(j),j=1,ng)
      Write (nout,*)
      Write (nout,*) 'Noise spectrum bounds multiplying factors'
      Write (nout,99998) 'Lower =', erlw, '     Upper =', erup
      Write (nout,*)
      Write (nout,*) 'Impulse response function'
      Write (nout,*)
      Write (nout,99999)(j-1,rf(j),j=1,l)
      Write (nout,*)
      Write (nout,99998) 'Impulse response function standard error =', rfse

100   Continue

99999 Format (1X,I5,F16.4)
99998 Format (1X,A,F10.4,A,F10.4)
    End Program g13cgfe