derivkit.calculus.jacobian module¶
Contains functions used to construct the Jacobian matrix.
- derivkit.calculus.jacobian.build_jacobian(function: Callable[[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | float], theta0: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], method: str | None = None, n_workers: int | None = 1, dk_kwargs: dict | None = None) ndarray[tuple[Any, ...], dtype[floating]]¶
Computes the Jacobian of a vector-valued function.
Each column in the Jacobian is the derivative with respect to one parameter.
- Parameters:
function – The vector-valued function to be differentiated. It should accept a list or array of parameter values as input and return an array of observable values.
theta0 – The parameter vector at which the jacobian is evaluated.
method – Method name or alias (e.g., “adaptive”, “finite”). If None, the DerivativeKit default (“adaptive”) is used.
n_workers – Number of workers used to parallelize across parameters. If None or 1, no parallelization is used. If greater than 1, this many threads will be used to compute derivatives with respect to different parameters in parallel.
dk_kwargs – Additional keyword arguments passed to DerivativeKit.differentiate.
- Returns:
- A 2D array representing the jacobian. Each column corresponds to
the derivative with respect to one parameter.
- Raises:
FloatingPointError – If non-finite values are encountered.
ValueError – If
theta0is an empty array.TypeError – If
functiondoes not return a vector value.