mirror of
https://github.com/luxfi/lattice.git
synced 2026-09-24 00:25:44 +00:00
- 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
15 lines
622 B
Go
15 lines
622 B
Go
package rgsw
|
|
|
|
import (
|
|
"github.com/luxfi/lattice/v7/core/rlwe"
|
|
"github.com/luxfi/lattice/v7/ring"
|
|
)
|
|
|
|
// NoiseRGSWCiphertext returns the log2 of the standard deviation of the noise of each component of the RGSW ciphertext.
|
|
// pt must be in the NTT and Montgomery domain
|
|
func NoiseRGSWCiphertext(ct *Ciphertext, pt ring.Poly, sk *rlwe.SecretKey, params rlwe.Parameters) (float64, float64) {
|
|
ptsk := *pt.CopyNew()
|
|
params.RingQ().AtLevel(ct.LevelQ()).MulCoeffsMontgomery(ptsk, sk.Value.Q, ptsk)
|
|
return rlwe.NoiseGadgetCiphertext(&ct.Value[0], pt, sk, params), rlwe.NoiseGadgetCiphertext(&ct.Value[1], ptsk, sk, params)
|
|
}
|