#include #include #include "utils.h" float *create_sa_matrix(int rows, int cols) { float *x; x = (float *) malloc(rows * cols * sizeof(float)); return x; } void destroy_sa_matrix(float *x) { free(x); } void print_sa_matrix(float *x, int rows, int cols) { int i, j; for (i = 0; i < rows; i++) { for (j = 0; j < cols; j++) { printf("%f\t", x[IDX(cols, i, j)]); } printf("\n"); } fflush(stdout); } float **create_matrix(int rows, int cols) { int i; float **x; x = (float **) malloc(rows * sizeof(float)); for (i = 0; i < rows; i++) { x[i] = (float *) malloc(cols * sizeof(float)); } return x; } void destroy_matrix(float **x, int rows) { int i; for (i = 0; i < rows; i++) { free(x[i]); } free(x); } void print_matrix(float **x, int rows, int cols) { int i, j; for (i = 0; i < rows; i++) { for (j = 0; j < cols; j++) { printf("%f\t", x[i][j]); } printf("\n"); } fflush(stdout); }