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

NAG FL Interface Introduction
Example description
    Program s14bnfe

!     S14BNF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s14bnf, x02ajf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: tol
      Integer                          :: i, ifail, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:), p(:), q(:), x(:)
      Integer, Allocatable             :: ivalid(:)
!     .. Executable Statements ..
      Write (nout,*) 'S14BNF Example Program Results'

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

!     Get N
      Read (nin,*) n

      Allocate (a(n),p(n),q(n),x(n),ivalid(n))

      Write (nout,*)
      Write (nout,*)                                                           &
        '         A           X           P           Q      IVALID'

      tol = x02ajf()

      Read (nin,*)(a(i),x(i),i=1,n)

      ifail = -1
      Call s14bnf(n,a,x,tol,p,q,ivalid,ifail)

      If (ifail==0) Then
        Do i = 1, n
          Write (nout,99999) a(i), x(i), p(i), q(i), ivalid(i)
        End Do
      End If

99999 Format (1X,4F12.4,I12)
    End Program s14bnfe