Skip to main content

chunked_linear_combination

Function chunked_linear_combination 

Source
pub fn chunked_linear_combination<const CHUNK: usize, A: Algebra<F> + Dup, F: Dup>(
    values: &[A],
    coeffs: &[F],
) -> A
Expand description

Linear combination over runtime-length slices, processing in chunks of CHUNK.

Computes Σ values[i] * coeffs[i] by batching into fixed-size chunks and delegating each to Algebra::mixed_dot_product, which SIMD implementations override with fused multiply-accumulate intrinsics.

This is the implementation backing Algebra::batched_linear_combination. Use it directly when overriding that method with a different chunk size.