[mlpack] 71/207: Fix selection to not return all 0s.
Barak A. Pearlmutter
barak+git at pearlmutter.net
Thu Mar 23 17:53:41 UTC 2017
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch master
in repository mlpack.
commit 1a7ef691597288b5cc0fa3a678d500b928ba18d1
Author: Ryan Curtin <ryan at ratml.org>
Date: Wed Aug 3 17:54:22 2016 -0400
Fix selection to not return all 0s.
---
src/mlpack/methods/dbscan/random_point_selection.hpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/mlpack/methods/dbscan/random_point_selection.hpp b/src/mlpack/methods/dbscan/random_point_selection.hpp
index 0ee2874..f4f373b 100644
--- a/src/mlpack/methods/dbscan/random_point_selection.hpp
+++ b/src/mlpack/methods/dbscan/random_point_selection.hpp
@@ -27,18 +27,17 @@ class RandomPointSelection
const size_t index = math::RandInt(max);
// Select the index'th unvisited point.
- size_t i = 0;
size_t found = 0;
for (size_t i = 0; i < unvisited.size(); ++i)
{
if (unvisited[i])
++found;
- if (found == index)
- break;
+ if (found > index)
+ return i;
}
- return i;
+ return 0; // Not sure if it is possible to get here.
}
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list