]> granicus.if.org Git - graphviz/commitdiff
remove NONCORE-guarded code
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 19 Dec 2021 19:03:17 +0000 (11:03 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 19 Dec 2021 23:14:36 +0000 (15:14 -0800)
Nothing in the build systems ever define this.

lib/neatogen/constrained_majorization.c
lib/neatogen/stress.c

index 1096bfc88193725732c25765bb91136394c13301..12e0e8549851220584949c1f6e1b4a5612b4a522 100644 (file)
@@ -53,9 +53,6 @@ int stress_majorization_with_hierarchy(vtx_data * graph,      /* Input graph in spars
     float *dist_accumulator = NULL;
     float *tmp_coords = NULL;
     float **b = NULL;
-#ifdef NONCORE
-    FILE *fp = NULL;
-#endif
     double *degrees = NULL;
     float *lap2 = NULL;
     int lap_length;
@@ -316,17 +313,6 @@ int stress_majorization_with_hierarchy(vtx_data * graph,   /* Input graph in spars
        lap2[count] = (float) degrees[i];
     }
 
-#ifdef NONCORE
-    fpos_t pos;
-    if (n > max_nodes_in_mem) {
-#define FILENAME "tmp_Dij$$$.bin"
-       fp = fopen(FILENAME, "wb");
-       fwrite(lap2, sizeof(float), lap_length, fp);
-       fclose(fp);
-       fp = NULL;
-    }
-#endif
-
        /*************************
        ** Layout optimization  **
        *************************/
@@ -339,17 +325,7 @@ int stress_majorization_with_hierarchy(vtx_data * graph,   /* Input graph in spars
 
     tmp_coords = N_GNEW(n, float);
     dist_accumulator = N_GNEW(n, float);
-#ifdef NONCORE
-    if (n <= max_nodes_in_mem) {
-#endif
-       lap1 = N_GNEW(lap_length, float);
-#ifdef NONCORE
-    } else {
-       lap1 = lap2;
-       fp = fopen(FILENAME, "rb");
-       fgetpos(fp, &pos);
-    }
-#endif
+    lap1 = N_GNEW(lap_length, float);
 
     old_stress = DBL_MAX;      /* at least one iteration */
 
@@ -362,15 +338,7 @@ int stress_majorization_with_hierarchy(vtx_data * graph,   /* Input graph in spars
 
        /* First, construct Laplacian of 1/(d_ij*|p_i-p_j|)  */
        set_vector_val(n, 0, degrees);
-#ifdef NONCORE
-       if (n <= max_nodes_in_mem) {
-#endif
-           sqrt_vecf(lap_length, lap2, lap1);
-#ifdef NONCORE
-       } else {
-           sqrt_vec(lap_length, lap1);
-       }
-#endif
+       sqrt_vecf(lap_length, lap2, lap1);
        for (count = 0, i = 0; i < n - 1; i++) {
            len = n - i - 1;
            /* init 'dist_accumulator' with zeros */
@@ -427,13 +395,6 @@ int stress_majorization_with_hierarchy(vtx_data * graph,   /* Input graph in spars
        }
        new_stress *= 2;
        new_stress += constant_term;    // only after mult by 2              
-#ifdef NONCORE
-       if (n > max_nodes_in_mem) {
-           /* restore lap2 from disk */
-           fsetpos(fp, &pos);
-           fread(lap2, sizeof(float), lap_length, fp);
-       }
-#endif
        for (k = 0; k < dim; k++) {
            right_mult_with_vector_ff(lap2, n, coords[k], tmp_coords);
            new_stress -= vectors_inner_productf(n, coords[k], tmp_coords);
@@ -517,16 +478,7 @@ int stress_majorization_with_hierarchy(vtx_data * graph,   /* Input graph in spars
     free(degrees);
     free(lap2);
 
-
-#ifdef NONCORE
-    if (n <= max_nodes_in_mem) {
-#endif
-       free(lap1);
-#ifdef NONCORE
-    }
-    if (fp)
-       fclose(fp);
-#endif
+    free(lap1);
 
 finish:
     free(ordering);
index a3a674fd93972baa6f1f0c0e82c489eceb44bde7..a864f0849a47f74152a332aa25a3bb02d63f12e1 100644 (file)
                                   by d_{ij}^{-2} otherwise, they are normalized by d_{ij}^{-1}
                                 */
 
-#ifdef NONCORE
-/* Set 'max_nodes_in_mem' so that 
- * 4*(max_nodes_in_mem^2) is smaller than the available memory (in bytes)
- * 4 = sizeof(float)
- */
-#define max_nodes_in_mem 18000
-#endif
-
  /* relevant when using sparse distance matrix not within subspace */
 #define smooth_pivots true
 
@@ -911,10 +903,6 @@ int stress_majorization_kD_mkernel(vtx_data * graph,       /* Input graph in sparse re
 #ifdef ALTERNATIVE_STRESS_CALC
     double mat_stress;
 #endif
-#ifdef NONCORE
-    FILE *fp = NULL;
-#endif
-
 
        /*************************************************
        ** Computation of full, dense, unrestricted k-D ** 
@@ -1079,16 +1067,6 @@ int stress_majorization_kD_mkernel(vtx_data * graph,     /* Input graph in sparse re
        lap2[count] = degrees[i];
     }
 
-#ifdef NONCORE
-    if (n > max_nodes_in_mem) {
-#define FILENAME "tmp_Dij$$$.bin"
-       fp = fopen(FILENAME, "wb");
-       fwrite(lap2, sizeof(float), lap_length, fp);
-       fclose(fp);
-       fp = NULL;
-    }
-#endif
-
        /*************************
        ** Layout optimization  **
        *************************/
@@ -1101,18 +1079,7 @@ int stress_majorization_kD_mkernel(vtx_data * graph,     /* Input graph in sparse re
 
     tmp_coords = N_NEW(n, float);
     dist_accumulator = N_NEW(n, float);
-    lap1 = NULL;
-#ifdef NONCORE
-    if (n <= max_nodes_in_mem) {
-       lap1 = N_NEW(lap_length, float);
-    } else {
-       lap1 = lap2;
-       fp = fopen(FILENAME, "rb");
-       fgetpos(fp, &pos);
-    }
-#else
     lap1 = N_NEW(lap_length, float);
-#endif
 
 
 #ifdef USE_MAXFLOAT
@@ -1134,15 +1101,7 @@ int stress_majorization_kD_mkernel(vtx_data * graph,     /* Input graph in sparse re
        memset(degrees, 0, n * sizeof(DegType));
        if (exp == 2) {
 #ifdef Dij2
-#ifdef NONCORE
-           if (n <= max_nodes_in_mem) {
-               sqrt_vecf(lap_length, lap2, lap1);
-           } else {
-               sqrt_vec(lap_length, lap1);
-           }
-#else
            sqrt_vecf(lap_length, lap2, lap1);
-#endif
 #endif
        }
        for (count = 0, i = 0; i < n - 1; i++) {
@@ -1209,13 +1168,6 @@ int stress_majorization_kD_mkernel(vtx_data * graph,     /* Input graph in sparse re
        }
        new_stress *= 2;
        new_stress += constant_term;    /* only after mult by 2 */
-#ifdef NONCORE
-       if (n > max_nodes_in_mem) {
-           /* restore lap2 from memory */
-           fsetpos(fp, &pos);
-           fread(lap2, sizeof(float), lap_length, fp);
-       }
-#endif
        for (k = 0; k < dim; k++) {
            right_mult_with_vector_ff(lap2, n, coords[k], tmp_coords);
            new_stress -= vectors_inner_productf(n, coords[k], tmp_coords);
@@ -1278,10 +1230,6 @@ int stress_majorization_kD_mkernel(vtx_data * graph,     /* Input graph in sparse re
            d_coords[i][j] = coords[i][j];
        }
     }
-#ifdef NONCORE
-    if (fp)
-       fclose(fp);
-#endif
 finish1:
     free(f_storage);
     free(coords);