Program m01dkfe
! M01DKF Example Program Text
! Mark 27.3 Release. NAG Copyright 2021.
! .. Use Statements ..
Use nag_library, Only: m01dkf
! .. 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 ..
Integer, Allocatable :: im(:,:), irank(:)
! .. Executable Statements ..
Write (nout,*) 'M01DKF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) m2, n2
ldm = m2
Allocate (im(ldm,n2),irank(n2))
m1 = 1
n1 = 1
Do i = m1, m2
Read (nin,*)(im(i,j),j=n1,n2)
End Do
ifail = 0
Call m01dkf(im,ldm,m1,m2,n1,n2,'Descending',irank,ifail)
Write (nout,*)
Write (nout,*) 'Data'
Write (nout,*)
Do i = m1, m2
Write (nout,99999)(im(i,j),j=n1,n2)
End Do
Write (nout,*)
Write (nout,*) 'Ranks'
Write (nout,*)
Write (nout,99999)(irank(i),i=n1,n2)
99999 Format (1X,12I6)
End Program m01dkfe