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

NAG FL Interface Introduction
Example description
    Program s14cpfe

!     S14CPF Example Program Text

!     Mark 28.6 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s14cpf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:), b(:), f(:)
      Integer, Allocatable             :: ivalid(:)
!     .. Executable Statements ..
      Write (nout,*) 'S14CPF Example Program Results'

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

      Write (nout,*)
      Write (nout,*) '     A           B           F          IVALID'
      Write (nout,*)

      Read (nin,*) n

      Allocate (a(n),b(n),f(n),ivalid(n))

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

      ifail = -1
      Call s14cpf(n,a,b,f,ivalid,ifail)

      Do i = 1, n
        Write (nout,99999) a(i), b(i), f(i), ivalid(i)
      End Do

99999 Format (1X,1P,3E12.3,I5)
    End Program s14cpfe