pub fn shift_operator_row<F: Field>(
variant: ShiftVariant,
amount: usize,
row: &mut [F],
psi: &[F],
)Expand description
Writes the row of a shift operator table that one (variant, amount) pair contributes.
The row holds, for each bit position, the weight that pair moves there:
row[j] = sum_k psi(k) * shift-ind_variant(k, j, amount)This is the one place that says what a variant does to a weight vector:
- Logical left and logical right move the weights and leave zeros behind.
- Arithmetic right piles every weight that falls off the end onto the sign position.
- Rotate wraps them around instead.
- The half-word forms apply the same rule to each 32-bit half, reading only the low 5 bits of the amount.
§Arguments
The amount is an index over the reduction’s amount axis rather than a validated
Shift amount: that axis spans Word::BITS for every
variant, and a half-word variant reads it modulo its own 32-bit width.
Every cell of row is written, so the caller need not zero it first. A caller reading one
slice at a time can therefore carry a single scratch row across every pair it visits.
§Panics
Panics unless the row and the weights each hold one entry per bit position of a word.