Commit graph

2 commits

Author SHA1 Message Date
Alex Xiong
ba38386100
Add tests for DeferredField trait
Test the accumulation-based API for both Fp and Fq: single
mul/square round-trips, inner products at various lengths (0–10,000),
reduce-zero identity, square-vs-mul consistency, mixed mul+square
accumulation, and a regression test with adversarial limb values that
exercise the partial-reduction path.

All tests are written against the DeferredField trait API and will
continue to pass when the eager accumulator is swapped for a lazy one.
2026-04-08 14:48:10 +08:00
Alex Xiong
c1ec4b7830
Introduce DeferredField trait with eager implementations
Add the `deferred` module with a `DeferredField` trait that enables
accumulating multiple unreduced products before performing a single
reduction.  The trait uses an accumulation-based API: callers feed
factor pairs into an `Accumulator` via `mul_accumulate` /
`square_accumulate`, then call `reduce` once at the end.

For now, both Fp and Fq implement the trait with `Accumulator = Self`,
performing eager reduction on each accumulation.  A later commit will
swap in a wide accumulator that defers reduction for real.

The module is feature-gated behind the `deferred` feature flag.
2026-04-08 14:47:20 +08:00