ATSuite C++  v1.0
Scientific C++ routines originally developed by Alexis Tantet
Macros | Typedefs | Functions
atmarkov.hpp File Reference

Markov transition matrix manipulation. More...

#include <list>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_vector_int.h>
#include <gsl/gsl_matrix.h>
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <ATSuite/atmatrix.hpp>

Go to the source code of this file.

Macros

#define plog2p(x)   ( (x) > 0.0 ? (x) * log(x) / log(2) : 0.0 )
 Calculates the log of x by x.
 

Typedefs

typedef SparseMatrix< double, RowMajor > SpMatCSR
 Eigen CSR matrix of double type.
 
typedef SparseMatrix< int, RowMajor > SpMatIntCSR
 Eigen CSR matrix of integer type.
 
typedef SparseMatrix< double, ColMajor > SpMatCSC
 Eigen CSC matrix of double type.
 
typedef SparseMatrix< bool, ColMajor > SpMatCSCBool
 Eigen CSC matrix of boolean type.
 

Functions

void toRightStochastic (SpMatCSC *T)
 Make an Eigen CSC matrix right stochastic. More...
 
void toRightStochastic (SpMatCSR *T)
 Make an Eigen CSR matrix right stochastic. More...
 
void toLeftStochastic (SpMatCSR *T)
 Make an Eigen CSR matrix left stochastic. More...
 
void toAndStochastic (SpMatCSR *T)
 Make an Eigen CSR matrix and stochastic. More...
 
void toAndStochastic (SpMatCSC *T)
 Make an Eigen CSC matrix and stochastic. More...
 
void filterTransitionMatrix (SpMatCSR *T, gsl_vector *rowCut, gsl_vector *colCut, double tol, int norm)
 Remove weak nodes from a transition matrix. More...
 

Detailed Description

ATSuite Markov transition matrix manipulation routines.

Definition in file atmarkov.hpp.

Function Documentation

void filterTransitionMatrix ( SpMatCSR T,
gsl_vector *  rowCut,
gsl_vector *  colCut,
double  tol,
int  norm 
)

Remove weak nodes from a transition matrix based on initial and final probability of each Markov state.

Parameters
[in,out]TThe Eigen CSR transition matrix to filter.
[in]rowCutThe probability distribution associated with each row.
[in]colCutThe probability distribution associated with each column.
[in]tolProbability under which Markov states are removed.
[in]normChoice of normalization,
  • norm = 0: normalize over all elements,
  • norm = 1: to right stochastic,
  • norm = 2: to left stochastic,
  • no normalization for any other choice.

Definition at line 173 of file atmarkov.hpp.

References normalizeVector(), toAndStochastic(), toLeftStochastic(), and toRightStochastic().

void toAndStochastic ( SpMatCSR T)

Make an Eigen CSR matrix and stochastic by normalizing it by the sum of its elements.

Parameters
[in]TEigen CSR matrix to make stochastic.

Definition at line 126 of file atmarkov.hpp.

References getSum().

Referenced by filterTransitionMatrix().

void toAndStochastic ( SpMatCSC T)

Make an Eigen CSC matrix and stochastic by normalizing it by the sum of its elements.

Parameters
[in]TEigen CSC matrix to make stochastic.

Definition at line 143 of file atmarkov.hpp.

void toLeftStochastic ( SpMatCSR T)

Make an Eigen CSR matrix left stochastic by normalizing each column by the sum of its elements.

Parameters
[in]TEigen CSR matrix to make stochastic.

Definition at line 101 of file atmarkov.hpp.

Referenced by filterTransitionMatrix(), and Grid::~Grid().

void toRightStochastic ( SpMatCSC T)

Make an Eigen CSC matrix right stochastic by normalizing each row by the sum of its elements.

Parameters
[in]TEigen CSC matrix to make stochastic.

Definition at line 55 of file atmarkov.hpp.

Referenced by filterTransitionMatrix().

void toRightStochastic ( SpMatCSR T)

Make an Eigen CSR matrix right stochastic by normalizing each row by the sum of its elements.

Parameters
[in]TEigen CSR matrix to make stochastic.

Definition at line 80 of file atmarkov.hpp.

References getRowSum(), and normalizeRows().