Function winter_math::get_power_series_with_offset[][src]

pub fn get_power_series_with_offset<E>(b: E, s: E, n: usize) -> Vec<E> where
    E: FieldElement
Expand description

Returns a vector containing successive powers of a given base offset by the specified value.

More precisely, for base b and offset s, generates a vector with values [s, s * b, s * b^2, s * b^3, …, s * b^(n-1)].

When concurrent feature is enabled, series generation is done concurrently in multiple threads.

Examples

let n = 2048;
let b = BaseElement::from(3u8);
let s = BaseElement::from(7u8);

let expected = (0..n)
    .map(|p| s * b.exp((p as u64).into()))
    .collect::<Vec<_>>();

let actual = get_power_series_with_offset(b, s, n);
assert_eq!(expected, actual);