-// computes matA * matB
-void mat_mul(double *matA, unsigned ah, unsigned aw,
- double *matB, unsigned bh, unsigned bw,
- double *result)
-{
- assert(aw == bh);
- for (unsigned y = 0; y < bw; ++y) {
- for (unsigned x = 0; x < ah; ++x) {
- double sum = 0.0;
- for (unsigned c = 0; c < aw; ++c) {
- sum += matA[c*ah + x] * matB[y*bh + c];
- }
- result[y*bw + x] = sum;
- }
- }
-}
-