algebra icon indicating copy to clipboard operation
algebra copied to clipboard

Restore divide_by_vanishing_poly_on_coset_in_place

Open swasilyev opened this issue 3 years ago • 4 comments

https://github.com/arkworks-rs/groth16/pull/40#issuecomment-1329664002

What do you think?

swasilyev avatar Nov 29 '22 12:11 swasilyev

because the vanishing polynomial is sparse, standard schoolbook division is actually efficient enough. This is implemented as https://docs.rs/ark-poly/0.4.0-alpha.3/ark_poly/polynomial/univariate/struct.DensePolynomial.html#method.divide_by_vanishing_poly

I suspect that this will be more efficient than dividing in the evaluation domain over the coset, no?

Pratyush avatar Nov 29 '22 16:11 Pratyush

But the evaluation domain consists of roots of unity and because of this the vanishing polynomial is constant on the coset domain and we therefore have to evaluate it in only one point like it is done here: https://github.com/achimcc/groth16/blob/master/src/r1cs_to_qap.rs#L201 That should be way more efficient than a general polynomial division?

achimcc avatar Nov 30 '22 07:11 achimcc

Since the vanishing polynomial consists of only two terms, general polynomial division is equally efficient.

Pratyush avatar Nov 30 '22 19:11 Pratyush

My point probably was that you don't always have the polynomial in the monomial form. I wanted to present Groth16 as an example but then realized that the division can be avoided altogether by normalizing the crs, see https://github.com/arkworks-rs/groth16/issues/41

Still, current implementation of Groth16 does the coset division : https://github.com/arkworks-rs/groth16/blob/9bac46fb3b1fbc0d2c88c6bc59b0ba798216bf6f/src/r1cs_to_qap.rs#L201-L208

swasilyev avatar Feb 17 '23 11:02 swasilyev