1 #ifndef SM_MultiStochasticFunctions_H
2 #define SM_MultiStochasticFunctions_H
5 #include "SM_MultiStochasticFunctionsInterface.h"
8 #include "RNDB_UniformIntDistribution.h"
10 #include "RNDB_MT19937.h"
13 #include "SM_StochasticFunctions.h"
44 std::vector<CORE_UniquePointer<F>> mFs;
101 for(
const auto& f: mFs) mem+=f->getContentsMemorySize();
111 inline static CORE_UniquePointer<SelfClass>
New() {
112 CORE_UniquePointer<SelfClass> p=CORE_UniquePointer<SelfClass>(
new SelfClass(),
122 inline void createFs() {
140 ASSERT_IN(threadId<mFs.size());
141 return *mFs[threadId].get();
148 ASSERT_IN(threadId<mFs.size());
149 return *mFs[threadId].get();
155 ASSERT_IN(threadId<mFs.size());
156 return *mFs[threadId].get();
172 virtual void setSeed(
const tULLInt& seed)
final {
193 virtual void randomSeed(
const tInteger& coresNumber,
const tInteger& coreIndex)
final {
197 tInteger threadsNumber=mFs.size();
205 for(tInteger t=0;t<1000;t++) {
206 seed=mSeedDistribution.
random(mSeedGenerator);
210 for(tInteger t=0;t<coreIndex*threadsNumber;t++) {
211 seed=mSeedDistribution.
random(mSeedGenerator);
220 seed=mSeedDistribution.
random(mSeedGenerator);
232 virtual void jump(
const tInteger& coresNumber,
const tInteger& coreIndex,
233 const tULLInt& jumpsNumber,
const tULLInt& nRNGs)
final {
237 tInteger threadsNumber=mFs.size();
240 tULLInt nRNGs_thread=nRNGs/threadsNumber;
243 tULLInt S_t=jumpsNumber;
252 for(tInteger t=0;t<1000;t++) {
253 seed=mSeedDistribution.
random(mSeedGenerator);
257 for(tInteger t=0;t<coreIndex*threadsNumber;t++) {
258 seed=mSeedDistribution.
random(mSeedGenerator);
267 seed=mSeedDistribution.
random(mSeedGenerator);
281 std::stringstream ret;
282 ret<<
" number of stoachastic functions per core :" <<mFs.size()<<
" of type :"<<mFs[0]->toString()<<
"\n";
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
T random(RAND_RandomNumberGenerator< T1, G, D1 > &generator)
random a number
Definition: RAND_RandomNumberDistribution.h:116
void setSeed(const tULInt &seed)
initialize the seed of the random number generator
Definition: RAND_RandomNumberGenerator.h:107
This class implements a stochastic function with a normal law implemented from the boost library.
Definition: RNDB_MT19937.h:16
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: RNDB_MT19937.h:90
This class describes a multi stochastic functions based on same random number generator which impleme...
Definition: SM_MultiStochasticFunctionsInterface.h:18
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: SM_MultiStochasticFunctionsInterface.h:85
This class describes a multi stochastic functions based on same random number generator which impleme...
Definition: SM_MultiStochasticFunctions.h:26
F & operator[](const tInteger &threadId)
operator for getting stochatic function at thread id
Definition: SM_MultiStochasticFunctions.h:147
virtual void randomSeed(const tInteger &coresNumber, const tInteger &coreIndex) final
jump a number of virtual random number generator
Definition: SM_MultiStochasticFunctions.h:193
virtual void setSeed(const tULLInt &seed) final
void set seed
Definition: SM_MultiStochasticFunctions.h:172
virtual void jump(const tInteger &coresNumber, const tInteger &coreIndex, const tULLInt &jumpsNumber, const tULLInt &nRNGs) final
jump a number of virtual random number generator
Definition: SM_MultiStochasticFunctions.h:232
virtual tString toString() const override
return the string representation of the multi stochastic functions
Definition: SM_MultiStochasticFunctions.h:280
SM_MultiStochasticFunctions(void)
create
Definition: SM_MultiStochasticFunctions.h:53
virtual tInteger getSize() const final
get the number of stochastic functions
Definition: SM_MultiStochasticFunctions.h:165
virtual tMemSize getMemorySize() const override
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_MultiStochasticFunctions.h:87
static CORE_UniquePointer< SelfClass > New()
build a new instance of default class factory
Definition: SM_MultiStochasticFunctions.h:111
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: SM_MultiStochasticFunctions.h:99
virtual ~SM_MultiStochasticFunctions(void)
destroy
Definition: SM_MultiStochasticFunctions.h:66
virtual SM_StochasticFunctionsInterface & operator()(const tInteger &threadId) override
operator for getting stochatic function at thread id
Definition: SM_MultiStochasticFunctions.h:139
const F & operator[](const tInteger &threadId) const
operator for getting stochatic function at thread id
Definition: SM_MultiStochasticFunctions.h:154
virtual void setSeed() final
set seed
Definition: SM_MultiStochasticFunctions.h:181
This class describes a stochastic functions based on same random number generator which implement ran...
Definition: SM_StochasticFunctionsInterface.h:18