conatus.expert.FlowMap

class conatus.expert.FlowMap(solver, steps, *, checkpoints=None, f_transpose='polynomial', solves='banded', max_dense=3000, t0=None, checkpoint_store='device', checkpoint_dir=None)[source]

Bases: object

Φ(X_0) = X_N for an IVPSolver (CPU or GPU), with exact discrete jvp and vjp (see the module docstring for the explicit choices f_transpose, solves, checkpoints).

Parameters:
  • solver (IVPSolver)

  • steps (int)

  • checkpoints (int | None)

  • f_transpose (str)

  • solves (str)

  • max_dense (int)

  • t0 (float | None)

  • checkpoint_store (str)

restore: bool = False

True: Φ(X_0) puts the solver’s state, clock and multistep history back after its run (set by Simulation.flowmap; review of the state audit, F6: sim.flowmap(T)(X0) moved the simulation to X_N). False (the expert default): they are left at X_N.

pair(a, b)[source]

The pairing for which vjp is the adjoint of jvp: Σ a b (bilinear, real states) or Re Σ conj(a) b (real pairing, complex states of real fields on the sphere).

Return type:

float

trajectory(x0)[source]

All states X_0 … X_N.

Parameters:

x0 (ndarray)

Return type:

list[ndarray]

jvp(x0, V)[source]

J V with J = dΦ/dX_0 at X_0 (exact discrete tangent), one forward pass.

Parameters:
  • x0 (ndarray)

  • V (ndarray)

Return type:

ndarray

vjp(x0, W, *, journal=None, budget_s=None, extra=None)[source]

Jᵀ W (bilinear transpose, exact discrete adjoint), states from checkpoints.

journal (a directory, Revolve only): if it holds a suspended sweep of this very computation (same x0, W and map, checked by digest), the sweep resumes from it (W may then be None); budget_s: seconds after which the sweep stops at a step boundary, writes the journal and raises conatus.adjoint.checkpoints.VJPSuspended. extra: JSON-ready data saved with the journal (journal_extra(journal) reads it). Without journal nothing is written and budget_s is refused.

Parameters:
  • x0 (ndarray)

  • W (ndarray | None)

  • budget_s (float | None)

  • extra (dict | None)

Return type:

ndarray

vjp_physical(x0, W, weight)[source]

Adjoint for the inner product ⟨a, b⟩_G = aᵀ G b: Φ† w = G⁻¹ Jᵀ G w. Refused if G is singular (e.g. tau rows carry no weight). CPU backend only.

Parameters:
  • x0 (ndarray)

  • W (ndarray)

Return type:

ndarray

explain()[source]
Return type:

str