Skip to content
Snippets Groups Projects
Commit 36de0e2b authored by Jordi Inglada's avatar Jordi Inglada
Browse files

ENH: normalization factor can be applied after the loop

parent 0db768ff
No related branches found
No related tags found
1 merge request!25Data augmentation
......@@ -138,9 +138,9 @@ double computeSquareDistance(const SampleType& x, const SampleType& y)
double dist{0};
for(size_t i=0; i<x.size(); ++i)
{
dist += (x[i]-y[i])*(x[i]-y[i])/(x.size()*x.size());
dist += (x[i]-y[i])*(x[i]-y[i]);
}
return dist;
return dist/(x.size()*x.size());
}
using NNIndicesType = std::vector<NeighborType>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment