Skip to main content

interleaved_complex_dot

Function interleaved_complex_dot 

Source
pub fn interleaved_complex_dot<T, A, const CONJ_B: bool>(
    a: &[T],
    b: &[T],
) -> Result<(T, T), SimdError>
where T: Scalar, A: SimdArch + SimdKernel<T>,
Expand description

Computes an interleaved complex dot product using architecture A.

Inputs must have identical even lengths in [re0, im0, re1, im1, ...] primitive lane order. The returned tuple is (re, im) for sum(a[k] * b[k]); when CONJ_B is true, the operation is sum(a[k] * conj(b[k])).

ยงExamples

use hermes_simd::{interleaved_complex_dot, Scalar};

let lhs = [1.0_f64, 2.0, 3.0, 4.0];
let rhs = [5.0_f64, 6.0, 7.0, 8.0];

let product_sum = interleaved_complex_dot::<f64, Scalar, false>(&lhs, &rhs).unwrap();

assert_eq!(product_sum, (-18.0, 68.0));