Trait realfft::ComplexToReal
source · pub trait ComplexToReal<T>: Sync + Send {
// Required methods
fn process(
&self,
input: &mut [Complex<T>],
output: &mut [T]
) -> Result<(), FftError>;
fn process_with_scratch(
&self,
input: &mut [Complex<T>],
output: &mut [T],
scratch: &mut [Complex<T>]
) -> Result<(), FftError>;
fn get_scratch_len(&self) -> usize;
fn len(&self) -> usize;
fn make_input_vec(&self) -> Vec<Complex<T>>;
fn make_output_vec(&self) -> Vec<T>;
fn make_scratch_vec(&self) -> Vec<Complex<T>>;
// Provided method
fn complex_len(&self) -> usize { ... }
}
Expand description
An inverse FFT that takes a complex spectrum of length N/2+1 and transforms it to a real-valued signal of length N.
Required Methods§
sourcefn process(
&self,
input: &mut [Complex<T>],
output: &mut [T]
) -> Result<(), FftError>
fn process( &self, input: &mut [Complex<T>], output: &mut [T] ) -> Result<(), FftError>
Inverse transform a complex spectrum corresponding to a real-valued signal of length N.
The input is a slice of complex values with length N/2+1 (with N/2 rounded down).
The resulting real-valued signal is stored in the output slice of length N.
The input buffer is used as scratch space,
so the contents of input should be considered garbage after calling.
It also allocates additional scratch space as needed.
An error is returned if any of the given slices has the wrong length.
If the input data is invalid, meaning that one of the positions that should
contain a zero holds a non-zero value, the transform is still performed.
The function then returns an FftError::InputValues
error to tell that the
result may not be correct.
sourcefn process_with_scratch(
&self,
input: &mut [Complex<T>],
output: &mut [T],
scratch: &mut [Complex<T>]
) -> Result<(), FftError>
fn process_with_scratch( &self, input: &mut [Complex<T>], output: &mut [T], scratch: &mut [Complex<T>] ) -> Result<(), FftError>
Inverse transform a complex spectrum,
similar to process()
.
The difference is that this method uses the provided
scratch buffer instead of allocating new scratch space.
This is faster if the same scratch buffer is used for multiple calls.
sourcefn get_scratch_len(&self) -> usize
fn get_scratch_len(&self) -> usize
Get the minimum length of the scratch space needed for process_with_scratch
.
sourcefn len(&self) -> usize
fn len(&self) -> usize
The FFT length. Get the length of the real-valued signal that this FFT returns.
sourcefn make_input_vec(&self) -> Vec<Complex<T>>
fn make_input_vec(&self) -> Vec<Complex<T>>
Convenience method to make an input vector of the right type and length.
sourcefn make_output_vec(&self) -> Vec<T>
fn make_output_vec(&self) -> Vec<T>
Convenience method to make an output vector of the right type and length.
sourcefn make_scratch_vec(&self) -> Vec<Complex<T>>
fn make_scratch_vec(&self) -> Vec<Complex<T>>
Convenience method to make a scratch vector of the right type and length.
Provided Methods§
sourcefn complex_len(&self) -> usize
fn complex_len(&self) -> usize
Get the length of the slice slice of complex values that this FFT accepts as input.