# Class AbstractRateMatrix

java.lang.Object
jebl.evolution.substmodel.AbstractRateMatrix

All Implemented Interfaces:
  `Serializable, Cloneable, RateMatrix`

Direct Known Subclasses:
  `AminoAcidModel`

public abstract class AbstractRateMatrix extends Object implements RateMatrix
abstract base class for all rate matrices

Version:
  $Id: AbstractRateMatrix.java 185 2006-01-23 23:03:18Z rambaut $
Author:
  Korbinian Strimmer, Alexei Drummond
See Also:
  - Serialized Form

## Method Summary

Modifier and Type
Method
Description
`int`
`getDimension()`
`double[]`
`getEquilibriumFrequencies()`
`double`
`getEquilibriumFrequency(int i)`
`double[][]`
`getRelativeRates()`
`SequenceType`
`getSequenceType()`
Get the data type of this rate matrix
`final void`
`getTransitionProbabilities(double[][] probabilityStore)`
A utility method for speed, transfers trans prob information quickly into store
`double`
`getTransitionProbability(int fromState, int toState)`
`final void`
`rebuild()`
`void`
`scale(double scale)`
`final void`
`setDistance(double distance)`
Sets the distance (such as time/branch length) used when calculating the probabilities.
`final void`
`setDistanceTranspose(double distance)`
Sets the distance (such as time/branch length) used when calculating the probabilities.
`double`
`setParametersNoScale(double[] parameters)`

### Methods inherited from class Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface RateMatrix

`getUniqueName`

## Method Details

### getDimension

public int getDimension()

Specified by:
  `getDimension` in interface `RateMatrix`
Returns:
  the dimension of this rate matrix.

### getEquilibriumFrequencies

public double[] getEquilibriumFrequencies()

Specified by:
  `getEquilibriumFrequencies` in interface `RateMatrix`
Returns:
  stationary frequencies (sum = 1.0)

### getEquilibriumFrequency

public double getEquilibriumFrequency(int i)

Specified by:
  `getEquilibriumFrequency` in interface `RateMatrix`
Returns:
  stationary frequencie (sum = 1.0) for ith state

### getSequenceType

public SequenceType getSequenceType()
Description copied from interface: `RateMatrix`
Get the data type of this rate matrix

Specified by:
  `getSequenceType` in interface `RateMatrix`

### getRelativeRates

public double[][] getRelativeRates()

Specified by:
  `getRelativeRates` in interface `RateMatrix`
Returns:
  rate matrix (transition: from 1st index to 2nd index)

### getTransitionProbability

public double getTransitionProbability(int fromState, int toState)

Specified by:
  `getTransitionProbability` in interface `RateMatrix`
Parameters:
  `fromState` - The state from which we are starting
  `toState` - The resulting state
Returns:
  the probability of going from one state to another given the current distance

### rebuild

public final void rebuild()

### setDistance

public final void setDistance(double distance)
Sets the distance (such as time/branch length) used when calculating the probabilities.

Specified by:
  `setDistance` in interface `RateMatrix`

### setDistanceTranspose

public final void setDistanceTranspose(double distance)
Sets the distance (such as time/branch length) used when calculating the probabilities. The resulting transition probabilities will be in reverse (that is in the matrix instead of [from][to] it's [to][from])

### getTransitionProbabilities

public final void getTransitionProbabilities(double[][] probabilityStore)
A utility method for speed, transfers trans prob information quickly into store

Specified by:
  `getTransitionProbabilities` in interface `RateMatrix`

### scale

public void scale(double scale)

### setParametersNoScale

public double setParametersNoScale(double[] parameters)