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

Simplify h_evals loop in verifier #45

Closed
ebfull opened this issue Oct 20, 2020 · 0 comments · Fixed by #48
Closed

Simplify h_evals loop in verifier #45

ebfull opened this issue Oct 20, 2020 · 0 comments · Fixed by #48
Assignees

Comments

@ebfull
Copy link
Contributor

ebfull commented Oct 20, 2020

let (_, h_eval) = self
            .h_evals
            .iter()
            .fold((C::Scalar::one(), C::Scalar::zero()), |(cur, acc), eval| {
                (cur * &x_3n, acc + &(cur * eval))
            });

Rewriting x^n as x, we can apply Horner's rule to simplify

let h_eval = self
            .h_evals
            .iter()
            .rev()
            .fold(C::Scalar::zero(), |acc, eval| {
                acc * &x_3n + eval
            });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants