From 64247a327d30a2d5fe7ad3d98f527bff1cc8fb85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Raz=20Guzm=C3=A1n=20Macedo?= Date: Wed, 30 Mar 2022 17:45:59 -0600 Subject: [PATCH] add _scalar names for dot_product examples --- crates/core_simd/examples/dot_product.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/core_simd/examples/dot_product.rs b/crates/core_simd/examples/dot_product.rs index 84824c2e5c4..936741a2ceb 100644 --- a/crates/core_simd/examples/dot_product.rs +++ b/crates/core_simd/examples/dot_product.rs @@ -13,7 +13,7 @@ // go along the resulting array and add up the result. // In the next example we will see if there // is any difference to adding and multiplying in tandem. -pub fn dot_prod_0(a: &[f32], b: &[f32]) -> f32 { +pub fn dot_prod_scalar_0(a: &[f32], b: &[f32]) -> f32 { assert_eq!(a.len(), b.len()); a.iter().zip(b.iter()).map(|(a, b)| a * b).sum() @@ -26,7 +26,7 @@ pub fn dot_prod_0(a: &[f32], b: &[f32]) -> f32 { // hypothesis and benchmarks - we will mention them later on. // With the use of `fold`, we're doing a multiplication, // and then adding it to the sum, one element from both vectors at a time. -pub fn dot_prod_1(a: &[f32], b: &[f32]) -> f32 { +pub fn dot_prod_scalar_1(a: &[f32], b: &[f32]) -> f32 { assert_eq!(a.len(), b.len()); a.iter() .zip(b.iter()) @@ -154,8 +154,8 @@ fn smoke_test() { let y: Vec = [2.0; 1003].to_vec(); // Basic check - assert_eq!(0.0, dot_prod_0(&a, &b)); - assert_eq!(0.0, dot_prod_1(&a, &b)); + assert_eq!(0.0, dot_prod_scalar_0(&a, &b)); + assert_eq!(0.0, dot_prod_scalar_1(&a, &b)); assert_eq!(0.0, dot_prod_simd_0(&a, &b)); assert_eq!(0.0, dot_prod_simd_1(&a, &b)); assert_eq!(0.0, dot_prod_simd_2(&a, &b));