computing-systems-212 / Lab 4: Optimizing Caches / task1 / mxmult.c
mxmult.c
Raw
#include <stdlib.h>

#define DIM 500
#define T 125

void mxmult(volatile double *out, volatile const double *a, volatile const double *b) {
    register size_t r;
    register size_t c;
    register size_t i;
    for (r = 0; r < DIM; ++r) {
        for (c = 0; c < DIM; ++c) {
            out[DIM * r + c] = 0.0;
            for (i = 0; i < DIM; ++i) {
                out[DIM * r + c] += a[DIM * r + i] * b[DIM * i + c];
            }
        }
    }
}