Last active
July 21, 2016 15:37
-
-
Save tkfx/7ab93bf211d13e3d699d22d216685267 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static double[] loopUnrolling2(double[][] matrix1, double[] vector1) { | |
double[] result = new double[vector1.length]; | |
for (int i = 0; i < matrix1.length; i++) { | |
result[i] += matrix1[i][0] * vector1[0]; | |
result[i] += matrix1[i][1] * vector1[1]; | |
result[i] += matrix1[i][2] * vector1[2]; | |
// and maybe it will expand even further - e.g. 4 iterations, thus | |
// adding code to fix the indexing | |
// which we would waste more time doing correctly and efficiently | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment