hawk.diff.event#
A step kernel’s stop rule as a DIFFERENTIABLE guard.
A kernel finishing its sample on terminated = cond stops on a boolean,
whose derivative is zero everywhere it exists. Event refinement needs the
smooth function that CHANGES SIGN where the boolean flips: event_guard()
reads it out of cond as an ordinary IR node, never a mask, under ONE
sign convention — the sample stops where g <= 0:
a < b/a <= b->g = a - b;a > b/a >= b->g = b - a;c1 or c2 ...-> one guard per comparison (each its own stop rule).
Everything else is refused at the guard’s construction, naming the kernel
and the rule: and/not, ==/!=, a bare flag, an integer
comparison (a count), and a comparison whose two sides carry no smooth
dependence on a floating-point input (a rounding, a sign, a class test or a
comparison on the path). The guard is a function of the step’s PRE-step
inputs — the same body the step evaluates — so evaluating it at a step size
tau is the guard at the end of a partial step.
guard_kernel() packages the guards as a kernel committing one
event_g<i> plane each, with every launch-start read of a Mutable turned
into a plain read of the same plane: a pure function of the state, so the
ordinary jvp()/vjp() differentiate it with
respect to the state AND the parameters.
Functions
|
|
|
A kernel committing each guard of |
|
A kernel committing each guard of |
Classes
A kernel's stop rule as smooth guards: |