dft 0.5.3

The package provides an algorithm to compute the discrete Fourier transform.

Crate dft [] [src]

Discrete Fourier transform.

The Transform trait is responsible for performing the transform. The trait is implemented for both real and complex data. There are three transform operations available: forward, backward, and inverse. The desired operation is specified by the Operation enumeration passed to the Plan::new function, which precomputes auxiliary information needed for Transform::transform. All the operations are preformed in place.

When applied to real data, the transform works as follows. If the operation is forward, the data are replaced by the positive frequency half of their complex transform. The first and last components of the complex transform, which are real, are stored in self[0] and self[1], respectively. If the operation is backward or inverse, the data are assumed to be stored according to the above convention. See the reference below for further details.

Example

use dft::{Operation, Plan, c64};

let plan = Plan::new(Operation::Forward, 512);
let mut data = vec![c64::new(42.0, 69.0); 512];
dft::transform(&mut data, &plan);

References

  1. W. Press, S. Teukolsky, W. Vetterling, and B. Flannery, “Numerical Recipes 3rd Edition: The Art of Scientific Computing,” Cambridge University Press, 2007.

Structs

Plan

A transform plan.

Enums

Operation

A transform operation.

Traits

Transform

The transform.

Functions

transform

Perform the transform.

unpack

Unpack the result produced by the forward transform applied to real data.

Type Definitions

c32

A complex number with 32-bit parts.

c64

A complex number with 64-bit parts.