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

Abstract class for transition structures. These are structures which describe transitions to one state to another one, to which is attached a numeric label. Typical instances should be one-step transition matrices of discrete-time Markov chains, and infinitesimal generators of continuous-time Markov chains. More...

#include <transitionStructure.h>

Inheritance diagram for transitionStructure:
eventMixture eventMixture multiDimHomTransition multiDimHomTransition sparseMatrix sparseMatrix

Public Member Functions

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...
 
virtual bool setEntry (int i, int j, double val)=0
 Method to set the value associated with some transition. More...
 
virtual double getEntry (int i, int j)=0
 Method to get the value associated with some transition. When state parameters are out of bounds, the returned value should be 0. More...
 
virtual int getNbElts (int i)=0
 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...
 
virtual int getCol (int i, int k)=0
 Method to get the number of the state corresponding to transition number k in the list of possible transitions from some state i. More...
 
virtual double getEntryByCol (int i, int k)=0
 Method to get the value attached to transition number k in the list of possible transitions from some state i. More...
 
virtual discreteDistributiongetTransDistrib (int i)=0
 Method to get the transition from some state as a probability distribution. 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 double rowSum (int i)=0
 Calculating the sum of values corresponding to transitions from some state. More...
 
virtual transitionStructurecopy ()=0
 Copying a transition structure. More...
 
virtual transitionStructureuniformize ()=0
 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...
 
virtual 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...
 
virtual void evaluateMeasure (discreteDistribution *d, discreteDistribution *res)
 Computing the action of the transition structure on some probability distribution. More...
 
virtual void evaluateValue (double *v, double *res)=0
 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...
 
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...
 
virtual bool setEntry (int i, int j, double val)=0
 Method to set the value associated with some transition. More...
 
virtual double getEntry (int i, int j)=0
 Method to get the value associated with some transition. When state parameters are out of bounds, the returned value should be 0. More...
 
virtual int getNbElts (int i)=0
 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...
 
virtual int getCol (int i, int k)=0
 Method to get the number of the state corresponding to transition number k in the list of possible transitions from some state i. More...
 
virtual double getEntryByCol (int i, int k)=0
 Method to get the value attached to transition number k in the list of possible transitions from some state i. More...
 
virtual discreteDistributiongetTransDistrib (int i)=0
 Method to get the transition from some state as a probability distribution. 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 double rowSum (int i)=0
 Calculating the sum of values corresponding to transitions from some state. More...
 
virtual transitionStructurecopy ()=0
 Copying a transition structure. More...
 
virtual transitionStructureuniformize ()=0
 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...
 
virtual 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...
 
virtual void evaluateMeasure (discreteDistribution *d, discreteDistribution *res)
 Computing the action of the transition structure on some probability distribution. More...
 
virtual void evaluateValue (double *v, double *res)=0
 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...
 
virtual void write (FILE *out, std::string format)=0
 Output method for a transition structure. More...
 

Protected Member Functions

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...
 

Protected Attributes

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...
 

Detailed Description

Abstract class for transition structures. These are structures which describe transitions to one state to another one, to which is attached a numeric label. Typical instances should be one-step transition matrices of discrete-time Markov chains, and infinitesimal generators of continuous-time Markov chains.

Author
Alain Jean-Marie

Constructor & Destructor Documentation

virtual transitionStructure::~transitionStructure ( )
inlinevirtual

Destructor of the class.

virtual transitionStructure::~transitionStructure ( )
inlinevirtual

Destructor of the class.

Member Function Documentation

int transitionStructure::consolidate ( int  i,
int *  destinations,
double *  values 
)
protected

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.

Parameters
ithe origin state
destinationsthe list of destinations
valuesthe list of probabilities
Returns
the number of different destinations
int transitionStructure::consolidate ( int  i,
int *  destinations,
double *  values 
)
protected

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.

Parameters
ithe origin state
destinationsthe list of destinations
valuesthe list of probabilities
Returns
the number of different destinations
virtual transitionStructure* transitionStructure::copy ( )
pure virtual
virtual transitionStructure* transitionStructure::copy ( )
pure virtual
virtual void transitionStructure::evaluateMeasure ( double *  d,
double *  res 
)
inlinevirtual

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 in sparseMatrix, sparseMatrix, multiDimHomTransition, multiDimHomTransition, eventMixture, and eventMixture.

virtual void transitionStructure::evaluateMeasure ( discreteDistribution d,
discreteDistribution res 
)
inlinevirtual

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

Parameters
dthe distribution to evaluate
resthe resulting distribution

Reimplemented in sparseMatrix, sparseMatrix, multiDimHomTransition, multiDimHomTransition, eventMixture, and eventMixture.

virtual void transitionStructure::evaluateMeasure ( double *  d,
double *  res 
)
inlinevirtual

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 in sparseMatrix, sparseMatrix, multiDimHomTransition, multiDimHomTransition, eventMixture, and eventMixture.

virtual void transitionStructure::evaluateMeasure ( discreteDistribution d,
discreteDistribution res 
)
inlinevirtual

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

Parameters
dthe distribution to evaluate
resthe resulting distribution

Reimplemented in sparseMatrix, sparseMatrix, multiDimHomTransition, multiDimHomTransition, eventMixture, and eventMixture.

virtual void transitionStructure::evaluateValue ( double *  v,
double *  res 
)
pure 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

Implemented in sparseMatrix, sparseMatrix, multiDimHomTransition, multiDimHomTransition, eventMixture, and eventMixture.

virtual void transitionStructure::evaluateValue ( double *  v,
double *  res 
)
pure 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

Implemented in sparseMatrix, sparseMatrix, multiDimHomTransition, multiDimHomTransition, eventMixture, and eventMixture.

virtual int transitionStructure::getCol ( int  i,
int  k 
)
pure 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

Implemented in multiDimHomTransition, sparseMatrix, multiDimHomTransition, sparseMatrix, eventMixture, and eventMixture.

virtual int transitionStructure::getCol ( int  i,
int  k 
)
pure 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

Implemented in multiDimHomTransition, sparseMatrix, multiDimHomTransition, sparseMatrix, eventMixture, and eventMixture.

virtual double transitionStructure::getEntry ( int  i,
int  j 
)
pure 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)

Implemented in multiDimHomTransition, multiDimHomTransition, sparseMatrix, eventMixture, sparseMatrix, and eventMixture.

virtual double transitionStructure::getEntry ( int  i,
int  j 
)
pure 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)

Implemented in multiDimHomTransition, multiDimHomTransition, sparseMatrix, eventMixture, sparseMatrix, and eventMixture.

virtual double transitionStructure::getEntryByCol ( int  i,
int  k 
)
pure 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

Implemented in multiDimHomTransition, sparseMatrix, multiDimHomTransition, sparseMatrix, eventMixture, and eventMixture.

virtual double transitionStructure::getEntryByCol ( int  i,
int  k 
)
pure 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

Implemented in multiDimHomTransition, sparseMatrix, multiDimHomTransition, sparseMatrix, eventMixture, and eventMixture.

virtual int transitionStructure::getNbElts ( int  i)
pure 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

Implemented in multiDimHomTransition, sparseMatrix, multiDimHomTransition, eventMixture, sparseMatrix, and eventMixture.

virtual int transitionStructure::getNbElts ( int  i)
pure 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

Implemented in multiDimHomTransition, sparseMatrix, multiDimHomTransition, eventMixture, sparseMatrix, and eventMixture.

virtual discreteDistribution* transitionStructure::getTransDistrib ( int  i)
pure virtual

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

Parameters
ithe origin state
Returns
a discrete distribution object

Implemented in sparseMatrix, multiDimHomTransition, sparseMatrix, multiDimHomTransition, eventMixture, and eventMixture.

virtual discreteDistribution* transitionStructure::getTransDistrib ( int  i)
pure virtual

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

Parameters
ithe origin state
Returns
a discrete distribution object

Implemented in sparseMatrix, multiDimHomTransition, sparseMatrix, multiDimHomTransition, eventMixture, and eventMixture.

bool transitionStructure::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.

Author
Alain Jean-Marie
Parameters
inputis the input flow from which the data is read
Returns
true if successful, false otherwise
bool transitionStructure::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.

Author
Alain Jean-Marie
Parameters
inputis the input flow from which the data is read
Returns
true if successful, false otherwise
virtual double transitionStructure::rowSum ( int  i)
pure virtual

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

Parameters
ithe state
Returns
the sum

Implemented in sparseMatrix, multiDimHomTransition, sparseMatrix, multiDimHomTransition, eventMixture, and eventMixture.

virtual double transitionStructure::rowSum ( int  i)
pure virtual

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

Parameters
ithe state
Returns
the sum

Implemented in sparseMatrix, multiDimHomTransition, sparseMatrix, multiDimHomTransition, eventMixture, and eventMixture.

virtual bool transitionStructure::setEntry ( int  i,
int  j,
double  val 
)
pure 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)

Implemented in multiDimHomTransition, multiDimHomTransition, eventMixture, sparseMatrix, eventMixture, and sparseMatrix.

virtual bool transitionStructure::setEntry ( int  i,
int  j,
double  val 
)
pure 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)

Implemented in multiDimHomTransition, multiDimHomTransition, eventMixture, sparseMatrix, eventMixture, and sparseMatrix.

void transitionStructure::setType ( timeType  t)
inline

Write accessor for the time type.

Parameters
tthe time type to be set
void transitionStructure::setType ( timeType  t)
inline

Write accessor for the time type.

Parameters
tthe time type to be set
void transitionStructure::setUniformizationRate ( double  rate)
inline

Write accessor for the uniformization rate.

Parameters
ratethe rate to be set
void transitionStructure::setUniformizationRate ( double  rate)
inline

Write accessor for the uniformization rate.

Parameters
ratethe rate to be set
int transitionStructure::size ( )
inline

Read accessor for the size of the state space.

Returns
the size of the state space
int transitionStructure::size ( )
inline

Read accessor for the size of the state space.

Returns
the size of the state space
timeType transitionStructure::type ( )
inline

Read accessor for the time type.

Returns
the time type
timeType transitionStructure::type ( )
inline

Read accessor for the time type.

Returns
the time type
double transitionStructure::uniformizationRate ( )
inline

Read accessor for the uniformization rate. Relevant mostly for discrete-time structures created by uniformization of a continuous-time one.

Returns
the uniformization rate
double transitionStructure::uniformizationRate ( )
inline

Read accessor for the uniformization rate. Relevant mostly for discrete-time structures created by uniformization of a continuous-time one.

Returns
the uniformization rate
virtual transitionStructure* transitionStructure::uniformize ( )
pure 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

Implemented in sparseMatrix, sparseMatrix, multiDimHomTransition, multiDimHomTransition, eventMixture, and eventMixture.

virtual transitionStructure* transitionStructure::uniformize ( )
pure 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

Implemented in sparseMatrix, sparseMatrix, multiDimHomTransition, multiDimHomTransition, eventMixture, and eventMixture.

virtual void transitionStructure::write ( FILE *  out,
std::string  format 
)
pure virtual

Output method for a transition structure.

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

Implemented in sparseMatrix, sparseMatrix, eventMixture, and eventMixture.

virtual void transitionStructure::write ( FILE *  out,
std::string  format 
)
pure virtual

Output method for a transition structure.

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

Implemented in sparseMatrix, sparseMatrix, eventMixture, and eventMixture.

Member Data Documentation

long int transitionStructure::_size
protected

size of the state space.

timeType transitionStructure::_type
protected

the time type of the structure: discrete or continuous.

This determines the nature of the numeric label: probabilities or rates.

double transitionStructure::_uniformizationRate
protected

value related to the uniformization procedure.


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