#include "matrix.h" float* CreateMatrix(int height, int width) { float* matrix = (float*)malloc(sizeof(float) * height * width); return matrix; } void SetRandomWeight(float* matrix, int height, int width) { for (int i = 0; i < height * width; i++) { matrix[i] = (2.0 * rand() / (float)RAND_MAX - 1) * sqrt(2.0 / (height * width)); } } void ApplyFunction(float *inputMatrix, float *outputMatrix, int height, int width, float (*fonction)(float val)) { for (int i = 0; i < height * width; i++) { outputMatrix[i] = fonction(inputMatrix[i]); } }