Skip to main content

dot_product_scalar

Function dot_product_scalar 

Source
pub fn dot_product_scalar(a: &[f32], b: &[f32]) -> f32
Expand description

Scalar fallback implementation of dot product

This is the baseline implementation that works on all platforms. It uses standard Rust iterator operations and is always available.

§Arguments

  • a - First vector slice
  • b - Second vector slice (must have same length as a)

§Returns

Dot product value (can be positive, negative, or zero)

§Panics

Panics if vectors have different lengths

§Performance

  • Time Complexity: O(n) where n is vector dimension
  • Memory Usage: O(1) additional space