@@ -13,7 +13,7 @@ use core_simd::*;
1313// go along the resulting array and add up the result.
1414// In the next example we will see if there
1515// is any difference to adding and multiplying in tandem.
16- pub fn dot_prod_0 ( a : & [ f32 ] , b : & [ f32 ] ) -> f32 {
16+ pub fn dot_prod_scalar_0 ( a : & [ f32 ] , b : & [ f32 ] ) -> f32 {
1717 assert_eq ! ( a. len( ) , b. len( ) ) ;
1818
1919 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 {
2626// hypothesis and benchmarks - we will mention them later on.
2727// With the use of `fold`, we're doing a multiplication,
2828// and then adding it to the sum, one element from both vectors at a time.
29- pub fn dot_prod_1 ( a : & [ f32 ] , b : & [ f32 ] ) -> f32 {
29+ pub fn dot_prod_scalar_1 ( a : & [ f32 ] , b : & [ f32 ] ) -> f32 {
3030 assert_eq ! ( a. len( ) , b. len( ) ) ;
3131 a. iter ( )
3232 . zip ( b. iter ( ) )
@@ -154,8 +154,8 @@ mod tests {
154154 let y: Vec < f32 > = [ 2.0 ; 1003 ] . to_vec ( ) ;
155155
156156 // Basic check
157- assert_eq ! ( 0.0 , dot_prod_0 ( & a, & b) ) ;
158- assert_eq ! ( 0.0 , dot_prod_1 ( & a, & b) ) ;
157+ assert_eq ! ( 0.0 , dot_prod_scalar_0 ( & a, & b) ) ;
158+ assert_eq ! ( 0.0 , dot_prod_scalar_1 ( & a, & b) ) ;
159159 assert_eq ! ( 0.0 , dot_prod_simd_0( & a, & b) ) ;
160160 assert_eq ! ( 0.0 , dot_prod_simd_1( & a, & b) ) ;
161161 assert_eq ! ( 0.0 , dot_prod_simd_2( & a, & b) ) ;
0 commit comments