MCPcopy Create free account
hub / github.com/docknetwork/crypto / eval_direct

Method eval_direct

vb_accumulator/src/batch_utils.rs:102–106  ·  view source on GitHub ↗

Evaluation of polynomial without creating the polynomial as the variable is already known. Returns `(updates[0]-x)*(updates[1]-x)*(updates[2]-x)*...(updates[n]-x)`

(updates: &[F], x: &F)

Source from the content-addressed store, hash-verified

100 /// Evaluation of polynomial without creating the polynomial as the variable is already known.
101 /// Returns `(updates[0]-x)*(updates[1]-x)*(updates[2]-x)*...(updates[n]-x)`
102 pub fn eval_direct(updates: &[F], x: &F) -> F {
103 updates.iter().fold(F::one(), |a, y| (*y - *x) * a)
104 // TODO: Figure out the why the following line is about 5 times slower than the sequential one above
105 // cfg_iter!(updates).map(|y| *y - *x).product()
106 }
107}
108
109impl<F> Poly_v_A<F>

Callers

nothing calls this directly

Calls 5

mapMethod · 0.80
iterMethod · 0.45
lenMethod · 0.45
into_iterMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected