Safe Haskell | None |
---|---|
Language | Haskell2010 |
Complete implementation for Fast Fourier Transform for any signal length. Although defined for all kinds of signal storage, we need fast access to arbitrary indices.
Synopsis
- class C y => Element y where
- transformForward :: (Element y, Transform sig y) => sig y -> sig y
- transformBackward :: (Element y, Transform sig y) => sig y -> sig y
- cacheForward :: (Element y, Transform sig y) => sig y -> Cache sig y
- cacheBackward :: (Element y, Transform sig y) => sig y -> Cache sig y
- cacheDuplex :: (Element y, Transform sig y) => sig y -> (Cache sig y, Cache sig y)
- transformWithCache :: (Element y, Transform sig y) => Cache sig y -> sig y -> sig y
- convolveCyclic :: (Element y, Transform sig y) => sig y -> sig y -> sig y
- data Window sig y
- window :: (Element y, Transform sig y) => sig y -> Window sig y
- convolveWithWindow :: (Element y, Transform sig y) => Window sig y -> sig y -> sig y
Documentation
class C y => Element y where Source #
recipInteger :: Read sig y => sig y -> y Source #
addId :: Read sig y => sig y -> y Source #
multId :: Read sig y => sig y -> y Source #
conjugatePrimitiveRootsOfUnity :: Read sig y => sig y -> (y, y) Source #
It must hold:
uncurry (*) (conjugatePrimitiveRootsOfUnity n) = 1
mapPair ((^m), (^m)) (conjugatePrimitiveRootsOfUnity (n*m) y) == conjugatePrimitiveRootsOfUnity n y@
since we need for caching that the cache is uniquely determined by singal length and transform direction.
conversion between time and frequency domain (spectrum)
transformForward :: (Element y, Transform sig y) => sig y -> sig y Source #
transformBackward :: (Element y, Transform sig y) => sig y -> sig y Source #
Shall we divide the result values by the length of the signal? Our dimensional wrapper around the Fourier transform does not expect this.
cacheForward :: (Element y, Transform sig y) => sig y -> Cache sig y Source #
The expression cacheForward prototype
precomputes all data that is needed for forward Fourier transforms
for signals of the type and length prototype
.
You can use this cache in transformWithCache
.
cacheBackward :: (Element y, Transform sig y) => sig y -> Cache sig y Source #
See cacheForward
.
cacheDuplex :: (Element y, Transform sig y) => sig y -> (Cache sig y, Cache sig y) Source #
It is (cacheForward x, cacheBackward x) = cacheDuplex x
but cacheDuplex
shared common data of both caches.
transformWithCache :: (Element y, Transform sig y) => Cache sig y -> sig y -> sig y Source #
The size and type of the signal must match the parameters, that the cache was generated for.
convolution based on Fourier transform
convolveCyclic :: (Element y, Transform sig y) => sig y -> sig y -> sig y Source #
Signal must have equal size and must not be empty.
Filter window stored as spectrum such that it can be applied efficiently to long signals.