Skip to content

Instantly share code, notes, and snippets.

@w01fe
Created July 10, 2013 06:50
Show Gist options
  • Save w01fe/5963980 to your computer and use it in GitHub Desktop.
Save w01fe/5963980 to your computer and use it in GitHub Desktop.
java_dot_product.java
// 8.5 us for 10k doubles: 2.3 GFlops
public double dotProduct(double [] ws, double[] xs) {
double result = 0.0;
for (int i=0; i < ws.length; ++i) {
result += ws[i] * xs[i];
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment