Skip to content

Commit

Permalink
updated godoc of conjugate invariant NTT
Browse files Browse the repository at this point in the history
  • Loading branch information
Pro7ech committed Oct 12, 2021
1 parent 50723dd commit 1c027cb
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions ring/ring_ntt.go
Expand Up @@ -74,8 +74,9 @@ func (r *Ring) InvNTTLazyLvl(level int, p1, p2 *Poly) {
// since the right half does not provide any additional information.
// See "Approximate Homomorphic Encryption over the Conjugate-invariant Ring", https://eprint.iacr.org/2018/952.
// The implemented approach is more efficient than the one proposed in the referenced work.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N + 1) by instead directly computing the left
// half of the NTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N - 1) by instead directly computing the left
// half of the NTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information, which
// allows to (re)use nega-cyclic NTT.
func (r *Ring) NTTConjugateInvariant(p1, p2 *Poly) {
for x := range r.Modulus {
NTTConjugateInvariant(p1.Coeffs[x], p2.Coeffs[x], r.N, r.NttPsi[x], r.Modulus[x], r.MredParams[x], r.BredParams[x])
Expand All @@ -87,8 +88,9 @@ func (r *Ring) NTTConjugateInvariant(p1, p2 *Poly) {
// since the right half does not provide any additional information.
// See "Approximate Homomorphic Encryption over the Conjugate-invariant Ring", https://eprint.iacr.org/2018/952.
// The implemented approach is more efficient than the one proposed in the referenced work.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N + 1) by instead directly computing the left
// half of the NTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N - 1) by instead directly computing the left
// half of the NTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information, which
// allows to (re)use nega-cyclic NTT.
// The value level defines the number of moduli of the input polynomials.
func (r *Ring) NTTConjugateInvariantLvl(level int, p1, p2 *Poly) {
for x := 0; x < level+1; x++ {
Expand All @@ -101,8 +103,9 @@ func (r *Ring) NTTConjugateInvariantLvl(level int, p1, p2 *Poly) {
// since the right half does not provide any additional information.
// See "Approximate Homomorphic Encryption over the Conjugate-invariant Ring", https://eprint.iacr.org/2018/952.
// The implemented approach is more efficient than the one proposed in the referenced work.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N + 1) by instead directly computing the left
// half of the NTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N - 1) by instead directly computing the left
// half of the NTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information, which
// allows to (re)use nega-cyclic NTT.
// Output values are in the range [0, 2q-1].
func (r *Ring) NTTConjugateInvariantLazy(p1, p2 *Poly) {
for x := range r.Modulus {
Expand All @@ -115,8 +118,9 @@ func (r *Ring) NTTConjugateInvariantLazy(p1, p2 *Poly) {
// since the right half does not provide any additional information.
// See "Approximate Homomorphic Encryption over the Conjugate-invariant Ring", https://eprint.iacr.org/2018/952.
// The implemented approach is more efficient than the one proposed in the referenced work.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N + 1) by instead directly computing the left
// half of the NTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N - 1) by instead directly computing the left
// half of the NTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information, which
// allows to (re)use nega-cyclic NTT.
// The value level defines the number of moduli of the input polynomials.
// Output values are in the range [0, 2q-1].
func (r *Ring) NTTConjugateInvariantLazyLvl(level int, p1, p2 *Poly) {
Expand All @@ -130,8 +134,9 @@ func (r *Ring) NTTConjugateInvariantLazyLvl(level int, p1, p2 *Poly) {
// since the right half does not provide any additional information.
// See "Approximate Homomorphic Encryption over the Conjugate-invariant Ring", https://eprint.iacr.org/2018/952.
// The implemented approach is more efficient than the one proposed in the referenced work.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N + 1) by instead directly computing the left
// half of the InvNTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N - 1) by instead directly computing the left
// half of the InvNTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information, which
// allows to (re)use nega-cyclic NTT.
func (r *Ring) InvNTTConjugateInvariant(p1, p2 *Poly) {
for x := range r.Modulus {
InvNTTConjugateInvariant(p1.Coeffs[x], p2.Coeffs[x], r.N, r.NttPsiInv[x], r.NttNInv[x], r.Modulus[x], r.MredParams[x])
Expand All @@ -143,8 +148,9 @@ func (r *Ring) InvNTTConjugateInvariant(p1, p2 *Poly) {
// since the right half does not provide any additional information.
// See "Approximate Homomorphic Encryption over the Conjugate-invariant Ring", https://eprint.iacr.org/2018/952.
// The implemented approach is more efficient than the one proposed in the referenced work.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N + 1) by instead directly computing the left
// half of the InvNTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N - 1) by instead directly computing the left
// half of the InvNTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information, which
// allows to (re)use nega-cyclic NTT.
// The value level defines the number of moduli of the input polynomials.
func (r *Ring) InvNTTConjugateInvariantLvl(level int, p1, p2 *Poly) {
for x := 0; x < level+1; x++ {
Expand All @@ -157,8 +163,9 @@ func (r *Ring) InvNTTConjugateInvariantLvl(level int, p1, p2 *Poly) {
// since the right half does not provide any additional information.
// See "Approximate Homomorphic Encryption over the Conjugate-invariant Ring", https://eprint.iacr.org/2018/952.
// The implemented approach is more efficient than the one proposed in the referenced work.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N + 1) by instead directly computing the left
// half of the InvNTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N - 1) by instead directly computing the left
// half of the InvNTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information, which
// allows to (re)use nega-cyclic NTT.
// Output values are in the range [0, 2q-1].
func (r *Ring) InvNTTConjugateInvariantLazy(p1, p2 *Poly) {
for x := range r.Modulus {
Expand All @@ -171,8 +178,9 @@ func (r *Ring) InvNTTConjugateInvariantLazy(p1, p2 *Poly) {
// since the right half does not provide any additional information.
// See "Approximate Homomorphic Encryption over the Conjugate-invariant Ring", https://eprint.iacr.org/2018/952.
// The implemented approach is more efficient than the one proposed in the referenced work.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N + 1) by instead directly computing the left
// half of the InvNTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information.
// It avoids the linear map Z[X + X^-1]/(X^2N + 1) <-> Z[X]/(X^N - 1) by instead directly computing the left
// half of the InvNTT of Z[X + X^-1]/(X^2N + 1) since the right half provides no additional information, which
// allows to (re)use nega-cyclic NTT.
// The value level defines the number of moduli of the input polynomials.
// Output values are in the range [0, 2q-1].
func (r *Ring) InvNTTConjugateInvariantLazyLvl(level int, p1, p2 *Poly) {
Expand Down

0 comments on commit 1c027cb

Please sign in to comment.