Function winter_math::get_power_series
source · pub fn get_power_series<E>(b: E, n: usize) -> Vec<E>where
E: FieldElement,
Expand description
Returns a vector containing successive powers of a given base.
More precisely, for base b
, generates a vector with values [1, b, b^2, b^3, …, 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 expected = (0..n)
.map(|p| b.exp((p as u64).into()))
.collect::<Vec<_>>();
let actual = get_power_series(b, n);
assert_eq!(expected, actual);