Program g01fc_t1w_fe
! G01FC_T1W_F Example Program Text
! Mark 29.2 Release. NAG Copyright 2023.
! .. Use Statements ..
Use iso_c_binding, Only: c_ptr
Use nagad_library, Only: g01fc_t1w_f, nagad_t1w_set_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) :: df, p, x
Real (Kind=nag_wp) :: dfr, dxdf, dxdp, pr
Integer :: i, ifail, n
! .. Executable Statements ..
Write (nout,*) 'G01FC_T1W_F Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) n
Write (nout,*)
Write (nout,*) ' deviates and derivatives'
Write (nout,*)
Write (nout,*) ' p df x dx/dp' // &
' dx/ddf'
! Create AD configuration data object
ifail = 0
Call x10aa_t1w_f(ad_handle,ifail)
Do i = 1, n
Read (nin,*) pr, dfr
p = pr
df = dfr
Call nagad_t1w_set_derivative(p,1.0_nag_wp)
ifail = 0
Call g01fc_t1w_f(ad_handle,p,df,x,ifail)
dxdp = x%tangent
p = pr
df = dfr
Call nagad_t1w_set_derivative(df,1.0_nag_wp)
ifail = 0
Call g01fc_t1w_f(ad_handle,p,df,x,ifail)
dxdf = x%tangent
Write (nout,99999) p%value, df%value, x%value, dxdp, dxdf
End Do
99999 Format (1X,1P,5E13.4)
! Remove computational data object
Call x10ab_t1w_f(ad_handle,ifail)
End Program g01fc_t1w_fe