Module for numerical differentiation using complex step differentiation and finite difference methods
for real(kind=rk) and complex(kind=rk). Use -DREAL32 for real kind 4 and -DREAL64 for real kind 8. Default is real kind 8.
Derivative interface
Calculates the derivative of a scalar-valued function w.r.t. a scalar-valued variable using complex step differentiation.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value complex(kind=rk)scalar complex function |
||||||||||||||||||||
real(kind=rk), | intent(in) | :: | x |
scalar variable |
||||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for complex step differentiation |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a vector-valued variable using complex step differentiation.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value complex(kind=rk)scalar complex function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for complex step differentiation |
derivative of w.r.t.
Calculates the derivative of a vector-valued function w.r.t. a vector-valued variable using complex step differentiation.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value complex(kind=rk), dimension(:), allocatablevector complex function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for complex step differentiation |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a scalar-valued variable using finite difference methods (forward, backward, central).
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in) | :: | x |
scalar variable |
||||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
||||||||||||||||
character(len=*), | intent(in) | :: | method |
finite difference method (forward, backward, central) |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a vector-valued variable using finite difference methods (forward, backward, central).
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
||||||||||||||||
character(len=*), | intent(in) | :: | method |
finite difference method (forward, backward, central) |
derivative of w.r.t.
Calculates the derivative of a vector-valued function w.r.t. a vector-valued variable using finite difference methods (forward, backward, central).
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk), dimension(:), allocatablevector function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
||||||||||||||||
character(len=*), | intent(in) | :: | method |
finite difference method (forward, backward, central) |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a scalar-valued variable using complex step differentiation.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value complex(kind=rk)scalar complex function |
||||||||||||||||||||
real(kind=rk), | intent(in) | :: | x |
scalar variable |
||||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for complex step differentiation |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a vector-valued variable using complex step differentiation.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value complex(kind=rk)scalar complex function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for complex step differentiation |
derivative of w.r.t.
Calculates the derivative of a vector-valued function w.r.t. a vector-valued variable using complex step differentiation.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value complex(kind=rk), dimension(:), allocatablevector complex function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for complex step differentiation |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a scalar-valued variable using finite difference methods (forward, backward, central).
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in) | :: | x |
scalar variable |
||||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
||||||||||||||||
character(len=*), | intent(in) | :: | method |
finite difference method (forward, backward, central) |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a scalar-valued variable using the central finite difference method.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in) | :: | x |
scalar variable |
||||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a scalar-valued variable using the forward finite difference method.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in) | :: | x |
scalar variable |
||||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a scalar-valued variable using the backward finite difference method.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in) | :: | x |
scalar variable |
||||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a vector-valued variable using finite difference methods (forward, backward, central).
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
||||||||||||||||
character(len=*), | intent(in) | :: | method |
finite difference method (forward, backward, central) |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a vector-valued variable using the central finite difference method.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a vector-valued variable using the forward finite difference method.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
derivative of w.r.t.
Calculates the derivative of a scalar-valued function w.r.t. a vector-valued variable using the backward finite difference method.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk)scalar function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
derivative of w.r.t.
Calculates the derivative of a vector-valued function w.r.t. a vector-valued variable using finite difference methods (forward, backward, central).
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk), dimension(:), allocatablevector function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
||||||||||||||||
character(len=*), | intent(in) | :: | method |
finite difference method (forward, backward, central) |
derivative of w.r.t.
Calculates the derivative of a vector-valued function w.r.t. a vector-valued variable using the central finite difference method.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk), dimension(:), allocatablevector function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
derivative of w.r.t.
Calculates the derivative of a vector-valued function w.r.t. a vector-valued variable using the forward finite difference method.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk), dimension(:), allocatablevector function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
derivative of w.r.t.
Calculates the derivative of a vector-valued function w.r.t. a vector-valued variable using the backward finite difference method.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
private impure function f(z) result(fz)Arguments
Return Value real(kind=rk), dimension(:), allocatablevector function |
||||||||||||||||||||
real(kind=rk), | intent(in), | dimension(:) | :: | x |
vector variable |
|||||||||||||||
real(kind=rk), | intent(in) | :: | h |
perturbation for finite difference methods |
derivative of w.r.t.