From eec71796e201c94c1e4546d93074f36ae5f09cbf Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 8 Jan 2022 10:54:46 -0800 Subject: [PATCH] nearest_neighbor_graph_ann: remove a level of indirection on array parameters None of these parameters are updated during `nearest_neighbor_graph_ann`, so taking them by pointer is irrelevant. --- lib/mingle/nearest_neighbor_graph.cpp | 2 +- lib/mingle/nearest_neighbor_graph_ann.cpp | 8 ++++---- lib/mingle/nearest_neighbor_graph_ann.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/mingle/nearest_neighbor_graph.cpp b/lib/mingle/nearest_neighbor_graph.cpp index b74e3dbdf..d1b9df67e 100644 --- a/lib/mingle/nearest_neighbor_graph.cpp +++ b/lib/mingle/nearest_neighbor_graph.cpp @@ -37,7 +37,7 @@ SparseMatrix nearest_neighbor_graph(int nPts, int num_neigbors, double *x, doubl val = (double*)MALLOC(sizeof(double)*nPts*k*2); #ifdef HAVE_ANN - nearest_neighbor_graph_ann(nPts, num_neigbors, eps, x, &nz, &irn, &jcn, &val); + nearest_neighbor_graph_ann(nPts, num_neigbors, eps, x, &nz, irn, jcn, val); A = SparseMatrix_from_coordinate_arrays(nz, nPts, nPts, irn, jcn, val, MATRIX_TYPE_REAL, sizeof(double)); #else diff --git a/lib/mingle/nearest_neighbor_graph_ann.cpp b/lib/mingle/nearest_neighbor_graph_ann.cpp index 26dc7a570..eb892d689 100644 --- a/lib/mingle/nearest_neighbor_graph_ann.cpp +++ b/lib/mingle/nearest_neighbor_graph_ann.cpp @@ -50,7 +50,7 @@ static void sortPtsY(int n, ANNpointArray pts){ } } -void nearest_neighbor_graph_ann(int nPts, int k, double eps, double *x, int *nz0, int **irn0, int **jcn0, double **val0){ +void nearest_neighbor_graph_ann(int nPts, int k, double eps, double *x, int *nz0, int *irn0, int *jcn0, double *val0){ /* Gives a nearest neighbor graph is a list of dim-dimendional points. The connectivity is in irn/jcn, and the distance in val. @@ -66,9 +66,9 @@ void nearest_neighbor_graph_ann(int nPts, int k, double eps, double *x, int *nz0 note that there could be repeates */ - int *irn = *irn0; - int *jcn = *jcn0; - double *val = *val0; + int *irn = irn0; + int *jcn = jcn0; + double *val = val0; ANNpointArray dataPts = annAllocPts(nPts, dim); // allocate data points diff --git a/lib/mingle/nearest_neighbor_graph_ann.h b/lib/mingle/nearest_neighbor_graph_ann.h index 2a344dc0d..d02affcd9 100644 --- a/lib/mingle/nearest_neighbor_graph_ann.h +++ b/lib/mingle/nearest_neighbor_graph_ann.h @@ -14,7 +14,7 @@ extern "C" { #endif -void nearest_neighbor_graph_ann(int nPts, int k, double eps, double *x, int *nz0, int **irn0, int **jcn0, double **val0); +void nearest_neighbor_graph_ann(int nPts, int k, double eps, double *x, int *nz0, int *irn0, int *jcn0, double *val0); #ifdef __cplusplus } -- 2.40.0