1 #ifndef OPAL_LATIN_HYPERCUBE_H
2 #define OPAL_LATIN_HYPERCUBE_H
14 typedef typename std::uniform_real_distribution<double>
dist_t;
39 void create(boost::shared_ptr<SampleIndividual>& ind, std::size_t i) {
52 int nSamples = args->getArg<
int>(
"nsamples",
true);
53 int nMasters = args->getArg<
int>(
"num-masters",
true);
55 int nLocSamples = nSamples / nMasters;
56 int rest = nSamples - nMasters * nLocSamples;
64 startBin = nLocSamples * id;
67 startBin = nLocSamples * id;
69 startBin = (nLocSamples + 1) * rest + (
id - rest) * nLocSamples;
90 std::size_t bin =
bin_m.back();
96 void fillBins_m(std::size_t nTotal, std::size_t nLocal,
int startBin,
99 std::deque<std::size_t> tmp;
101 std::iota(tmp.begin(), tmp.end(), 0);
104 std::mt19937_64 eng(seed);
105 std::shuffle(tmp.begin(), tmp.end(), eng);
108 std::copy(tmp.begin()+startBin,
109 tmp.begin()+startBin+nLocal,
110 std::back_inserter(
bin_m));
int seed
The current random seed.
std::uniform_real_distribution< double > dist_t
void fillBins_m(std::size_t nTotal, std::size_t nLocal, int startBin, std::size_t seed)
void create(boost::shared_ptr< SampleIndividual > &ind, std::size_t i)
void allocate(const CmdArguments_t &args, const Comm::Bundle_t &comm)
boost::shared_ptr< CmdArguments > CmdArguments_t
LatinHyperCube(double lower, double upper)
LatinHyperCube(double lower, double upper, int seed)
static void deleteInstance(RNGStream *&generator)
DISTR::result_type getNext(DISTR &RNGDist)
double map2domain_m(double val)
static RNGStream * getInstance()
bundles all communicators for a specific role/pid
RNGStream * RNGInstance_m
std::deque< std::size_t > bin_m