ca.mcgill.lmp.finite
Class TransitionMatrix

java.lang.Object
  extended byca.mcgill.lmp.finite.TransitionMatrix

public class TransitionMatrix
extends java.lang.Object

A transition matrix.

Author:
Alexandre Bouchard

Constructor Summary
TransitionMatrix(double[][] transitionProbabilities)
          Create a new transition probability matrix with the provided probabilities.
TransitionMatrix(java.lang.String description)
          Create a new transition probabilities based on a String description.
 
Method Summary
 double Pr(State from, java.util.Collection to)
           
 double Pr(State from, State to)
           
 int size()
          The number of states of the underlying probability space.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransitionMatrix

public TransitionMatrix(java.lang.String description)
Create a new transition probabilities based on a String description. The String should contain a matrix with columns separated by tabs and rows separated by new lines. Entry i,j should represent the probability to go from state i to state j.

Parameters:
description -

TransitionMatrix

public TransitionMatrix(double[][] transitionProbabilities)
Create a new transition probability matrix with the provided probabilities. transitionProbilities[i][j] should be the probability to go from state i to state j.

Parameters:
transitionProbabilities -
Method Detail

size

public int size()
The number of states of the underlying probability space.

Returns:

Pr

public double Pr(State from,
                 State to)
Parameters:
from - The initial state.
to - The destination state.
Returns:
The probability to go from the initial to the destination state.

Pr

public double Pr(State from,
                 java.util.Collection to)
Parameters:
from - The initial state.
to - A set of States, the destination states.
Returns:
The probability to transition from the initial state to any one of the state in the provided set of destination states.

toString

public java.lang.String toString()
Returns: