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

NAG FL Interface Introduction
Example description
    Program g13dxfe

!     G13DXF Example Program Text

!     Mark 27.3 Release. NAG Copyright 2021.

!     .. Use Statements ..
      Use nag_library, Only: g13dxf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, ip, k, kip, npar
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: par(:), ri(:), rmod(:), rr(:),       &
                                          work(:)
      Integer, Allocatable             :: iwork(:)
!     .. Executable Statements ..
      Write (nout,*) 'G13DXF Example Program Results'
      Write (nout,*)

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

!     Read in problem size
      Read (nin,*) k, ip

      kip = k*ip
      npar = k*kip
      Allocate (par(npar),rr(kip),ri(kip),rmod(kip),work(ip*npar),iwork(kip))

!     Read the AR (or MA) parameters
      Read (nin,*) par(1:npar)

!     Calculate zeros
      ifail = 0
      Call g13dxf(k,ip,par,rr,ri,rmod,work,iwork,ifail)

!     Display results
      Write (nout,*) '        Eigenvalues       Moduli'
      Write (nout,*) '        -----------       ------'
      Do i = 1, k*ip
        If (ri(i)>=0.0E0_nag_wp) Then
          Write (nout,99999) rr(i), ri(i), rmod(i)
        Else
          Write (nout,99998) rr(i), -ri(i), rmod(i)
        End If
      End Do

99999 Format (' ',F10.3,'  + ',F6.3,' i  ',F8.3)
99998 Format (' ',F10.3,'  - ',F6.3,' i  ',F8.3)
    End Program g13dxfe