Skip to content

Instantly share code, notes, and snippets.

@pubudu91
Created November 10, 2016 20:34
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 pubudu91/fbe6ef467c8798dcf1834b22ca0ad3e5 to your computer and use it in GitHub Desktop.
Save pubudu91/fbe6ef467c8798dcf1834b22ca0ad3e5 to your computer and use it in GitHub Desktop.
void multiply1D(Matrix1D *A, Matrix1D *B, Matrix1D *C, int n) {
for (int i = 0; i < n; ++i) {
double *Arow = &A->matrix[i * n];
double *Crow = &C->matrix[i * n];
for (int j = 0; j < n; ++j) {
double sum = 0;
for (int k = 0; k < n; ++k)
sum += *(Arow + k) * B->matrix[k * n + j];
*(Crow + j) = sum;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment