Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug[ring]: NTTLazy returns values outside of the range [0, 2q-1] #524

Open
Pro7ech opened this issue Dec 17, 2024 · 0 comments · May be fixed by #533
Open

Bug[ring]: NTTLazy returns values outside of the range [0, 2q-1] #524

Pro7ech opened this issue Dec 17, 2024 · 0 comments · May be fixed by #533
Assignees
Labels
bug Something isn't working

Comments

@Pro7ech
Copy link
Collaborator

Pro7ech commented Dec 17, 2024

To be clear, this is not a correctness issue and it can also be treated as a documentation issue and cleared by updating the documentation to the range [0, 4q-2]. However the convention for the suffix lazy in Lattigo usually means the output values are expected to be in the range [0, 2q-1]. Predictable range is especially important when doing lazy additions, to know how many additions can be done without modular reduction before values wrap around u64.

package main

import(
	"fmt"
	"github.com/tuneinsight/lattigo/v6/ring"
)

func main(){
	n := 16
	r, err := ring.NewRing(n, []uint64{65537})

	if err != nil{
		panic(err)
	}

	p := r.NewPoly()

	for i := range n{
		p.Coeffs[0][i] = uint64(i)
	}

	r.NTTLazy(p, p)

	fmt.Println(p)
}
@Pro7ech Pro7ech added the bug Something isn't working label Dec 17, 2024
@lehugueni lehugueni linked a pull request Jan 13, 2025 that will close this issue
@lehugueni lehugueni linked a pull request Jan 13, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants