Versions in this module Expand all Collapse all v6 v6.1.1 Jan 26, 2025 v6.0.3 Jan 26, 2025 v6.0.2 Jan 26, 2025 v6.0.1 Jan 26, 2025 Changes in this version + const ConjugateInvariant + const GaloisGen + const MinimumRingDegreeForLoopUnrolledNTT + const MinimumRingDegreeForLoopUnrolledOperations + const Standard + var Pi60 = []uint64 + var Qi60 = []uint64 + func AutomorphismNTTIndex(N int, NthRoot, GalEl uint64) (index []uint64, err error) + func BRed(x, y, q uint64, bredconstant [2]uint64) (r uint64) + func BRedAdd(a, q uint64, bredconstant [2]uint64) (r uint64) + func BRedAddLazy(x, q uint64, bredconstant [2]uint64) uint64 + func BRedLazy(x, y, q uint64, bredconstant [2]uint64) (r uint64) + func CRed(a, q uint64) uint64 + func CheckFactors(m uint64, factors []uint64) (err error) + func CheckPrimitiveRoot(g, q uint64, factors []uint64) (err error) + func EvalPolyModP(x uint64, poly []uint64, p uint64) (y uint64) + func GenBRedConstant(q uint64) [2]uint64 + func GenMRedConstant(q uint64) (mredconstant uint64) + func IMForm(a, q, mredconstant uint64) (r uint64) + func IMFormLazy(a, q, mredconstant uint64) (r uint64) + func INTTConjugateInvariant(p1, p2 []uint64, N int, NInv, Q, MRedConstant uint64, roots []uint64) + func INTTConjugateInvariantLazy(p1, p2 []uint64, N int, NInv, Q, MRedConstant uint64, roots []uint64) + func INTTStandard(p1, p2 []uint64, N int, NInv, Q, MRedConstant uint64, roots []uint64) + func INTTStandardLazy(p1, p2 []uint64, N int, NInv, Q, MRedConstant uint64, roots []uint64) + func IsPrime(x uint64) bool + func MForm(a, q uint64, bredconstant [2]uint64) (r uint64) + func MFormLazy(a, q uint64, bredconstant [2]uint64) (r uint64) + func MRed(x, y, q, mredconstant uint64) (r uint64) + func MRedLazy(x, y, q, mredconstant uint64) (r uint64) + func MapSmallDimensionToLargerDimensionNTT(polSmall, polLarge Poly) + func MaskVec(p1 []uint64, w int, mask uint64, p2 []uint64) + func Min(x, y int) int + func ModExp(x, e, p uint64) (result uint64) + func ModExpPow2(x, e, p uint64) (result uint64) + func ModUpExact(p1, p2 [][]uint64, ringQ, ringP *Ring, MUC ModUpConstants) + func ModexpMontgomery(x uint64, e int, q, mredconstant uint64, bredconstant [2]uint64) (result uint64) + func NTTConjugateInvariant(p1, p2 []uint64, N int, Q, MRedConstant uint64, BRedConstant [2]uint64, ...) + func NTTConjugateInvariantLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) + func NTTStandard(p1, p2 []uint64, N int, Q, MRedConstant uint64, BRedConstant [2]uint64, ...) + func NTTStandardLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) + func PrimitiveRoot(q uint64, factors []uint64) (uint64, []uint64, error) + func RandUniform(prng sampling.PRNG, v uint64, mask uint64) (randomInt uint64) + func ZeroVec(p1 []uint64) + type BasisExtender struct + func NewBasisExtender(ringQ, ringP *Ring) (be *BasisExtender) + func (be *BasisExtender) ModDownQPtoP(levelQ, levelP int, p1Q, p1P, p2P Poly) + func (be *BasisExtender) ModDownQPtoQ(levelQ, levelP int, p1Q, p1P, p2Q Poly) + func (be *BasisExtender) ModDownQPtoQNTT(levelQ, levelP int, p1Q, p1P, p2Q Poly) + func (be *BasisExtender) ModUpPtoQ(levelP, levelQ int, polP, polQ Poly) + func (be *BasisExtender) ModUpQtoP(levelQ, levelP int, polQ, polP Poly) + func (be *BasisExtender) ShallowCopy() *BasisExtender + type Decomposer struct + ModUpConstants [][][]ModUpConstants + func NewDecomposer(ringQ, ringP *Ring) (decomposer *Decomposer) + func (decomposer *Decomposer) DecomposeAndSplit(levelQ, levelP, nbPi, BaseRNSDecompositionVectorSize int, p0Q, p1Q, p1P Poly) + type Dimensions struct + Cols int + Rows int + type DiscreteGaussian struct + Bound float64 + Sigma float64 + func (d DiscreteGaussian) MarshalJSON() ([]byte, error) + func (d DiscreteGaussian) Type() string + type DistributionParameters interface + Type func() string + func ParametersFromMap(distDef map[string]interface{}) (DistributionParameters, error) + type GaussianSampler struct + func NewGaussianSampler(prng sampling.PRNG, baseRing *Ring, X DiscreteGaussian, montgomery bool) (g *GaussianSampler) + func (g *GaussianSampler) AtLevel(level int) Sampler + func (g *GaussianSampler) Read(pol Poly) + func (g *GaussianSampler) ReadAndAdd(pol Poly) + func (g *GaussianSampler) ReadNew() (pol Poly) + type Interpolator struct + func NewInterpolator(degree int, T uint64) (itp *Interpolator, err error) + func (itp *Interpolator) Interpolate(roots []uint64) (coeffs []uint64) + func (itp *Interpolator) Lagrange(x, y []uint64) (coeffs []uint64, err error) + type ModUpConstants struct + func GenModUpConstants(Q, P []uint64) ModUpConstants + type NTTFriendlyPrimesGenerator struct + CheckNextPrime bool + CheckPrevPrime bool + NextPrime uint64 + NthRoot uint64 + PrevPrime uint64 + Size float64 + func NewNTTFriendlyPrimesGenerator(BitSize, NthRoot uint64) NTTFriendlyPrimesGenerator + func (n *NTTFriendlyPrimesGenerator) NextAlternatingPrime() (uint64, error) + func (n *NTTFriendlyPrimesGenerator) NextAlternatingPrimes(k int) (primes []uint64, err error) + func (n *NTTFriendlyPrimesGenerator) NextDownstreamPrime() (uint64, error) + func (n *NTTFriendlyPrimesGenerator) NextDownstreamPrimes(k int) (primes []uint64, err error) + func (n *NTTFriendlyPrimesGenerator) NextUpstreamPrime() (uint64, error) + func (n *NTTFriendlyPrimesGenerator) NextUpstreamPrimes(k int) (primes []uint64, err error) + type NTTTable struct + NInv uint64 + NthRoot uint64 + PrimitiveRoot uint64 + RootsBackward []uint64 + RootsForward []uint64 + type NumberTheoreticTransformer interface + Backward func(p1, p2 []uint64) + BackwardLazy func(p1, p2 []uint64) + Forward func(p1, p2 []uint64) + ForwardLazy func(p1, p2 []uint64) + func NewNumberTheoreticTransformerConjugateInvariant(r *SubRing, n int) NumberTheoreticTransformer + func NewNumberTheoreticTransformerStandard(r *SubRing, n int) NumberTheoreticTransformer + type NumberTheoreticTransformerConjugateInvariant struct + func (rntt NumberTheoreticTransformerConjugateInvariant) Backward(p1, p2 []uint64) + func (rntt NumberTheoreticTransformerConjugateInvariant) BackwardLazy(p1, p2 []uint64) + func (rntt NumberTheoreticTransformerConjugateInvariant) Forward(p1, p2 []uint64) + func (rntt NumberTheoreticTransformerConjugateInvariant) ForwardLazy(p1, p2 []uint64) + type NumberTheoreticTransformerStandard struct + func (rntt NumberTheoreticTransformerStandard) Backward(p1, p2 []uint64) + func (rntt NumberTheoreticTransformerStandard) BackwardLazy(p1, p2 []uint64) + func (rntt NumberTheoreticTransformerStandard) Forward(p1, p2 []uint64) + func (rntt NumberTheoreticTransformerStandard) ForwardLazy(p1, p2 []uint64) + type Parameters struct + type Poly struct + Coeffs structs.Matrix[uint64] + func NewPoly(N, Level int) (pol Poly) + func (pol *Poly) Copy(p1 Poly) + func (pol *Poly) CopyLvl(level int, p1 Poly) + func (pol *Poly) ReadFrom(r io.Reader) (n int64, err error) + func (pol *Poly) Resize(level int) + func (pol *Poly) UnmarshalBinary(p []byte) (err error) + func (pol Poly) BinarySize() (size int) + func (pol Poly) CopyNew() *Poly + func (pol Poly) Equal(other *Poly) bool + func (pol Poly) Level() int + func (pol Poly) MarshalBinary() (p []byte, err error) + func (pol Poly) N() int + func (pol Poly) WriteTo(w io.Writer) (n int64, err error) + func (pol Poly) Zero() + type RNSScalar []uint64 + type Ring struct + ModulusAtLevel []*big.Int + RescaleConstants [][]uint64 + SubRings []*SubRing + func NewRing(N int, Moduli []uint64) (r *Ring, err error) + func NewRingConjugateInvariant(N int, Moduli []uint64) (r *Ring, err error) + func NewRingFromType(N int, Moduli []uint64, ringType Type) (r *Ring, err error) + func NewRingWithCustomNTT(N int, ModuliChain []uint64, ...) (r *Ring, err error) + func (r *Ring) Inverse(a RNSScalar) + func (r *Ring) MFormRNSScalar(s1, s2 RNSScalar) + func (r *Ring) MulRNSScalar(s1, s2, sout RNSScalar) + func (r *Ring) NegRNSScalar(s1, s2 RNSScalar) + func (r *Ring) NewRNSScalar() RNSScalar + func (r *Ring) NewRNSScalarFromBigint(v *big.Int) (rns RNSScalar) + func (r *Ring) NewRNSScalarFromUInt64(v uint64) (rns RNSScalar) + func (r *Ring) SubRNSScalar(s1, s2, sout RNSScalar) + func (r *Ring) Type() Type + func (r *Ring) UnmarshalBinary(data []byte) (err error) + func (r *Ring) UnmarshalJSON(data []byte) (err error) + func (r Ring) Add(p1, p2, p3 Poly) + func (r Ring) AddDoubleRNSScalar(p1 Poly, scalar0, scalar1 RNSScalar, p2 Poly) + func (r Ring) AddLazy(p1, p2, p3 Poly) + func (r Ring) AddScalar(p1 Poly, scalar uint64, p2 Poly) + func (r Ring) AddScalarBigint(p1 Poly, scalar *big.Int, p2 Poly) + func (r Ring) AtLevel(level int) *Ring + func (r Ring) Automorphism(polIn Poly, gen uint64, polOut Poly) + func (r Ring) AutomorphismNTT(polIn Poly, gen uint64, polOut Poly) + func (r Ring) AutomorphismNTTWithIndex(polIn Poly, index []uint64, polOut Poly) + func (r Ring) AutomorphismNTTWithIndexThenAddLazy(polIn Poly, index []uint64, polOut Poly) + func (r Ring) BRedConstants() (BRC [][2]uint64) + func (r Ring) ConjugateInvariantRing() (*Ring, error) + func (r Ring) DivFloorByLastModulus(p0, p1 Poly) + func (r Ring) DivFloorByLastModulusMany(nbRescales int, p0, buff, p1 Poly) + func (r Ring) DivFloorByLastModulusManyNTT(nbRescales int, p0, buff, p1 Poly) + func (r Ring) DivFloorByLastModulusNTT(p0, buff, p1 Poly) + func (r Ring) DivRoundByLastModulus(p0, p1 Poly) + func (r Ring) DivRoundByLastModulusMany(nbRescales int, p0, buff, p1 Poly) + func (r Ring) DivRoundByLastModulusManyNTT(nbRescales int, p0, buff, p1 Poly) + func (r Ring) DivRoundByLastModulusNTT(p0, buff, p1 Poly) + func (r Ring) Equal(p1, p2 Poly) bool + func (r Ring) EvalPolyScalar(p1 []Poly, scalar uint64, p2 Poly) + func (r Ring) FoldStandardToConjugateInvariant(polyStandard Poly, permuteNTTIndexInv []uint64, polyConjugateInvariant Poly) + func (r Ring) IMForm(p1, p2 Poly) + func (r Ring) INTT(p1, p2 Poly) + func (r Ring) INTTLazy(p1, p2 Poly) + func (r Ring) Level() int + func (r Ring) Log2OfStandardDeviation(poly Poly) (std float64) + func (r Ring) LogModuli() (logmod float64) + func (r Ring) LogN() int + func (r Ring) MForm(p1, p2 Poly) + func (r Ring) MFormLazy(p1, p2 Poly) + func (r Ring) MRedConstants() (MRC []uint64) + func (r Ring) MarshalBinary() (data []byte, err error) + func (r Ring) MarshalJSON() (data []byte, err error) + func (r Ring) MaxLevel() int + func (r Ring) ModuliChain() (moduli []uint64) + func (r Ring) ModuliChainLength() int + func (r Ring) Modulus() *big.Int + func (r Ring) MulByVectorMontgomery(p1 Poly, vector []uint64, p2 Poly) + func (r Ring) MulByVectorMontgomeryThenAddLazy(p1 Poly, vector []uint64, p2 Poly) + func (r Ring) MulCoeffsBarrett(p1, p2, p3 Poly) + func (r Ring) MulCoeffsBarrettLazy(p1, p2, p3 Poly) + func (r Ring) MulCoeffsBarrettThenAdd(p1, p2, p3 Poly) + func (r Ring) MulCoeffsBarrettThenAddLazy(p1, p2, p3 Poly) + func (r Ring) MulCoeffsMontgomery(p1, p2, p3 Poly) + func (r Ring) MulCoeffsMontgomeryLazy(p1, p2, p3 Poly) + func (r Ring) MulCoeffsMontgomeryLazyThenAddLazy(p1, p2, p3 Poly) + func (r Ring) MulCoeffsMontgomeryLazyThenNeg(p1, p2, p3 Poly) + func (r Ring) MulCoeffsMontgomeryLazyThenSubLazy(p1, p2, p3 Poly) + func (r Ring) MulCoeffsMontgomeryThenAdd(p1, p2, p3 Poly) + func (r Ring) MulCoeffsMontgomeryThenAddLazy(p1, p2, p3 Poly) + func (r Ring) MulCoeffsMontgomeryThenSub(p1, p2, p3 Poly) + func (r Ring) MulCoeffsMontgomeryThenSubLazy(p1, p2, p3 Poly) + func (r Ring) MulDoubleRNSScalar(p1 Poly, scalar0, scalar1 RNSScalar, p2 Poly) + func (r Ring) MulDoubleRNSScalarThenAdd(p1 Poly, scalar0, scalar1 RNSScalar, p2 Poly) + func (r Ring) MulRNSScalarMontgomery(p1 Poly, scalar RNSScalar, p2 Poly) + func (r Ring) MulScalar(p1 Poly, scalar uint64, p2 Poly) + func (r Ring) MulScalarBigint(p1 Poly, scalar *big.Int, p2 Poly) + func (r Ring) MulScalarBigintThenAdd(p1 Poly, scalar *big.Int, p2 Poly) + func (r Ring) MulScalarThenAdd(p1 Poly, scalar uint64, p2 Poly) + func (r Ring) MulScalarThenSub(p1 Poly, scalar uint64, p2 Poly) + func (r Ring) MultByMonomial(p1 Poly, k int, p2 Poly) + func (r Ring) N() int + func (r Ring) NTT(p1, p2 Poly) + func (r Ring) NTTLazy(p1, p2 Poly) + func (r Ring) Neg(p1, p2 Poly) + func (r Ring) NewMonomialXi(i int) (p Poly) + func (r Ring) NewPoly() Poly + func (r Ring) NthRoot() uint64 + func (r Ring) PadDefaultRingToConjugateInvariant(polyStandard Poly, IsNTT bool, polyConjugateInvariant Poly) + func (r Ring) PolyToBigint(p1 Poly, gap int, coeffsBigint []*big.Int) + func (r Ring) PolyToBigintCentered(p1 Poly, gap int, coeffsBigint []*big.Int) + func (r Ring) PolyToString(p1 Poly) []string + func (r Ring) Reduce(p1, p2 Poly) + func (r Ring) ReduceLazy(p1, p2 Poly) + func (r Ring) SetCoefficientsBigint(coeffs []*big.Int, p1 Poly) + func (r Ring) Shift(p1 Poly, k int, p2 Poly) + func (r Ring) StandardRing() (*Ring, error) + func (r Ring) Sub(p1, p2, p3 Poly) + func (r Ring) SubDoubleRNSScalar(p1 Poly, scalar0, scalar1 RNSScalar, p2 Poly) + func (r Ring) SubLazy(p1, p2, p3 Poly) + func (r Ring) SubScalar(p1 Poly, scalar uint64, p2 Poly) + func (r Ring) SubScalarBigint(p1 Poly, scalar *big.Int, p2 Poly) + func (r Ring) UnfoldConjugateInvariantToStandard(polyConjugateInvariant, polyStandard Poly) + type Sampler interface + AtLevel func(level int) Sampler + Read func(pol Poly) + ReadAndAdd func(pol Poly) + ReadNew func() (pol Poly) + func NewSampler(prng sampling.PRNG, baseRing *Ring, X DistributionParameters, montgomery bool) (Sampler, error) + type SubRing struct + BRedConstant [2]uint64 + Factors []uint64 + MRedConstant uint64 + Mask uint64 + Modulus uint64 + N int + func NewSubRing(N int, Modulus uint64) (s *SubRing, err error) + func NewSubRingWithCustomNTT(N int, Modulus uint64, ntt func(*SubRing, int) NumberTheoreticTransformer, ...) (s *SubRing, err error) + func (s *SubRing) Add(p1, p2, p3 []uint64) + func (s *SubRing) AddLazy(p1, p2, p3 []uint64) + func (s *SubRing) AddLazyThenMulScalarMontgomery(p1, p2 []uint64, scalarMont uint64, p3 []uint64) + func (s *SubRing) AddScalar(p1 []uint64, scalar uint64, p2 []uint64) + func (s *SubRing) AddScalarLazy(p1 []uint64, scalar uint64, p2 []uint64) + func (s *SubRing) AddScalarLazyThenMulScalarMontgomery(p1 []uint64, scalar0, scalarMont1 uint64, p2 []uint64) + func (s *SubRing) AddScalarLazyThenNegTwoModulusLazy(p1 []uint64, scalar uint64, p2 []uint64) + func (s *SubRing) IMForm(p1, p2 []uint64) + func (s *SubRing) INTT(p1, p2 []uint64) + func (s *SubRing) INTTLazy(p1, p2 []uint64) + func (s *SubRing) MForm(p1, p2 []uint64) + func (s *SubRing) MFormLazy(p1, p2 []uint64) + func (s *SubRing) MulCoeffsBarrett(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsBarrettLazy(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsBarrettThenAdd(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsBarrettThenAddLazy(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsLazy(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsLazyThenAddLazy(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsMontgomery(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsMontgomeryLazy(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsMontgomeryLazyThenAddLazy(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsMontgomeryLazyThenNeg(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsMontgomeryLazyThenSubLazy(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsMontgomeryThenAdd(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsMontgomeryThenAddLazy(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsMontgomeryThenSub(p1, p2, p3 []uint64) + func (s *SubRing) MulCoeffsMontgomeryThenSubLazy(p1, p2, p3 []uint64) + func (s *SubRing) MulScalarMontgomery(p1 []uint64, scalarMont uint64, p2 []uint64) + func (s *SubRing) MulScalarMontgomeryLazy(p1 []uint64, scalarMont uint64, p2 []uint64) + func (s *SubRing) MulScalarMontgomeryThenAdd(p1 []uint64, scalarMont uint64, p2 []uint64) + func (s *SubRing) MulScalarMontgomeryThenAddScalar(p1 []uint64, scalar0, scalarMont1 uint64, p2 []uint64) + func (s *SubRing) NTT(p1, p2 []uint64) + func (s *SubRing) NTTLazy(p1, p2 []uint64) + func (s *SubRing) Neg(p1, p2 []uint64) + func (s *SubRing) Reduce(p1, p2 []uint64) + func (s *SubRing) ReduceLazy(p1, p2 []uint64) + func (s *SubRing) Sub(p1, p2, p3 []uint64) + func (s *SubRing) SubLazy(p1, p2, p3 []uint64) + func (s *SubRing) SubScalar(p1 []uint64, scalar uint64, p2 []uint64) + func (s *SubRing) SubThenMulScalarMontgomeryTwoModulus(p1, p2 []uint64, scalarMont uint64, p3 []uint64) + func (s *SubRing) Type() Type + type Ternary struct + H int + P float64 + func (d Ternary) MarshalJSON() ([]byte, error) + func (d Ternary) Type() string + type TernarySampler struct + func NewTernarySampler(prng sampling.PRNG, baseRing *Ring, X Ternary, montgomery bool) (ts *TernarySampler, err error) + func (ts *TernarySampler) AtLevel(level int) Sampler + func (ts *TernarySampler) Read(pol Poly) + func (ts *TernarySampler) ReadAndAdd(pol Poly) + func (ts *TernarySampler) ReadNew() (pol Poly) + type Type int + func (rt *Type) UnmarshalJSON(b []byte) error + func (rt Type) MarshalJSON() ([]byte, error) + func (rt Type) String() string + type Uniform struct + func (d Uniform) MarshalJSON() ([]byte, error) + func (d Uniform) Type() string + type UniformSampler struct + func NewUniformSampler(prng sampling.PRNG, baseRing *Ring) (u *UniformSampler) + func (u *UniformSampler) AtLevel(level int) Sampler + func (u *UniformSampler) Read(pol Poly) + func (u *UniformSampler) ReadAndAdd(pol Poly) + func (u *UniformSampler) ReadNew() (pol Poly) + func (u *UniformSampler) WithPRNG(prng sampling.PRNG) *UniformSampler Other modules containing this package github.com/baahl-nyu/lattigo/v5