Skip to content

Instantly share code, notes, and snippets.

@keisukefukuda
Created August 1, 2015 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keisukefukuda/95d8413a00e3d7acdbf7 to your computer and use it in GitHub Desktop.
Save keisukefukuda/95d8413a00e3d7acdbf7 to your computer and use it in GitHub Desktop.
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