Skip to main content

gemm_cplx_fused

Function gemm_cplx_fused 

Source
pub fn gemm_cplx_fused<T: ComplexScalar>(
    alpha: T,
    a: MatRef<'_, T>,
    conj_a: bool,
    b: MatRef<'_, T>,
    conj_b: bool,
    beta: T,
    c: MatMut<'_, T>,
    bias: Option<Bias<'_, T>>,
    par: Parallelism,
)
Available on crate features complex and epilogue only.
Expand description

Complex GEMM with an optional fused per-row / per-col bias: C <- alpha*op(A)*op(B) + beta*C + bias in 1 pass, where op conjugates an operand exactly as in gemm_cplx. T is Complex<f32> or Complex<f64>. Uses the thread-local workspace pool

The bias is Bias::PerRow (length A.rows) or Bias::PerCol (length B.cols). It is added by 1 complex add to every element of that row or column, after the alpha*op(A)*op(B) + beta*C combine. It is added verbatim, never conjugated. There is no activation parameter. An ordering-based activation such as ReLU has no definition on complex numbers, so bias is the only fusible complex epilogue. bias == None delegates to plain gemm_cplx

The kernel stores exactly the bits plain gemm_cplx would and applies the bias in a tile-local post-pass on the final depth panel. The result is bit-identical to gemm_cplx followed by the same element-wise bias add. This holds for every shape, every conj combination, and both the real and imaginary parts. Serial and parallel runs also agree bit-for-bit today, though the crate’s reproducibility contract covers only a fixed configuration

§Panics

Same conditions as gemm_cplx, plus: a PerRow bias whose length is not A.rows (or a PerCol bias not B.cols), or a bias slice that overlaps C