Class AbstractRateMatrix

    • Constructor Detail

      • AbstractRateMatrix

        protected AbstractRateMatrix​(int dim)
    • Method Detail

      • getTypeID

        public int getTypeID()
        get numerical code describing the data type
        Specified by:
        getTypeID in interface RateMatrix
        Returns:
        integer code identifying a data type
      • getModelID

        public abstract int getModelID()
        get numerical code describing the model type
        Specified by:
        getModelID in interface RateMatrix
        Returns:
        integer code identifying a substitution model
      • 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
      • setDataType

        protected final void setDataType​(DataType dt)
      • 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)
        Returns the probability of going from one state to another given the current distance
        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.
        Specified by:
        setDistanceTranspose in interface RateMatrix
      • 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)
        Specified by:
        scale in interface RateMatrix
      • printFrequencies

        protected void printFrequencies​(java.io.PrintWriter out)
      • setFrequencies

        protected void setFrequencies​(double[] f)
      • setParameters

        public void setParameters​(double[] parameters)
      • setParameter

        public final void setParameter​(double value,
                                       int parameter)
        Description copied from interface: Parameterized
        set model parameter
        Specified by:
        setParameter in interface Parameterized
        Parameters:
        value - parameter value
        parameter - parameter number
      • getParameter

        public final double getParameter​(int parameter)
        Description copied from interface: Parameterized
        get model parameter
        Specified by:
        getParameter in interface Parameterized
        Parameters:
        parameter - parameter number
        Returns:
        parameter value
      • rebuildRateMatrix

        protected abstract void rebuildRateMatrix​(double[][] rate,
                                                  double[] parameters)
      • addPalObjectListener

        public void addPalObjectListener​(PalObjectListener pol)
        Description copied from interface: RateMatrix
        Add a PalObjectListener to be notified of changes to the model. Only the parametersChanged method will generally be called
        Specified by:
        addPalObjectListener in interface RateMatrix
      • fireParametersChangedEvent

        protected void fireParametersChangedEvent()
      • fireParametersChangedEvent

        protected void fireParametersChangedEvent​(PalObjectEvent pe)
      • updateMatrixExp

        protected void updateMatrixExp()
      • parameterChanged

        public void parameterChanged​(ParameterEvent pe)
        For the external parameter interface. This can be ignored unless you want to use this Rate Matrix as an external parameter listener This method does two things.First it sets a flag indicating that rebuild method should be called the next time a setDistance method is called, and then it notifies any PalObject listeners that a parameter has changed
        Specified by:
        parameterChanged in interface ExternalParameterListener
      • clone

        public java.lang.Object clone()
        Specified by:
        clone in interface RateMatrix
        Overrides:
        clone in class java.lang.Object
      • getFrequencies

        protected final double[] getFrequencies()