Problem function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(numdiff_type), | intent(inout) | :: | me | |||
| real(kind=wp), | intent(in), | dimension(:) | :: | x | ||
| real(kind=wp), | intent(out), | dimension(:) | :: | f | ||
| integer, | intent(in), | dimension(:) | :: | funcs_to_compute |
subroutine my_func(me,x,f,funcs_to_compute) !! Problem function implicit none class(numdiff_type),intent(inout) :: me real(wp),dimension(:),intent(in) :: x real(wp),dimension(:),intent(out) :: f integer,dimension(:),intent(in) :: funcs_to_compute if (any(funcs_to_compute==1)) f(1) = x(1)*x(2) - x(3)**3 if (any(funcs_to_compute==2)) f(2) = x(3) - 1.0_wp if (any(funcs_to_compute==3)) f(3) = x(4)*x(5) if (any(funcs_to_compute==4)) f(4) = 2.0_wp*x(6) + sin(x(7)) if (any(funcs_to_compute==5)) f(5) = cos(x(8)) + sqrt(abs(x(9))) if (any(funcs_to_compute==6)) f(6) = 1.0_wp / (1.0_wp + exp(x(10))) func_evals = func_evals + 1 end subroutine my_func