TwoDimensionalExecutorR2C

Trait TwoDimensionalExecutorR2C 

Source
pub trait TwoDimensionalExecutorR2C<T>: ExecutorWithScratch {
    // Required methods
    fn execute(
        &self,
        source: &[T],
        output: &mut [Complex<T>],
    ) -> Result<(), ZaftError>;
    fn execute_with_scratch(
        &self,
        source: &[T],
        output: &mut [Complex<T>],
        scratch: &mut [Complex<T>],
    ) -> Result<(), ZaftError>;
    fn width(&self) -> usize;
    fn height(&self) -> usize;
    fn real_size(&self) -> usize;
    fn complex_size(&self) -> usize;
}

Required Methods§

Source

fn execute( &self, source: &[T], output: &mut [Complex<T>], ) -> Result<(), ZaftError>

Executes the 2D Real-to-Complex FFT using an internal scratch buffer.

The size of the source slice must be equal to self.real_size(), and the size of the output slice must be equal to self.complex_size().

§Parameters
  • source: The real-valued 2D input array (flattened into a 1D slice).
  • output: The mutable slice where the complex-valued frequency data will be written.
§Errors

Returns a ZaftError if the execution fails (e.g., due to incorrect slice lengths).

Source

fn execute_with_scratch( &self, source: &[T], output: &mut [Complex<T>], scratch: &mut [Complex<T>], ) -> Result<(), ZaftError>

Executes the 2D Real-to-Complex FFT using an externally provided scratch buffer.

This method allows the caller to manage and reuse the scratch memory, potentially avoiding internal memory allocations.

The size requirements for source and output are the same as execute. The scratch slice must meet the size requirement specified by the inherited ExecutorWithScratch::required_scratch_size().

§Parameters
  • source: The real-valued 2D input array.
  • output: The mutable slice where the complex-valued frequency data will be written.
  • scratch: The mutable scratch buffer required for intermediate calculations.
§Errors

Returns a ZaftError if the execution fails.

Source

fn width(&self) -> usize

Returns the width (number of columns, X-dimension) of the 2D input data grid.

Source

fn height(&self) -> usize

Returns the height (number of rows, Y-dimension) of the 2D input data grid.

Source

fn real_size(&self) -> usize

Returns the total size (number of real elements) of the 2D input array.

This is equivalent to self.width() * self.height().

Source

fn complex_size(&self) -> usize

Returns the total size (number of complex elements) of the frequency-domain output array.

This value accounts for the Hermitian symmetry property of the R2C FFT. For an input of size W x H, the complex size is typically H * (W/2 + 1).

Implementors§