prepare_hvp
Stable function · Evaluate the Jacobian
Tier: stable · Kind: function · Topic: Evaluate the Jacobian
| Julia | Python | Rust |
|---|---|---|
prepare_hvp | prepare_hvp | prepare_hvp |
Julia
prepare_hvp(input; wrt, model_name, forcing, build_kwargs, source_layout, eval_cse, eval_cse_min_nodes)
prepare_hvp(input; wrt = (:states, :states), model_name = nothing, forcing = nothing,
build_kwargs = NamedTuple(), source_layout = nothing) -> HVPEvaluator
Build the second-order contraction once (jacobian_bands2
): each
second-order coefficient field becomes a state of the derived evaluation model
(the same mechanism as prepare_jacobian
, whose keywords and
source_layout contract this shares), and a precomputed
(field slot, row, col, col2) list drives the contraction. A second column
outside its variable’s extent is a ghost read on the state and parameter
axes and an error on the forcing axis, as for the first-order columns.
Python
prepare_hvp(obj, model_name: str | None = None, wrt=('states', 'states'), forcing=None) -> HVPEvaluator
Build an HVPEvaluator
once — second-order differentiation,
column spaces and point placement — for repeated hvp
calls (one
per Rosenbrock step of an adjoint sweep).
Rust
pub fn prepare_hvp(file: &EsmFile, model_name: Option<&str>, wrt: (Wrt, Wrt), forcing: Option<&[String]>) -> Result<HvpEvaluator, BandError>
Build an HvpEvaluator
once for the axis pair wrt (first axis states
or time, second states, parameters or forcing).