jphase

## Class HyperErlangVar

- java.lang.Object
- - jphase.AbstractContPhaseVar
  - - jphase.HyperErlangVar

- All Implemented Interfaces:
    JMarkovElement, ContPhaseVar, PhaseVar

      public class HyperErlangVar
      extends AbstractContPhaseVar
      implements PhaseVar

  This class allows the creation and manipulation of HyperErlang distributions. The associated matrix has dense representation
  Version:
    1.0
  Author:
    German Riaņo, Juan F. Perez

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HyperErlangVar()` Constructor of a Hyper Erlang variable in dense representation.
    `HyperErlangVar(int n)` Constructor of a Hyper Erlang variable with n phases in dense representation
    `HyperErlangVar(int[] r, double[] alphas, double[] lambdas, boolean deep)` Constructor of a Hyper Erlang variable in dense representation
    `HyperErlangVar(int N, int M, int[] r, double[] alphas, double[] lambdas, boolean deep)` Constructor of a Hyper Erlang variable in dense representation

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ContPhaseVar` | `copy()` Creates a deep copy of the original Phase-type variable
    `double` | `expectedValue()` Computes the Expected Value of the Phase-type variable
    `double[]` | `getAlphas()`
    `double[][]` | `getDMatrix()` Returns the Double MAtrix that represents the variable
    `double[]` | `getDVector()` Returns the Double MAtrix that represents the variable
    `double[]` | `getLambdas()`
    `int` | `getM()`
    `no.uib.cipr.matrix.Matrix` | `getMatrix()` Returns the transition matrix of the Phase-Type Distribution
    `int` | `getN()`
    `int` | `getNumPhases()` Returns the number of phases of the Phase-type distribution
    `int[]` | `getR()`
    `no.uib.cipr.matrix.Vector` | `getVector()` Returns the initial probability mass vector
    `double` | `moment(int k)` Compuetes the k-th Moment of the Phase-type variable
    `ContPhaseVar` | `newVar(int n)` Creates a new variable of the same class of the original Continuous Phase-Type Variable
    `void` | `setAlphas(double[] alphas)`
    `void` | `setLambdas(double[] lambdas)`
    `void` | `setM(int M)`
    `void` | `setMatrix(no.uib.cipr.matrix.Matrix A)` Sets the transition matrix of the Phase-type distribution to be A
    `void` | `setN(int N)`
    `void` | `setR(int[] r)`
    `void` | `setVector(no.uib.cipr.matrix.Vector alpha)` Sets the initial probability vector to be alpha

    - ### Methods inherited from class jphase.AbstractContPhaseVar

      `cdf, cdf, CV, description, eqResidualTime, getMat0, getMat0Array, getMatrixArray, getVec0, getVectorArray, label, lossFunction1, lossFunction2, max, max, median, min, min, mix, mix, pdf, pdf, prob, quantil, residualTime, residualVar, stdDeviation, sum, sum, sumGeom, sumPH, sumPH, survival, survival, times, toString, variance, waitingQ`

    - ### Methods inherited from class java.lang.Object

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

    - ### Methods inherited from interface jphase.PhaseVar

      `cdf, cdf, CV, getMat0, getMat0Array, getMatrixArray, getVec0, getVectorArray, lossFunction1, lossFunction2, median, prob, quantil, stdDeviation, survival, survival, variance`

    - ### Methods inherited from interface jmarkov.basic.JMarkovElement

      `description, equals, label, toString`

