Files
zeekay eaf864890e feat: release v7.0.0 with GPU acceleration and module update
- Update module path to github.com/luxfi/lattice/v7
- Add GPU acceleration with Metal (macOS) and CUDA backends
- Enhance threshold FHE operations
- Revert to vanilla Apache 2.0 license (remove tfhe)
- Update Go version to 1.25.5
- Merge upstream lattigo improvements
2025-12-30 15:37:37 -08:00

62 lines
1.2 KiB
Go

package ringqp
import (
"testing"
"github.com/luxfi/lattice/v7/ring"
"github.com/luxfi/lattice/v7/utils/buffer"
"github.com/luxfi/lattice/v7/utils/sampling"
"github.com/luxfi/lattice/v7/utils/structs"
"github.com/stretchr/testify/require"
)
func TestRingQP(t *testing.T) {
LogN := 10
ringQ, err := ring.NewRing(1<<LogN, ring.Qi60[:4])
require.NoError(t, err)
ringP, err := ring.NewRing(1<<LogN, ring.Pi60[:4])
require.NoError(t, err)
ringQP := Ring{ringQ, ringP}
prng, err := sampling.NewPRNG()
require.NoError(t, err)
usampler := NewUniformSampler(prng, ringQP)
t.Run("Binary/Poly", func(t *testing.T) {
p := usampler.ReadNew()
buffer.RequireSerializerCorrect(t, &p)
})
t.Run("structs/PolyVector", func(t *testing.T) {
polys := make([]Poly, 4)
for i := range polys {
polys[i] = usampler.ReadNew()
}
pv := structs.Vector[Poly](polys)
buffer.RequireSerializerCorrect(t, &pv)
})
t.Run("structs/PolyMatrix", func(t *testing.T) {
polys := make([][]Poly, 4)
for i := range polys {
polys[i] = make([]Poly, 4)
for j := range polys {
polys[i][j] = usampler.ReadNew()
}
}
pm := structs.Matrix[Poly](polys)
buffer.RequireSerializerCorrect(t, &pm)
})
}