fdm.multivariate module¶
-
fdm.multivariate.
default_adaptive_method
= <fdm.fdm.FDM object>¶ Default adaptive method.
- Type
-
fdm.multivariate.
gradient
(f, method=<fdm.fdm.FDM object>)[source]¶ Compute the gradient of f.
The function f should be scalar valued.
- Parameters
f (function) – Function to compute gradient of. This should be a scalar-valued function.
method (
fdm.FDM
, optional) – Finite difference method to use. Defaults tomultivariate.default_adaptive_method
.
- Returns
Gradient.
- Return type
function
-
fdm.multivariate.
hvp
(f, v, jac_method=<fdm.fdm.FDM object>, dir_method=<fdm.fdm.FDM object>)[source]¶ Compute a Hessian-vector product.
- Parameters
f (function) – Function to compute Hessian of.
v (tensor) – Vector to multiply Hessian with. Should be of the same form as the arguments supplied to f.
jac_method (
fdm.FDM
, optional) – Finite difference method to use for Jacobian computation. Defaults tomultivariate.default_adaptive_method
.dir_method (
fdm.FDM
, optional) – Finite difference method to use for directional derivative computation. Defaults tomultivariate.default_robust_method
.
- Returns
Hessian of f multiplied by v.
- Return type
function
-
fdm.multivariate.
jacobian
(f, method=<fdm.fdm.FDM object>)[source]¶ Compute the Jacobian of f.
- Parameters
f (function) – Function to compute Jacobian of.
method (
fdm.FDM
, optional) – Finite difference method to use. Defaults tomultivariate.default_adaptive_method
.
- Returns
Jacobian.
- Return type
function
-
fdm.multivariate.
jvp
(f, v, method=<fdm.fdm.FDM object>)[source]¶ Compute a Jacobian-vector product, also known as a directional derivative.
- Parameters
f (function) – Function to compute Jacobian of.
v (tensor) – Vector to multiply Jacobian with. Should be of the same form as the arguments supplied to f.
method (
fdm.FDM
, optional) – Finite difference method to use. Defaults tomultivariate.default_adaptive_method
.
- Returns
- Jacobian of f multiplied by v, or directional
derivative in the direction v.
- Return type
function