23 #ifndef PICK_N_RANDOM_POINTS_H_ 24 #define PICK_N_RANDOM_POINTS_H_ 26 #include <gudhi/Clock.h> 28 #include <boost/range/size.hpp> 40 namespace subsampling {
50 template <
typename Point_container,
51 typename OutputIterator>
53 std::size_t final_size,
54 OutputIterator output_it) {
55 #ifdef GUDHI_SUBSAMPLING_PROFILING 59 std::size_t nbP = boost::size(points);
63 std::vector<int> landmarks(nbP);
64 std::iota(landmarks.begin(), landmarks.end(), 0);
66 std::random_device rd;
69 std::shuffle(landmarks.begin(), landmarks.end(), g);
70 landmarks.resize(final_size);
72 for (
int l : landmarks)
73 *output_it++ = points[l];
75 #ifdef GUDHI_SUBSAMPLING_PROFILING 77 std::cerr <<
"Random landmark choice took " << t.num_seconds()
78 <<
" seconds." << std::endl;
86 #endif // PICK_N_RANDOM_POINTS_H_ void pick_n_random_points(Point_container const &points, std::size_t final_size, OutputIterator output_it)
Subsample a point set by picking random vertices.
Definition: pick_n_random_points.h:52
Definition: SimplicialComplexForAlpha.h:26