[−][src]Struct chfft::CFft1D
Perform a complex-to-complex one-dimensional Fourier transform
When X is input array and Y is output array, the forward discrete Fourier transform of the one-dimensional array is
\[ \Large Y_k = \sum_{j=0}^{n-1} X_j e^{- \frac {2 \pi i j k}{n}} \]
also, the backward discrete Fourier transform of the one-dimensional array is
\[ \Large Y_k = \sum_{j=0}^{n-1} X_j e^{\frac {2 \pi i j k}{n}} \]
Example
use num_complex::Complex; use chfft::CFft1D; 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 fft = CFft1D::<f64>::with_len(input.len()); let output = fft.forward(&input); println!("the transform of {:?} is {:?}", input, output); }
Methods
impl<T: Float + FloatConst + NumAssign> CFft1D<T>
[src]
pub fn new() -> Self
[src]
Returns a instances to execute FFT
use chfft::CFft1D; let mut fft = CFft1D::<f64>::new();
pub fn with_len(len: usize) -> Self
[src]
Returns a instances to execute length initialized FFT
use chfft::CFft1D; let mut fft = CFft1D::<f64>::with_len(1024);
pub fn setup(&mut self, len: usize)
[src]
Reinitialize length
use chfft::CFft1D; let mut fft = CFft1D::<f64>::with_len(1024); // reinitialize fft.setup(2048);
pub fn forward(&mut self, source: &[Complex<T>]) -> Vec<Complex<T>>
[src]
The 1 scaling factor forward transform
use chfft::CFft1D; use num_complex::Complex; 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 fft = CFft1D::<f64>::with_len(input.len()); let output = fft.forward(&input);
pub fn forward0(&mut self, source: &[Complex<T>]) -> Vec<Complex<T>>
[src]
The 1 scaling factor forward transform
use chfft::CFft1D; use num_complex::Complex; 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 fft = CFft1D::<f64>::with_len(input.len()); let output = fft.forward0(&input);
pub fn forwardu(&mut self, source: &[Complex<T>]) -> Vec<Complex<T>>
[src]
The \(\frac 1 {\sqrt n}\) scaling factor forward transform
use chfft::CFft1D; use num_complex::Complex; 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 fft = CFft1D::<f64>::with_len(input.len()); let output = fft.forwardu(&input);
pub fn forwardn(&mut self, source: &[Complex<T>]) -> Vec<Complex<T>>
[src]
The \(\frac 1 {n}\) scaling factor forward transform
use chfft::CFft1D; use num_complex::Complex; 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 fft = CFft1D::<f64>::with_len(input.len()); let output = fft.forwardn(&input);
pub fn backward(&mut self, source: &[Complex<T>]) -> Vec<Complex<T>>
[src]
The \(\frac 1 n\) scaling factor backward transform
use chfft::CFft1D; use num_complex::Complex; 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 fft = CFft1D::<f64>::with_len(input.len()); let output = fft.backward(&input);
pub fn backward0(&mut self, source: &[Complex<T>]) -> Vec<Complex<T>>
[src]
The 1 scaling factor backward transform
use chfft::CFft1D; use num_complex::Complex; 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 fft = CFft1D::<f64>::with_len(input.len()); let output = fft.backward0(&input);
pub fn backwardu(&mut self, source: &[Complex<T>]) -> Vec<Complex<T>>
[src]
The \(\frac 1 {\sqrt n}\) scaling factor backward transform
use chfft::CFft1D; use num_complex::Complex; 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 fft = CFft1D::<f64>::with_len(input.len()); let output = fft.backwardu(&input);
pub fn backwardn(&mut self, source: &[Complex<T>]) -> Vec<Complex<T>>
[src]
The \(\frac 1 n\) scaling factor backward transform
use chfft::CFft1D; use num_complex::Complex; 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 fft = CFft1D::<f64>::with_len(input.len()); let output = fft.backwardn(&input);
pub fn forward0i(&mut self, source: &mut [Complex<T>])
[src]
The 1 scaling factor and in-place forward transform
use chfft::CFft1D; use num_complex::Complex; let mut 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 fft = CFft1D::<f64>::with_len(input.len()); fft.forward0i(&mut input);
pub fn backward0i(&mut self, source: &mut [Complex<T>])
[src]
The 1 scaling factor and in-place backward transform
use chfft::CFft1D; use num_complex::Complex; let mut 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 fft = CFft1D::<f64>::with_len(input.len()); fft.backward0i(&mut input);
pub fn forwardui(&mut self, source: &mut [Complex<T>])
[src]
The \(\frac 1 {\sqrt n}\) scaling factor and in-place forward transform
use chfft::CFft1D; use num_complex::Complex; let mut 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 fft = CFft1D::<f64>::with_len(input.len()); fft.forwardui(&mut input);
pub fn backwardui(&mut self, source: &mut [Complex<T>])
[src]
The \(\frac 1 {\sqrt n}\) scaling factor and in-place backward transform
use chfft::CFft1D; use num_complex::Complex; let mut 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 fft = CFft1D::<f64>::with_len(input.len()); fft.backwardui(&mut input);
Trait Implementations
impl<T: Debug> Debug for CFft1D<T>
[src]
impl<T: Float + FloatConst + NumAssign> Default for CFft1D<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for CFft1D<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for CFft1D<T> where
T: Send,
T: Send,
impl<T> Sync for CFft1D<T> where
T: Sync,
T: Sync,
impl<T> Unpin for CFft1D<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for CFft1D<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,