COPASI API
4.40.278
|
#include <CRandom.h>
Classes | |
struct | ExpVars |
struct | PoissonVars |
Public Types | |
enum | Type { r250 = 0 , mt19937 , mt19937HR , unkown } |
Static Public Member Functions | |
static CRandom * | createGenerator (CRandom::Type type=CRandom::mt19937, unsigned C_INT32 seed=0) |
static unsigned C_INT32 | getSystemSeed () |
Static Public Attributes | |
static const std::string | TypeName [] |
static const char * | XMLType [] |
Protected Member Functions | |
CRandom () | |
void | setModulus (const unsigned C_INT32 &modulus) |
Protected Attributes | |
C_FLOAT64 | mFloat |
unsigned C_INT32 | mModulus |
C_FLOAT64 | mModulusInv |
C_FLOAT64 | mModulusInv1 |
C_INT32 | mNumberS |
unsigned C_INT32 | mNumberU |
CRandom::Type | mType |
Private Member Functions | |
C_FLOAT64 | fsign (C_FLOAT64 num, C_FLOAT64 sign) |
unsigned int & | syscall (int arg1) |
Private Attributes | |
ExpVars | vare |
PoissonVars | varp |
enum CRandom::Type |
|
protected |
Default/Named constructor. Seeds the random number generator with the given seed.
References CRandom::PoissonVars::a0, CRandom::PoissonVars::a1, CRandom::PoissonVars::a2, CRandom::PoissonVars::a3, CRandom::PoissonVars::a4, CRandom::PoissonVars::a5, CRandom::PoissonVars::a6, CRandom::PoissonVars::a7, CRandom::PoissonVars::fact, CRandom::PoissonVars::muold, CRandom::PoissonVars::muprev, CRandom::ExpVars::q, CRandom::ExpVars::q1, vare, and varp.
|
virtual |
The destructor.
CRandom * CRandom::copy | ( | ) |
Create a copy of the generator
References createGenerator(), getRandomU(), and mType.
|
static |
Create a Generator. Note: the returned object has to be released after use with delete
CRandom::Type | type (default Mersenne Twister) |
const | C_INT32 & seed (default system generated seed) |
References getSystemSeed(), mt19937, mt19937HR, mType, and r250.
Referenced by CEvaluationNodeFunction::CEvaluationNodeFunction(), copy(), CPraxis::CPraxis(), CDirEntry::createTmpName(), CScanMethod::CScanMethod(), CStochMethod::CStochMethod(), CTrajectoryMethodDsaLsodar::CTrajectoryMethodDsaLsodar(), COptMethodCoranaWalk::initialize(), COptMethodSA::initialize(), COptPopulationMethod::initialize(), CRandomSearch::initialize(), and CCopasiSpringLayout::randomize().
Referenced by getRandomPoisson().
const unsigned C_INT32 & CRandom::getModulus | ( | ) | const |
|
virtual |
Produces a uniformly distributed random number in 0 <= x <= 1.
Reimplemented in Cr250, Cmt19937HR, and Cmt19937.
References getRandomU(), and mModulusInv.
Referenced by COptMethodPS::create(), CTauLeapMethod::doSingleStep(), getRandomExp(), getRandomPoisson(), COptItem::getRandomValue(), COptMethodPS::move(), CPraxis::operator()(), COptMethodCoranaWalk::optimise(), COptMethodSA::optimise(), CCopasiSpringLayout::randomize(), randomlyPlaceGlyphInCompartmentGlyph(), randomlyPlaceGlyphInDimensions(), and CScanItemRandom::step().
|
virtual |
Produces a uniformly distributed random number in 0 <= x < 1. Note: 0 < x <= 1 may be achieved by 1.0 - getRandomCO().
Reimplemented in Cr250, Cmt19937HR, and Cmt19937.
References getRandomU(), and mModulusInv1.
Referenced by COptMethodCoranaWalk::optimise(), and COptMethodSA::optimise().
|
virtual |
References CRandom::ExpVars::a, getRandomCC(), CRandom::ExpVars::i, CRandom::ExpVars::q, CRandom::ExpVars::q1, CRandom::ExpVars::sexpo, CRandom::ExpVars::u, CRandom::ExpVars::umin, CRandom::ExpVars::ustar, and vare.
Referenced by getRandomPoisson().
References getRandomStdGamma().
Referenced by CEvaluationNodeFunction::rgamma(), and CScanItemRandom::step().
Produces a Normally distributed random number with Mean=mean and SD=sd
const | C_FLOAT64 & mean |
const | C_FLOAT64 & sd |
References getRandomNormal01().
Referenced by COptMethodPS::create(), getRandomNormalPositive(), COptItem::getRandomValue(), and CEvaluationNodeFunction::rnormal().
|
virtual |
Produces a Normally distributed random number with mean=0 and SD=1
References C_FLOAT64, and getRandomOO().
Referenced by getRandomNormal(), getRandomNormalLog(), getRandomPoisson(), getRandomStdGamma(), and CScanItemRandom::step().
Produces a Normally distributed random number with Mean=mean and SD=sd in Logarithmic scale
References getRandomNormal01().
Produces a Strictly Positive Normally distributed random number with Mean=mean and SD=sd
const | C_FLOAT64 & mean |
const | C_FLOAT64 & sd |
References C_FLOAT64, and getRandomNormal().
|
virtual |
Produces a uniformly distributed random number in 0 < x < 1.
Reimplemented in Cr250, Cmt19937HR, and Cmt19937.
References getRandomU(), and mModulusInv1.
Referenced by CTrajAdaptiveSA::doSingleSSAStep(), CTrajectoryMethodDsaLsodar::doSingleStep(), CStochDirectMethod::doSingleStep(), CTrajAdaptiveSA::doSingleTauLeapStep(), CHybridMethodODE45::fireReaction(), CStochMethod::generateReactionIndex(), CStochMethod::generateReactionTime(), CHybridMethod::generateReactionTime(), getRandomNormal01(), getRandomStdGamma(), CHybridMethodODE45::getReactionToFire(), CEvaluationNodeFunction::runiform(), and CHybridMethodODE45::start().
Produces a Poisson distributed random number with Mean=mean
const | C_FLOAT64 & mean |
References CRandom::PoissonVars::a0, CRandom::PoissonVars::a1, CRandom::PoissonVars::a2, CRandom::PoissonVars::a3, CRandom::PoissonVars::a4, CRandom::PoissonVars::a5, CRandom::PoissonVars::a6, CRandom::PoissonVars::a7, CRandom::PoissonVars::b1, CRandom::PoissonVars::b2, CRandom::PoissonVars::c, CRandom::PoissonVars::c0, CRandom::PoissonVars::c1, CRandom::PoissonVars::c2, CRandom::PoissonVars::c3, CRandom::PoissonVars::d, CRandom::PoissonVars::del, CRandom::PoissonVars::difmuk, CRandom::PoissonVars::e, CRandom::PoissonVars::fact, CRandom::PoissonVars::fk, fsign(), CRandom::PoissonVars::fx, CRandom::PoissonVars::fy, CRandom::PoissonVars::g, getRandomCC(), getRandomExp(), getRandomNormal01(), CRandom::PoissonVars::ignpoi, CRandom::PoissonVars::j, CRandom::PoissonVars::k, CRandom::PoissonVars::kflag, CRandom::PoissonVars::l, CRandom::PoissonVars::ll, CRandom::PoissonVars::m, max, min, CRandom::PoissonVars::muold, CRandom::PoissonVars::muprev, CRandom::PoissonVars::omega, CRandom::PoissonVars::p, CRandom::PoissonVars::p0, CRandom::PoissonVars::pp, CRandom::PoissonVars::px, CRandom::PoissonVars::py, CRandom::PoissonVars::q, CRandom::PoissonVars::s, CRandom::PoissonVars::t, CRandom::PoissonVars::u, CRandom::PoissonVars::v, varp, CRandom::PoissonVars::x, and CRandom::PoissonVars::xx.
Referenced by CTauLeapMethod::doSingleStep(), CTrajAdaptiveSA::doSingleTauLeapStep(), CEvaluationNodeFunction::rpoisson(), and CScanItemRandom::step().
|
virtual |
Get a random number in 0 <= n <= max Note: max must be smaller than Modulus (no check for performance)
const | C_INT32 & max |
References C_INT32, getRandomU(), max, and mModulus.
References C_FLOAT64, getRandomNormal01(), and getRandomOO().
Referenced by getRandomGamma().
|
virtual |
Get a random number in 0 <= n <= Modulus
Reimplemented in Cr250, and Cmt19937.
References fatalError, and mNumberU.
Referenced by copy(), CDirEntry::createTmpName(), CMathEventQueue::getAction(), getRandomCC(), getRandomCO(), getRandomOO(), getRandomS(), getRandomU(), CPermutation::pick(), CStochasticRungeKuttaRI5::randomIHat(), CStochasticRungeKuttaRI5::randomITilde(), and CPermutation::shuffle().
Get a random number in 0 <= n <= max Note: max must be smaller than Modulus (no check for performance)
const | unsigned C_INT32 & max |
References C_INT32, getRandomU(), max, and mModulus.
|
static |
get a system dependend seed (hopefully random)
References C_INT32, CCopasiTimeVariable::getCurrentWallTime(), CCopasiTimeVariable::getMicroSeconds(), and syscall().
Referenced by createGenerator(), and CCopasiSpringLayout::randomize().
const CRandom::Type & CRandom::getType | ( | ) | const |
|
virtual |
Initialize or reinitialize the random number generator with the given seed.
unsigned | C_INT32 seed (default system seed) |
Reimplemented in Cr250, and Cmt19937.
References fatalError.
Referenced by CHybridMethod::start(), CHybridMethodODE45::start(), CStochDirectMethod::start(), CStochMethod::start(), CTauLeapMethod::start(), and CTrajAdaptiveSA::start().
|
protected |
Set the Modulus
References mModulus, mModulusInv, and mModulusInv1.
Referenced by Cmt19937::Cmt19937(), and Cr250::Cr250().
|
private |
Referenced by getSystemSeed().
|
protected |
A 64-bit floating point random number.
Referenced by Cmt19937::genrand_res53(), Cmt19937HR::getRandomCC(), Cmt19937HR::getRandomCO(), and Cmt19937HR::getRandomOO().
|
protected |
Referenced by getModulus(), getRandomS(), getRandomU(), and setModulus().
|
protected |
Referenced by Cr250::getRandomCC(), getRandomCC(), and setModulus().
|
protected |
Referenced by getRandomCO(), Cr250::getRandomOO(), getRandomOO(), and setModulus().
|
protected |
A signed 32-bit integer random number.
|
protected |
A unsigned 32-bit integer random number.
Referenced by Cr250::dr250(), Cmt19937::getRandomCC(), Cmt19937::getRandomCO(), Cmt19937::getRandomOO(), Cmt19937::getRandomS(), Cmt19937::getRandomU(), getRandomU(), Cr250::r250(), and Cr250::r250n().
|
protected |
The type of the generator
Referenced by copy(), createGenerator(), and getType().
|
static |
String literals for the GUI to display type names of random number generators known to COPASI.
|
private |
Referenced by CRandom(), and getRandomExp().
|
private |
Referenced by CRandom(), and getRandomPoisson().
|
static |
XML type names of random number generators known to COPASI.