From 661df189e5a0c5cdfa12607d03da4cd59c51018f Mon Sep 17 00:00:00 2001 From: skachano Date: Fri, 2 Sep 2016 13:15:33 +0000 Subject: Mark comment #1 + Vincent comment #1 git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1472 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e9a2fb8d8f9e11c60326203c7e0e46cdb2b12435 --- .../include/gudhi/choose_by_farthest_point.h | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/Subsampling/include/gudhi') diff --git a/src/Subsampling/include/gudhi/choose_by_farthest_point.h b/src/Subsampling/include/gudhi/choose_by_farthest_point.h index 8dea19be..b09192d9 100644 --- a/src/Subsampling/include/gudhi/choose_by_farthest_point.h +++ b/src/Subsampling/include/gudhi/choose_by_farthest_point.h @@ -46,7 +46,7 @@ namespace subsampling { * \brief Subsample by a greedy strategy of iteratively adding the farthest point from the * current chosen point set to the subsampling. * The iteration starts with the landmark `starting point`. - * \details It chooses `final_size` points from a random access range `points` and + * \details It chooses `final_size` points from a random access range `input_pts` and * outputs it in the output iterator `output_it`. * */ @@ -54,31 +54,31 @@ namespace subsampling { template < typename Kernel, typename Point_container, typename OutputIterator> - void choose_by_farthest_point( Kernel& k, - Point_container const &points, - int final_size, - int starting_point, + void choose_by_farthest_point( Kernel const &k, + Point_container const &input_pts, + unsigned final_size, + unsigned starting_point, OutputIterator output_it) { typename Kernel::Squared_distance_d sqdist = k.squared_distance_d_object(); - int nb_points = boost::size(points); + int nb_points = boost::size(input_pts); assert(nb_points >= final_size); - int current_number_of_landmarks = 0; // counter for landmarks + unsigned current_number_of_landmarks = 0; // counter for landmarks double curr_max_dist = 0; // used for defining the furhest point from L const double infty = std::numeric_limits::infinity(); // infinity (see next entry) - std::vector< double > dist_to_L(nb_points, infty); // vector of current distances to L from points + std::vector< double > dist_to_L(nb_points, infty); // vector of current distances to L from input_pts int curr_max_w = starting_point; for (current_number_of_landmarks = 0; current_number_of_landmarks != final_size; current_number_of_landmarks++) { // curr_max_w at this point is the next landmark - *output_it++ = points[curr_max_w]; + *output_it++ = input_pts[curr_max_w]; // std::cout << curr_max_w << "\n"; unsigned i = 0; - for (auto& p : points) { - double curr_dist = sqdist(p, *(std::begin(points) + curr_max_w)); + for (auto& p : input_pts) { + double curr_dist = sqdist(p, *(std::begin(input_pts) + curr_max_w)); if (curr_dist < dist_to_L[i]) dist_to_L[i] = curr_dist; ++i; @@ -98,7 +98,7 @@ namespace subsampling { * \brief Subsample by a greedy strategy of iteratively adding the farthest point from the * current chosen point set to the subsampling. * The iteration starts with a random landmark. - * \details It chooses `final_size` points from a random access range `points` and + * \details It chooses `final_size` points from a random access range `input_pts` and * outputs it in the output iterator `output_it`. * */ @@ -106,7 +106,7 @@ namespace subsampling { typename Point_container, typename OutputIterator> void choose_by_farthest_point( Kernel& k, - Point_container const &points, + Point_container const &input_pts, int final_size, OutputIterator output_it) { @@ -115,7 +115,7 @@ namespace subsampling { std::mt19937 gen(rd()); std::uniform_int_distribution<> dis(1, 6); int starting_point = dis(gen); - choose_by_farthest_point(k, points, final_size, starting_point, output_it); + choose_by_farthest_point(k, input_pts, final_size, starting_point, output_it); } } // namespace subsampling -- cgit v1.2.3