Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

grego/rfft.h

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rfft.h

Public domain single header fast Fourier transform for arbitrary array sizes, in about 100 lines of C code, which should be straightforward to understand.

A C++ implementation using the stdlib complex and vector is also provided in rfft.hpp.

Algorithms

The classic Cooley-Turkey algorithm is used in place (without additional allocations) for arrays of size 2^k.

For more more general ones, Bluestein algorithm is used. It utilizes the binomial identity 2nk = n^2 + k^2 - (k - n)^2 to express the Fourier transform as a convolution of two sequences, which can be computed using the algorith for the power of 2 sizes. It needs to allocate two auxillary array of size at most 4n + 3.

The runnig time is always O(n log(n)). However, if the speed is crucial, more optimized libraries like FFTW are recommended.

Inspiration

Inspired by Project Nayuki, but written in a simpler and arguably more straightforward way.

License

Public domain.

About

Reasonably fast Fourier transform in a single header for C and C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.