Commit cdbee71f authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

always initialize the output values in LSH-based k-nearest search (patch by Alex Mordvintsev)

parent 255617ff
......@@ -197,6 +197,8 @@ public:
KNNUniqueResultSet<DistanceType> resultSet(knn);
for (size_t i = 0; i < queries.rows; i++) {
resultSet.clear();
std::fill_n(indices[i], knn, -1);
std::fill_n(dists[i], knn, std::numeric_limits<DistanceType>::max());
findNeighbors(resultSet, queries[i], params);
if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices[i], dists[i], knn);
else resultSet.copy(indices[i], dists[i], knn);
......
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