repl.txt (1010B)
1 2 {{alias}}( x, y ) 3 Computes the dot product of two vectors. 4 5 In general, for best performance, especially for large vectors, provide 6 1-dimensional ndarrays whose underlying data type is either 'float64' or 7 'float32'. 8 9 If provided empty vectors, the function returns `0.0`. 10 11 Parameters 12 ---------- 13 x: ndarray|ArrayLikeObject 14 First input array. 15 16 y: ndarray|ArrayLikeObject 17 Second input array. 18 19 Returns 20 ------- 21 dot: number 22 The dot product. 23 24 Examples 25 -------- 26 // Using ndarrays... 27 > var x = {{alias:@stdlib/ndarray/array}}( new {{alias:@stdlib/array/float64}}( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] ) ); 28 > var y = {{alias:@stdlib/ndarray/array}}( new {{alias:@stdlib/array/float64}}( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] ) ); 29 > {{alias}}( x, y ) 30 -5.0 31 32 // Using array-like objects... 33 > x = [ 4.0, 2.0, -3.0, 5.0, -1.0 ]; 34 > y = [ 2.0, 6.0, -1.0, -4.0, 8.0 ]; 35 > {{alias}}( x, y ) 36 -5.0 37 38 See Also 39 -------- 40