NAG Library Manual, Mark 28.3
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program g13cffe

!     G13CFF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: g13cff, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, j, ng
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: gn(:), gnlw(:), gnup(:), ph(:),      &
                                          phlw(:), phup(:), xg(:), xyig(:),    &
                                          xyrg(:), yg(:)
      Real (Kind=nag_wp)               :: stats(4)
!     .. Executable Statements ..
      Write (nout,*) 'G13CFF Example Program Results'
      Write (nout,*)

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

!     Read in problem size
      Read (nin,*) ng

      Allocate (xg(ng),yg(ng),xyrg(ng),xyig(ng),gn(ng),gnlw(ng),gnup(ng),      &
        ph(ng),phlw(ng),phup(ng))

!     Read in statistics
      Read (nin,*) stats(1:4)

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

!     Calculate gain and phase
      ifail = -1
      Call g13cff(xg,yg,xyrg,xyig,ng,stats,gn,gnlw,gnup,ph,phlw,phup,ifail)
      If (ifail/=0) Then
        If (ifail<2) Then
          Go To 100
        End If
      End If

!     Display results
      Write (nout,*) '              The gain'
      Write (nout,*)
      Write (nout,*) '                    Lower     Upper'
      Write (nout,*) '          Value     bound     bound'
      Write (nout,99999)(j-1,gn(j),gnlw(j),gnup(j),j=1,ng)
      Write (nout,*)
      Write (nout,*) '             The phase'
      Write (nout,*)
      Write (nout,*) '                    Lower     Upper'
      Write (nout,*) '          Value     bound     bound'
      Write (nout,99999)(j-1,ph(j),phlw(j),phup(j),j=1,ng)

100   Continue

99999 Format (1X,I5,3F10.4)
    End Program g13cffe