Skip to main content

lagrange_basis_at

Function lagrange_basis_at 

Source
pub fn lagrange_basis_at(
    xs: &[u64],
    i: usize,
    x: u64,
    op_eval: &impl Fn(i128) -> i128,
    op_mul: &impl Fn(i128, i128) -> i128,
    op_div: &impl Fn(i128, i128) -> i128,
) -> i128
Expand description

Compute the Lagrange coefficient λ_i(x) evaluated at point x, given the set of x-coordinates xs and the index i.

For threshold schemes, this is typically computed modulo a prime that depends on the curve/group. This crate provides the algorithmic skeleton; concrete modprime arithmetic lives in the algorithm crates.