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

40 lines
1.0 KiB
Go

package polynomial
import (
"testing"
"github.com/luxfi/lattice/v7/core/rlwe"
"github.com/luxfi/lattice/v7/utils/bignum"
"github.com/luxfi/lattice/v7/utils/buffer"
"github.com/luxfi/lattice/v7/utils/sampling"
)
func TestPowerBasis(t *testing.T) {
t.Run("WriteAndRead", func(t *testing.T) {
var err error
var params rlwe.Parameters
if params, err = rlwe.NewParametersFromLiteral(rlwe.ParametersLiteral{
LogN: 10,
Q: []uint64{0x200000440001, 0x7fff80001},
P: []uint64{0x3ffffffb80001, 0x4000000800001},
}); err != nil {
t.Fatal(err)
}
levelQ := params.MaxLevelQ()
prng, _ := sampling.NewPRNG()
ct := rlwe.NewCiphertextRandom(prng, params, 1, levelQ)
basis := NewPowerBasis(ct, bignum.Chebyshev)
basis.Value[2] = rlwe.NewCiphertextRandom(prng, params, 1, levelQ)
basis.Value[3] = rlwe.NewCiphertextRandom(prng, params, 2, levelQ)
basis.Value[4] = rlwe.NewCiphertextRandom(prng, params, 1, levelQ)
basis.Value[8] = rlwe.NewCiphertextRandom(prng, params, 1, levelQ)
buffer.RequireSerializerCorrect(t, &basis)
})
}