initial commit

This commit is contained in:
2024-10-30 04:07:12 -05:00
commit bb505acce1
28 changed files with 5273 additions and 0 deletions

33
README.md Normal file
View File

@@ -0,0 +1,33 @@
# SwiftPFFFT
Swift package providing a PFFFT (Pretty Fast, Fast Fourier Transform) library with wrapper.
This code is based on the marton78 fork of PFFFT that was forked from the original PFFFT implementation
by Julien Pommier. This fork provides support for doubles in addition to floats and provides additional SIMD implementations:
The origin for the C implementation in this package is https://github.com/marton78/pffft.
PFFFT provides substantial performance improvement over KissFFT. The advantage over FFTW is reasonable
performance with much simpler usage and a permissive 3 clause BSD license.
## Example
``` swift
// construct an interface for FFT, IFFT and convolutions. The interface is parameterized on the
// type of element in the signal (time) domain. The spectrum (frequency) domain type will always be
// complex. For a real valued signal the spectrum size will be `n / 2`, with the packing convention
//
let fft = try FFT<Complex<Float>>(n: 16)
let signal = fft.makeSignalBuffer()
signal.mutateEach { (i, v) in
v = Complex(Float(i) + 1.0, Float(i) - 2.0)
}
let spectrum = fft.makeSpectrumBuffer()
fft.forward(signal: signal, spectrum: spectrum)
fft.inverse(spectrum: spectrum, signal: signal)
```