Commit 1364f20e authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #120 from sanchom/master

Bugfix: NNs not found due to precision error.
parents 49102c7e 6d4c23a6
......@@ -1766,7 +1766,9 @@ static void NN_chain_core(const int_fast32_t N, double * const D, t_members * co
for (i=active_nodes.start; i<idx2; i=active_nodes.succ[i])
{
if (D_(i,idx2) < min)
// Need double_equal check because of some numerical imprecision
// in construction of D_.
if (D_(i,idx2) < min && !double_equal(D_(i,idx2), min))
{
min = D_(i,idx2);
idx1 = i;
......@@ -1774,7 +1776,7 @@ static void NN_chain_core(const int_fast32_t N, double * const D, t_members * co
}
for (i=active_nodes.succ[idx2]; i<N; i=active_nodes.succ[i])
{
if (D_(idx2,i) < min)
if (D_(idx2,i) < min && !double_equal(D_(idx2,i), min))
{
min = D_(idx2,i);
idx1 = i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment