Given a polynomial `polynomial` and an evaluation point `evaluation_point`, return the evaluation of `polynomial in `evaluation_point`, together with an evaluation proof.
(
&self,
polynomial: &[E::ScalarField],
evalualtion_point: &E::ScalarField,
)
| 102 | /// return the evaluation of `polynomial in `evaluation_point`, |
| 103 | /// together with an evaluation proof. |
| 104 | pub fn open( |
| 105 | &self, |
| 106 | polynomial: &[E::ScalarField], |
| 107 | evalualtion_point: &E::ScalarField, |
| 108 | ) -> (E::ScalarField, EvaluationProof<E>) { |
| 109 | let mut quotient = Vec::new(); |
| 110 | |
| 111 | let mut previous = E::ScalarField::zero(); |
| 112 | for &c in polynomial.iter().rev() { |
| 113 | let coefficient = c + previous * evalualtion_point; |
| 114 | quotient.insert(0, coefficient); |
| 115 | previous = coefficient; |
| 116 | } |
| 117 | |
| 118 | let (&evaluation, quotient) = quotient |
| 119 | .split_first() |
| 120 | .unwrap_or((&E::ScalarField::zero(), &[])); |
| 121 | let evaluation_proof = msm::<E>(&self.powers_of_g, quotient); |
| 122 | (evaluation, EvaluationProof(evaluation_proof)) |
| 123 | } |
| 124 | |
| 125 | /// Evaluate a single polynomial at a set of points `eval_points`, and provide a single evaluation proof. |
| 126 | pub fn open_multi_points( |