Project

EarthSciASTDiff

Analytical sparse Jacobians for EarthSciAST (.esm) models by symbolic differentiation of the expression AST.

Contents

This is the documentation for the older version v0.7.0. For the latest release, see v0.8.0.

vjp_document

Stable function · Evaluate the Jacobian

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

JuliaPythonRust
vjp_documentvjp_documentvjp_document

Julia

vjp_document(input; wrt, model_name, forcing, cse, cse_min_nodes, data_sources)
jvp_document(input; wrt = :states, model_name = nothing, forcing = nothing,
             cse = true) -> (doc, io)
vjp_document(input; …) -> (doc, io)

The product documents of esm-jacobian-spec.md §9.2 / §9.3 for one first-order axis: a derived ESM document (model "JvpEval" / "VjpEval") whose right-hand side, evaluated by an unmodified EarthSciAST evaluator at (u, inputs, p, t), leaves J v (resp. Jᵀ λ) in the derivative slots of its outputs. input is an EsmFile or a FlattenedSystem, as for jacobian_bands .

io names the inputs and outputs: io.v maps each column variable to its direction input and io.jvp each state to its output (io.lam / io.vjp for vjp_document). The consumer writes the inputs into the evaluator’s state slots beside the source states and reads the outputs from du through the evaluator’s variable map.

A VjpEval document is an equality-filtered faq scatter: correct under any evaluator, linear-time only under one that implements §9.3’s equality-filter scatter.

Source

Python

vjp_document(obj, model_name: str | None = None, wrt: str = 'states', forcing=None, cse: bool = True, cse_min_nodes: int = 12, data_sources=None)

The Jᵀ λ product document of spec §9.3 for one first-order axis (model "VjpEval"), as jvp_document : io["lam"] maps each state to its adjoint input and io["vjp"] each column variable to its output.

A VjpEval document is an equality-filtered faq scatter: correct under any evaluator, linear-time only under one that implements §9.3’s equality-filter scatter.

Source

Rust

pub fn vjp_document(sv: &SysView<'_>, entries: &[JacEntry], wrt: Wrt, opts: &ProductOptions<'_>) -> Result<(Value, VjpIo), BandError>

The Jᵀ λ product document of spec §9.3 (model "VjpEval"): as jvp_document , with the cotangent inputs VjpIo::lam and the outputs VjpIo::vjp. An equality-filtered faq scatter: correct under any evaluator, linear-time only under one that implements §9.3’s equality-filter scatter. entries and opts.forcing must agree, as for jvp_document , which also says what to pass through a recurrence.

Source · Rust docs