Previous Optimisation of Dense Matrix-Matrix multiplication |
Parent Optimisation of Dense Matrix-Matrix multiplication |
Outline | Next The classical approach |
In our case, we are going to deal with square matrices of size N.
Mathematicaly it is :In C++ code :
1 2 3 4 5 6 7 8 9 10 11 |
void sgemm(float* matOut, const float * matX, const float* matY, long unsigned int size){ for(long unsigned int i(0lu); i < size; ++i){ for(long unsigned int j(0lu); j < size; ++j){ float res(0.0f); for(long unsigned int k(0lu); k < size; ++k){ res += matX[i*size + k]*matY[k*size + j]; } matOut[i*size + j] = res; } } } |
Previous Optimisation of Dense Matrix-Matrix multiplication |
Parent Optimisation of Dense Matrix-Matrix multiplication |
Outline | Next The classical approach |