../../.cargo/katex-header.html

Function winter_math::polynom::mul_by_scalar

source ·
pub fn mul_by_scalar<E>(p: &[E], k: E) -> Vec<E>
where E: FieldElement,
Expand description

Returns a polynomial resulting from multiplying a given polynomial by a scalar value.

Specifically, multiplies every coefficient of polynomial p by constant k and returns the resulting vector.

§Examples

let p = [
    BaseElement::new(1),
    BaseElement::new(2),
    BaseElement::new(3),
];
let k = BaseElement::new(2);

let expected = vec![
    BaseElement::new(2),
    BaseElement::new(4),
    BaseElement::new(6),
];
assert_eq!(expected, mul_by_scalar(&p, k));