[][src]Struct chfft::CFft2D

pub struct CFft2D<T> { /* fields omitted */ }

Perform a complex-to-complex two-dimensional Fourier transform

Example

use num_complex::Complex;
use chfft::CFft2D;

fn main() {
    let input = [
        vec![
            Complex::new(2.0, 0.0),
            Complex::new(1.0, 1.0),
            Complex::new(0.0, 3.0),
            Complex::new(2.0, 4.0),
        ],
        vec![
            Complex::new(5.0, 0.0),
            Complex::new(3.0, 1.0),
            Complex::new(2.0, 3.0),
            Complex::new(2.0, 8.0),
        ],
        vec![
            Complex::new(2.0, 5.0),
            Complex::new(2.0, 3.0),
            Complex::new(3.0, 7.0),
            Complex::new(2.0, 1.0),
        ],
        vec![
            Complex::new(5.0, 4.0),
            Complex::new(1.0, 2.0),
            Complex::new(4.0, 3.0),
            Complex::new(2.0, 1.0),
        ],
    ];

    let mut fft = CFft2D::<f64>::with_len(input.len(), input[0].len());

    let output = fft.forward(&input);

    println!("the transform of {:?} is {:?}", input, output);
}

Methods

impl<T: Float + FloatConst + NumAssign> CFft2D<T>[src]

pub fn new() -> Self[src]

Returns a instances to execute FFT

use chfft::CFft2D;
let mut fft = CFft2D::<f64>::new();

pub fn with_len(len_m: usize, len_n: usize) -> Self[src]

Returns a instances to execute length initialized FFT

use chfft::CFft2D;
let mut fft = CFft2D::<f64>::with_len(1024, 1024);

pub fn setup(&mut self, len_m: usize, len_n: usize)[src]

Reinitialize length

use chfft::CFft2D;
let mut fft = CFft2D::<f64>::with_len(1024, 1024);

// reinitialize
fft.setup(2048, 2048);

pub fn forward(&mut self, source: &[Vec<Complex<T>>]) -> Vec<Vec<Complex<T>>>[src]

The 1 scaling factor forward transform

use num_complex::Complex;
use chfft::CFft2D;

let input = [
    vec![
        Complex::new(2.0, 0.0),
        Complex::new(1.0, 1.0),
        Complex::new(0.0, 3.0),
        Complex::new(2.0, 4.0),
    ],
    vec![
        Complex::new(5.0, 0.0),
        Complex::new(3.0, 1.0),
        Complex::new(2.0, 3.0),
        Complex::new(2.0, 8.0),
    ],
];

let mut fft = CFft2D::<f64>::with_len(input.len(), input[0].len());
let output = fft.forward(&input);

pub fn forward0(&mut self, source: &[Vec<Complex<T>>]) -> Vec<Vec<Complex<T>>>[src]

The 1 scaling factor forward transform

use num_complex::Complex;
use chfft::CFft2D;

let input = [
    vec![
        Complex::new(2.0, 0.0),
        Complex::new(1.0, 1.0),
        Complex::new(0.0, 3.0),
        Complex::new(2.0, 4.0),
    ],
    vec![
        Complex::new(5.0, 0.0),
        Complex::new(3.0, 1.0),
        Complex::new(2.0, 3.0),
        Complex::new(2.0, 8.0),
    ],
];

let mut fft = CFft2D::<f64>::with_len(input.len(), input[0].len());
let output = fft.forward0(&input);

pub fn forwardu(&mut self, source: &[Vec<Complex<T>>]) -> Vec<Vec<Complex<T>>>[src]

The \(\frac 1 {\sqrt n}\) scaling factor forward transform

use num_complex::Complex;
use chfft::CFft2D;

let input = [
    vec![
        Complex::new(2.0, 0.0),
        Complex::new(1.0, 1.0),
        Complex::new(0.0, 3.0),
        Complex::new(2.0, 4.0),
    ],
    vec![
        Complex::new(5.0, 0.0),
        Complex::new(3.0, 1.0),
        Complex::new(2.0, 3.0),
        Complex::new(2.0, 8.0),
    ],
];

