#include #include #include #include #include "symnmf.h" #define BETA 0.5 #define EPSILON 1e-4 #define SMALL_NUMBER 1e-13 #define MAX_ITER 300 /** * @brief Transposes a given matrix. * * @param mat Input matrix (flattened). * @param n Number of rows. * @param k Number of columns. * @return Pointer to the transposed matrix, or NULL if memory allocation fails. */ static double *transpose_matrix(const double *mat, int n, int k){ int i, j; double *mat_t = malloc((size_t)n*k*sizeof(double)); if(!mat_t) return NULL; for(i=0; i