/*! \file \brief A simple program to convert a tensor in coordinate format into an unfolded matrix \author George */ #include int main(int argc, char *argv[]) { size_t nnz, i, j, k, nI, nJ, nK, nrows, ncols; int32_t *I, *J, *K, *rowind, *colind; ssize_t *rowptr, *colptr; float *V, *rowval, *colval; if (argc != 2) errexit("Usage %s [%d]\n", argv[0], argc); if (!gk_fexists(argv[1])) errexit("File %s does not exist.\n", argv[1]); gk_getfilestats(argv[1], &nnz, NULL, NULL, NULL); I = gk_i32malloc(nnz, "I"); J = gk_i32malloc(nnz, "J"); K = gk_i32malloc(nnz, "K"); V = gk_fmalloc(nnz, "V"); fprintf(stderr, "Input nnz: %zd\n", nnz); FILE *fpin = gk_fopen(argv[1], "r", "infile"); for (i=0; i