jphase

## Class DenseContPhaseVar

- java.lang.Object
- - jphase.AbstractContPhaseVar
  - - jphase.DenseContPhaseVar

- All Implemented Interfaces:
    JMarkovElement, ContPhaseVar, PhaseVar

      public class DenseContPhaseVar
      extends AbstractContPhaseVar

  This class allows the creation and manipulation of Continuous Phase-type distributions represented by dense matrices.
  Version:
    1.0
  Author:
    German Riaņo, Juan F. Perez

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DenseContPhaseVar()` Constructs an empty continuous Phase-type Distribution with dense representation
    `DenseContPhaseVar(no.uib.cipr.matrix.DenseVector alpha, no.uib.cipr.matrix.DenseMatrix A)` Constructs a continuous Phase-type Distribution with dense representation
    `DenseContPhaseVar(double[] alpha, double[][] A)` Constructs a continuous Phase-type Distribution with dense representation
    `DenseContPhaseVar(int n)` Constructs an empty Continuous Phase-type Distribution of size n with dense representation
    `DenseContPhaseVar(no.uib.cipr.matrix.Vector alpha, no.uib.cipr.matrix.Matrix A)` Constructs a continuous Phase-type Distribution with dense representation

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ContPhaseVar` | `copy()` Creates a deep copy of the original Phase-Type Variable
    `static DenseContPhaseVar` | `Coxian(int n, double[] lambdas, double[] probs)` Constructs a Phase-Type representation of a Coxian distribution with n phases
    `static DenseContPhaseVar` | `Erlang(double lambda, int n)` Constructs a Phase-Type representation of an Erlang distribution with rate lambda and n exponential phases
    `static DenseContPhaseVar` | `ErlangCoxian(int n, double p, double lambdaY, double lambdaX1, double lambdaX2, double px)` Constructs a Phase-Type representation of an ErlangCoxian distribution as defined by Osogami and Harchol in "Closed form solutions for mapping general distributions to quasi-minimal PH distributions", 2005.
    `static DenseContPhaseVar` | `expo(double lambda)` Constructs a Phase-Type representation of an Exponential distribution with rate lambda
    `no.uib.cipr.matrix.Matrix` | `getMatrix()` Returns the transition matrix of the Phase-Type Distribution
    `no.uib.cipr.matrix.Vector` | `getVector()` Returns the initial probability mass vector
    `static DenseContPhaseVar` | `HipoExponential(double[] lambdas)`
    `static DenseContPhaseVar` | `HyperErlang(HyperErlangVar var)` Constructs a Phase-Type representation of a Hyper-Erlang distribution from a Dense representation of the same distribution
    `static DenseContPhaseVar` | `HyperErlang(int k, double[] lambdas, int[] n, double[] probs)` Constructs a Phase-Type representation of a Hyper-Erlang distribution with k erlang branches, its k rates and n number of phases per branch
    `static DenseContPhaseVar` | `HyperExpo(double[] lambdas, double[] probs)` Constructs a Phase Distribution that represents a HyperExponential distribution with the especified parameters
    `ContPhaseVar` | `newVar(int n)` Creates a new variable of the same class of the original Continuous Phase-Type Variable
    `void` | `setMatrix(no.uib.cipr.matrix.Matrix A)` Sets the transition matrix of the Phase-type distribution to be A
    `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, expectedValue, getMat0, getMat0Array, getMatrixArray, getNumPhases, getVec0, getVectorArray, label, lossFunction1, lossFunction2, max, max, median, min, min, mix, mix, moment, 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 jmarkov.basic.JMarkovElement

      `equals`

- - ### Constructor Detail

    - #### DenseContPhaseVar

          public DenseContPhaseVar()

      Constructs an empty continuous Phase-type Distribution with dense representation

    - #### DenseContPhaseVar

          public DenseContPhaseVar(int n)

      Constructs an empty Continuous Phase-type Distribution of size n with dense representation
      Parameters:
        `n` - size of the Continuous Phase-type Distribution

    - #### DenseContPhaseVar

          public DenseContPhaseVar(no.uib.cipr.matrix.DenseVector alpha,
                           no.uib.cipr.matrix.DenseMatrix A)

      Constructs a continuous Phase-type Distribution with dense representation
      Parameters:
        `A` - rate matrix
        `alpha` - initial probability distribution vector

    - #### DenseContPhaseVar

          public DenseContPhaseVar(no.uib.cipr.matrix.Vector alpha,
                           no.uib.cipr.matrix.Matrix A)

      Constructs a continuous Phase-type Distribution with dense representation
      Parameters:
        `A` - rate matrix
        `alpha` - initial probability distribution vector

    - #### DenseContPhaseVar

          public DenseContPhaseVar(double[] alpha,
                           double[][] A)

      Constructs a continuous Phase-type Distribution with dense representation
      Parameters:
        `A` - rate matrix
        `alpha` - initial probability distribution vector

  - ### Method Detail

    - #### expo

          public static DenseContPhaseVar expo(double lambda)

      Constructs a Phase-Type representation of an Exponential distribution with rate lambda
      Parameters:
        `lambda` - exponential distribution rate
      Returns:
        Dense Continuous Phase-Type Distribution

    - #### Erlang

          public static DenseContPhaseVar Erlang(double lambda,
                                 int n)

      Constructs a Phase-Type representation of an Erlang distribution with rate lambda and n exponential phases
      Parameters:
        `lambda` - exponential rate in each phase
        `n` - number of exponential phases
      Returns:
        Dense Continuous Phase-Type Distribution

    - #### HipoExponential

          public static DenseContPhaseVar HipoExponential(double[] lambdas)

    - #### HyperExpo

          public static DenseContPhaseVar HyperExpo(double[] lambdas,
                                    double[] probs)

      Constructs a Phase Distribution that represents a HyperExponential distribution with the especified parameters
      Parameters:
        `lambdas` - ecah one of the exponential rates
        `probs` - initial probability vector
      Returns:
        Dense Continuous Phase-Type Distribution

    - #### HyperErlang

          public static DenseContPhaseVar HyperErlang(int k,
                                      double[] lambdas,
                                      int[] n,
                                      double[] probs)

      Constructs a Phase-Type representation of a Hyper-Erlang distribution with k erlang branches, its k rates and n number of phases per branch
      Parameters:
        `k` - number of Erlang branches
        `lambdas` - exponential rate of each phase in each branch
        `n` - number of exponential phases in each branch
        `probs` - probability distribution of taking each one of the branches
      Returns:
        Dense Continuous Phase-Type Distribution

    - #### HyperErlang

          public static DenseContPhaseVar HyperErlang(HyperErlangVar var)

      Constructs a Phase-Type representation of a Hyper-Erlang distribution from a Dense representation of the same distribution
      Parameters:
        `var` - HyperErlang variable from which the Dense Continuous variable must be constructed
      Returns:
        Dense Continuous Phase-Type Distribution

    - #### Coxian

          public static DenseContPhaseVar Coxian(int n,
                                 double[] lambdas,
                                 double[] probs)

      Constructs a Phase-Type representation of a Coxian distribution with n phases
      Parameters:
        `n` - number of phases
        `lambdas` - exponential rates of each phase
        `probs` - probability of going to the next phase (no absorption) in each phase except the last one.
      Returns:
        Dense Continuous Phase-Type Distribution

    - #### ErlangCoxian

          public static DenseContPhaseVar ErlangCoxian(int n,
                                       double p,
                                       double lambdaY,
                                       double lambdaX1,
                                       double lambdaX2,
                                       double px)

      Constructs a Phase-Type representation of an ErlangCoxian distribution as defined by Osogami and Harchol in "Closed form solutions for mapping general distributions to quasi-minimal PH distributions", 2005.
      Parameters:
        `n` - total number of phases (Erlang degree: n-2)
        `p` - probability of having a positive elapse time in the distribution. 1-p: mass probability at zero
        `lambdaY` - rate of the Erlang distribution
        `lambdaX1` - rate of the first stage of the Coxian distribution
        `lambdaX2` - rate of the second stage of the Coxian distribution
        `px` - probability of going from the first to the second stage in the Coxian distribution. 1-p: probability of absorption at the first stage of the Coxian distribution
      Returns:
        Dense Continuous Phase-Type Distribution

    - #### getMatrix

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

      Description copied from interface: `PhaseVar`
      Returns the transition matrix of the Phase-Type Distribution
      Returns:
        Transition matrix for 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
      Returns:
        Initial probability mass vector

    - #### 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
      Parameters:
        `A` - Transition matrix for the transient states of the Phase-Type Distribution

    - #### setVector

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

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

    - #### copy

          public ContPhaseVar copy()

      Description copied from interface: `ContPhaseVar`
      Creates a deep copy of the original Phase-Type Variable
      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
      Parameters:
        `n` - number of Phases of the new Variable
      Returns:
        A new variable of the same class of the original Continuous Phase-Type Variable