Zaft

Struct Zaft 

Source
pub struct Zaft {}

Implementations§

Source§

impl Zaft

Source

pub fn make_r2c_fft_f32( n: usize, ) -> Result<Arc<dyn R2CFftExecutor<f32> + Send + Sync>, ZaftError>

Creates a Real-to-Complex (R2C) FFT plan executor for single-precision floating-point numbers (f32).

This plan transforms a real-valued input array of length n into a complex output array of length n/2 + 1 (or n if odd, with a special handling for the last complex element).

§Parameters
  • n: The length of the real-valued input vector.
§Returns

A Result containing an Arc to a dynamically dispatched R2CFftExecutor<f32> plan, or a ZaftError if the plan cannot be generated.

Source

pub fn make_c2r_fft_f32( n: usize, ) -> Result<Arc<dyn C2RFftExecutor<f32> + Send + Sync>, ZaftError>

Creates a Complex-to-Real (C2R) Inverse FFT plan executor for single-precision floating-point numbers (f32).

This plan transforms a complex input array (the result of an R2C FFT) back into a real-valued output array of length n.

§Parameters
  • n: The length of the final real-valued output vector.
§Returns

A Result containing an Arc to a dynamically dispatched C2RFftExecutor<f32> plan, or a ZaftError if the plan cannot be generated.

Source

pub fn make_forward_fft_f32( n: usize, ) -> Result<Arc<dyn FftExecutor<f32> + Send + Sync>, ZaftError>

Creates a standard Complex-to-Complex Forward FFT plan executor for single-precision floating-point numbers (f32).

This is used for a standard Discrete Fourier Transform (DFT) where both input and output are complex.

§Parameters
  • n: The length of the input/output complex vectors.
§Returns

A Result containing an Arc to a dynamically dispatched FftExecutor<f32> plan, or a ZaftError if the plan cannot be generated.

Source

pub fn make_forward_fft_f64( n: usize, ) -> Result<Arc<dyn FftExecutor<f64> + Send + Sync>, ZaftError>

Creates a standard Complex-to-Complex Forward FFT plan executor for double-precision floating-point numbers (f64).

§Parameters
  • n: The length of the input/output complex vectors.
§Returns

A Result containing an Arc to a dynamically dispatched FftExecutor<f64> plan, or a ZaftError if the plan cannot be generated.

Source

pub fn make_c2r_fft_f64( n: usize, ) -> Result<Arc<dyn C2RFftExecutor<f64> + Send + Sync>, ZaftError>

Creates a Complex-to-Real (C2R) Inverse FFT plan executor for double-precision floating-point numbers (f64).

This is the double-precision version of make_c2r_fft_f32.

§Parameters
  • n: The length of the final real-valued output vector.
§Returns

A Result containing an Arc to a dynamically dispatched C2RFftExecutor<f64> plan, or a ZaftError if the plan cannot be generated.

Source

pub fn make_r2c_fft_f64( n: usize, ) -> Result<Arc<dyn R2CFftExecutor<f64> + Send + Sync>, ZaftError>

Creates a Real-to-Complex (R2C) FFT plan executor for double-precision floating-point numbers (f64).

This is the double-precision version of make_r2c_fft_f32.

§Parameters
  • n: The length of the real-valued input vector.
§Returns

A Result containing an Arc to a dynamically dispatched R2CFftExecutor<f64> plan, or a ZaftError if the plan cannot be generated.

Source

pub fn make_inverse_fft_f32( n: usize, ) -> Result<Arc<dyn FftExecutor<f32> + Send + Sync>, ZaftError>

Creates a standard Complex-to-Complex Inverse FFT plan executor for single-precision floating-point numbers (f32).

This is the inverse transformation for the standard DFT, used to convert frequency-domain data back into the time domain.

§Parameters
  • n: The length of the input/output complex vectors.
§Returns

A Result containing an Arc to a dynamically dispatched FftExecutor<f32> plan, or a ZaftError if the plan cannot be generated.

