test3 Program

Uses

  • program~~test3~~UsesGraph program~test3 test3 forunittest forunittest program~test3->forunittest kinds kinds program~test3->kinds module~fordiff fordiff program~test3->module~fordiff module~mod_func3 mod_func3 program~test3->module~mod_func3 module~fordiff->kinds module~mod_func3->kinds

Calls

program~~test3~~CallsGraph program~test3 test3 check check program~test3->check interface~derivative fordiff::derivative program~test3->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 test3

   use kinds
   use mod_func3
   use fordiff
   use forunittest

   implicit none

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

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

   ! reference derivative
   allocate(expected_dfdx(size(dfdx,1), size(dfdx,2)))
   expected_dfdx(1,1) = 2.0_rk*(1.0_rk)
   expected_dfdx(1,2) = (-1.0_rk)
   expected_dfdx(2,1) = 3.0_rk*(1.0_rk)**2
   expected_dfdx(2,2) = 1.5_rk*(-1.0_rk)**2
   expected_dfdx(3,1) = 4.0_rk*(1.0_rk)**3
   expected_dfdx(3,2) = 2.0_rk*(-1.0_rk)**3   

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

   deallocate(dfdx, expected_dfdx)

end program test3