Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

cps::GaussianRandomGenerator Class Reference

A random number generator generating gaussian random numbers. More...

#include <random.h>

Inherits cps::RandomGenerator.

Inherited by cps::UGrandomGenerator.

List of all members.

Public Member Functions

 GaussianRandomGenerator (IFloat s2=1.0)
 ~GaussianRandomGenerator ()
IFloat Rand (int noexit=0)
int RNGints () const
 Number of Integers in RNG, that should be stored to record status.
int RNGIFloats () const
void store (int *buf)
 to store this object
void load (int *buf)
 to load from file

Static Public Member Functions

void SetSigma (IFloat s2)
 Sets the variance of the distribution.


Detailed Description

A random number generator generating gaussian random numbers.

The mean of the distribution is 0; the variance is defined in the constructor. It is based on the Box-Muller algorithm (see "Numerical Recipes in C" pp.289).

This should be inherited by UGrandomGenerator class rather than used directly.

Definition at line 165 of file random.h.


Constructor & Destructor Documentation

cps::GaussianRandomGenerator::GaussianRandomGenerator IFloat  s2 = 1.0  )  [inline]
 

The default variance is 1.0.

Parameters:
s2 the variance of the gaussian distribution.

Definition at line 177 of file random.h.

cps::GaussianRandomGenerator::~GaussianRandomGenerator  )  [inline]
 

Definition at line 179 of file random.h.


Member Function Documentation

void cps::GaussianRandomGenerator::load int *  buf  )  [inline]
 

to load from file

Reimplemented from cps::RandomGenerator.

Definition at line 204 of file random.h.

References cps::ERR, and cps::Error::General().

Referenced by cps::SerialIO::load(), cps::ParallelIO::load(), cps::SerialIO::store(), and cps::ParallelIO::store().

IFloat cps::GaussianRandomGenerator::Rand int  noexit = 0  ) 
 

Precondition:
::Reset must have already been called.
Returns:
A random number from a gaussian distribution with zero mean.

Definition at line 71 of file random_asm.C.

References cps::ERR, cps::MPISCU::fprintf(), cps::Error::General(), cps::IFloat, cps::Verbose::Result(), and cps::VRB.

int cps::GaussianRandomGenerator::RNGIFloats  )  const [inline]
 

Definition at line 192 of file random.h.

int cps::GaussianRandomGenerator::RNGints  )  const [inline, virtual]
 

Number of Integers in RNG, that should be stored to record status.

Reimplemented from cps::RandomGenerator.

Reimplemented in cps::UGrandomGenerator.

Definition at line 191 of file random.h.

void cps::GaussianRandomGenerator::SetSigma IFloat  s2  )  [inline, static]
 

Sets the variance of the distribution.

Parameters:
s2 the variance of the gaussian distribution.

Reimplemented in cps::UGrandomGenerator.

Definition at line 185 of file random.h.

void cps::GaussianRandomGenerator::store int *  buf  )  [inline]
 

to store this object

Reimplemented from cps::RandomGenerator.

Definition at line 195 of file random.h.

References cps::ERR, and cps::Error::General().

Referenced by cps::SerialIO::store(), and cps::ParallelIO::store().


The documentation for this class was generated from the following files:
Generated on Sat Oct 10 14:12:14 2009 for Columbia Physics System by  doxygen 1.3.9.1