Project

EarthSciASTDiff

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

Contents

transfer_definition

Stable function · Differentiate a model

Tier: stable · Kind: function · Topic: Differentiate a model

JuliaPythonRust
transfer_definitiontransfer_definitiontransfer_definition

Note: The transfer recurrence T = (I − G)⁻¹ a block’s auxiliary field carries (spec §4.5).

Julia

transfer_definition(rec::Recurrence, obs, recs::Vector{Recurrence}, ctx::EarthSciASTDiff.Ctx, tname::String; scalars)
transfer_definition(rec::Recurrence, obs, recs, ctx, tname; scalars) -> ASTExpr

The transfer recurrence T of rec (esm-jacobian-spec.md §4.5): over the frame plus one output index j on the axis, T[o, k, j] = [k == j] + Σ_{self bands} coef · T[o, k − lag, j], so T[o, ·, ·] = (I − G)⁻¹ on each line. Lower triangular on each line. scalars names the view’s variables declared without a shape that are not observed (an elementwise observed read at a cell in the definition reads them unchanged).

Source

Python

transfer_definition(rec: Recurrence, obs: dict, recs: list[Recurrence], ctx, tname: str, scalars=frozenset())

The transfer recurrence T of rec (spec §4.5): over the frame plus one output index j on the axis, T[o, k, j] = [k == j] + Σ_{self bands} coef · T[o, k − lag, j], so T[o, ·, ·] = (I − G)⁻¹ on each line. Lower triangular on each line. scalars names the view’s variables declared without a shape that are not observed.

Source

Rust

pub fn transfer_definition(rec: &Recurrence, obs: &HashMap<String, Expr>, recs: &[Recurrence], ctx: &Ctx, tname: &str, scalars: &HashSet<String>) -> Result<Expr, BandError>

The transfer recurrence T of rec (spec §4.5): over the frame plus one output index j on the axis,

T[o, k, j] = [k == j] + Σ_{self bands} coef · T[o, k − lag, j]

so T[o, ·, ·] = (I − G)⁻¹ on each line: ∂V[o, k] / ∂(source at [o, j]). Lower triangular on each line (zero for j > k). scalars names the view’s variables declared without a shape that are not observed (an elementwise observed read at a cell in the definition reads them unchanged).

Source · Rust docs