Vector Dot Product
EasyMachine LearningMath
Description
Given two equal-length vectors a and b, return their dot product (sum of element-wise products).
Examples
Input:
a = [1,2,3], b = [4,5,6]Output:
32Explanation:
Summing the element-wise products gives 32.
Input:
a = [1,0], b = [0,1]Output:
0Explanation:
Summing the element-wise products gives 0.
Input:
a = [2,2], b = [3,3]Output:
12Explanation:
Summing the element-wise products gives 12.
Constraints
- •
1 ≤ a.length ≤ 10⁴