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

NAG FL Interface Introduction
Example description
    Program h03abfe

!     H03ABF Example Program Text

!     Mark 30.0 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: h03abf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: z
      Integer                          :: i, ifail, j, ldkost, m, ma, maxit,   &
                                          mb, numit
!     .. Local Arrays ..
      Integer, Allocatable             :: k11(:), k12(:), k15(:), k6(:),       &
                                          k7(:), k8(:), k9(:), kost(:,:)
!     .. Executable Statements ..
      Write (nout,*) 'H03ABF Example Program Results'

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

      Read (nin,*) ma, mb
      m = ma + mb
      ldkost = ma
      Allocate (kost(ldkost,mb),k15(m),k7(m),k9(m),k6(m),k8(m),k11(m),k12(m))

      Read (nin,*)(k15(i),i=1,m)

      Do i = 1, ma
        Read (nin,*)(kost(i,j),j=1,mb)
      End Do

      maxit = 200

      ifail = 0
      Call h03abf(kost,ldkost,ma,mb,m,k15,maxit,k7,k9,numit,k6,k8,k11,k12,z,   &
        ifail)

      Write (nout,*)
      Write (nout,99999) 'Total cost = ', z
      Write (nout,*)
      Write (nout,*) 'Goods from  to'
      Write (nout,*)
      Write (nout,99998)(k11(i),k6(i),k8(i),i=1,m-1)

99999 Format (1X,A,F5.1)
99998 Format (1X,I3,I6,I5)
    End Program h03abfe