Files
math/go.mod
T
Hanzo AI 7301885120 LP-107 Phase 3: NTT canonical body migration to luxfi/math/ntt
Migrates the canonical Lattigo-derived Montgomery NTT body from
luxfi/lattice/v7/ring into luxfi/math/ntt/canonical. This is the
ownership inversion LP-107 Phase 3 calls for: the math substrate
now OWNS the canonical body, and luxfi/lattice/ring becomes a thin
shim over it.

ntt/canonical/ — new public package with the canonical body:
* subring.go         — SubRing struct + constructors (269 LoC)
* ntt.go             — NTT/INTT body, loop-unrolled-by-16 (1320 LoC)
* ntt_simd.go        — SIMD AVX2 dispatcher (405 LoC, build-tagged)
* ntt_simd_stub.go   — purego dispatcher stub for non-SIMD builds
* modular_reduction.go — Barrett + Montgomery scalars
* factorization.go   — prime factorization helpers
* utils.go           — primitive root finders, parameter helpers
* vec_ops.go         — vectorized polynomial helpers
* weierstrass.go     — companion algebraic helpers

ntt/purego.go — REWORK: the pureGoBackend now holds *canonical.SubRing
instead of *lattice/v7/ring.SubRing; the lattice/v7/ring import is
GONE. Cycle-free: GOWORK=off go list -deps github.com/luxfi/math/ntt
shows zero github.com/luxfi/lattice imports.

Total: ~3.7K LoC of canonical body migrated. Public API unchanged
for downstream callers — luxfi/lattice/ring re-exports the same
SubRing.NTT/INTT surface from the new owner location.

Tests: GOWORK=off go test ./... in luxfi/math/.claude/worktrees/lp-107-phase3
  ok  github.com/luxfi/math/ntt              (cached)
  ok  github.com/luxfi/math/ntt/canonical    0.276s
  + every other package green.
2026-05-04 10:26:46 -07:00

27 lines
846 B
AMPL

module github.com/luxfi/math
go 1.26.1
require (
github.com/luxfi/ids v1.2.7
github.com/luxfi/math/big v0.1.0
github.com/luxfi/sampler v1.0.0
github.com/stretchr/testify v1.11.1
github.com/zeebo/blake3 v0.2.4
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90
)
require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/luxfi/crypto v1.17.36 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/sys v0.42.0 // indirect
gonum.org/v1/gonum v0.17.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)