complex_step_module Module

Complex-step differentiation routines.

See also

  1. J.R.R.A. Martins, P. Sturdza, J.J. Alonso, "The Complex-Step Derivative Approximation", ACM Transactions on Mathematical Software, Vol. 29, No. 3, September 2003, Pages 245262.

Uses

  • module~~complex_step_module~~UsesGraph module~complex_step_module complex_step_module module~kind_module kind_module module~complex_step_module->module~kind_module iso_fortran_env iso_fortran_env module~kind_module->iso_fortran_env

Used by

  • module~~complex_step_module~~UsedByGraph module~complex_step_module complex_step_module module~fortran_astrodynamics_toolkit fortran_astrodynamics_toolkit module~fortran_astrodynamics_toolkit->module~complex_step_module

Interfaces

interface

  • private function func(x) result(f)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=wp), intent(in) :: x

    Return Value complex(kind=wp)


Subroutines

public subroutine complex_step_derivative(f, x, h, dfdx)

Compute the first derivative using the complex-step method. This is Equation 6 from Reference [1].

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f
complex(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: h
real(kind=wp), intent(out) :: dfdx

private subroutine forward_diff(f, x, h, dfdx)

Compute the first derivative using a forward difference. This is Equation 1 from Reference [1].

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f
complex(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: h
real(kind=wp), intent(out) :: dfdx

private subroutine central_diff(f, x, h, dfdx)

Compute the first derivative using a 2-point central difference [-h,h].

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f
complex(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: h
real(kind=wp), intent(out) :: dfdx

private subroutine central_diff_4(f, x, h, dfdx)

Compute the first derivative using a 4-point central difference [-2h,-h,h,2h].

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f
complex(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: h
real(kind=wp), intent(out) :: dfdx

public subroutine complex_step_test()

Unit test for the complex_step module.

Arguments

None