Skip to content

Instantly share code, notes, and snippets.

@stevester94
Last active March 31, 2016 05:21
Show Gist options
  • Select an option

  • Save stevester94/547de4ad532a397e33cb6bd322f3dd7c to your computer and use it in GitHub Desktop.

Select an option

Save stevester94/547de4ad532a397e33cb6bd322f3dd7c to your computer and use it in GitHub Desktop.
double** multiplyMatrices(double** A, int Am, int An, double** B, int Bm, int Bn) {
int i, j, k, l;
double** retAr = create2DDoubleArray(Am, Bn);
if(An != Bm) {
printf("OH FUCK YO\n");
return NULL;
}
for(i = 0; i < Am; i++) {
for(j = 0; j < Bn; j++) {
for(k = 0; k < An; k++) {
//printf("%d, %d, %d\n", i,j,k);
retAr[i][j] += A[i][k] * B[k][j];
}
}
}
return retAr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment