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

NAG FL Interface Introduction
Example description
    Program m01zbfe

!     M01ZBF Example Program Text

!     Mark 27.2 Release. NAG Copyright 2021.

!     .. Use Statements ..
      Use nag_library, Only: m01eaf, m01zbf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, m1, m2
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: rv(:)
      Integer, Allocatable             :: iperm(:)
!     .. Executable Statements ..
      Write (nout,*) 'M01ZBF Example Program Results'

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

      Read (nin,*) m2
      Allocate (rv(m2),iperm(m2))

      m1 = 1

      Read (nin,*)(rv(i),i=m1,m2)
      Read (nin,*)(iperm(i),i=m1,m2)

      ifail = 0
      Call m01zbf(iperm,m1,m2,ifail)

      ifail = 0
      Call m01eaf(rv,m1,m2,iperm,ifail)

      Write (nout,*)
      Write (nout,*) 'Numbers in rank order'
      Write (nout,*)
      Write (nout,99999)(rv(i),i=m1,m2)

99999 Format (1X,10F7.1)
    End Program m01zbfe