]> granicus.if.org Git - graphviz/commitdiff
mm2gv: remove unused 'mm_read_unsymmetric_sparse'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 8 Apr 2022 15:02:21 +0000 (08:02 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 11 Apr 2022 02:54:35 +0000 (19:54 -0700)
cmd/tools/mmio.c
cmd/tools/mmio.h

index 92ac65b3e2a6abf077ba4ca7f4f563f5de111bbc..528363d8b2ef5a04d370507b13f4122a2c95cb17 100644 (file)
 
 #include "mmio.h"
 
-int mm_read_unsymmetric_sparse(const char *fname, int *M_, int *N_,
-                              int *nz_, double **val_, int **I_, int **J_)
-{
-    FILE *f;
-    MM_typecode matcode;
-    int M, N, nz;
-    int i;
-    double *val;
-    int *I, *J;
-
-    if ((f = fopen(fname, "r")) == NULL)
-       return -1;
-
-
-    if (mm_read_banner(f, &matcode) != 0) {
-       fprintf(stderr,
-               "mm_read_unsymetric: Could not process Matrix Market banner ");
-       fprintf(stderr, " in file [%s]\n", fname);
-       return -1;
-    }
-
-
-
-    if (!(mm_is_real(matcode) && mm_is_matrix(matcode) &&
-         mm_is_sparse(matcode))) {
-       fprintf(stderr, "Sorry, this application does not support ");
-       fprintf(stderr, "Market Market type: [%s]\n",
-               mm_typecode_to_str(matcode));
-       return -1;
-    }
-
-    /* find out size of sparse matrix: M, N, nz .... */
-
-    if (mm_read_mtx_crd_size(f, &M, &N, &nz) != 0) {
-       fprintf(stderr,
-               "read_unsymmetric_sparse(): could not parse matrix size.\n");
-       return -1;
-    }
-
-    *M_ = M;
-    *N_ = N;
-    *nz_ = nz;
-
-    /* reseve memory for matrices */
-
-    I = malloc(nz * sizeof(int));
-    J = malloc(nz * sizeof(int));
-    val = malloc(nz * sizeof(double));
-
-    *val_ = val;
-    *I_ = I;
-    *J_ = J;
-
-    /* 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)            */
-
-    for (i = 0; i < nz; i++) {
-       int num = fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i]);
-       (void)num;
-       assert(num == 3);
-       I[i]--;                 /* adjust from 1-based to 0-based */
-       J[i]--;
-    }
-    fclose(f);
-
-    return 0;
-}
-
 int mm_is_valid(MM_typecode matcode)
 {
     if (!mm_is_matrix(matcode))
index bd8ae939363d89afc0c89bb12de84f2b671f45af..a60e7dded67fd275cf710a48ab20a0fce6f66571 100644 (file)
@@ -132,7 +132,3 @@ int mm_read_mtx_crd_data(FILE * f, int M, int N, int nz, int I[], int J[],
                         double val[], MM_typecode matcode);
 int mm_read_mtx_crd_entry(FILE * f, int *I, int *J, double *realpart,
                          double *img, MM_typecode matcode);
-
-int mm_read_unsymmetric_sparse(const char *fname, int *M_, int *N_,
-                              int *nz_, double **val_, int **I_,
-                              int **J_);