mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
The Bernoulli gives a no compile due to a static assertion that the type be integral
in 4.7 random.h Probably need to go through an Integer type, and then conver to real after the random draw to make clean.
This commit is contained in:
parent
5341977948
commit
ec4a9b7f6c
@ -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<RealD>> _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<RealD>{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<RealD>{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