*/
ANNpointArray dataPts; // data points
- ANNdistArray dists; // near neighbor distances
ANNkd_tree* kdTree; // search structure
double *xx;
dataPts = annAllocPts(nPts, dim); // allocate data points
std::vector<ANNidx> nnIdx(k); // allocate near neighbor indices
- dists = new ANNdist[k]; // allocate near neighbor dists
+ std::vector<ANNdist> dists(k); // allocate near neighbor dists
for (int i = 0; i < nPts; i++){
xx = dataPts[i];
dataPts[ip], // query point
k, // number of near neighbors
nnIdx.data(), // nearest neighbors (returned)
- dists, // distance (returned)
+ dists.data(), // distance (returned)
eps); // error bound
for (int i = 0; i < k; i++) { // print summary
dataPts[ip], // query point
k, // number of near neighbors
nnIdx.data(), // nearest neighbors (returned)
- dists, // distance (returned)
+ dists.data(), // distance (returned)
eps); // error bound
for (int i = 0; i < k; i++) { // print summary
}
}
- delete [] dists; // clean things up
- delete kdTree;
+ delete kdTree; // clean things up
*nz0 = nz;