Sparse VJP Contexts #
Shape-indexed context builders used by the NF reverse-mode proofs. These helpers write only the positions touched by a local VJP rule and leave every other component at zero, which lets the sparse cases avoid unnecessary rounded additions.
Sparse Contexts For Local VJPs #
A TList filled with zeros (shape-wise), used to build sparse contexts for local VJPs.
Instances For
Set a single Idx position in a TList, filling all other entries with zeros.
Instances For
Set two indices; if they coincide, add the contributions at that position.
Instances For
An EList filled with zeros, used for sparse error-bound contexts.
Instances For
Set a single Idx position in an EList, filling all other entries with zeros.
Instances For
Set two indices in an EList; if they coincide, use the supplied combined value eBoth.
Instances For
Set three indices when the positions are pairwise distinct.
This avoids any context-wise addition: only the three targeted positions are written,
and all others are 0. This is important for NF, where even x + 0 would incur rounding.