
Definition in file MathFunctions.C.
#include "Util/MathFunctions.H"
#include "Util/log.H"
#include <cmath>
#include <sys/types.h>
#include <unistd.h>
Include dependency graph for MathFunctions.C:

Go to the source code of this file.
Functions | |
| bool | isFinite (const byte &arg) |
| Function to check for finite value. | |
| bool | isFinite (const int16 &arg) |
| Function to check for finite value. | |
| bool | isFinite (const int32 &arg) |
| Function to check for finite value. | |
| bool | isFinite (const float &arg) |
| Function to check for finite value. | |
| bool | isFinite (const double &arg) |
| Function to check for finite value. | |
| void | initRandomNumbers () |
| Initialize random seeds from pseudo-random sources (e.g. time(), getpid()). | |
| void | initRandomNumbersZero () |
| Initialize random seeds with zero, to produce deterministic pseudo-random sequences. | |
| double | randomDouble () |
| Generate a random double in [0.0,1.0). | |
| double | randomDoubleFromNormal (const double s) |
| Generate a random double from a normal distribution with mean zero and standard deviation s. | |
| int | randomUpToIncluding (const int n) |
| Generate a random integer in [0,n] (i.e., including n). | |
| int | randomUpToNotIncluding (const int n) |
| Generate a random integer in [0,n) (i.e., not including n). | |
| double | ran2 (int &idum) |
| Random number generator from Numerical Recipes in C book. | |
| int | getIdum (const bool useRandom) |
| Get a random seed for ran2. | |
| double | gasdev (int &idum) |
| Randomly distributed Gaussian deviate with zero mean and unit variance. | |
| double | expdev (int &idum) |
| Randomly distributed Exponential deviate. | |
| double | lngamma (double x) |
| Compute log of Gamma. | |
| double | poisson (const unsigned int k, const double mu) |
| Compute probability of drawing a value k from a Poisson of mean mu. | |
| double | AUC (const float *model, const float *rand, size_t sm, size_t sr, const double step) |
|
|
Randomly distributed Exponential deviate.
Definition at line 204 of file MathFunctions.C. |
|
|
Randomly distributed Gaussian deviate with zero mean and unit variance.
Definition at line 181 of file MathFunctions.C. References log(), ran2(), and sqrt(). Referenced by ObjRec::generateNewEdgeState(), ObjRec::generateNewLineState(), getImage(), World2DInput::getLineOri(), and IRobotSim::getSensors(). |
|
|
Get a random seed for ran2. If useRandom is true, a random negative number will be return, otherwise a negative number that is always the same will be returned. Definition at line 172 of file MathFunctions.C. Referenced by ObjRec::generateNewEdgeState(), ObjRec::generateNewLineState(), getImage(), World2DInput::getLineOri(), and IRobotSim::getSensors(). |
|
|
Initialize random seeds from pseudo-random sources (e.g. time(), getpid()).
Definition at line 68 of file MathFunctions.C. Referenced by BeeStemSim::BeeStemSim(), Contour::Contour(), Geons3D::Geons3D(), ObjRecBOF::getCodeWords(), SeaBee3MainDisplayForm::init(), main(), Objects::Objects(), ModelManager::paramChanged(), SimulationViewerI::run(), SceneGenerator::SceneGenerator(), Staircase::start2(), ObjRec::start2(), submain(), TwoHalfDSketch::TwoHalfDSketch(), and World2DInput::World2DInput(). |
|
|
Initialize random seeds with zero, to produce deterministic pseudo-random sequences.
Definition at line 77 of file MathFunctions.C. Referenced by ModelManager::paramChanged(). |
|
|
Function to check for finite value.
Definition at line 51 of file MathFunctions.C. |
|
|
Function to check for finite value.
Definition at line 50 of file MathFunctions.C. |
|
|
Function to check for finite value.
Definition at line 47 of file MathFunctions.C. |
|
|
Function to check for finite value.
Definition at line 46 of file MathFunctions.C. |
|
|
Function to check for finite value.
Definition at line 45 of file MathFunctions.C. |
|
|
Compute log of Gamma.
Definition at line 215 of file MathFunctions.C. References D_LOG_SQRT_2_PI, and log(). Referenced by poisson(). |
|
||||||||||||
|
Compute probability of drawing a value k from a Poisson of mean mu.
Definition at line 250 of file MathFunctions.C. References exp(), lngamma(), and log(). Referenced by SurpriseModelOD::surprise(). |
|
|
Random number generator from Numerical Recipes in C book. Long period >2x10^18 random number generator of L Ecuyer with Bays-Durham shuffle. Return a uniform deviate in the interval (0,1). Call with int variable as argument set to a negative value, and don't change this variable between calls unless you want to reseed the generator. You can get ain initial seed using the function getIdum() Definition at line 130 of file MathFunctions.C. References temp. |
|
|
Generate a random double in [0.0,1.0). This is a thin wrapper around drand48() or rand(), depending on which is available on the build platform. Definition at line 86 of file MathFunctions.C. References Dlist::rand(). Referenced by WTAwinner::buildFromSMcoords(), createCloud(), doAction(), lobot::doctored(), generateInput(), World2DInput::getLineOri(), getTargetPos(), Staircase::getValues(), image_patch(), inplaceAddBGnoise2(), inplaceSpeckleNoise(), likelihood(), main(), lobot::random_time_to_impact(), randomDoubleFromNormal(), BPnnet::randomizeWeights(), randomUpToNotIncluding(), V4d::resampleParticles(), V4::resampleParticles(), IT::resampleParticles(), HippocampusI::resampleParticles(), sample(), ObjRec::samplePosterior(), Beowulf::send(), and submain(). |
|
|
Generate a random double from a normal distribution with mean zero and standard deviation s. This function call randomDouble() 12 times to sample from normal distribution Definition at line 96 of file MathFunctions.C. References i, randomDouble(), and sum. Referenced by Particle::drift_angle(), Particle::drift_position(), Contour::evolve(), MapperI::moveParticles(), V4d::proposeParticles(), V4::proposeParticles(), IT::proposeParticles(), V4d::proposeParticlesHarris(), TwoHalfDSketch::proposeState(), Objects::proposeState(), HarrierSim::simLoop(), BeoHawkSim::simLoop(), HippocampusI::updateParticleMotion(), and SeaBee3Simulator::updateSensors(). |
|
|
Generate a random integer in [0,n] (i.e., including n). This is a thin wrapper around lrand48() or rand(), depending on which is available on the build platform. Definition at line 106 of file MathFunctions.C. References randomUpToNotIncluding(). Referenced by calcGradient(), ArmPlanner::calcGradient(), Contour::Contour(), BeeStemSim::getSensors(), gibbsSampling(), ArmPlanner::gibbsSampling(), inplaceColorSpeckleNoise(), main(), randArmMove(), and SimulationViewerI::run(). |
|
|
Generate a random integer in [0,n) (i.e., not including n). This is a thin wrapper around lrand48() or rand(), depending on which is available on the build platform. Definition at line 112 of file MathFunctions.C. References randomDouble(). Referenced by PsychoDisplay::displayEyeTrackerCalibration(), ObjRecBOF::getCodeWords(), World2DInput::getLineLength(), ImageSpring< T >::getStats(), ImageSpring< T >::getStatsDist(), SimulationViewerCompress::getTraj(), inplaceColorSpeckleNoise(), main(), World2DInput::placeSquare(), randomUpToIncluding(), randShuffle(), ObjRec::sampleOriFromEdgeSpace(), ObjRec::sampleOriFromLineSpace(), ObjRec::samplePosFromEdgeSpace(), ObjRec::samplePosFromLineSpace(), ObjRec::samplePosterior(), ObjRec::sampleSizeFromLineSpace(), SimulationViewerStats::save1(), scramble(), and submain(). |
1.4.4