Crate dft [−] [src]
The Transform
trait is responsible for performing the transform. The trait
is implemented for real and complex data, which are represented by [f64]
and [c64]
, respectively. There are three transformation 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
.
Example
use dft::{Operation, Plan, Transform, c64}; let size = 512; let plan = Plan::new(Operation::Forward, size); let mut data = vec![c64::new(42.0, 69.0); size]; data.transform(&plan);
Real Data
When applied to real data, Transform::transform
works as follows. If the
operation is Operation::Forward
, the data are replaced by the positive
frequency half of their complex Fourier transform. The real-valued first and
last components of the complex transform are returned as elements self[0]
and self[1]
, respectively. If the operation is Operation::Backward
or
Operation::Inverse
, the function assumes that the data are packed in the
format that has just been described. See the reference below for further
information on the format.
References
- William H. Press, Saul A. Teukolsky, William T. Vetterling, Brian P. Flannery, “Numerical Recipes 3rd Edition: The Art of Scientific Computing,” Cambridge University Press, 2007.
Structs
Plan |
A transformation plan. |
Enums
Operation |
A transformation operation. |
Traits
Transform |
A type suitable for transformation. |
Functions
unpack |
Unpack a compressed representation produced by |
Type Definitions
c64 |
A complex number with 64-bit parts. |