Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Bindings to FFTW.
Example usage:
import Foreign.Marshal.Array import Data.Complex import Foreign.Storable.Complex import FFTW main = do inA <- fftwAllocComplex 1024 outA <- fftwAllocComplex 1024 plan <- planDFT1d 1024 inA outA Forward fftwEstimate pokeArray inA $ map (:+ 0) [0..1023] execute plan res <- peekArray 1024 outA fftwFree inA fftwFree outA print res
- fftwMalloc :: Word32 -> IO (Ptr a)
- fftwFree :: Ptr a -> IO ()
- fftwFreePtr :: FunPtr (Ptr a -> IO ())
- fftwAllocReal :: Word32 -> IO (Ptr CDouble)
- fftwAllocComplex :: Word32 -> IO (Ptr (Complex CDouble))
- data Direction
- data Flag
- fftwMeasure :: Flag
- fftwExhaustive :: Flag
- fftwPatient :: Flag
- fftwEstimate :: Flag
- fftwWisdomOnly :: Flag
- fftwDestroyInput :: Flag
- fftwUnaligned :: Flag
- fftwPreserveInput :: Flag
- data FFTWPlan i o
- planDFT1d :: Int -> Ptr (Complex CDouble) -> Ptr (Complex CDouble) -> Direction -> Flag -> IO (FFTWPlan (Complex CDouble) (Complex CDouble))
- planDFTR2C1d :: Int -> Ptr CDouble -> Ptr (Complex CDouble) -> Flag -> IO (FFTWPlan CDouble (Complex CDouble))
- execute :: FFTWPlan i o -> IO ()
- executeDFT :: FFTWPlan (Complex CDouble) (Complex CDouble) -> Ptr (Complex CDouble) -> Ptr (Complex CDouble) -> IO ()
- executeDFTR2C :: FFTWPlan CDouble (Complex CDouble) -> Ptr CDouble -> Ptr (Complex CDouble) -> IO ()
Memory allocation functions
Like malloc, but ensures that the pointer obeys the alignment restrictions of FFTW (e.g. for SIMD acceleration). You probably want to use fftwAllocReal
or fftwAllocComplex
instead.
Free a pointer returned by fftwMalloc
, fftwAllocReal
, or fftwAllocComplex
fftwFreePtr :: FunPtr (Ptr a -> IO ()) Source
A function pointer to fftwFree
.
Allocates an array of Doubles. It ensures that the pointer obeys the alignment restrictions of FFTW (e.g. for SIMD acceleration).
Allocates an array of complex Doubles (i.e. the c type "double complex"). It ensures that the pointer obeys the alignment restrictions of FFTW (e.g. for SIMD acceleration).
FFT planning flags
The direction of the transform: Forward for a normal transform, Backward for an inverse transform
FFTW planner flags. These flags affect the planning process. They can be combined using the Monoid
instance. See the FFTW flag documentation: http://www.fftw.org/doc/Planner-Flags.html.
Planning rigor flags
Algorithm restriction flags
FFT planning
A FFTWPlan i o
contains all of the information necessary to perform a transform from an input array of type i
to an output array of type o
, including pointers to the input and output arrays.
:: Int | size |
-> Ptr (Complex CDouble) | input pointer |
-> Ptr (Complex CDouble) | output pointer |
-> Direction | direction |
-> Flag | planner flags |
-> IO (FFTWPlan (Complex CDouble) (Complex CDouble)) |
Create a plan for a 1 dimensional complex to complex DFT. The plan stores pointers to the input and output arrays, and these will be used if you execute
the plan in the future. They are required even if you intend to specify different input and output arrays in the future (i.e. using executeDFT
)
:: Int | size |
-> Ptr CDouble | input pointer |
-> Ptr (Complex CDouble) | output pointer |
-> Flag | planner flags |
-> IO (FFTWPlan CDouble (Complex CDouble)) |
Create a plan for a 1 dimensional real to complex DFT. The plan stores pointers to the input and output arrays, and these will be used if you execute
the plan in the future. They are required even if you intend to specify different input and output arrays in the future (i.e. using executeDFTR2C
)
FFT execution
Execute a plan. Performs an FFT. The input and output arrays are stored within the plan so do not need to be given.