- - ### Constructor Detail

    - #### HyperErlangVar

          public HyperErlangVar()

      Constructor of a Hyper Erlang variable in dense representation. As default it has just one branch that is taken with probability one. the unique branch has one phase with rate 1 per time unit.

    - #### HyperErlangVar

          public HyperErlangVar(int n)

      Constructor of a Hyper Erlang variable with n phases in dense representation
      Parameters:
        `n` - Total number of phases

    - #### HyperErlangVar

          public HyperErlangVar(int N,
                        int M,
                        int[] r,
                        double[] alphas,
                        double[] lambdas,
                        boolean deep)

      Constructor of a Hyper Erlang variable in dense representation
      Parameters:
        `N` - Total number of phases
        `M` - Number of branches
        `r` - Number of phases in each branch
        `alphas` - Probability associated to each branch
        `lambdas` - Rate associated to each branch
        `deep` - True if this is a deep constructor, false if not

    - #### HyperErlangVar

          public HyperErlangVar(int[] r,
                        double[] alphas,
                        double[] lambdas,
                        boolean deep)

      Constructor of a Hyper Erlang variable in dense representation
      Parameters:
        `r` - Number of phases in each branch
        `alphas` - Probability associated to each branch
        `lambdas` - Rate associated to each branch
        `deep` - True if this is a deep constructor, false if not

  - ### Method Detail

    - #### getN

          public int getN()

      Returns:
        Total number of phases

    - #### setN

          public void setN(int N)

      Parameters:
        `N` - Total number of phases to set

    - #### getM

          public int getM()

      Returns:
        Nnumber of branches

    - #### setM

          public void setM(int M)

      Parameters:
        `M` - Number of branches to set

    - #### getR

          public int[] getR()

      Returns:
        Number of phases in each branch

    - #### setR

          public void setR(int[] r)

      Parameters:
        `r` - Number of phases in each branch to set

    - #### getAlphas

          public double[] getAlphas()

      Returns:
        Probability associated to each branch

    - #### setAlphas

          public void setAlphas(double[] alphas)

      Parameters:
        `alphas` - Probability associated to each branch to set

    - #### getLambdas

          public double[] getLambdas()

      Returns:
        Rate associated to each branch

    - #### setLambdas

          public void setLambdas(double[] lambdas)

      Parameters:
        `lambdas` - Rates associated to each branch to set

    - #### getMatrix

          public no.uib.cipr.matrix.Matrix getMatrix()

      Description copied from interface: `PhaseVar`
      Returns the transition matrix of the Phase-Type Distribution
      Specified by:
        `getMatrix` in interface `PhaseVar`
      Returns:
        Transition matrix for transient states of the Phase-Type Distribution

    - #### getDMatrix

          public double[][] getDMatrix()

      Returns the Double MAtrix that represents the variable
      Returns:
        Double Matrix

    - #### setMatrix

          public void setMatrix(no.uib.cipr.matrix.Matrix A)

      Description copied from interface: `PhaseVar`
      Sets the transition matrix of the Phase-type distribution to be A
      Specified by:
        `setMatrix` in interface `PhaseVar`
      Parameters:
        `A` - Transition matrix for the transient states of the Phase-Type Distribution

    - #### getVector

          public no.uib.cipr.matrix.Vector getVector()

      Description copied from interface: `PhaseVar`
      Returns the initial probability mass vector
      Specified by:
        `getVector` in interface `PhaseVar`
      Returns:
        Initial probability mass vector

    - #### getDVector

          public double[] getDVector()

      Returns the Double MAtrix that represents the variable
      Returns:
        Double Vector

    - #### setVector

          public void setVector(no.uib.cipr.matrix.Vector alpha)

      Description copied from interface: `PhaseVar`
      Sets the initial probability vector to be alpha
      Specified by:
        `setVector` in interface `PhaseVar`
      Parameters:
        `alpha` - Initial probability mass vector

    - #### copy

          public ContPhaseVar copy()

      Description copied from interface: `PhaseVar`
      Creates a deep copy of the original Phase-type variable
      Specified by:
        `copy` in interface `ContPhaseVar`
      Specified by:
        `copy` in interface `PhaseVar`
      Returns:
        A deep copy of the original Phase-type variable

    - #### newVar

          public ContPhaseVar newVar(int n)

      Description copied from interface: `ContPhaseVar`
      Creates a new variable of the same class of the original Continuous Phase-Type Variable
      Specified by:
        `newVar` in interface `ContPhaseVar`
      Parameters:
        `n` - number of Phases of the new Variable
      Returns:
        A new variable of the same class of the original Continuous Phase-Type Variable

    - #### getNumPhases

          public int getNumPhases()

      Description copied from interface: `PhaseVar`
      Returns the number of phases of the Phase-type distribution
      Specified by:
        `getNumPhases` in interface `PhaseVar`
      Overrides:
        `getNumPhases` in class `AbstractContPhaseVar`
      Returns:
        Number of phases of the Phase-type distribution
      See Also:
        `PhaseVar.getNumPhases()`

    - #### expectedValue

          public double expectedValue()

      Description copied from interface: `PhaseVar`
      Computes the Expected Value of the Phase-type variable
      Specified by:
        `expectedValue` in interface `PhaseVar`
      Overrides:
        `expectedValue` in class `AbstractContPhaseVar`
      Returns:
        Expected Value of the Phase-type variable
      See Also:
        `PhaseVar.expectedValue()`

    - #### moment

          public double moment(int k)

      Description copied from interface: `PhaseVar`
      Compuetes the k-th Moment of the Phase-type variable
      Specified by:
        `moment` in interface `PhaseVar`
      Overrides:
        `moment` in class `AbstractContPhaseVar`
      Parameters:
        `k` - Moment to compute
      Returns:
        k-th Moment of the Phase-type variable
      See Also:
        `PhaseVar.moment(int)`