]> granicus.if.org Git - graphviz/commitdiff
mingle nearest_neighbor_graph: squash warnings when building without libANN
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 18 Jan 2023 16:24:45 +0000 (08:24 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 22 Jan 2023 00:32:26 +0000 (16:32 -0800)
lib/mingle/nearest_neighbor_graph.cpp

index bd1f6ab2affb2a90ecad4ab1fa19be483117ce65..aa731bd401bbf47e521dfd2de8ea171554e882c3 100644 (file)
@@ -27,11 +27,12 @@ SparseMatrix nearest_neighbor_graph(int nPts, int num_neighbors, double *x, doub
     x: nPts*dim vector. The i-th point is x[i*dim : i*dim + dim - 1]
 
   */
+  SparseMatrix A = NULL;
+
+#ifdef HAVE_ANN
   int nz;
-  SparseMatrix A;
   int k = num_neighbors;
 
-#ifdef HAVE_ANN
   /* need to *2 as we do two sweeps of neighbors, so could have repeats */
   std::vector<int> irn(nPts * k * 2);
   std::vector<int> jcn(nPts * k * 2);
@@ -43,7 +44,10 @@ SparseMatrix nearest_neighbor_graph(int nPts, int num_neighbors, double *x, doub
                                           jcn.data(), val.data(),
                                           MATRIX_TYPE_REAL, sizeof(double));
 #else
-  A = NULL;
+  (void)nPts;
+  (void)num_neighbors;
+  (void)x;
+  (void)eps;
 #endif
 
   return A;