Dot Product Example
Recall that if x=(x_0,x_1,…) and y=(y_0,y_1,…) are n-dimensional vectors of real numbers then x.y = x_0*y_0 + x_1*y_1 + …
float Serial_dot(
float x[] /* in */,
float y[] /* in */,
int n /* in */) {
int i;
float sum = 0.0;
for (i = 0; i < n; i++)
sum = sum + x[i]*y[i];
return sum;
} /* Serial_dot */
Previous slide
Next slide
Back to first slide
View graphic version