Example description
    Program g01ha_t1w_fe

!     G01HA_T1W_F Example Program Text
!     Mark 27 Release. NAG Copyright 2019.

!     .. Use Statements ..
      Use iso_c_binding, Only: c_ptr
      Use nagad_library, Only: g01ha_t1w_f, nagad_t1w_inc_derivative,          &
                               nagad_t1w_w_rtype, x10aa_t1w_f, x10ab_t1w_f,    &
                               Assignment (=)
      Use nag_library, Only: nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Type (c_ptr)                     :: ad_handle
      Type (nagad_t1w_w_rtype)         :: p, rho, x, y
      Real (Kind=nag_wp)               :: dpdr, dpdx, dpdy, rhor, xr, yr
      Integer                          :: i, ifail, n
!     .. Executable Statements ..
      Write (nout,*) 'G01HA_T1W_F Example Program Results'

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

      Write (nout,*)
      Write (nout,*) 'Lower tail probablities and derivatives'
      Write (nout,*)
      Write (nout,99998) 'x', 'y', 'rho', 'p', 'dp/dx', 'dp/dy', 'dp/drho'

!     Create AD configuration data object
      ifail = 0
      Call x10aa_t1w_f(ad_handle,ifail)

      Do i = 1, n

        Read (nin,*) xr, yr, rhor

        x = xr
        y = yr
        rho = rhor
        Call nagad_t1w_inc_derivative(x,1.0_nag_wp)
        ifail = 0
        Call g01ha_t1w_f(ad_handle,x,y,rho,p,ifail)
        dpdx = p%tangent

        x = xr
        y = yr
        rho = rhor
        Call nagad_t1w_inc_derivative(y,1.0_nag_wp)
        ifail = 0
        Call g01ha_t1w_f(ad_handle,x,y,rho,p,ifail)
        dpdy = p%tangent

        x = xr
        y = yr
        rho = rhor
        Call nagad_t1w_inc_derivative(rho,1.0_nag_wp)
        ifail = 0
        Call g01ha_t1w_f(ad_handle,x,y,rho,p,ifail)
        dpdr = p%tangent

        Write (nout,99999) x%value, y%value, rho%value, p%value, dpdx, dpdy,   &
          dpdr
      End Do
99999 Format (1X,1P,7E11.2)
99998 Format (1X,A4,A11,A13,A9,A15,A11,A13)

!     Remove computational data object
      Call x10ab_t1w_f(ad_handle,ifail)

    End Program g01ha_t1w_fe