@@ -13,7 +13,7 @@ use core_simd::*;
13
13
// go along the resulting array and add up the result.
14
14
// In the next example we will see if there
15
15
// 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 {
17
17
assert_eq ! ( a. len( ) , b. len( ) ) ;
18
18
19
19
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 {
26
26
// hypothesis and benchmarks - we will mention them later on.
27
27
// With the use of `fold`, we're doing a multiplication,
28
28
// 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 {
30
30
assert_eq ! ( a. len( ) , b. len( ) ) ;
31
31
a. iter ( )
32
32
. zip ( b. iter ( ) )
@@ -154,8 +154,8 @@ mod tests {
154
154
let y: Vec < f32 > = [ 2.0 ; 1003 ] . to_vec ( ) ;
155
155
156
156
// 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) ) ;
159
159
assert_eq ! ( 0.0 , dot_prod_simd_0( & a, & b) ) ;
160
160
assert_eq ! ( 0.0 , dot_prod_simd_1( & a, & b) ) ;
161
161
assert_eq ! ( 0.0 , dot_prod_simd_2( & a, & b) ) ;
0 commit comments