39 int &nz0, std::vector<int> &irn,
40 std::vector<int> &jcn,
41 std::vector<double> &val) {
59 ANNpointArray dataPts = annAllocPts(nPts,
dim);
60 std::vector<ANNidx> nnIdx(k);
61 std::vector<ANNdist> dists(k);
63 for (
int i = 0; i < nPts; i++){
64 double *xx = dataPts[i];
65 for (
int j = 0; j <
dim; j++) xx[j] = x[i*
dim + j];
75 for (
int ip = 0; ip < nPts; ip++){
83 for (
int i = 0; i < k; i++) {
84 if (nnIdx[i] == ip)
continue;
98 for (
int ip = 0; ip < nPts; ip++){
106 for (
int i = 0; i < k; i++) {
107 if (nnIdx[i] == ip)
continue;
110 jcn[nz++] = nnIdx[i];
116 annDeallocPts(dataPts);
void nearest_neighbor_graph_ann(int nPts, int k, const std::vector< double > &x, int &nz0, std::vector< int > &irn, std::vector< int > &jcn, std::vector< double > &val)