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

NAG FL Interface Introduction
Example description
    Program f01crfe

!     F01CRF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: f01crf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, lmove, m, mn, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:)
      Integer, Allocatable             :: move(:)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: real
!     .. Executable Statements ..
      Write (nout,*) 'F01CRF Example Program Results'
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) m, n
      mn = m*n
      lmove = (m+n)/2
      Allocate (a(mn),move(lmove))
      Do i = 1, mn
        a(i) = real(i,kind=nag_wp)
      End Do

!     ifail: behaviour on error exit
!            =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call f01crf(a,m,n,mn,move,lmove,ifail)

      Write (nout,*)
      Write (nout,99999) a(1:mn)

99999 Format (1X,7F7.1)
    End Program f01crfe