package fftw3

  1. Overview
  2. Docs

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).

Precision

type float_elt = Stdlib.Bigarray.float32_elt

Precision of float numbers.

type complex_elt = Stdlib.Bigarray.complex32_elt

Precision of complex numbers.

val float : (float, float_elt) Stdlib.Bigarray.kind

Float of the precision of this module. Use this to create precision independent code.

val complex : (Stdlib.Complex.t, complex_elt) Stdlib.Bigarray.kind

Complex of the precision of this module. Use this to create precision independent code.

Specifying plans

type 'a plan

FFTW plan.

type c2c

c2c plan usual discrete Fourier transform, from complex to complex

type r2c

r2c plan real to complex transform

type c2r

c2r plan complex to real transform

type r2r

r2r plan real to real transform

type dir =
  1. | Forward
  2. | Backward

Direction of the transform — see the FFTW manual.

type measure =
  1. | Estimate
    (*

    No measurements are made, use a simple heuristic to pick a (probably sub-optimal) plan quickly.

    *)
  2. | Measure
    (*

    Find an optimized plan by actually computing several FFTs and measuring their execution time.

    *)
  3. | Patient
    (*

    Like Measure, but considers a wider range of algorithms and often produces a "more optimal" plan at the expense of several times longer planning time.

    *)
  4. | Exhaustive
    (*

    Like Patient, but considers an even wider range of algorithms, including many that are thought unlikely to be fast, to produce the most optimal plan but with a substantially increased planning time.

    *)

Planning-rigor flags.

type r2r_kind =
  1. | R2HC
    (*

    real to halfcomplex

    *)
  2. | HC2R
    (*

    halfcomplex to real

    *)
  3. | DHT
    (*

    discrete Hartley Transform

    *)
  4. | REDFT00
    (*

    real-even DFT: even around j=0 and even around j=n-1

    *)
  5. | REDFT01
    (*

    real-even DFT: even around j=0 and odd around j=n

    *)
  6. | REDFT10
    (*

    real-even DFT: even around j=-0.5 and even around j=n-0.5

    *)
  7. | REDFT11
    (*

    real-even DFT: even around j=-0.5 and odd around j=n-0.5

    *)
  8. | RODFT00
    (*

    real-odd DFT; odd around j=-1 and odd around j=n

    *)
  9. | RODFT01
    (*

    real-odd DFT; odd around j=-1 and even around j=n-1

    *)
  10. | RODFT10
    (*

    real-odd DFT; odd around j=-0.5 and odd around j=n-0.5

    *)
  11. | RODFT11
    (*

    real-odd DFT; odd around j=-0.5 and even around j=n-0.5

    *)

Real-to-Real transform kinds. The real-even (resp. real-odd) DFT are somtimes called Discrete Cosine Transform (DCT) (resp. Discrete Sine Transform (DST)). Note that the explanations of the various transforms are for an input array of dimension n and C layout (i.e. the input array is input[0..n-1]). The logical size N is N=2(n-1) for REDFT00, N=2(n+1) for RODFT00, and N=2n otherwise. See the FFTW manual for more details.

exception Failure of string

Exception raised to indicate that a plan could not be created.

Executing plans

val exec : 'a plan -> unit

exec plan executes the plan on the arrays given at the creation of this plan. This is the normal way to execute any kind of plan.

This function is thread safe (and may run the actual computation on a different core than the main program).

module Guru : sig ... end

Guru execution of plans.

Creating plans

module Genarray : sig ... end

FFT of Bigarray.Genarray.

module Array1 : sig ... end

FFT of Bigarray.Array1.

module Array2 : sig ... end

FFT of Bigarray.Array2.

module Array3 : sig ... end

FFT of Bigarray.Array3.

OCaml

Innovation. Community. Security.