11 #ifndef PICK_N_RANDOM_POINTS_H_ 12 #define PICK_N_RANDOM_POINTS_H_ 14 #include <gudhi/Clock.h> 16 #include <boost/range/size.hpp> 28 namespace subsampling {
38 template <
typename Point_container,
39 typename OutputIterator>
41 std::size_t final_size,
42 OutputIterator output_it) {
43 #ifdef GUDHI_SUBSAMPLING_PROFILING 47 std::size_t nbP = boost::size(points);
51 std::vector<int> landmarks(nbP);
52 std::iota(landmarks.begin(), landmarks.end(), 0);
54 std::random_device rd;
57 std::shuffle(landmarks.begin(), landmarks.end(), g);
58 landmarks.resize(final_size);
60 for (
int l : landmarks)
61 *output_it++ = points[l];
63 #ifdef GUDHI_SUBSAMPLING_PROFILING 65 std::cerr <<
"Random landmark choice took " << t.num_seconds()
66 <<
" seconds." << std::endl;
74 #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:40
Definition: SimplicialComplexForAlpha.h:14