Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
Public Member Functions | Protected Attributes | List of all members
multiDimHomTransition Class Reference

Class for multidimensional, homogeneous random walk transition structures. These are characterized by. More...

#include <multiDimHomTransition.h>

Inheritance diagram for multiDimHomTransition:
transitionStructure transitionStructure

Public Member Functions

 multiDimHomTransition (int nbDims, int *dimSize, double *p, double *q)
 General constructor of the class. More...
 
 ~multiDimHomTransition ()
 Destructor of the class. More...
 
int dimSize (int d)
 Read accessor for the size of the state space in each dimension. More...
 
double p (int d)
 Read accessor for the jump probability to the right in each dimension. More...
 
double q (int d)
 Read accessor for the jump probability to the right in each dimension. More...
 
bool setEntry (int i, int j, double val)
 Method to set the value associated with some transition. Not applicable here. More...
 
double getEntry (int i, int j)
 Method to get the value associated with some transition. More...
 
int getNbElts (int i)
 Method to get the number of non-zero entries in a transition from some state. This can be seen as the number of actually possible transitions from that state. More...
 
int getCol (int i, int k)
 Method to get the number of the state corresponding to transition number k in the list of possible transitions from some state i. More...
 
double getEntryByCol (int i, int k)
 Method to get the value attached to transition number k in the list of possible transitions from some state i. More...
 
discreteDistributiongetTransDistrib (int i)
 Method to get the transition from some state as a probability distribution. More...
 
double rowSum (int i)
 Sum of entries on some row i. Always 1.0 since this is a discrete-time transition structure. More...
 
multiDimHomTransitioncopy ()
 Copying a transition structure. More...
 
multiDimHomTransitionuniformize ()
 Uniformizing a transition structure. Since the origin structure is already of discrete-time type, a copy is returned. More...
 
void evaluateMeasure (double *d, double *res)
 Computing the action of the transition structure on some measure, the measure being represented as a vector of real numbers. This corresponds to the multiplication vector/matrix, the row vector being interpreted as a signed measure. The result is placed in an array that must have been previously allocated. More...
 
void evaluateMeasure (discreteDistribution *d, discreteDistribution *res)
 Computing the action of the transition structure on some probability distribution. More...
 
void evaluateValue (double *v, double *res)
 Computing the action of the transition structure on some vector of values. This corresponds to the multiplication matrix/vector, the column vector being interpreted as a vector of values attached to the states. More...
 
void write (FILE *out, string format)
 Output method for the transition structure. Supported formats are: XBORNE, MARCA, Ers, Maple. More...
 
discreteDistributiongetJumpDistribution ()
 Getting a discrete distribution representing the generic jumps. The distribution has 2*nbDims + 1 values: 0, +/- 1, ..., +/- nDims. The coding is: More...
 
 multiDimHomTransition (int nbDims, int *dimSize, double *p, double *q)
 General constructor of the class. More...
 
 ~multiDimHomTransition ()
 Destructor of the class. More...
 
int dimSize (int d)
 Read accessor for the size of the state space in each dimension. More...
 
double p (int d)
 Read accessor for the jump probability to the right in each dimension. More...
 
double q (int d)
 Read accessor for the jump probability to the right in each dimension. More...
 
bool setEntry (int i, int j, double val)
 Method to set the value associated with some transition. More...
 
double getEntry (int i, int j)
 Method to get the value associated with some transition. When state parameters are out of bounds, the returned value should be 0. More...
 
int getNbElts (int i)
 Method to get the number of non-zero entries in a transition from some state. This can be seen as the number of actually possible transitions from that state. More...
 
int getCol (int i, int k)
 Method to get the number of the state corresponding to transition number k in the list of possible transitions from some state i. More...
 
double getEntryByCol (int i, int k)
 Method to get the value attached to transition number k in the list of possible transitions from some state i. More...
 
discreteDistributiongetTransDistrib (int i)
 Method to get the transition from some state as a probability distribution. More...
 
double rowSum (int i)
 Calculating the sum of values corresponding to transitions from some state. More...
 
multiDimHomTransitioncopy ()
 Copying a transition structure. More...
 
multiDimHomTransitionuniformize ()
 Uniformizing a transition structure. The structure should be of continuous time type. The resulting one will be of discrete time type. If uniformization fails, a NULL pointer should be returned. If the origin structure is already of discrete-time type, a copy should be returned. More...
 
void evaluateMeasure (double *d, double *res)
 Computing the action of the transition structure on some measure, the measure being represented as a vector of real numbers. This corresponds to the multiplication vector/matrix, the row vector being interpreted as a signed measure. More...
 
void evaluateMeasure (discreteDistribution *d, discreteDistribution *res)
 Computing the action of the transition structure on some probability distribution. More...
 
void evaluateValue (double *v, double *res)
 Computing the action of the transition structure on some vector of values. This corresponds to the multiplication matrix/vector, the column vector being interpreted as a vector of values attached to the states. More...
 
void write (FILE *out, string format)
 
discreteDistributiongetJumpDistribution ()
 
- Public Member Functions inherited from transitionStructure
virtual ~transitionStructure ()
 Destructor of the class. More...
 
int size ()
 Read accessor for the size of the state space. More...
 
timeType type ()
 Read accessor for the time type. More...
 
double uniformizationRate ()
 Read accessor for the uniformization rate. Relevant mostly for discrete-time structures created by uniformization of a continuous-time one. More...
 
void setType (timeType t)
 Write accessor for the time type. More...
 
void setUniformizationRate (double rate)
 Write accessor for the uniformization rate. More...
 
bool readEntry (FILE *input)
 Reading from a file, and adding an element to the matrix. The field must be in the form "row column value" with blank spaces as separators. More...
 
virtual void write (FILE *out, std::string format)=0
 Output method for a transition structure. More...
 
virtual ~transitionStructure ()
 Destructor of the class. More...
 
int size ()
 Read accessor for the size of the state space. More...
 
timeType type ()
 Read accessor for the time type. More...
 
double uniformizationRate ()
 Read accessor for the uniformization rate. Relevant mostly for discrete-time structures created by uniformization of a continuous-time one. More...
 
void setType (timeType t)
 Write accessor for the time type. More...
 
void setUniformizationRate (double rate)
 Write accessor for the uniformization rate. More...
 
bool readEntry (FILE *input)
 Reading from a file, and adding an element to the matrix. The field must be in the form "row column value" with blank spaces as separators. More...
 
virtual void write (FILE *out, std::string format)=0
 Output method for a transition structure. More...
 

Protected Attributes

int _nbDims
 the number of dimensions More...
 
int * _dimSize
 size of the state space in each dimension More...
 
double * _p
 probas to jump to the right in each dimension More...
 
double * _q
 probas to jump to the left in each dimension More...
 
- Protected Attributes inherited from transitionStructure
timeType _type
 the time type of the structure: discrete or continuous. More...
 
long int _size
 size of the state space. More...
 
double _uniformizationRate
 value related to the uniformization procedure. More...
 

Additional Inherited Members

- Protected Member Functions inherited from transitionStructure
int consolidate (int i, int *destinations, double *values)
 Method to consolidate (aggregate) transition probabilities from a given state. The method returns the number of different destination states, and modifies the arrays which will containt the lists of destinations and the corresponding probabilities. These arrays must have been allocated beforehand, with a size large enough to handle safely all possibilities. More...
 
int consolidate (int i, int *destinations, double *values)
 Method to consolidate (aggregate) transition probabilities from a given state. The method returns the number of different destination states, and modifies the arrays which will containt the lists of destinations and the corresponding probabilities. These arrays must have been allocated beforehand, with a size large enough to handle safely all possibilities. More...
 

Detailed Description

Class for multidimensional, homogeneous random walk transition structures. These are characterized by.

Constructor & Destructor Documentation

multiDimHomTransition::multiDimHomTransition ( int  nbDims,
int *  dimSize,
double *  p,
double *  q 
)

General constructor of the class.

Parameters
nbDimsthe number of dimensions
dimSizethe array of sizes
pthe array of jump probabilities to the right
qthe array of jump probabilities to the left
multiDimHomTransition::~multiDimHomTransition ( )

Destructor of the class.

Destructor.

multiDimHomTransition::multiDimHomTransition ( int  nbDims,
int *  dimSize,
double *  p,
double *  q 
)

General constructor of the class.

Parameters
nbDimsthe number of dimensions
dimSizethe array of sizes
pthe array of jump probabilities to the right
qthe array of jump probabilities to the left
multiDimHomTransition::~multiDimHomTransition ( )

Destructor of the class.

Member Function Documentation

multiDimHomTransition * multiDimHomTransition::copy ( )
virtual

Copying a transition structure.

Returns
transitionStructure

Implements transitionStructure.

multiDimHomTransition* multiDimHomTransition::copy ( )
virtual

Copying a transition structure.

Returns
transitionStructure

Implements transitionStructure.

int multiDimHomTransition::dimSize ( int  d)
inline

Read accessor for the size of the state space in each dimension.

Parameters
dthe dimension
Returns
the size of the state space in dimension d
int multiDimHomTransition::dimSize ( int  d)
inline

Read accessor for the size of the state space in each dimension.

Parameters
dthe dimension
Returns
the size of the state space in dimension d
void multiDimHomTransition::evaluateMeasure ( double *  pi,
double *  res 
)
virtual

Computing the action of the transition structure on some measure, the measure being represented as a vector of real numbers. This corresponds to the multiplication vector/matrix, the row vector being interpreted as a signed measure. The result is placed in an array that must have been previously allocated.

Parameters
pithe measure to evaluate
resthe resulting measure

Reimplemented from transitionStructure.

void multiDimHomTransition::evaluateMeasure ( discreteDistribution d,
discreteDistribution res 
)
virtual

Computing the action of the transition structure on some probability distribution.

Parameters
dthe distribution to evaluate
resthe resulting distribution

Reimplemented from transitionStructure.

void multiDimHomTransition::evaluateMeasure ( double *  d,
double *  res 
)
virtual

Computing the action of the transition structure on some measure, the measure being represented as a vector of real numbers. This corresponds to the multiplication vector/matrix, the row vector being interpreted as a signed measure.

Parameters
dthe measure to evaluate
resthe resulting measure

Reimplemented from transitionStructure.

void multiDimHomTransition::evaluateMeasure ( discreteDistribution d,
discreteDistribution res 
)
virtual

Computing the action of the transition structure on some probability distribution.

Parameters
dthe distribution to evaluate
resthe resulting distribution

Reimplemented from transitionStructure.

void multiDimHomTransition::evaluateValue ( double *  v,
double *  res 
)
virtual

Computing the action of the transition structure on some vector of values. This corresponds to the multiplication matrix/vector, the column vector being interpreted as a vector of values attached to the states.

Parameters
vthe vector of values to evaluate
resthe resulting vector

Implements transitionStructure.

void multiDimHomTransition::evaluateValue ( double *  v,
double *  res 
)
virtual

Computing the action of the transition structure on some vector of values. This corresponds to the multiplication matrix/vector, the column vector being interpreted as a vector of values attached to the states.

Parameters
vthe vector of values to evaluate
resthe resulting vector

Implements transitionStructure.

int multiDimHomTransition::getCol ( int  i,
int  k 
)
virtual

Method to get the number of the state corresponding to transition number k in the list of possible transitions from some state i.

Parameters
ithe origin state
kthe index of transition from state i
Returns
the destination state corresponding to the k-th possible transition from state i

Implements transitionStructure.

int multiDimHomTransition::getCol ( int  i,
int  k 
)
virtual

Method to get the number of the state corresponding to transition number k in the list of possible transitions from some state i.

Parameters
ithe origin state
kthe index of transition from state i
Returns
the destination state corresponding to the k-th possible transition from state i

Implements transitionStructure.

double multiDimHomTransition::getEntry ( int  i,
int  j 
)
virtual

Method to get the value associated with some transition.

Parameters
ithe origin state
jthe destination state
Returns
the value attached to the transition (i,j)

Implements transitionStructure.

double multiDimHomTransition::getEntry ( int  i,
int  j 
)
virtual

Method to get the value associated with some transition. When state parameters are out of bounds, the returned value should be 0.

Parameters
ithe origin state
jthe destination state
Returns
the value attached to the transition (i,j)

Implements transitionStructure.

double multiDimHomTransition::getEntryByCol ( int  i,
int  k 
)
virtual

Method to get the value attached to transition number k in the list of possible transitions from some state i.

Parameters
ithe origin state
kthe index of the transition from state i
Returns
the value attached to the k-th possible transition from state i

Implements transitionStructure.

double multiDimHomTransition::getEntryByCol ( int  i,
int  k 
)
virtual

Method to get the value attached to transition number k in the list of possible transitions from some state i.

Parameters
ithe origin state
kthe index of the transition from state i
Returns
the value attached to the k-th possible transition from state i

