Given a vector of polynomials `polys` and scalars `coeffs`, return their inner product `polys[0] * coeffs[0] + polys[1] * coeffs[1] + ...`
(
polys: &[DensePolynomial<F>],
coeffs: Vec<F>,
)
| 44 | |
| 45 | /// Given a vector of polynomials `polys` and scalars `coeffs`, return their inner product `polys[0] * coeffs[0] + polys[1] * coeffs[1] + ...` |
| 46 | pub fn inner_product_poly<F: Field>( |
| 47 | polys: &[DensePolynomial<F>], |
| 48 | coeffs: Vec<F>, |
| 49 | ) -> DensePolynomial<F> { |
| 50 | let product = cfg_into_iter!(coeffs) |
| 51 | .zip(cfg_into_iter!(polys)) |
| 52 | .map(|(f, p)| p * f); |
| 53 | |
| 54 | let zero = DensePolynomial::zero; |
| 55 | cfg_iter_sum!(product, zero) |
| 56 | } |
| 57 | |
| 58 | /// Create a polynomial from given `roots` as `(x-roots[0])*(x-roots[1])*(x-roots[2])*..` |
| 59 | pub fn poly_from_roots<F: Field>(roots: &[F]) -> DensePolynomial<F> { |
no test coverage detected