Powers of a finite field as `[1, s, s^2, .. s^{num-1}]`
(s: &F, num: u32)
| 74 | |
| 75 | /// Powers of a finite field as `[1, s, s^2, .. s^{num-1}]` |
| 76 | pub fn powers<F: Field>(s: &F, num: u32) -> Vec<F> { |
| 77 | let mut powers = Vec::with_capacity(num as usize); |
| 78 | if num > 0 { |
| 79 | powers.push(F::one()); |
| 80 | for i in 1..num { |
| 81 | powers.push(powers[i as usize - 1] * s); |
| 82 | } |
| 83 | } |
| 84 | powers |
| 85 | } |
| 86 | |
| 87 | /// Powers of a finite field as `[start, start*exp, start * exp^2, .. start * exp^{num-1}]` |
| 88 | pub fn powers_starting_from<F: Field>(start: F, exp: &F, num: u32) -> Vec<F> { |
no outgoing calls