STK++ 1.0

STK::Law::ILawReal Class Reference

#include <STK_Law_ILawReal.h>

Inheritance diagram for STK::Law::ILawReal:

List of all members.

Public Member Functions

virtual ~ILawReal ()
virtual Real rand () const =0
virtual Real icdf (Real const &p) const =0
 inverse cumulative distribution function Compute the Real quantile t such that the probability of a random variate less to t is less or equal to p.
template<class TContainer1D >
void rand1D (ITContainer1D< Real, TContainer1D > &A) const
template<class TContainerHo , class TContainerVe , class TContainer2D >
void rand (ITContainer2D< Real, TContainerHo, TContainerVe, TContainer2D > &A) const

Protected Member Functions

 ILawReal (String const &name=Arithmetic< String >::NA())

Detailed Description

Interface base class for the Real probabilities laws. Every derived class have to furnish :

  • a random generator method
     Real rand() const 
    
  • a quantile method (inverse cdf)
     Real icdf(Real const& p) const 
    
    .

The derived objects should also furnish the same static functions. Instantiation of a derived object is interesting when one want to simulate independent identical distributed random variates : the creation of the object initialize all parameter-dependent variables.

Definition at line 59 of file STK_Law_ILawReal.h.


Constructor & Destructor Documentation

STK::Law::ILawReal::ILawReal ( String const &  name = Arithmetic<String>::NA()) [inline, protected]

constructor

Parameters:
namename of the law

Definition at line 66 of file STK_Law_ILawReal.h.

            : IUnivariate(name)
    { ;}
virtual STK::Law::ILawReal::~ILawReal ( ) [inline, virtual]

Virtual destructor.

Definition at line 74 of file STK_Law_ILawReal.h.

{ ;}

Member Function Documentation

virtual Real STK::Law::ILawReal::rand ( ) const [pure virtual]

Generate a Real random variate.

Implemented in STK::Law::Cauchy, and STK::Law::Normal.

Referenced by rand(), rand1D(), and STK::LinearAAModel::simul().

virtual Real STK::Law::ILawReal::icdf ( Real const &  p) const [pure virtual]

inverse cumulative distribution function Compute the Real quantile t such that the probability of a random variate less to t is less or equal to p.

Parameters:
pvalue of the probability

Implemented in STK::Law::Cauchy, and STK::Law::Normal.

template<class TContainer1D >
void STK::Law::ILawReal::rand1D ( ITContainer1D< Real, TContainer1D > &  A) const [inline]

Pseudo-random Real law generator for a one dimensional container of Real.

Parameters:
Athe container to store the random numbers

Definition at line 93 of file STK_Law_ILawReal.h.

References STK::IContainer1D::first(), STK::IContainer1D::last(), and rand().

    {
      // get dimensions
      const Integer first = A.first(), last = A.last();
      // generate and set random variables
      for (Integer i=first; i<=last; i++) A[i] = rand();
    }
template<class TContainerHo , class TContainerVe , class TContainer2D >
void STK::Law::ILawReal::rand ( ITContainer2D< Real, TContainerHo, TContainerVe, TContainer2D > &  A) const [inline]

Pseudo-random Real law generator for a two dimensional container of Real.

Parameters:
Athe container to store the random numbers

Definition at line 106 of file STK_Law_ILawReal.h.

References STK::IContainer2D::firstCol(), STK::IContainer2D::firstRow(), STK::IContainer2D::lastCol(), STK::IContainer2D::lastRow(), and rand().

    {
      // get dimensions
      const Integer first_row = A.firstRow(), last_row = A.lastRow();
      const Integer first_col = A.firstCol(), last_col = A.lastCol();
      // generate and set random variables
      for (Integer j=first_col; j<=last_col; j++)
        for (Integer i=first_row; i<=last_row; i++)
          A(i, j) = rand();
    }

The documentation for this class was generated from the following file: