10.3.2 : The sgemm_swap.cpp file

The sgemm_swap.cpp file :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <string.h>
#include "sgemm_swap.h"

///Compute the Matrix-Matrix product of the x,y matrices
/**	@param[out] matOut : result
 * 	@param matX : left matrix
 * 	@param matY : right matrix
 * 	@param size : size of the square matrices
*/
void sgemm(float* matOut, const float * matX, const float* matY, long unsigned int size){
	memset(matOut, 0, sizeof(float)*size*size);
	for(long unsigned int i(0lu); i < size; ++i){
		for(long unsigned int k(0lu); k < size; ++k){
			for(long unsigned int j(0lu); j < size; ++j){
				matOut[i*size + j] += matX[i*size + k]*matY[k*size + j];
			}
		}
	}
}