/// Given multiple secret keys (y values) at different indices (which give x
/// values) interpolate the value at zero.
Given multiple secret keys (y values) at different indices (which give x
values) interpolate the value at zero.
Given multiple secret keys ( y values ) at different indices ( which give x values ) interpolate the value at zero .
pub fn interpolate_secret_key(shares: &[Option<SecretKey>]) -> SecretKey {
        let shares: Vec<(SecretKey, SecretKey)> = shares
            .iter()
            .enumerate()
            .filter_map(|(index, share_maybe)| {
                share_maybe.map(|share| (crypto::x_for_index(index as NodeIndex), share))
            })
            .collect();
        Polynomial::interpolate(&shares).coefficients[0]
    }
pub fn interpolate_secret_key ( shares : & [ Option < SecretKey > ] ) -> SecretKey { let shares : Vec < ( SecretKey , SecretKey ) > = shares . iter ( ) . enumerate ( ) . filter_map ( | ( index , share_maybe ) | { share_maybe . map ( | share | ( crypto :: x_for_index ( index as NodeIndex ) , share ) ) } ) . collect ( ) ; Polynomial :: interpolate ( & shares ) . coefficients [ 0 ] }
Given multiple secret keys (y values) at different indices (which give x
values) interpolate the value at zero.
Given multiple secret keys ( y values ) at different indices ( which give x values ) interpolate the value at zero .
shares
&[Option<SecretKey>]