The largest absolute value of a stored coefficient.
Equations
- p.maxAbs = Array.foldl (fun (m : Nat) (c : Int) => max m c.natAbs) 0 (Hex.DensePoly.toArray p)
Instances For
Every coefficient is bounded in absolute value by maxAbs.
A product coefficient is bounded by the number of diagonal terms times the square of the coefficient bound. This is the no-overlap budget: it is what the slot width has to accommodate.
The min-symmetric form of natAbs_coeff_mul_le.
A product coefficient is bounded using the two operands' separate
coefficient bounds. Keeping A * C rather than first replacing both by their
maximum is important for strongly asymmetric inputs.
The symmetric diagonal-length form of natAbs_mulCoeff_le, while
retaining separate coefficient bounds for the two operands.
∑_{i < len} f i * (2 ^ b) ^ i, as an integer.
Equations
- Hex.ZPoly.packSpec b f 0 = 0
- Hex.ZPoly.packSpec b f len.succ = f 0 + 2 ^ b * Hex.ZPoly.packSpec b (fun (i : Nat) => f (i + 1)) len
Instances For
∑_{i < len} c i * (2 ^ b) ^ i, as a natural number.
Equations
- Hex.ZPoly.natEval b c 0 = 0
- Hex.ZPoly.natEval b c len.succ = c 0 + 2 ^ b * Hex.ZPoly.natEval b (fun (i : Nat) => c (i + 1)) len
Instances For
Packing a polynomial's coefficients is Horner evaluation at 2 ^ b.
Balanced packing of len slots of width b starting at index lo. Halving
keeps the running integers balanced, so the shifts cost O(n log n) limb
operations instead of the O(n²) a sequential Horner scan would pay.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Packing a constant slot value. The recursion doubles rather than walking
the slots, so the bias repunit costs O(log n) big-integer operations instead
of the O(n) a general packAux would pay for it — which measured as the
single largest cost in the Kronecker path before it was split out.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Balanced base-2 ^ b digit extraction of n into len slots.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The substitution identity. Given a slot width b whose half-range strictly
dominates every coefficient of the product, packing both operands at 2 ^ b,
multiplying once, biasing every slot and reading the base-2 ^ b digits back
off recovers the schoolbook product exactly.
hbudget is the no-overlap bound; Hex.ZPoly.mulKroneckerAt discharges it from
a runtime scan of the actual coefficients rather than assuming it.
The measured size cutoff: the shorter operand must store at least this many coefficients before the substitution pays for its packing, single GMP multiplication and unpacking.
Equations
Instances For
The measured coefficient-width cutoff, in bits. Schoolbook cost per coefficient pair steps twice as coefficients widen — about 9 ns up to 12 bits, about 53 ns at 16, about 120 ns at 20 — and packing only amortises against the widest regime at the size cutoff. Below 20 bits the schoolbook loop is what runs, at any degree.
Equations
Instances For
Kronecker substitution with explicit cutoffs, so the kernel benchmark can
sweep them. Production uses Hex.ZPoly.mulKronecker, which fixes them to the
measured Hex.ZPoly.kroneckerSizeCutoff and Hex.ZPoly.kroneckerBitCutoff.
Both guards are checked before the coefficient scan is used, and the size guard is checked before the scan is run at all, so a product that stays on the schoolbook path for its size pays nothing for the test.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The Kronecker kernel computes the schoolbook product, at every cutoff.
Kronecker substitution at the measured cutoffs.
Equations
Instances For
The production kernel computes the schoolbook product.