Skip to content

Conversation

@nachiket2005
Copy link

Overview

The fft_recursive function decomposes a DFT of size N into smaller DFTs of even and odd indexed elements, recursively combining their results.
If the input vector’s length is not a power of two, it is zero-padded to the next power of two for optimal performance.

This implementation serves as a clear, educational example of FFT internals while maintaining compatibility with complex input data.


Features

  • Fully recursive Cooley–Tukey FFT implementation
  • Accepts both numeric and complex input vectors
  • Automatically zero-pads input to the next power of two
  • Returns complex output representing frequency-domain components
  • Compact and easy to understand — ideal for teaching and research use
  • Includes example usage block for quick verification

Complexity

  • Time Complexity: O(N log N)
  • Space Complexity: O(N) (due to recursive calls and intermediate storage)

Copilot AI review requested due to automatic review settings October 18, 2025 09:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a recursive Cooley–Tukey FFT implementation in R with zero-padding to next power-of-two and accompanying documentation.

  • Introduces fft_recursive with power-of-two padding and complex output
  • Adds documentation and usage examples
  • Includes an interactive example block in the R script

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
mathematics/fast_fourier_transform.r Adds the recursive FFT implementation, zero-padding helper, and an interactive example block
documentation/fast_fourier_transform.md Documents the FFT function, usage, and complexity notes

@@ -0,0 +1,29 @@
# Fast Fourier Transform (FFT)

This file documents the recursive Cooley-Tukey FFT implementation added to `R/mathematics/fast_fourier_transform.r`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file, we don't add documentation separately from the source code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants