pub fn evaluate(&self, x: &Scalar) -> Scalar {
        if self.coefficients.is_empty() {
            Scalar::zero()
        // if x is zero then we can ignore most of the expensive computation and
        // just return the last term of the polynomial
        } else if x.is_zero() {
            // we checked that coefficients are not empty so unwrap here is fine
            *self.coefficients.first().unwrap()
        } else {
            self.coefficients
                .iter()
                .enumerate()
                // coefficient[n] * x ^ n
                .map(|(i, coefficient)| coefficient * x.pow(&[i as u64, 0, 0, 0]))
                .sum()
        }
    }
/// Evaluates the polynomial at point x.
Evaluates the polynomial at point x.
Evaluates the polynomial at point x .
pub fn evaluate(&self, x: &Scalar) -> Scalar {
        if self.coefficients.is_empty() {
            Scalar::zero()
        // if x is zero then we can ignore most of the expensive computation and
        // just return the last term of the polynomial
        } else if x.is_zero() {
            // we checked that coefficients are not empty so unwrap here is fine
            *self.coefficients.first().unwrap()
        } else {
            self.coefficients
                .iter()
                .enumerate()
                // coefficient[n] * x ^ n
                .map(|(i, coefficient)| coefficient * x.pow(&[i as u64, 0, 0, 0]))
                .sum()
        }
    }
pub fn evaluate ( & self , x : & Scalar ) -> Scalar { if self . coefficients . is_empty ( ) { Scalar :: zero ( ) // if x is zero then we can ignore most of the expensive computation and // just return the last term of the polynomial } else if x . is_zero ( ) { // we checked that coefficients are not empty so unwrap here is fine * self . coefficients . first ( ) . unwrap ( ) } else { self . coefficients . iter ( ) . enumerate ( ) // coefficient[n] * x ^ n . map ( | ( i , coefficient ) | coefficient * x . pow ( & [ i as u64 , 0 , 0 , 0 ] ) ) . sum ( ) } }
Evaluates the polynomial at point x.
Evaluates the polynomial at point x .
&self
x
&Scalar