提交 739916a7 编写于 作者: M Marius Muja

Bug fix. (thanks Frédéric Devernay)

上级 5d8edd14
...@@ -216,7 +216,7 @@ int Index<Distance>::radiusSearch(const Matrix<ElementType>& query, Matrix<int>& ...@@ -216,7 +216,7 @@ int Index<Distance>::radiusSearch(const Matrix<ElementType>& query, Matrix<int>&
} }
RadiusResultSet<DistanceType> result_set(radius, indices_ptr, dists_ptr, n); RadiusResultSet<DistanceType> result_set(radius, indices_ptr, dists_ptr, n);
nnIndex->findNeighbors(result_set, query[0], searchParams); nnIndex->findNeighbors(result_set, query[0], searchParams);
size_t cnt = result_set.size(); size_t cnt = std::min(result_set.size(), (size_t)n);
if (n > 0 && searchParams.sorted) { if (n > 0 && searchParams.sorted) {
std::sort(make_pair_iterator(dists_ptr, indices_ptr), std::sort(make_pair_iterator(dists_ptr, indices_ptr),
make_pair_iterator(dists_ptr + cnt, indices_ptr + cnt), make_pair_iterator(dists_ptr + cnt, indices_ptr + cnt),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册