21 #ifndef OPAL_LATIN_HYPERCUBE_H
22 #define OPAL_LATIN_HYPERCUBE_H
34 typedef typename std::uniform_real_distribution<double>
dist_t;
59 void create(std::shared_ptr<SampleIndividual>& ind, std::size_t i) {
72 int nSamples = args->getArg<
int>(
"nsamples",
true);
73 int nMasters = args->getArg<
int>(
"num-masters",
true);
75 int nLocSamples = nSamples / nMasters;
76 int rest = nSamples - nMasters * nLocSamples;
84 startBin = nLocSamples * id;
87 startBin = nLocSamples * id;
89 startBin = (nLocSamples + 1) * rest + (
id - rest) * nLocSamples;
110 std::size_t bin =
bin_m.back();
116 void fillBins_m(std::size_t nTotal, std::size_t nLocal,
int startBin,
119 std::deque<std::size_t> tmp;
121 std::iota(tmp.begin(), tmp.end(), 0);
124 std::mt19937_64 eng(seed);
125 std::shuffle(tmp.begin(), tmp.end(), eng);
129 tmp.begin()+startBin+nLocal,
130 std::back_inserter(
bin_m));
int seed
The current random seed.
LatinHyperCube(double lower, double upper)
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a copy
std::deque< std::size_t > bin_m
std::uniform_real_distribution< double > dist_t
void allocate(const CmdArguments_t &args, const Comm::Bundle_t &comm)
RNGStream * RNGInstance_m
DISTR::result_type getNext(DISTR &RNGDist)
static void deleteInstance(RNGStream *&generator)
double map2domain_m(double val)
std::shared_ptr< CmdArguments > CmdArguments_t
bundles all communicators for a specific role/pid
static RNGStream * getInstance()
void create(std::shared_ptr< SampleIndividual > &ind, std::size_t i)
LatinHyperCube(double lower, double upper, int seed)
void fillBins_m(std::size_t nTotal, std::size_t nLocal, int startBin, std::size_t seed)