jacobian_from_function#

cosmicjellyfish.analysis.fisher_operations.jacobian_from_function(function, fiducial, method='fd', step=1e-06)[source]#

Jacobian of a vector function at a fiducial point.

The returned matrix is \(J_{i\alpha} = \partial f_i / \partial x_\alpha\), with rows indexing the outputs of function and columns indexing its inputs.

Parameters:
  • function (callable) – callable mapping a 1D array of inputs to a 1D array of outputs. With method='jax' it must be written with jax.numpy.

  • fiducial (array-like) – point where the Jacobian is evaluated.

  • method (string) – 'fd' for central finite differences or 'jax' for forward-mode automatic differentiation (requires jax).

  • step (float) – relative finite-difference step; the absolute step for input \(x_\alpha\) is step * max(|x_alpha|, 1). Ignored with method='jax'.

Returns:

the Jacobian matrix, shape (n_outputs, n_inputs).

Return type:

numpy.ndarray