Safe Haskell | None |
---|
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.
- class C y => Element y where
- recipInteger :: Read sig y => sig y -> y
- addId :: Read sig y => sig y -> y
- multId :: Read sig y => sig y -> y
- conjugatePrimitiveRootsOfUnity :: Read sig y => sig y -> (y, y)
- 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 whereSource
recipInteger :: Read sig y => sig y -> ySource
addId :: Read sig y => sig y -> ySource
multId :: Read sig y => sig y -> ySource
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 ySource
transformBackward :: (Element y, Transform sig y) => sig y -> sig ySource
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 ySource
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 ySource
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 ySource
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 ySource
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.
convolveWithWindow :: (Element y, Transform sig y) => Window sig y -> sig y -> sig ySource
Efficient convolution of a large filter window with a probably infinite signal.