Frames of the iterative Cook–Mertz procedure #
Cslib.TreeEval.proc is recursive. Unravelled into a loop, its state is the three registers, a
stack with one frame per level, and a mode. A frame records only the round, the phase within the
round, the sign and the target register of its level, which is what makes the procedure
space-efficient: the path to the current node is read off the phases of the frames.
In mode call neg t, the procedure is about to add ± the value of the node at the current path
to register t. In mode ret, it continues the round of the top frame, which calls the children
in the order left, right, left, right, with signs +, +, -, -, as in Cslib.TreeEval.gateRound,
and moves on to the next round or returns. The read machine Cslib.TreeEval.Reader.machine runs
this loop over ZMod p with the units 1, …, p - 1.
Main definitions #
Cslib.TreeEval.Iter.Frame,Cslib.TreeEval.Iter.Mode: frames and modes.Cslib.TreeEval.Iter.path: the path to the current node.Cslib.TreeEval.Iter.zmodUnit: the units1, …, p - 1ofZMod p.
References #
A frame of the recursion: the round, the phase within the round, whether the level subtracts
its value, and its target register. In phase n the frame has called its left child (n even)
or its right child (n odd), adding for n < 2 and subtracting otherwise.
- round : ℕ
The round, indexing the unit that masks the children.
- phase : Fin 4
The phase within the round.
- neg : Bool
Whether the value of this level is subtracted.
- target : Fin 3
The target register.
Instances For
Instances For
The child a frame has called: the right one in the odd phases.
Instances For
Instances For
The coefficient of a sign.