fdm.multivariate module

fdm.multivariate.default_adaptive_method = <fdm.fdm.FDM object>

Default adaptive method.

Type

fdm.FDM

fdm.multivariate.default_robust_method = <fdm.fdm.FDM object>

Default robust method.

Type

fdm.FDM

fdm.multivariate.gradient(f, method=<fdm.fdm.FDM object>)[source]

Compute the gradient of f.

The function f should be scalar valued.

Parameters
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 to multivariate.default_adaptive_method.

  • dir_method (fdm.FDM, optional) – Finite difference method to use for directional derivative computation. Defaults to multivariate.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
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 to multivariate.default_adaptive_method.

Returns

Jacobian of f multiplied by v, or directional

derivative in the direction v.

Return type

function