Version: dev

vjp_forcing

Stable function · Evaluate the Jacobian

Tier: stable · Kind: function · Topic: Evaluate the Jacobian

JuliaPythonRust
vjp_forcing!vjp_forcingvjp_forcing

Julia

vjp_forcing!(ḡ::AbstractVector, jac::JacobianEvaluator, λ, u, p, t::Real)
vjp_forcing!(ḡ::AbstractDict, jac::JacobianEvaluator, λ, u, p, t::Real)
vjp_forcing!(ḡ, jac::JacobianEvaluator, λ, u, p, t) -> ḡ

vjp! on a wrt = :forcing evaluator: the forcing cotangent of one stage evaluation, ḡ_B += (∂f/∂B)ᵀ λ (esm-jacobian-spec.md §4.3). ḡ is either a flat vector over the canonical column ordinal (jac.colnames) or a Dict of buffer-shaped accumulators keyed by buffer name (one per jac.columns entry, each the buffer’s shape). It accumulates; which dataset record a buffer slot holds, and when to flush, is the caller’s bookkeeping.

Source

Python

vjp_forcing(g, obj, lam: dict, model_name: str | None = None, states: dict | None = None, params: dict | None = None, t: float = 0.0, forcing=None)

vjp on the forcing axis: the forcing cotangent of one stage evaluation, g_B += (∂f/∂B)ᵀ λ (spec §4.3). obj is a wrt="forcing" JacobianEvaluator — build it once with prepare_jacobian and reuse it across stages — or anything assemble_jacobian takes. g is either a flat sequence over the canonical column ordinal or a dict of buffer-shaped numpy accumulators keyed by buffer name (one per forcing buffer, each of the buffer’s shape, indexed by cell). It accumulates; which dataset record a buffer slot holds is the caller’s bookkeeping.

Source

Rust

pub fn vjp_forcing(file: &EsmFile, model_name: Option<&str>, forcing: Option<&[String]>, env: &Env, lambda: &HashMap<String, f64>, gbar: &mut HashMap<String, Vec<f64>>) -> Result<(), BandError>

vjp on the forcing axis, into buffer-shaped accumulators: the forcing cotangent of one stage evaluation, ḡ_B += (∂f/∂B)ᵀ λ (spec §4.3). gbar holds one accumulator per forcing buffer, keyed by buffer name, each the buffer’s cells COLUMN-MAJOR (first index fastest). It accumulates; which dataset record a buffer slot holds, and when to flush, is the caller’s bookkeeping. This prepares the evaluator for one call; an adjoint loop calls JacobianEvaluator::vjp_forcing on one prepare_jacobian instead.

Source · Rust docs