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

NAG FL Interface Introduction
Example description
!   D01UBF Example Program Text
!   Mark 27.3 Release. NAG Copyright 2021.

    Module d01ubfe_mod
!     D01UBF Example Program Module:
!            Parameters and User-defined Routines

!     .. Use Statements ..
      Use nag_library, Only: nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Accessibility Statements ..
      Private
      Public                           :: f
!     .. Parameters ..
      Integer, Parameter, Public       :: nout = 6
    Contains
      Subroutine f(x,fv,n,iuser,ruser,ifail)

!       .. Scalar Arguments ..
        Integer, Intent (Inout)        :: ifail
        Integer, Intent (In)           :: n
!       .. Array Arguments ..
        Real (Kind=nag_wp), Intent (Out) :: fv(n)
        Real (Kind=nag_wp), Intent (Inout) :: ruser(*)
        Real (Kind=nag_wp), Intent (In) :: x(n)
        Integer, Intent (Inout)        :: iuser(*)
!       .. Executable Statements ..
        fv = x
      End Subroutine f

    End Module d01ubfe_mod

    Program d01ubfe

!     .. Use Statements ..
      Use d01ubfe_mod, Only: f, nout
      Use nag_library, Only: d01ubf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: ans
      Integer                          :: ifail, n
!     .. Local Arrays ..
      Real (Kind=nag_wp)               :: ruser(1)
      Integer                          :: iuser(1)
!     .. Executable Statements ..
      Write (nout,*) 'D01UBF Example Program Results'
      n = 10
      ifail = 0
      Call d01ubf(f,n,ans,iuser,ruser,ifail)
      Write (nout,*)
      Write (nout,99999) 'Approximation to the integral = ', ans

99999 Format (1X,A,F12.5)
    End Program d01ubfe