Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ColoCarletti committed Oct 17, 2024
1 parent e0c666d commit 3073470
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions math/src/circle/cfft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub fn icfft(
/// [P(x0, y0), P(x2, y2), P(x4, y4), P(x6, y6), P(x7, y7), P(x5, y5), P(x3, y3), P(x1, y1)],
/// where the even indices are found first in ascending order and then the odd indices in descending order.
/// This function permutes the slice [0, 2, 4, 6, 7, 5, 3, 1] into [0, 1, 2, 3, 4, 5, 6, 7].
/// NOTE: This can be optimized by performing in-place value swapping (WIP).
pub fn order_cfft_result_naive(
input: &mut [FieldElement<Mersenne31Field>],
) -> Vec<FieldElement<Mersenne31Field>> {
Expand All @@ -92,6 +93,7 @@ pub fn order_cfft_result_naive(
/// [(x0, y0), (x2, y2), (x4, y4), (x6, y6), (x7, y7), (x5, y5), (x3, y3), (x1, y1)],
/// where the even indices are found first in ascending order and then the odd indices in descending order.
/// This function permutes the slice [0, 1, 2, 3, 4, 5, 6, 7] into [0, 2, 4, 6, 7, 5, 3, 1].
/// NOTE: This can be optimized by performing in-place value swapping (WIP).
pub fn order_icfft_input_naive(
input: &mut [FieldElement<Mersenne31Field>],
) -> Vec<FieldElement<Mersenne31Field>> {
Expand Down Expand Up @@ -170,18 +172,6 @@ mod tests {
assert_eq!(res, expected_slice)
}

#[test]
fn reverse_cfft_index_works() {
let mut reversed: Vec<usize> = Vec::with_capacity(16);
for i in 0..reversed.capacity() {
reversed.push(reverse_cfft_index(i, reversed.capacity()));
}
assert_eq!(
reversed[..],
[0, 2, 4, 6, 8, 10, 12, 14, 15, 13, 11, 9, 7, 5, 3, 1]
);
}

#[test]
fn from_natural_to_icfft_input_order_works() {
let mut slice = [
Expand Down

0 comments on commit 3073470

Please sign in to comment.