diff options
author | glisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-26 12:38:26 +0000 |
---|---|---|
committer | glisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-26 12:38:26 +0000 |
commit | d2e5de256424e824e9f54a6ae6c30cd06d8111d4 (patch) | |
tree | bf9f2210f06ef146c90f9953732fe998ab5a326c /src/Subsampling/include | |
parent | 1208d423e700764a3453767886e6a3b4c0a09125 (diff) |
Remove overload of choose_n_farthest_points.
Use a named constant instead of -1 to denote a random value.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/farthest_distance@2245 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 166dff85c74ab2c13bfd788f226d1d8a15d1d1b9
Diffstat (limited to 'src/Subsampling/include')
-rw-r--r-- | src/Subsampling/include/gudhi/choose_n_farthest_points.h | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/src/Subsampling/include/gudhi/choose_n_farthest_points.h b/src/Subsampling/include/gudhi/choose_n_farthest_points.h index 5061a511..02376c03 100644 --- a/src/Subsampling/include/gudhi/choose_n_farthest_points.h +++ b/src/Subsampling/include/gudhi/choose_n_farthest_points.h @@ -36,11 +36,21 @@ namespace Gudhi { namespace subsampling { +/** + * \ingroup subsampling + */ +enum : std::size_t { +/** + * Argument for `choose_n_farthest_points` to indicate that the starting point should be picked randomly. + */ + random_first_landmark = std::size_t(-1) +}; + /** * \ingroup 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` or, if `starting point==-1`, with a random landmark. + * The iteration starts with the landmark `starting point` or, if `starting point==random_first_landmark`, with a random landmark. * \tparam Kernel must provide a type Kernel::Squared_distance_d which is a model of the * concept <a target="_blank" * href="http://doc.cgal.org/latest/Kernel_d/classKernel__d_1_1Squared__distance__d.html">Kernel_d::Squared_distance_d</a> @@ -80,7 +90,7 @@ void choose_n_farthest_points(Kernel const &k, if (final_size < 1) return; - if (starting_point == std::size_t(-1)) { + if (starting_point == random_first_landmark) { // Choose randomly the first landmark std::random_device rd; std::mt19937 gen(rd()); @@ -117,37 +127,6 @@ void choose_n_farthest_points(Kernel const &k, } } -/** - * \ingroup 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. - * \tparam Kernel must provide a type Kernel::Squared_distance_d which is a model of the - * concept <a target="_blank" - * href="http://doc.cgal.org/latest/Kernel_d/classKernel__d_1_1Squared__distance__d.html">Kernel_d::Squared_distance_d</a> - * concept. - * It must also contain a public member 'squared_distance_d_object' of this type. - * \tparam Point_range Range whose value type is Kernel::Point_d. It must provide random-access - * via `operator[]` and the points should be stored contiguously in memory. - * \tparam PointOutputIterator Output iterator whose value type is Kernel::Point_d. - * \details It chooses `final_size` points from a random access range `input_pts` and - * outputs it in the output iterator `output_it`. - * @param[in] k A kernel object. - * @param[in] input_pts Const reference to the input points. - * @param[in] final_size The size of the subsample to compute. - * @param[out] output_it The output iterator. - * - */ -template < typename Kernel, -typename Point_range, -typename PointOutputIterator> -void choose_n_farthest_points(Kernel const& k, - Point_range const &input_pts, - std::size_t final_size, - PointOutputIterator output_it) { - choose_n_farthest_points(k, input_pts, final_size, -1, output_it); -} - } // namespace subsampling } // namespace Gudhi |