From: Matthew Fernandez Date: Fri, 8 Apr 2022 15:26:09 +0000 (-0700) Subject: mm2gv: strip all formats except CSR from 'SparseMatrix_import_matrix_market' X-Git-Tag: 4.0.0~115^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=411208071884523ecfcf007336a825bed6a3fba7;p=graphviz mm2gv: strip all formats except CSR from 'SparseMatrix_import_matrix_market' Only `FORMAT_CSR` was being used when calling into this code. --- diff --git a/cmd/tools/matrix_market.c b/cmd/tools/matrix_market.c index e854d8155..50c125ddf 100644 --- a/cmd/tools/matrix_market.c +++ b/cmd/tools/matrix_market.c @@ -30,7 +30,7 @@ static int mm_get_type(MM_typecode typecode) return MATRIX_TYPE_UNKNOWN; } -SparseMatrix SparseMatrix_import_matrix_market(FILE * f, int format) +SparseMatrix SparseMatrix_import_matrix_market(FILE * f) { int ret_code, type; MM_typecode matcode; @@ -76,15 +76,6 @@ SparseMatrix SparseMatrix_import_matrix_market(FILE * f, int format) I = MALLOC(nz * sizeof(int)); J = MALLOC(nz * sizeof(int)); - - - switch (format) { - case FORMAT_CSC: - assert(0); /* not supported yet */ - break; - case FORMAT_CSR: - case FORMAT_COORD: - /* NOTE: when reading in doubles, ANSI C requires the use of the "l" */ /* specifier as in "%lg", "%lf", "%le", otherwise errors will occur */ /* (ANSI C X3.159-1989, Sec. 4.9.6.2, p. 136 lines 13-15) */ @@ -246,17 +237,8 @@ SparseMatrix SparseMatrix_import_matrix_market(FILE * f, int format) return 0; } - if (format == FORMAT_CSR) { - A = SparseMatrix_from_coordinate_arrays(nz, m, n, I, J, vp, + A = SparseMatrix_from_coordinate_arrays(nz, m, n, I, J, vp, type, sizeof(double)); - } else { - A = SparseMatrix_new(m, n, 1, type, FORMAT_COORD); - A = SparseMatrix_coordinate_form_add_entries(A, nz, I, J, vp); - } - break; - default: - A = NULL; - } free(I); free(J); free(val); diff --git a/cmd/tools/matrix_market.h b/cmd/tools/matrix_market.h index 1ce587f43..00dd0eac2 100644 --- a/cmd/tools/matrix_market.h +++ b/cmd/tools/matrix_market.h @@ -12,4 +12,4 @@ #include "mmio.h" #include -SparseMatrix SparseMatrix_import_matrix_market(FILE * f, int format); +SparseMatrix SparseMatrix_import_matrix_market(FILE * f); diff --git a/cmd/tools/mm2gv.c b/cmd/tools/mm2gv.c index 956e7569e..af706adb5 100644 --- a/cmd/tools/mm2gv.c +++ b/cmd/tools/mm2gv.c @@ -315,7 +315,7 @@ int main(int argc, char *argv[]) /* ======================= read graph ==================== */ - A = SparseMatrix_import_matrix_market(pv.inf, FORMAT_CSR); + A = SparseMatrix_import_matrix_market(pv.inf); if (!A) { fprintf (stderr, "Unable to read input file \"%s\"\n", pv.infile); usage(1);