From de0bdf55c16de11d47809dc6f347773b10cc3673 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 16 Dec 2016 16:11:45 +0000 Subject: Warning fixes git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@1905 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7b7222ebe65fd01fde30f8ba527ebaee633fc87e --- src/Subsampling/include/gudhi/choose_n_farthest_points.h | 3 ++- src/Subsampling/include/gudhi/pick_n_random_points.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Subsampling/include') diff --git a/src/Subsampling/include/gudhi/choose_n_farthest_points.h b/src/Subsampling/include/gudhi/choose_n_farthest_points.h index ea387bf9..5e908090 100644 --- a/src/Subsampling/include/gudhi/choose_n_farthest_points.h +++ b/src/Subsampling/include/gudhi/choose_n_farthest_points.h @@ -145,7 +145,8 @@ void choose_n_farthest_points(Kernel const& k, std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<> dis(0, (input_pts.size() - 1)); - int starting_point = dis(gen); + std::size_t starting_point = dis(gen); + choose_n_farthest_points(k, input_pts, final_size, starting_point, output_it); } diff --git a/src/Subsampling/include/gudhi/pick_n_random_points.h b/src/Subsampling/include/gudhi/pick_n_random_points.h index e89b2b2d..f0e3f1f1 100644 --- a/src/Subsampling/include/gudhi/pick_n_random_points.h +++ b/src/Subsampling/include/gudhi/pick_n_random_points.h @@ -57,7 +57,9 @@ void pick_n_random_points(Point_container const &points, #endif std::size_t nbP = boost::size(points); - assert(nbP >= final_size); + if (final_size > nbP) + final_size = nbP; + std::vector landmarks(nbP); std::iota(landmarks.begin(), landmarks.end(), 0); -- cgit v1.2.3