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

Function inner_product

utils/src/ff.rs:21–26  ·  view source on GitHub ↗

Inner product of 2 vectors `a` and `b`

(a: &[F], b: &[F])

Source from the content-addressed store, hash-verified

19
20/// Inner product of 2 vectors `a` and `b`
21pub fn inner_product<F: Field>(a: &[F], b: &[F]) -> F {
22 let size = a.len().min(b.len());
23 let product = cfg_into_iter!(0..size).map(|i| a[i] * b[i]);
24 let zero = F::zero;
25 cfg_iter_sum!(product, zero)
26}
27
28/// Hadamard product of two vectors of scalars
29pub fn hadamard_product<F: Field>(a: &[F], b: &[F]) -> Vec<F> {

Callers 15

eval_direct_on_batchMethod · 0.50
responseMethod · 0.50
is_validMethod · 0.50
newMethod · 0.50
compute_vMethod · 0.50
round_3Method · 0.50
g_offsetMethod · 0.50
init_given_baseMethod · 0.50

Calls 2

mapMethod · 0.80
lenMethod · 0.45

Tested by 1