mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Bernoulli reenabled -- using integral type for the discrete_distribution, but
then casts in the fill
This commit is contained in:
parent
ec4a9b7f6c
commit
f7ca6ca889
@ -122,7 +122,7 @@ namespace Grid {
|
||||
std::vector<RngEngine> _generators;
|
||||
std::vector<std::uniform_real_distribution<RealD>> _uniform;
|
||||
std::vector<std::normal_distribution<RealD>> _gaussian;
|
||||
// std::vector<std::discrete_distribution<RealD>> _bernoulli;
|
||||
std::vector<std::discrete_distribution<int32_t>> _bernoulli;
|
||||
|
||||
void GetState(std::vector<RngStateType> & saved,int gen) {
|
||||
saved.resize(RngStateCount);
|
||||
@ -162,7 +162,7 @@ namespace Grid {
|
||||
_generators.resize(1);
|
||||
_uniform.resize(1,std::uniform_real_distribution<RealD>{0,1});
|
||||
_gaussian.resize(1,std::normal_distribution<RealD>(0.0,1.0) );
|
||||
// _bernoulli.resize(1,std::discrete_distribution<RealD>{1,1});
|
||||
_bernoulli.resize(1,std::discrete_distribution<int32_t>{1,1});
|
||||
_seeded=0;
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ namespace Grid {
|
||||
_generators.resize(_vol);
|
||||
_uniform.resize(_vol,std::uniform_real_distribution<RealD>{0,1});
|
||||
_gaussian.resize(_vol,std::normal_distribution<RealD>(0.0,1.0) );
|
||||
// _bernoulli.resize(_vol,std::discrete_distribution<RealD>{1,1});
|
||||
_bernoulli.resize(_vol,std::discrete_distribution<int32_t>{1,1});
|
||||
_seeded=0;
|
||||
}
|
||||
|
||||
@ -372,9 +372,9 @@ PARALLEL_FOR_LOOP
|
||||
rng.fill(l,rng._gaussian);
|
||||
}
|
||||
|
||||
// template <class vobj> inline void bernoulli(GridParallelRNG &rng,Lattice<vobj> &l){
|
||||
// rng.fill(l,rng._bernoulli);
|
||||
// }
|
||||
template <class vobj> inline void bernoulli(GridParallelRNG &rng,Lattice<vobj> &l){
|
||||
rng.fill(l,rng._bernoulli);
|
||||
}
|
||||
|
||||
template <class sobj> inline void random(GridSerialRNG &rng,sobj &l){
|
||||
rng.fill(l,rng._uniform);
|
||||
@ -384,9 +384,9 @@ PARALLEL_FOR_LOOP
|
||||
rng.fill(l,rng._gaussian);
|
||||
}
|
||||
|
||||
// template <class sobj> inline void bernoulli(GridSerialRNG &rng,sobj &l){
|
||||
// rng.fill(l,rng._bernoulli);
|
||||
// }
|
||||
template <class sobj> inline void bernoulli(GridSerialRNG &rng,sobj &l){
|
||||
rng.fill(l,rng._bernoulli);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user