Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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