Created
August 1, 2015 06:46
-
-
Save keisukefukuda/95d8413a00e3d7acdbf7 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
void func1(int n, double *mat, double *sum) { | |
int col, row; | |
for (col = 0; col < n; col++) { | |
sum[col] = 0; | |
} | |
for (col = 0; col < n; col++) { | |
for (row = 0; row < n; row++) { | |
sum[col] += mat[n * row + col]; | |
} | |
} | |
} | |
void func2(int n, double *mat, double *sum) { | |
int col, row; | |
for (col = 0; col < n; col++) { | |
sum[col] = 0; | |
} | |
for (row = 0; row < n; row++) { | |
for (col = 0; col < n; col++) { | |
sum[col] += mat[n * row + col]; | |
} | |
} | |
} | |
void func3(int n, double *mat, double *sum, int B) { | |
int col, row, b; | |
for (col = 0; col < n; col++) { | |
sum[col] = 0; | |
} | |
for (col = 0; col < n; col += B) { | |
for (row = 0; row < n; row++) { | |
for (b = 0; b < B; b++) { | |
sum[col + b] += mat[n * row + (col + b)]; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment