Function fftw3::c2c_1d [-]  [+] [src]

pub fn c2c_1d(in_: &[Complex<f64>], out: &mut [Complex<f64>], forward: bool) -> Result<(), FftError>

Perform a complex-to-complex one-dimensional Fourier transform of in_, writing to out.

The direction is controlled by forward: true for the forward transform (that is, multiplying by exp(-2πi/N)) and false for the inverse (exp(2πi/N)). This uses the ESTIMATE rigor for making a plan to avoid overwriting in_ and out while planning, hence this definitely does not achieve the peak performance possible with FFTW.

An error is returned if out is shorter than in_, since there is insufficient space to perform the transform, or if the FFTW3 planning function does not succeed.

Example

extern crate fftw3;
extern crate num;
use num::Complex;

fn main() {
    let input = [Complex::new(2.0, 0.0), Complex::new(1.0, 1.0),
                 Complex::new(0.0, 3.0), Complex::new(2.0, 4.0)];
    let mut output = [Complex::new(0.0, 0.0), .. 4];

    fftw3::c2c_1d(&input, &mut output, true).unwrap(); // panic on error

    println!("the transform of {} is {}", input.as_slice(), output.as_slice());
}