Now that all calls to this function are in C++, there is no need to degrade to C
data types when calling into it.
Gitlab: #2154
std::vector<int> jcn(nPts * k * 2);
std::vector<double> val(nPts * k * 2);
- nearest_neighbor_graph_ann(nPts, num_neigbors, eps, x, &nz, irn.data(),
- jcn.data(), val.data());
+ nearest_neighbor_graph_ann(nPts, num_neigbors, eps, x, &nz, irn, jcn, val);
A = SparseMatrix_from_coordinate_arrays(nz, nPts, nPts, irn.data(),
jcn.data(), val.data(),
}
}
-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, std::vector<int> &irn,
+ std::vector<int> &jcn,
+ std::vector<double> &val) {
/* Gives a nearest neighbor graph is a list of dim-dimendional points. The connectivity is in irn/jcn, and the distance in val.
note that there could be repeates
*/
- int *irn = irn0;
- int *jcn = jcn0;
- double *val = val0;
-
-
ANNpointArray dataPts = annAllocPts(nPts, dim); // allocate data points
std::vector<ANNidx> nnIdx(k); // allocate near neighbor indices
std::vector<ANNdist> dists(k); // allocate near neighbor dists
#pragma once
-void nearest_neighbor_graph_ann(int nPts, int k, double eps, double *x, int *nz0, int *irn0, int *jcn0, double *val0);
+#include <vector>
+
+void nearest_neighbor_graph_ann(int nPts, int k, double eps, double *x,
+ int *nz0, std::vector<int> &irn,
+ std::vector<int> &jcn,
+ std::vector<double> &val);