Diffpack Documentation


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

ProbDistr Class Reference

general base class for probability distributions. More...

#include <ProbDistr.h>

Inheritance diagram for ProbDistr::

HandleId DetermDistr NormalDistr UniformDistr LogNormalDistr List of all members.

Public Methods

 ProbDistr (const ProbDistr_prm &prm)
virtual real f (real x)=0
virtual real F (real x)=0
virtual real Finv (real p)=0
virtual real expec ()=0
virtual real stdev ()=0

Public Attributes

Handle(ProbDistr_prmpm

Protected Methods

bool ok (int n)

Detailed Description

general base class for probability distributions.

NAME: ProbDistr - general base class for probability distributions

DESCRIPTION:

The class enables, together with class "ProbDistr_prm", a unified interface to all probability distribution classes. In a typically subclass, implementing a particular distribution, the density and cumulative distribution functions are static. This base class defines coexisting virtual versions of the density, cumulative and inverse cumulative functions. The user can hence choose the most convenient implementation, either static versions (which behaves like standard C functions and can be represented by simple function pointers) or the virtual versions (which enables object-oriented programming and the use of a ""general"" distribution class, provided that a "ProbDistr_prm" object is supplied at construction time).

In subclasses, the static distribution functions usually reflect a ""normalized"" distribution, with as few parameters as possible. The virtual versions, on the ohter hand, make use of the internal "ProbDistr_prm" object and allows all legal parameters for a distribution to be set. For example, in class "NormalDistr", the static versions return values from the standardized normal distribution (with zero mean and unit variance), while the virtual distribution functions return a normal variate with expectation and standard deviation accoring to "pm(1)" and "pm(2)" in the internal "ProbDistr_prm" object "pm".

A "VecSimplest(Handle(ProbDistr))" class is available for the case where one has a collection of random variables with different distributions.


Constructor & Destructor Documentation

ProbDistr::ProbDistr ( const ProbDistr_prm & prm ) [inline]
 


Member Function Documentation

real ProbDistr::F ( real x ) [pure virtual]
 

returns the value of the cumulative distribution function.

Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr.

real ProbDistr::Finv ( real p ) [pure virtual]
 

returns the value of the inverse of the cumulative distribution function.

Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr.

real ProbDistr::expec ( ) [pure virtual]
 

returns the expectation (mean).

Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr.

real ProbDistr::f ( real x ) [pure virtual]
 

returns the value of the density function.

Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr.

bool ProbDistr::ok ( int n ) [protected]
 

real ProbDistr::stdev ( ) [pure virtual]
 

returns the standard deviation.

Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr.


Member Data Documentation

Handle(ProbDistr_prm) ProbDistr::pm
 


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