Skip to content

Commit

Permalink
bit reverse coset order
Browse files Browse the repository at this point in the history
  • Loading branch information
ohad-starkware committed Nov 11, 2024
1 parent 8385e54 commit 774531a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/prover/src/core/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,23 @@ pub fn bit_reverse<T>(v: &mut [T]) {
}
}

/// Performs a coset-natural-order to circle-domain-bit-reversed-order permutation in-place.
///
/// # Panics
///
/// Panics if the length of the slice is not a power of two.
pub fn bit_reverse_coset_to_circle_domain_order<T>(v: &mut [T]) {
let n = v.len();
assert!(n.is_power_of_two());
let log_n = n.ilog2();
for i in 0..n {
let j = bit_reverse_index(coset_index_to_circle_domain_index(i, log_n), log_n);
if j > i {
v.swap(i, j);
}
}
}

pub fn generate_secure_powers(felt: SecureField, n_powers: usize) -> Vec<SecureField> {
(0..n_powers)
.scan(SecureField::one(), |acc, _| {
Expand Down

0 comments on commit 774531a

Please sign in to comment.