#include <string.h>
void change_major(float* A, int M, int N) {
float* tmpA = (float*)malloc(sizeof(float) * (M * N));
memcpy(tmpA, A, sizeof(float) * M * N);
for (int n = 0; n < N; n++) {
for (int m = 0; m < M; m++) {
A[n * M + m] = tmpA[m * N + n];
}
}
free(tmpA);
}