Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

ProbDistr_prm Class Reference

name and parameters of a probability distribution. More...

#include <ProbDistr_prm.h>

Inheritance diagram for ProbDistr_prm::

HandleId List of all members.

Public Methods

virtual ~ProbDistr_prm ()
 ProbDistr_prm (const ProbDistr_prm &pm)
real operator() (int i) const
void operator= (const ProbDistr_prm &pm)
void scan (Is is)
String print () const
void print (Os os) const
virtual ProbDistrcreate () const
const StringListhier () const

Static Public Methods

ProbDistr_prm* construct ()
const StringListhierStatic ()
void registerPrmSubclass (ProbDistr_prm &sc)
void unregisterPrmSubclass ()

Public Attributes

String init_str
String distribution
VecSimple(real) parameters

Protected Methods

virtual ProbDistr_prm* clone ()
 ProbDistr_prm ()

Protected Attributes

StringList subclasses

Static Protected Attributes

Handle(ProbDistr_prmmaster

Friends

Isoperator>> (Is &is, ProbDistr_prm &pm)
Osoperator<< (Os &os, const ProbDistr_prm &pm)

Detailed Description

name and parameters of a probability distribution.

NAME: ProbDistr_prm - name and parameters of a probability distribution

DESCRIPTION:

The class contains the name of a specified probability distribution and an array containing its parameters. A class object can be used as ""general"" input to "RandGen generate" for generating random variates of a particular probability distribution. To initialize the object, the user supplies an "Is" with information with a particular syntax. First the name of the distribution (as a "String") and then its parameters enclosed in parenthesis () and separated by commas, e.g., "NormalDistr(2.0,3)" means the normal distribution with mean 2 and standard deviation 3. The proper name "NormalDistr" is the name of the class implementing the distribution in question. A more convenient form "Normal(2,0.3)" is also allowed ("ProbDistr_prm" will then add the "Distr" term). It is the user''s responsibility to supply a consistent set of parameters. For example, errors like "NormalDistr(3)" result in undefined behavior, probably an error message ''"index out of bounds"'' from "ProbDistr_prm operator ()".

The implemented probability distributions are the normal distribution ("NormalDistr"), the lognormal distribution ("LogNormalDistr"), the uniform distribution ("UniformDistr") and deterministic numbers ("DetermDistr"). The "DetermDistr" type is very convenient when some parameters in a program are to be chosen as stochastic and others are not, at run-time. "DetermDistr(3.4)" is the syntax for the deterministic number 3.4 (the associated probability density is the dirac delta function located at x-3.4).

The main application of the class aims at user-friendly input of probability distributions and their parameters. It is convenient to have a menu item for the name and the parameters and extract the data using the "ProbDistr_prm scan" function on the input string. The distribution can then be created on basis of the parameter information. Using a distribution object of class "ProbDistr", one can easily generate random numbers from "RandGen generate(ProbDistr&)".

A "VecSimplest(Handle(ProbDistr_prm))" class is available for collecting probability distribution information for a set of random variables.


Constructor & Destructor Documentation

ProbDistr_prm::ProbDistr_prm ( ) [protected]
 

See documentation of one of the overloaded constructor.

ProbDistr_prm::~ProbDistr_prm ( ) [inline, virtual]
 

ProbDistr_prm::ProbDistr_prm ( const ProbDistr_prm & pm )
 

See documentation of one of the overloaded constructor.


Member Function Documentation

ProbDistr_prm * ProbDistr_prm::clone ( ) [inline, protected, virtual]
 

ProbDistr_prm * ProbDistr_prm::construct ( ) [static]
 

ProbDistr * ProbDistr_prm::create ( ) const [virtual]
 

const StringList & ProbDistr_prm::hier ( ) const [inline]
 

const StringList & ProbDistr_prm::hierStatic ( ) [inline, static]
 

real ProbDistr_prm::operator() ( int i ) const
 

void ProbDistr_prm::operator= ( const ProbDistr_prm & pm )
 

void ProbDistr_prm::print ( Os os ) const
 

String ProbDistr_prm::print ( ) const
 

void ProbDistr_prm::registerPrmSubclass ( ProbDistr_prm & sc ) [inline, static]
 

void ProbDistr_prm::scan ( Is is )
 

void ProbDistr_prm::unregisterPrmSubclass ( ) [inline, static]
 


Friends And Related Function Documentation

Os & operator<< ( Os & os,
const ProbDistr_prm & pm ) [friend]
 

Is & operator>> ( Is & is,
ProbDistr_prm & pm ) [friend]
 


Member Data Documentation

String ProbDistr_prm::distribution
 

String ProbDistr_prm::init_str
 

Handle(ProbDistr_prm) ProbDistr_prm::master [static, protected]
 

VecSimple(real) ProbDistr_prm::parameters
 

StringList ProbDistr_prm::subclasses [protected]
 


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.