MCPcopy Create free account
hub / github.com/arkworks-rs/poly-commit / tensor_prime

Function tensor_prime

poly-commit/src/hyrax/utils.rs:27–39  ·  view source on GitHub ↗

This function computes all evaluations of the MLE EQ(i, values) for i between 0...0 and 1...1 (n-bit strings). This results in essentially the same as the tensor_vec function in the `linear_codes/utils.rs`, the difference being the endianness of the order of the output.

(values: &[F])

Source from the content-addressed store, hash-verified

25// the same as the tensor_vec function in the `linear_codes/utils.rs`,
26// the difference being the endianness of the order of the output.
27pub(crate) fn tensor_prime<F: Field>(values: &[F]) -> Vec<F> {
28 if values.is_empty() {
29 return vec![F::one()];
30 }
31
32 let tail = tensor_prime(&values[1..]);
33 let val = values[0];
34
35 cfg_iter!(tail)
36 .map(|v| *v * (F::one() - val))
37 .chain(cfg_iter!(tail).map(|v| *v * val))
38 .collect()
39}

Callers 2

openMethod · 0.85
checkMethod · 0.85

Calls 1

is_emptyMethod · 0.80

Tested by

no test coverage detected