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

NAG FL Interface Introduction
Example description
    Program m01djfe

!     M01DJF Example Program Text

!     Mark 30.0 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: m01djf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, j, ldm, m1, m2, n1, n2
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: rm(:,:)
      Integer, Allocatable             :: irank(:)
!     .. Executable Statements ..
      Write (nout,*) 'M01DJF Example Program Results'

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

      Read (nin,*) m2, n2
      ldm = m2
      Allocate (rm(ldm,n2),irank(n2))

      m1 = 1
      n1 = 1

      Do i = m1, m2
        Read (nin,*)(rm(i,j),j=n1,n2)
      End Do

      ifail = 0
      Call m01djf(rm,ldm,m1,m2,n1,n2,'Ascending',irank,ifail)

      Write (nout,*)
      Write (nout,*) 'Data'
      Write (nout,*)

      Do i = m1, m2
        Write (nout,99999)(rm(i,j),j=n1,n2)
      End Do

      Write (nout,*)
      Write (nout,*) 'Ranks'
      Write (nout,*)
      Write (nout,99998)(irank(i),i=n1,n2)

99999 Format (1X,12F6.1)
99998 Format (1X,12I6)
    End Program m01djfe