#[repr(C)]pub struct Complex32 {
pub re: f32,
pub im: f32,
}Expand description
Single-precision complex element. #[repr(C)] struct of two f32
fields (real, imag) — ABI-compatible with cuFFT’s cufftComplex
(which is itself an alias for CUDA’s float2), with NumPy’s
complex64, and with PyTorch’s torch.complex64.
Used by the FFT op family (Milestone 6.4) as the element type for
spectrum-domain tensors. Complex arithmetic is not a kernel concern
at this layer — Rust callers build / inspect complex values via the
re / im fields and pass DeviceBuffer<Complex32> directly to
the FFT plans, which reinterpret them as cufftComplex over the
FFI boundary.
Layout invariant: Complex32 { re, im } and cufftComplex { x, y }
share identical byte storage on every platform CUDA supports
((f32, f32) is 8-byte aligned, naturally padded). A
DeviceBuffer<Complex32> can be reinterpreted as a
DeviceBuffer<cufftComplex> via view_as without copying.
Fields§
§re: f32Real component.
im: f32Imaginary component.
Implementations§
Trait Implementations§
impl Copy for Complex32
impl DeviceRepr for Complex32
Source§impl Element for Complex32
Single-precision complex (interleaved real/imag pair of f32) as an
elementwise kernel input element. Used by the FFT family (fft,
ifft, rfft output / irfft input, etc.) for spectrum-domain
tensors. The Scalar projection is f32 (matches the real width).
impl Element for Complex32
Single-precision complex (interleaved real/imag pair of f32) as an
elementwise kernel input element. Used by the FFT family (fft,
ifft, rfft output / irfft input, etc.) for spectrum-domain
tensors. The Scalar projection is f32 (matches the real width).
Source§type Scalar = f32
type Scalar = f32
f32 for f16/bf16/f32/F32Strict
— the epilogue runs at f32 to match the F32 accumulator. f64
for f64 — the DGEMM path uses an F64 accumulator and
f64 alpha/beta. For integer / Bool elements the projection
is nominally f32 (no α/β-scaled epilogue applies).Source§impl KernelDtype for Complex32
impl KernelDtype for Complex32
Source§const KIND: ElementKind = ElementKind::Complex32
const KIND: ElementKind = ElementKind::Complex32
crate::KernelSku::element.