/// Compute product of a polynomial and a polynomial
Compute product of a polynomial and a polynomial
Compute product of a polynomial and a polynomial
fn mul(&self, rhs: &Self) -> ThresholdEcdsaResult<Self> {
        if self.curve_type() != rhs.curve_type() {
            return Err(ThresholdEcdsaError::CurveMismatch);
        }
        let n_coeffs = self.coefficients.len() + rhs.coefficients.len() - 1;
        let curve = self.curve_type();
        let zero = EccScalar::zero(curve);
        let mut coeffs = vec![zero; n_coeffs];
        for (i, ca) in self.coefficients.iter().enumerate() {
            for (j, cb) in rhs.coefficients.iter().enumerate() {
                let tmp = ca.mul(cb)?;
                coeffs[i + j] = coeffs[i + j].add(&tmp)?;
            }
        }
        Self::new(curve, coeffs)
    }
fn mul ( & self , rhs : & Self ) -> ThresholdEcdsaResult < Self > { if self . curve_type ( ) != rhs . curve_type ( ) { return Err ( ThresholdEcdsaError :: CurveMismatch ) ; } let n_coeffs = self . coefficients . len ( ) + rhs . coefficients . len ( ) - 1 ; let curve = self . curve_type ( ) ; let zero = EccScalar :: zero ( curve ) ; let mut coeffs = vec ! [ zero n_coeffs ] ; for ( i , ca ) in self . coefficients . iter ( ) . enumerate ( ) { for ( j , cb ) in rhs . coefficients . iter ( ) . enumerate ( ) { let tmp = ca . mul ( cb ) ? ; coeffs [ i + j ] = coeffs [ i + j ] . add ( & tmp ) ? ; } } Self :: new ( curve , coeffs ) }
Compute product of a polynomial and a polynomial
Compute product of a polynomial and a polynomial
&self
rhs
&Self