test2 Program

Uses

  • program~~test2~~UsesGraph program~test2 test2 forunittest forunittest program~test2->forunittest module~fordiff fordiff program~test2->module~fordiff module~mod_func2 mod_func2 program~test2->module~mod_func2 kinds kinds module~fordiff->kinds module~mod_func2->kinds

Calls

program~~test2~~CallsGraph program~test2 test2 check check program~test2->check interface~derivative fordiff::derivative program~test2->interface~derivative proc~complex_step_derivative_t0_t0 fordiff::complex_step_derivative_T0_T0 interface~derivative->proc~complex_step_derivative_t0_t0 proc~complex_step_derivative_t0_t1 fordiff::complex_step_derivative_T0_T1 interface~derivative->proc~complex_step_derivative_t0_t1 proc~complex_step_derivative_t1_t1 fordiff::complex_step_derivative_T1_T1 interface~derivative->proc~complex_step_derivative_t1_t1 proc~finite_difference_t0_t0 fordiff::finite_difference_T0_T0 interface~derivative->proc~finite_difference_t0_t0 proc~finite_difference_t0_t1 fordiff::finite_difference_T0_T1 interface~derivative->proc~finite_difference_t0_t1 proc~finite_difference_t1_t1 fordiff::finite_difference_T1_T1 interface~derivative->proc~finite_difference_t1_t1 proc~finite_difference_backward_t0_t0 fordiff::finite_difference_backward_T0_T0 proc~finite_difference_t0_t0->proc~finite_difference_backward_t0_t0 proc~finite_difference_central_t0_t0 fordiff::finite_difference_central_T0_T0 proc~finite_difference_t0_t0->proc~finite_difference_central_t0_t0 proc~finite_difference_forward_t0_t0 fordiff::finite_difference_forward_T0_T0 proc~finite_difference_t0_t0->proc~finite_difference_forward_t0_t0 proc~finite_difference_backward_t0_t1 fordiff::finite_difference_backward_T0_T1 proc~finite_difference_t0_t1->proc~finite_difference_backward_t0_t1 proc~finite_difference_central_t0_t1 fordiff::finite_difference_central_T0_T1 proc~finite_difference_t0_t1->proc~finite_difference_central_t0_t1 proc~finite_difference_forward_t0_t1 fordiff::finite_difference_forward_T0_T1 proc~finite_difference_t0_t1->proc~finite_difference_forward_t0_t1 proc~finite_difference_backward_t1_t1 fordiff::finite_difference_backward_T1_T1 proc~finite_difference_t1_t1->proc~finite_difference_backward_t1_t1 proc~finite_difference_central_t1_t1 fordiff::finite_difference_central_T1_T1 proc~finite_difference_t1_t1->proc~finite_difference_central_t1_t1 proc~finite_difference_forward_t1_t1 fordiff::finite_difference_forward_T1_T1 proc~finite_difference_t1_t1->proc~finite_difference_forward_t1_t1

Variables

Type Attributes Name Initial
real(kind=rk), dimension(:), allocatable :: dfdx
real(kind=rk), dimension(:), allocatable :: expected_dfdx
integer :: i
type(unit_test) :: ut

Source Code

program test2

   use fordiff
   use mod_func2
   use forunittest

   implicit none

   real(rk), dimension(:), allocatable :: dfdx, expected_dfdx
   integer                             :: i
   type(unit_test) :: ut

   ! compute derivative
   dfdx = derivative(f=func2, x=[1.0_rk, -1.0_rk], h=tiny(0.0_rk))

   ! compute reference derivative
   allocate(expected_dfdx(size(dfdx)))
   expected_dfdx(1) = 2.0_rk*(1.0_rk)
   expected_dfdx(2) = 1.0_rk*(-1.0_rk)

   ! check if derivative is correct
   call ut%check(dfdx, expected_dfdx, 1.0e-6_rk, 'test2' )

   deallocate(dfdx, expected_dfdx)

end program test2