SOPT
Sparse OPTimisation
sampling.cc
Go to the documentation of this file.
1 #include "sopt/sampling.h"
2 
3 namespace sopt {
4 Sampling::Sampling(t_uint size, t_uint samples) : indices_(size), size(size) {
5  std::iota(indices_.begin(), indices_.end(), 0);
6  std::shuffle(indices_.begin(), indices_.end(), std::mt19937(std::random_device()()));
7  indices_.resize(samples);
8 }
9 } // namespace sopt
Sampling(t_uint size, std::vector< t_uint > const &indices)
Constructs from a vector.
Definition: sampling.h:20
size_t t_uint
Root of the type hierarchy for unsigned integers.
Definition: types.h:15