# Internal Functions

These functions are not intended to be used by you, the user.

## Documentation

The main type is DiscreteMarkovChain:

DiscreteMarkovChains.digraphFunction
digraph(x)

Creates a digraph (directed graph) representation of a Markov chain.

Arguments

• x: some kind of Markov chain.

Returns

A 1D array of 2-tuples. An element $(i, j)$ is in the array iff the transition matrix at $(i,j)$ is nonzero.

DiscreteMarkovChains.state_indexFunction
state_index(x)

Arguments

• x: some kind of Markov chain.

Returns

A dictionary mapping each state in a Markov chain to its position in the state space. It is essentially the inverse of state_space(x).

DiscreteMarkovChains.is_row_stochasticFunction
is_row_stochastic(mat, row_sum=1)

Tests whether a matrix, x, is row stochasitc. The desired sum of each row can be specified as well.

Definitions

A matrix is said to be row stochasic if all its rows sum to 1. This definition is extened so that all its rows sum to row_sum.

Arguments

• mat: a matrix that we want to check.
• row_sum: the desired value that each row should total to.

Returns

true if the given matrix, mat, is row-stochasitc.

DiscreteMarkovChains.required_row_sumFunction
required_row_sum(type)

Arguments

• type: The type of Markov chain. It can be

DiscreteMarkovChain or ContinuousMarkovChain.

Returns

The number that each row in the transition matrix should sum up to.

DiscreteMarkovChains.characteristic_matrixFunction
characteristic_matrix(::AbstractDiscreteMarkovChain)
characteristic_matrix(::AbstractContinuousMarkovChain)

Definitions

Many derivations and interesting ideas about Markov chains involve the identity matrix or zero matrix somewhere along the line. Most of the time, the identity matrix appears more often in discrete Markov chains. Instead of the identity matrix, the zero matrix appears in its place for continuous Markov chains.

Returns

The identity matrix if its argument is an instance of AbstractDiscreteMarkovChain. The zero matrix if its argument is an instance of AbstractContinuousMarkovChain