verve::globals Namespace Reference

Contains global functions. More...


Functions

real VERVE_CALL getAttributeReal (const TiXmlNode *nodePtr, const std::string &name)
int VERVE_CALL getAttributeInt (const TiXmlNode *nodePtr, const std::string &name)
bool VERVE_CALL getAttributeBool (const TiXmlNode *nodePtr, const std::string &name)
std::string VERVE_CALL getAttributeString (const TiXmlNode *nodePtr, const std::string &name)
real abs (real value)
real sqrt (real value)
real exp (real exponent)
real pow (real base, real exponent)
int roundToInt (real value)
real checkParamValid (real value, real rangeMin, real rangeMax, const std::string &callingFunction)
real calcDecayConstant (real decayPercent, real decayTime, real dt)
real calcDecayConstant (real timeConstant, real dt)
bool randomBool ()
int randomIntUniform (int min, int max)
real randomRealUniform (real min, real max)
real randomRealGauss (real variance)
real scaleZeroToOne (real value, real rangeMin, real rangeMax)
real scaleNegOneToOne (real value, real rangeMin, real rangeMax)


Detailed Description

Contains global functions.

Function Documentation

real verve::globals::abs real  value  )  [inline]
 

Returns the absolute value of a real number.

Definition at line 37 of file Globals.h.

real verve::globals::calcDecayConstant real  timeConstant,
real  dt
[inline]
 

Another method of calculating decay constants that uses time constants instead of "decay percents" and "decay times.".

Definition at line 168 of file Globals.h.

References calcDecayConstant(), and verve::VERVE_E.

real verve::globals::calcDecayConstant real  decayPercent,
real  decayTime,
real  dt
[inline]
 

This decay function calculates the decay constant necessary to reduce a value across the given dt at a rate of decayPercent per decayTime seconds.

For example, to decay some parameter p by 10% per 0.2 seconds across a dt of 0.01, simply call p *= calcDecayConstant(0.1, 0.2, 0.01). Here, p will asymptote to 0. Another way to use it is to decay the error between a desired/equilibrium value and the actual value: p += (1-calcDecayConstant(0.1, 0.2, 0.01)) * (desiredValue - p). This reduces the error between p's desired and actual value by 10% per 0.2 seconds across a dt of 0.01. Here, p will asymptote to its desired value. A constant for a faster rate of decay can be calculated by using a higher decayPercent and/or a lower decayTime (the combination of the two helps achieve a wider range of decay constants with limited numerical precision). Note that a decayPercent of 1 or a decayTime of 0 will always return 0, instantly decaying the parameter to 0.

Definition at line 146 of file Globals.h.

References pow().

Referenced by calcDecayConstant(), verve::PredictiveModel::setDeltaLearningRate(), verve::RLModule::setETraceTimeConstant(), verve::RLModule::setTDDiscountTimeConstant(), and verve::RLModule::setTDLearningRate().

real verve::globals::checkParamValid real  value,
real  rangeMin,
real  rangeMax,
const std::string &  callingFunction
[inline]
 

Checks whether the given value is within its acceptable range.

If not, it clamps the value and logs a warning message. Returns the (possibly clamped) value.

Definition at line 102 of file Globals.h.

References VERVE_LOGGER.

real verve::globals::exp real  exponent  )  [inline]
 

Returns the value of e raised to the given exponent.

Definition at line 57 of file Globals.h.

Referenced by verve::Neuron::updateFiringRateSigmoid().

bool VERVE_CALL verve::globals::getAttributeBool const TiXmlNode *  nodePtr,
const std::string &  name
 

Returns the boolean attribute value of the given name from the given XML node.

Valid string values are "true", "false", "1", and "0". Returns false and prints an error message if the attribute doesn't exist or if its value is not a valid string.

Definition at line 75 of file Globals.cpp.

References VERVE_LOGGER.

int VERVE_CALL verve::globals::getAttributeInt const TiXmlNode *  nodePtr,
const std::string &  name
 

Returns the integer attribute value of the given name from the given XML node.

Returns 0 and prints an error message if the attribute doesn't exist.

Definition at line 53 of file Globals.cpp.

References VERVE_LOGGER.

real VERVE_CALL verve::globals::getAttributeReal const TiXmlNode *  nodePtr,
const std::string &  name
 

Returns the real attribute value of the given name from the given XML node.

Returns 0 and prints an error message if the attribute doesn't exist.

Definition at line 31 of file Globals.cpp.

References VERVE_LOGGER.

std::string VERVE_CALL verve::globals::getAttributeString const TiXmlNode *  nodePtr,
const std::string &  name
 

Returns the string attribute value of the given name from the given XML node.

Returns an empty string and prints an error message if the attribute doesn't exist.

Definition at line 115 of file Globals.cpp.

References VERVE_LOGGER.

real verve::globals::pow real  base,
real  exponent
[inline]
 

Returns the value of the given base raised to the given exponent.

Definition at line 67 of file Globals.h.

Referenced by calcDecayConstant(), verve::RBFPopulation::computeMaxActivationSum(), and verve::RBFInputData::computeNumUniqueStates().

bool verve::globals::randomBool  )  [inline]
 

Returns a random boolean value with equal probability of being true or false.

Definition at line 182 of file Globals.h.

int verve::globals::randomIntUniform int  min,
int  max
[inline]
 

Returns a random integer between min and max using a uniform probability distribution.

Definition at line 196 of file Globals.h.

real verve::globals::randomRealGauss real  variance  )  [inline]
 

Returns a random real value using a normal (Gaussian) probability distribution with mean 0 and the given variance.

Variance = standard deviation^2. Originally from Numerical Recipes in C, Second Edition.

Definition at line 212 of file Globals.h.

References sqrt().

Referenced by verve::Projection::setInitialConnectionWeight().

real verve::globals::randomRealUniform real  min,
real  max
[inline]
 

Returns a random real value between min and max using a uniform probability distribution.

Definition at line 203 of file Globals.h.

int verve::globals::roundToInt real  value  )  [inline]
 

Rounds the value to the closest integer.

Definition at line 77 of file Globals.h.

real verve::globals::scaleNegOneToOne real  value,
real  rangeMin,
real  rangeMax
[inline]
 

Scales a real value linearly to the interval [-1, 1], given some range of possible values.

If the range is zero, returns zero. Values outside the given range will be clamped.

Definition at line 281 of file Globals.h.

References scaleZeroToOne().

real verve::globals::scaleZeroToOne real  value,
real  rangeMin,
real  rangeMax
[inline]
 

Scales a real value linearly to the interval [0, 1], given some range of possible values.

If the range is zero, returns zero. Values outside the given range will be clamped.

Definition at line 245 of file Globals.h.

Referenced by scaleNegOneToOne().

real verve::globals::sqrt real  value  )  [inline]
 

Returns the square root of a real number.

Definition at line 47 of file Globals.h.

Referenced by randomRealGauss().


Generated on Tue Jan 24 21:46:40 2006 for Verve by  doxygen 1.4.6-NO