let mut fft = CFft2D::<f64>::with_len(input.len(), input[0].len());
let output = fft.forwardu(&input);

pub fn forwardn(&mut self, source: &[Vec<Complex<T>>]) -> Vec<Vec<Complex<T>>>[src]

The \(\frac 1 n\) scaling factor forward transform

use num_complex::Complex;
use chfft::CFft2D;

let input = [
    vec![
        Complex::new(2.0, 0.0),
        Complex::new(1.0, 1.0),
        Complex::new(0.0, 3.0),
        Complex::new(2.0, 4.0),
    ],
    vec![
        Complex::new(5.0, 0.0),
        Complex::new(3.0, 1.0),
        Complex::new(2.0, 3.0),
        Complex::new(2.0, 8.0),
    ],
];

let mut fft = CFft2D::<f64>::with_len(input.len(), input[0].len());
let output = fft.forwardn(&input);

pub fn backward(&mut self, source: &[Vec<Complex<T>>]) -> Vec<Vec<Complex<T>>>[src]

The \(\frac 1 n\) scaling factor backward transform

use num_complex::Complex;
use chfft::CFft2D;

let input = [
    vec![
        Complex::new(2.0, 0.0),
        Complex::new(1.0, 1.0),
        Complex::new(0.0, 3.0),
        Complex::new(2.0, 4.0),
    ],
    vec![
        Complex::new(5.0, 0.0),
        Complex::new(3.0, 1.0),
        Complex::new(2.0, 3.0),
        Complex::new(2.0, 8.0),
    ],
];

let mut fft = CFft2D::<f64>::with_len(input.len(), input[0].len());
let output = fft.backward(&input);

pub fn backward0(&mut self, source: &[Vec<Complex<T>>]) -> Vec<Vec<Complex<T>>>[src]

The 1 scaling factor backward transform

use num_complex::Complex;
use chfft::CFft2D;

let input = [
    vec![
        Complex::new(2.0, 0.0),
        Complex::new(1.0, 1.0),
        Complex::new(0.0, 3.0),
        Complex::new(2.0, 4.0),
    ],
    vec![
        Complex::new(5.0, 0.0),
        Complex::new(3.0, 1.0),
        Complex::new(2.0, 3.0),
        Complex::new(2.0, 8.0),
    ],
];

let mut fft = CFft2D::<f64>::with_len(input.len(), input[0].len());
let output = fft.backward0(&input);

pub fn backwardu(&mut self, source: &[Vec<Complex<T>>]) -> Vec<Vec<Complex<T>>>[src]

The \(\frac 1 {\sqrt n}\) scaling factor backward transform

use num_complex::Complex;
use chfft::CFft2D;

let input = [
    vec![
        Complex::new(2.0, 0.0),
        Complex::new(1.0, 1.0),
        Complex::new(0.0, 3.0),
        Complex::new(2.0, 4.0),
    ],
    vec![
        Complex::new(5.0, 0.0),
        Complex::new(3.0, 1.0),
        Complex::new(2.0, 3.0),
        Complex::new(2.0, 8.0),
    ],
];

let mut fft = CFft2D::<f64>::with_len(input.len(), input[0].len());
let output = fft.backwardu(&input);

Trait Implementations

impl<T: Debug> Debug for CFft2D<T>[src]

impl<T: Float + FloatConst + NumAssign> Default for CFft2D<T>[src]

fn default() -> Self[src]

Returns a instances to execute FFT

use chfft::CFft2D;
let mut fft = CFft2D::<f64>::default();

Auto Trait Implementations

impl<T> RefUnwindSafe for CFft2D<T> where
    T: RefUnwindSafe

impl<T> Send for CFft2D<T> where
    T: Send

impl<T> Sync for CFft2D<T> where
    T: Sync

impl<T> Unpin for CFft2D<T> where
    T: Unpin

impl<T> UnwindSafe for CFft2D<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.