Source

pub fn make_inverse_fft_f64( n: usize, ) -> Result<Arc<dyn FftExecutor<f64> + Send + Sync>, ZaftError>

Creates a standard Complex-to-Complex Inverse FFT plan executor for double-precision floating-point numbers (f64).

§Parameters
  • n: The length of the input/output complex vectors.
§Returns

A Result containing an Arc to a dynamically dispatched FftExecutor<f64> plan, or a ZaftError if the plan cannot be generated.

Source

pub fn make_2d_r2c_fft_f32( width: usize, height: usize, thread_count: usize, ) -> Result<Arc<dyn TwoDimensionalExecutorR2C<f32> + Send + Sync>, ZaftError>

Creates a high-performance, two-dimensional Real-to-Complex (R2C) FFT plan executor for single-precision floating-point numbers (f32).

This function constructs a plan for transforming a real-valued 2D input array (with dimensions height x width) into its frequency-domain representation. The executor is optimized for parallel execution across the specified number of threads.

The R2C 2D FFT is typically performed in two steps:

  1. A 1D R2C FFT is performed across the rows (or columns) of the input.
  2. A 1D Complex-to-Complex (C2C) FFT is performed across the columns (or rows) of the intermediate complex data.
§Parameters
  • width: The number of elements in the X-dimension (columns) of the 2D input array.
  • height: The number of elements in the Y-dimension (rows) of the 2D input array.
  • thread_count: The maximum number of threads the executor is allowed to use during execution.
§Returns

A Result containing an Arc to a dynamically dispatched TwoDimensionalExecutorR2C<f32> plan, or a ZaftError if the plan cannot be generated (e.g., due to invalid dimensions).

§Note on Output Size

The resulting frequency-domain complex data will typically have dimensions of height x (width/2 + 1) complex elements, leveraging the Hermitian symmetry property of real-input FFTs.

Source

pub fn make_2d_r2c_fft_f64( width: usize, height: usize, thread_count: usize, ) -> Result<Arc<dyn TwoDimensionalExecutorR2C<f64> + Send + Sync>, ZaftError>

Creates a high-performance, two-dimensional Real-to-Complex (R2C) FFT plan executor for double-precision floating-point numbers (f64).

This function constructs a plan for transforming a real-valued 2D input array (with dimensions height x width) into its frequency-domain representation. The executor is highly optimized for parallel execution across the specified number of threads.

The R2C 2D FFT typically follows a row-column or column-row decomposition:

  1. A 1D R2C FFT is performed across the elements of one axis.
  2. A 1D Complex-to-Complex (C2C) FFT is performed across the elements of the other axis on the intermediate complex data.

This process efficiently computes the 2D transform while leveraging the computational savings offered by the real-valued nature of the input data.

§Parameters
  • width: The number of elements in the X-dimension (columns) of the 2D input array.
  • height: The number of elements in the Y-dimension (rows) of the 2D input array.
  • thread_count: The maximum number of threads the executor is allowed to use during the parallel computation.
§Returns

A Result containing an Arc to a dynamically dispatched TwoDimensionalExecutorR2C<f64> plan, which is safe to use across threads (Send + Sync), or a ZaftError if the plan cannot be generated.

§Note on Output Size

Due to the resulting frequency-domain complex data will only store approximately half the data required for a full C2C transform. Specifically, the output complex array will typically have dimensions of height x (width/2 + 1) complex elements.

Source

pub fn make_2d_c2c_fft_f32( width: usize, height: usize, fft_direction: FftDirection, thread_count: usize, ) -> Result<Arc<dyn TwoDimensionalFftExecutor<f32> + Send + Sync>, ZaftError>

Creates a 2D complex-to-complex FFT executor for f32 inputs.

This function constructs a two-dimensional FFT executor that can perform forward or inverse FFTs on a width × height grid of complex f32 values. The executor internally manages separate FFTs along the width and height dimensions, and uses a transpose strategy for efficient computation.

§Parameters
  • width - The number of columns in the input data grid.
  • height - The number of rows in the input data grid.
  • fft_direction - The direction of the FFT (Forward or Inverse).
  • thread_count - Number of threads to use for parallel computation (minimum 1).
§Returns

Returns a Result containing an Arc to a type implementing TwoDimensionalFftExecutor, or a ZaftError if FFT creation fails.

§Notes

The internal width and height of the FFT executors are swapped for inverse FFTs to correctly handle the transformation.

Source

pub fn make_2d_c2c_fft_f64( width: usize, height: usize, fft_direction: FftDirection, thread_count: usize, ) -> Result<Arc<dyn TwoDimensionalFftExecutor<f64> + Send + Sync>, ZaftError>

Creates a 2D complex-to-complex FFT executor for f64 inputs.

This function constructs a two-dimensional FFT executor that can perform forward or inverse FFTs on a width × height grid of complex f64 values. The executor internally manages separate FFTs along the width and height dimensions, and uses a transpose strategy for efficient computation.

§Parameters
  • width - The number of columns in the input data grid.
  • height - The number of rows in the input data grid.
  • fft_direction - The direction of the FFT (Forward or Inverse).
  • thread_count - Number of threads to use for parallel computation (minimum 1).
§Returns

Returns a Result containing an Arc to a type implementing TwoDimensionalFftExecutor, or a ZaftError if FFT creation fails.

§Notes

The internal width and height of the FFT executors are swapped for inverse FFTs to correctly handle the transformation.

Source

pub fn make_2d_c2r_fft_f32( width: usize, height: usize, thread_count: usize, ) -> Result<Arc<dyn TwoDimensionalExecutorC2R<f32> + Send + Sync>, ZaftError>

Creates two-dimensional Complex-to-Real (C2R) Inverse FFT plan executor for single-precision floating-point numbers (f32).

This plan transforms a Hermitian symmetric complex frequency-domain input array (the output of an R2C FFT) back into a real-valued time-domain output array of size height x width. The executor is configured for parallel execution across the specified number of threads.

§Parameters
  • width: The number of elements in the X-dimension (columns) of the final real output.
  • height: The number of elements in the Y-dimension (rows) of the final real output.
  • thread_count: The maximum number of threads the executor is allowed to use during the parallel computation.
§Returns

A Result containing an Arc to a dynamically dispatched TwoDimensionalExecutorC2R<f32> plan, or a ZaftError if the plan cannot be generated (e.g., ZeroSizedFft).

§Errors

Returns ZaftError::ZeroSizedFft if width * height is zero.

Source

pub fn make_2d_c2r_fft_f64( width: usize, height: usize, thread_count: usize, ) -> Result<Arc<dyn TwoDimensionalExecutorC2R<f64> + Send + Sync>, ZaftError>

Creates two-dimensional Complex-to-Real (C2R) Inverse FFT plan executor for double-precision floating-point numbers (f64).

This is the double-precision equivalent of make_2d_c2r_fft_f32. It transforms the complex, frequency-domain input back into a real-valued array of size height x width.

§Parameters
  • width: The number of elements in the X-dimension (columns) of the final real output.
  • height: The number of elements in the Y-dimension (rows) of the final real output.
  • thread_count: The maximum number of threads the executor is allowed to use during the parallel computation.
§Returns

A Result containing an Arc to a dynamically dispatched TwoDimensionalExecutorC2R<f64> plan, or a ZaftError if the plan cannot be generated.

§Errors

Returns ZaftError::ZeroSizedFft if width * height is zero.

Auto Trait Implementations§

§

impl Freeze for Zaft

§

impl RefUnwindSafe for Zaft

§

impl Send for Zaft

§

impl Sync for Zaft

§

impl Unpin for Zaft

§

impl UnwindSafe for Zaft

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.