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

37 lines
1.2 KiB
Go

// Package polynomial implements a homomorphic polynomial evaluator for the BFV/BGV schemes.
package polynomial
import (
"github.com/luxfi/lattice/v7/circuits/common/polynomial"
"github.com/luxfi/lattice/v7/schemes/bgv"
"github.com/luxfi/lattice/v7/utils/bignum"
)
// Polynomial is a type wrapping the type [polynomial.Polynomial].
type Polynomial polynomial.Polynomial
// NewPolynomial creates a new Polynomial from a list of coefficients []T.
func NewPolynomial[T bgv.Integer](coeffs []T) Polynomial {
return Polynomial(polynomial.NewPolynomial(bignum.NewPolynomial(bignum.Monomial, coeffs, nil)))
}
// PolynomialVector is a type wrapping the type [polynomial.PolynomialVector].
type PolynomialVector polynomial.PolynomialVector
// Depth returns the depth of the target [PolynomialVector].
func (p PolynomialVector) Depth() int {
return p.Value[0].Depth()
}
func NewPolynomialVector[T bgv.Integer](polys [][]T, mapping map[int][]int) (PolynomialVector, error) {
ps := make([]bignum.Polynomial, len(polys))
for i := range ps {
ps[i] = bignum.NewPolynomial(bignum.Monomial, polys[i], nil)
}
p, err := polynomial.NewPolynomialVector(ps, mapping)
return PolynomialVector(p), err
}