package fftw3

  1. Overview
  2. Docs

Interface for FFTW version 3.

  • author Christophe Troestler <Christophe.Troestler\@umons.ac.be>
  • version 0.8.1

We advise against opening this module as it contains submodules with the same names as the Bigarray ones. Instead, declare

module FFT = Fftw3.D 						

or

module FFT = Fftw3.S 						

depending to the precision you need (this way of proceeding makes it easy to change the precision of the FFT sould it be necessary) and then use it as

let input  = FFT.Array1.create FFT.complex Bigarray.c_layout dim in
let output = FFT.Array1.create FFT.complex Bigarray.c_layout dim in
let dft    = FFT.Array1.dft FFT.Forward input output in
(* code to initialize input and output arrays here *)
FFT.exec dft (* compute the DFT *)

The plan creation function will raise FFT.Failure in case of problems. The last line can be repeated as many times as needed to compute the FFT of input into output. Beware that creating the plan (FFT.Array1.dft) usually destroys the content of input and output, so only fill them afterwards.

HINT: Plan creation functions like Fftw3.Sig.Array1.dft have many optional arguments for maximum flexibility. The important one is ~meas. The other ones can be ignored at first.

module type Sig = sig ... end

Precision independent signature for FFTW3 submodules.

Double precision FFTW.

Single precision FFTW. This is only available if the single precision FFTW3 library was found when this module was compiled (if not, all functions raise Failure).

module Wisdom : sig ... end

Managing wisdom. Save and restore plans to/from disk or other media.

OCaml

Innovation. Community. Security.