Recover slots signed base-2 ^ b digits from a packed integer.
Every digit is biased by 2 ^ (b - 1) before extraction. If each true digit
lies strictly inside the signed half-range, the bias makes every extracted
digit nonnegative without allowing a carry into the next slot.
Equations
- Hex.ZPoly.signedUnpack b packed slots = Array.map (fun (d : Nat) => ↑d - ↑(2 ^ (b - 1))) (Hex.ZPoly.unpackAux b (packed + Hex.ZPoly.constPack b (↑(2 ^ (b - 1))) slots).toNat slots)
Instances For
Horner evaluation of the first len values of f at an arbitrary
integer point. packSpec is the specialization to 2 ^ b.
Equations
- Hex.ZPoly.evalRange x f 0 = 0
- Hex.ZPoly.evalRange x f len.succ = f 0 + x * Hex.ZPoly.evalRange x (fun (i : Nat) => f (i + 1)) len
Instances For
Range evaluation agrees with polynomial evaluation once the requested range covers all stored coefficients.
An even-length evaluation splits into its even and odd coefficient streams, each evaluated at the squared point.
Subtracting evaluations at opposite points isolates the odd coefficient stream, with one factor of the evaluation point.
Alternating-sign balanced packing evaluates a polynomial at -2 ^ b.
Balanced positive packing evaluates a polynomial at 2 ^ b.
Interleave equal-length even and odd coefficient channels, retaining only the requested number of output slots.
Equations
Instances For
The two-point reconstruction at an explicit half-width and output shape.
The only large products are the evaluations at 2 ^ b and -2 ^ b.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Two evaluations at opposite points recover the schoolbook product when the doubled slots contain every signed coefficient.
The exact maximum product-coefficient budget used by the multipoint kernels: diagonal length times the two separate coefficient maxima.
Equations
- p.coeffBudget q = min (Hex.DensePoly.size p) (Hex.DensePoly.size q) * (p.maxAbs * q.maxAbs)
Instances For
Half-width used by KS2. Two adjacent result coefficients share a
2 * ks2Width-bit packed slot after the opposite-point evaluations are
combined.
Equations
- p.ks2Width q = (Hex.ZPoly.bitLen (p.coeffBudget q) + 2) / 2
Instances For
Forced two-point Kronecker substitution. Every nonzero input uses exactly
the two packed integer products at B and -B; there is no size or width
fallback in this entry point.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pack an operand in descending coefficient order. Multiplying two such values is the reciprocal product used by KS3.
Equations
- Hex.ZPoly.KS3.reversePack b p = Hex.ZPoly.packAux b (fun (i : Nat) => Hex.DensePoly.coeff p (Hex.DensePoly.size p - 1 - i)) 0 (Hex.DensePoly.size p)
Instances For
Descending packing is evaluation of the normalized reversed polynomial.
Extending the precision of a reversed polynomial merely appends zero coefficients, which normalization removes.
Recover one coefficient from the low end of a forward packed residual and the high end of its reciprocal packed residual.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Sequential reciprocal recovery. Each step removes the coefficient just recovered from both packed residuals; the forward residual is then shifted by one base digit.
Equations
- One or more equations did not get rendered due to their size.
- Hex.ZPoly.KS3.digits b 0 x✝¹ x✝ = []
Instances For
Array-valued wrapper around digits.
Equations
- Hex.ZPoly.KS3.unpack b forward reverse slots = (Hex.ZPoly.KS3.digits b slots forward reverse).toArray
Instances For
Reciprocal recovery at an explicit half-width and output shape. The only large products are the forward and reversed operand packings.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reciprocal recovery inverts a forward packing and its reversed packing when every coefficient fits in two base digits with one spare high value for carry disambiguation.
The product of two reversed operands lists the schoolbook product coefficients in descending order.
Multiplying descending operand packings yields the descending coefficient packing of their schoolbook product.
Forward and reciprocal packing recover the schoolbook product whenever every signed coefficient fits strictly inside the reciprocal bias range.
Half-width used by reciprocal Kronecker substitution. Each recovered coefficient may occupy two adjacent base digits.
Equations
- p.ks3Width q = (Hex.ZPoly.bitLen (p.coeffBudget q) + 3) / 2
Instances For
Forced reciprocal Kronecker substitution. Every nonzero input uses exactly the forward and reversed packed integer products; there is no size or width fallback in this entry point.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Descending coefficient packing at the negative evaluation point.
Equations
- Hex.ZPoly.KS4.reverseAlternatePack b p = Hex.ZPoly.packAux b (Hex.ZPoly.alternate fun (i : Nat) => Hex.DensePoly.coeff p (Hex.DensePoly.size p - 1 - i)) 0 (Hex.DensePoly.size p)
Instances For
Four-point reconstruction at an explicit quarter-width. The four large
products evaluate the operands at B, -B, and the corresponding two
reciprocal points represented by descending coefficient packings.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Four-point reconstruction recovers the schoolbook product whenever every coefficient fits the reciprocal range of either parity channel.
Quarter-width used by the four-point kernel. Opposite-point splitting first doubles the base exponent, after which reciprocal recovery uses two adjacent channel digits.
Equations
- p.ks4Width q = (Hex.ZPoly.bitLen (p.coeffBudget q) + 5) / 4
Instances For
Forced four-point Kronecker substitution. Every nonzero input uses the four packed integer products at the positive, negative, and two reciprocal evaluation points; there is no fallback in this entry point.
Equations
- One or more equations did not get rendered due to their size.