Inner product of 2 vectors `a` and `b`
(a: &[F], b: &[F])
| 19 | |
| 20 | /// Inner product of 2 vectors `a` and `b` |
| 21 | pub 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 |
| 29 | pub fn hadamard_product<F: Field>(a: &[F], b: &[F]) -> Vec<F> { |