Implements transitionStructure.

discreteDistribution * multiDimHomTransition::getJumpDistribution ( )

Getting a discrete distribution representing the generic jumps. The distribution has 2*nbDims + 1 values: 0, +/- 1, ..., +/- nDims. The coding is:

  • 0 codes the self jump
  • +d codes a jump upwards in dimension (d-1).
  • -d codes a jump downwards in dimension (d-1).
Returns
a discrete distribution object
int multiDimHomTransition::getNbElts ( int  i)
virtual

Method to get the number of non-zero entries in a transition from some state. This can be seen as the number of actually possible transitions from that state.

Parameters
ithe origin state
Returns
int the number of possible transitions

Implements transitionStructure.

int multiDimHomTransition::getNbElts ( int  i)
virtual

Method to get the number of non-zero entries in a transition from some state. This can be seen as the number of actually possible transitions from that state.

Parameters
ithe origin state
Returns
int the number of possible transitions

Implements transitionStructure.

discreteDistribution * multiDimHomTransition::getTransDistrib ( int  i)
virtual

Method to get the transition from some state as a probability distribution.

Parameters
ithe origin state
Returns
a discrete distribution object

Implements transitionStructure.

discreteDistribution* multiDimHomTransition::getTransDistrib ( int  i)
virtual

Method to get the transition from some state as a probability distribution.

Parameters
ithe origin state
Returns
a discrete distribution object

Implements transitionStructure.

double multiDimHomTransition::p ( int  d)
inline

Read accessor for the jump probability to the right in each dimension.

Parameters
dthe dimension
Returns
the jump probability
double multiDimHomTransition::p ( int  d)
inline

Read accessor for the jump probability to the right in each dimension.

Parameters
dthe dimension
Returns
the jump probability
double multiDimHomTransition::q ( int  d)
inline

Read accessor for the jump probability to the right in each dimension.

Parameters
dthe dimension
Returns
the jump probability
double multiDimHomTransition::q ( int  d)
inline

Read accessor for the jump probability to the right in each dimension.

Parameters
dthe dimension
Returns
the jump probability
double multiDimHomTransition::rowSum ( int  i)
virtual

Sum of entries on some row i. Always 1.0 since this is a discrete-time transition structure.

Parameters
ithe row to be summed
Returns
1.0

Implements transitionStructure.

double multiDimHomTransition::rowSum ( int  i)
virtual

Calculating the sum of values corresponding to transitions from some state.

Parameters
ithe state
Returns
the sum

Implements transitionStructure.

bool multiDimHomTransition::setEntry ( int  i,
int  j,
double  val 
)
virtual

Method to set the value associated with some transition. Not applicable here.

Parameters
ithe origin state
jthe destination state
valthe value attached to the transition
Returns
true if the operation was successful, false otherwise (out of bounds; wrong numeric value)

Implements transitionStructure.

bool multiDimHomTransition::setEntry ( int  i,
int  j,
double  val 
)
virtual

Method to set the value associated with some transition.

Parameters
ithe origin state
jthe destination state
valthe value attached to the transition
Returns
true if the operation was successful, false otherwise (out of bounds; wrong numeric value)

Implements transitionStructure.

multiDimHomTransition * multiDimHomTransition::uniformize ( )
virtual

Uniformizing a transition structure. Since the origin structure is already of discrete-time type, a copy is returned.

Returns
a discrete-time transition structure

Implements transitionStructure.

multiDimHomTransition* multiDimHomTransition::uniformize ( )
virtual

Uniformizing a transition structure. The structure should be of continuous time type. The resulting one will be of discrete time type. If uniformization fails, a NULL pointer should be returned. If the origin structure is already of discrete-time type, a copy should be returned.

Returns
a discrete-time transition structure

Implements transitionStructure.

void multiDimHomTransition::write ( FILE *  out,
string  format 
)

Output method for the transition structure. Supported formats are: XBORNE, MARCA, Ers, Maple.

Parameters
outthe file descriptor to which the structure should be written.
formatthe format/language to be used

Member Data Documentation

int * multiDimHomTransition::_dimSize
protected

size of the state space in each dimension

int multiDimHomTransition::_nbDims
protected

the number of dimensions

double * multiDimHomTransition::_p
protected

probas to jump to the right in each dimension

double * multiDimHomTransition::_q
protected

probas to jump to the left in each dimension


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