Skip to main content

FftKind

Enum FftKind 

Source
#[non_exhaustive]
#[repr(u16)]
pub enum FftKind { Fft = 0, Ifft = 1, Rfft = 2, Irfft = 3, FftShift = 4, IfftShift = 5, }
Expand description

FFT-family op discriminant — Category U from the comprehensive plan.

Stored as u16 in crate::KernelSku::op when category == OpCategory::Fft. Milestone 6.4 wires the four canonical PyTorch / JAX 1-D FFTs (fft / ifft / rfft / irfft) plus the two index-permutation helpers (fftshift / ifftshift).

1-D only for the trailblazer. Multi-D FFTs (fft2, fftn, …) and arbitrary-axis FFTs follow in fanout sessions — they don’t require new cuFFT bindings, just additional descriptor shape + plan glue.

Dtype coverage: f32 (single precision) and f64 (double precision) only. cuFFT’s main API does not expose f16 / bf16 for native transforms. Callers needing reduced precision must cast on either side. Spectrum-domain tensors use crate::Complex32 / crate::Complex64 for the interleaved real/imag pairs.

Normalization: forward transforms are unnormalized; inverse transforms are normalized by 1/N to match PyTorch’s norm="backward" default. cuFFT itself returns N · IFFT(x); the plan layer multiplies by 1/N after the inverse exec.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Fft = 0

y = FFT(x) — complex-to-complex forward transform (unnormalized). PyTorch torch.fft.fft. Both input and output are complex with the same shape [batch, n].

§

Ifft = 1

y = IFFT(x) — complex-to-complex inverse transform, normalized by 1/N to match PyTorch’s norm="backward". PyTorch torch.fft.ifft. Both input and output are complex [batch, n].

§

Rfft = 2

y = RFFT(x) — real-to-complex forward transform (unnormalized). PyTorch torch.fft.rfft. Input is real [batch, n], output is complex [batch, n/2 + 1] (Hermitian-half).

§

Irfft = 3

y = IRFFT(x, n) — complex-to-real inverse transform, normalized by 1/N. PyTorch torch.fft.irfft. Input is complex [batch, n/2 + 1], output is real [batch, n]. The output length n is a required descriptor parameter (cannot be inferred from the Hermitian-half input shape — both 2*(n/2) and 2*(n/2)+1 map to the same Hermitian-half length).

§

FftShift = 4

fftshift — shift the zero-frequency component to the center of the spectrum. PyTorch torch.fft.fftshift (matches NumPy’s np.fft.fftshift).

Equivalent to roll(x, n // 2), giving: y[i] = x[(i - n // 2) mod n] = x[(i + (n+1) // 2) mod n].

Bit-exact (pure index permutation, no arithmetic on values).

§

IfftShift = 5

ifftshift — true inverse of fftshift: ifftshift(fftshift(x)) == x for any n. PyTorch torch.fft.ifftshift.

Equivalent to roll(x, -(n // 2)), giving: y[i] = x[(i + n // 2) mod n].

For even n this is identical to fftshift (the n/2 offset is self-inverse mod n); for odd n the two cyclic offsets differ by one cell. Bit-exact.

Trait Implementations§

Source§

impl Clone for FftKind

Source§

fn clone(&self) -> FftKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FftKind

Source§

impl Debug for FftKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for FftKind

Source§

impl Hash for FftKind

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FftKind

Source§

fn eq(&self, other: &FftKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for FftKind

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.