]> granicus.if.org Git - graphviz/commitdiff
mm2gv: strip all formats except CSR from 'SparseMatrix_import_matrix_market'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 8 Apr 2022 15:26:09 +0000 (08:26 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 11 Apr 2022 02:54:35 +0000 (19:54 -0700)
Only `FORMAT_CSR` was being used when calling into this code.

cmd/tools/matrix_market.c
cmd/tools/matrix_market.h
cmd/tools/mm2gv.c

index e854d81550d845ec7046544b25d1be8e3ccbf80c..50c125ddf17887e026c59edd840ade68a5520a09 100644 (file)
@@ -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);
index 1ce587f436d60175d02756064b7224078c9ebaab..00dd0eac24320778502da70a55250811992b17db 100644 (file)
@@ -12,4 +12,4 @@
 
 #include "mmio.h"
 #include <sparse/SparseMatrix.h>
-SparseMatrix SparseMatrix_import_matrix_market(FILE * f, int format);
+SparseMatrix SparseMatrix_import_matrix_market(FILE * f);
index 956e7569e898609f81a5994d875254739d983f2e..af706adb565b7a9fc2c8068c420ffc9ba58325b9 100644 (file)
@@ -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);