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

NAG FL Interface Introduction
Example description
    Program h02bffe

!     H02BFF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: h02bff, nag_wp, x04acf, x04baf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Real (Kind=nag_wp), Parameter    :: xbl_default = 0.0E0_nag_wp
      Real (Kind=nag_wp), Parameter    :: xbu_default = 1.0E+20_nag_wp
      Integer, Parameter               :: maxm = 50, maxn = 50, msglvl = 1,    &
                                          nindat = 7, nout = 6
      Integer, Parameter               :: maxdpt = 3*maxn/2
      Character (*), Parameter         :: fname = 'h02bffe.opt'
      Character (3), Parameter         :: optim = 'MIN'
!     .. Local Scalars ..
      Integer                          :: ifail, infile, liwork, lrwork, m,    &
                                          mode, n
      Character (80)                   :: rec
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: rwork(:)
      Real (Kind=nag_wp)               :: x(maxn)
      Integer, Allocatable             :: iwork(:)
      Character (8)                    :: crname(maxn+maxm)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: min
!     .. Executable Statements ..
      Write (rec,99999) 'H02BFF Example Program Results'
      Call x04baf(nout,rec)

!     Open the data file for reading

      mode = 0

      ifail = 0
      Call x04acf(nindat,fname,mode,ifail)

!     Solve the problem

      liwork = (25+maxn+maxm)*maxdpt + 7*maxn + 2*maxm + 4
      lrwork = maxdpt*(maxn+1) + 2*min(maxn,maxm+1)**2 + maxm*maxn + 19*maxn + &
        15*maxm
      Allocate (iwork(liwork),rwork(lrwork))

      infile = nindat

      ifail = 0
      Call h02bff(infile,maxn,maxm,optim,xbl_default,xbu_default,maxdpt,       &
        msglvl,n,m,x,crname,iwork,liwork,rwork,lrwork,ifail)

99999 Format (1X,A)
    End Program h02bffe