jphase

## Class AbstractDiscPhaseVar

- java.lang.Object
- - jphase.AbstractDiscPhaseVar

- All Implemented Interfaces:
    JMarkovElement, DiscPhaseVar, PhaseVar
  Direct Known Subclasses:
    DenseDiscPhaseVar, SparseDiscPhaseVar

      public abstract class AbstractDiscPhaseVar
      extends java.lang.Object
      implements DiscPhaseVar

  Abstract class that defines the behaviour of the Discrete Phase-Type distributions
  Version:
    1.0
  Author:
    German Riaņo, Juan F. Perez

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractDiscPhaseVar()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `cdf(double x)` Evaluates the cumulative distribution function at x
    `double[]` | `cdf(int n, double delta)` Evaluates the cumulative distribution function at n values of x, starting with x=0, step delta
    `double` | `CV()` Computes the Coefficient of Variation of the Phase-type variable
    `java.lang.String` | `description()` This method return a complete verbal describtion of this element.
    `double` | `expectedValue()` Computes the Expected Value of the Phase-type variable
    `no.uib.cipr.matrix.Vector` | `getMat0()` Returns the exit vector from the transient states into absorption
    `double[]` | `getMat0Array()` Returns the exit vector in double[] format
    `double[][]` | `getMatrixArray()` Returns the transition matrix in double format
    `int` | `getNumPhases()` Returns the number of phases of the Phase-type distribution
    `double` | `getVec0()` Returns the probability mass at zero (alpha_0)
    `double[]` | `getVectorArray()` Returns the initial probability mass vector in double[] format
    `java.lang.String` | `label()` This method returns a short String used in the user interface to describe this element.
    `double` | `lossFunction1(double x)` Evaluates the loss function of order 1 at x
    `double` | `lossFunction2(double x)` Evaluates the loss function of order 2 at x
    `DiscPhaseVar` | `max(DiscPhaseVar v2)` Returns the maximum between the variable B and the original: res = max(A,B)
    `DiscPhaseVar` | `max(DiscPhaseVar v2, DiscPhaseVar res)` Returns the maximum between the variable B and the original: res = max(A,B)
    `double` | `median()` Computes the median of the distribution
    `DiscPhaseVar` | `min(DiscPhaseVar v2)` Returns the minimum between the variable B and the original: res = min(A,B)
    `DiscPhaseVar` | `min(DiscPhaseVar v2, DiscPhaseVar res)` Returns the minimum between the variable B and the original: res = min(A,B)
    `DiscPhaseVar` | `mix(double p, DiscPhaseVar v2)` Computes the distribution of the mix: res = A*p + B*(1-p)
    `DiscPhaseVar` | `mix(double p, DiscPhaseVar v2, DiscPhaseVar res)` Computes the distribution of the mix: res = A*p + B*(1-p)
    `double` | `moment(int k)` Compuetes the k-th Moment of the Phase-type variable
    `double` | `pmf(int k)` Evaluates the probability mass function at k
    `double[]` | `pmf(int n, int delta)` Evaluates the probability mass function at n values of x, from zero to n times delta
    `double` | `prob(double a, double b)` Computes the probability that this variable takes a value between a and b
    `double` | `quantil(double p)` Computes the quantile q of the distribution, such that F(q) = p
    `double` | `stdDeviation()` Computes the Standard deviation of the Phase-type variable
    `DiscPhaseVar` | `sum(DiscPhaseVar v2)` Computes the sum of variables: res = A +B
    `DiscPhaseVar` | `sum(DiscPhaseVar v2, DiscPhaseVar res)` Computes the sum of variables: res = A +B
    `DiscPhaseVar` | `sumGeom(double p)` Returns the sum of a geometric number of independent copies of this variable
    `DiscPhaseVar` | `sumPH(DiscPhaseVar v2)` Returns the sum of a Phase-type-distributed number of Discrete Phase-type distributions
    `DiscPhaseVar` | `sumPH(DiscPhaseVar B, DiscPhaseVar res)` Returns the sum of a Phase-type-distributed number of Discrete Phase-type distributions
    `double` | `survival(double x)` Evaluates the survival function at x
    `double[]` | `survival(int n, double delta)` Evaluates the survival function at n values of x, starting with x=0, step delta
    `java.lang.String` | `toString()` This method returns a short String used in the user interface to describe this element.
    `double` | `variance()` Computes the variance of the Phase-type variable

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

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

    - ### Methods inherited from interface jphase.DiscPhaseVar

      `copy, newVar`

    - ### Methods inherited from interface jphase.PhaseVar

      `getMatrix, getVector, setMatrix, setVector`

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

      `equals`

- - ### Constructor Detail

    - #### AbstractDiscPhaseVar

          public AbstractDiscPhaseVar()

  - ### Method Detail

    - #### sumPH

          public DiscPhaseVar sumPH(DiscPhaseVar B,
                           DiscPhaseVar res)

      Description copied from interface: `DiscPhaseVar`
      Returns the sum of a Phase-type-distributed number of Discrete Phase-type distributions
      Specified by:
        `sumPH` in interface `DiscPhaseVar`
      Parameters:
        `B` - Discrete-Phase Type Distribution that determines the number of Discrete Phase-Type Distributions to sum
        `res` - Discrete Phase Variable to store the resulting distribution
      Returns:
        Sum of a Phase number of Discrete Phase-type distributions
      See Also:
        `DiscPhaseVar.sumPH(jphase.DiscPhaseVar, jphase.DiscPhaseVar)`

    - #### sumPH

          public DiscPhaseVar sumPH(DiscPhaseVar v2)

      Description copied from interface: `DiscPhaseVar`
      Returns the sum of a Phase-type-distributed number of Discrete Phase-type distributions
      Specified by:
        `sumPH` in interface `DiscPhaseVar`
      Parameters:
        `v2` - Discrete-Phase Type Distribution that determines the number of Discrete Phase-Type Distributions to sum
      Returns:
        Sum of a Phase number of Discrete Phase-type distributions
      See Also:
        `DiscPhaseVar.sumPH(jphase.DiscPhaseVar)`

    - #### 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`
      Returns:
        Number of phases of the Phase-type distribution
      See Also:
        `PhaseVar.getNumPhases()`

    - #### getVec0

          public double getVec0()

      Description copied from interface: `PhaseVar`
      Returns the probability mass at zero (alpha_0)
      Specified by:
        `getVec0` in interface `PhaseVar`
      Returns:
        Probability mass at zero (alpha_0)
      See Also:
        `PhaseVar.getVec0()`

    - #### getMat0

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

      Description copied from interface: `PhaseVar`
      Returns the exit vector from the transient states into absorption
      Specified by:
        `getMat0` in interface `PhaseVar`
      Returns:
        Exit vector from the transient states into absorption
      See Also:
        `PhaseVar.getMat0()`

    - #### getMatrixArray

          public double[][] getMatrixArray()

      Description copied from interface: `PhaseVar`
      Returns the transition matrix in double format
      Specified by:
        `getMatrixArray` in interface `PhaseVar`
      Returns:
        Transition matrix for transient states of the Phase-Type Distribution in double[][] format
      See Also:
        `PhaseVar.getMatrixArray()`

    - #### getVectorArray

          public double[] getVectorArray()

      Description copied from interface: `PhaseVar`
      Returns the initial probability mass vector in double[] format
      Specified by:
        `getVectorArray` in interface `PhaseVar`
      Returns:
        Initial probability mass vector in double[] format
      See Also:
        `PhaseVar.getVectorArray()`

    - #### getMat0Array

          public double[] getMat0Array()

      Description copied from interface: `PhaseVar`
      Returns the exit vector in double[] format
      Specified by:
        `getMat0Array` in interface `PhaseVar`
      Returns:
        Exit vector from the transient states to absorption in double[] format
      See Also:
        `PhaseVar.getMat0Array()`

    - #### expectedValue

          public double expectedValue()

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

    - #### variance

          public double variance()

      Description copied from interface: `PhaseVar`
      Computes the variance of the Phase-type variable
      Specified by:
        `variance` in interface `PhaseVar`
      Returns:
        Variance of the Phase-type variable
      See Also:
        `PhaseVar.variance()`

    - #### stdDeviation

          public double stdDeviation()

      Description copied from interface: `PhaseVar`
      Computes the Standard deviation of the Phase-type variable
      Specified by:
        `stdDeviation` in interface `PhaseVar`
      Returns:
        Standard deviation of the Phase-type variable
      See Also:
        `PhaseVar.stdDeviation()`

    - #### CV

          public double CV()

      Description copied from interface: `PhaseVar`
      Computes the Coefficient of Variation of the Phase-type variable
      Specified by:
        `CV` in interface `PhaseVar`
      Returns:
        Coefficient of Variation of the Phase-type variable
      See Also:
        `PhaseVar.CV()`

    - #### 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`
      Parameters:
        `k` - Moment to compute
      Returns:
        k-th Moment of the Phase-type variable
      See Also:
        `PhaseVar.moment(int)`

    - #### cdf

          public double cdf(double x)

      Description copied from interface: `PhaseVar`
      Evaluates the cumulative distribution function at x
      Specified by:
        `cdf` in interface `PhaseVar`
      Parameters:
        `x` - Evaluation point
      Returns:
        Cumulative density function at x
      See Also:
        `PhaseVar.cdf(double)`

    - #### cdf

          public double[] cdf(int n,
                     double delta)

      Description copied from interface: `PhaseVar`
      Evaluates the cumulative distribution function at n values of x, starting with x=0, step delta
      Specified by:
        `cdf` in interface `PhaseVar`
      Parameters:
        `n` - number of evaluation points
        `delta` - distance between evaluation points
      Returns:
        Evaluation of the survival Function at x = 0,d,2d,..,(n-1)d
      See Also:
        `PhaseVar.cdf(int, double)`

    - #### pmf

          public double pmf(int k)

      Description copied from interface: `DiscPhaseVar`
      Evaluates the probability mass function at k
      Specified by:
        `pmf` in interface `DiscPhaseVar`
      Parameters:
        `k` - Evaluation point
      Returns:
        Evaluation of the probability mass function at k
      See Also:
        `DiscPhaseVar.pmf(int)`

    - #### pmf

          public double[] pmf(int n,
                     int delta)

      Description copied from interface: `DiscPhaseVar`
      Evaluates the probability mass function at n values of x, from zero to n times delta
      Specified by:
        `pmf` in interface `DiscPhaseVar`
      Parameters:
        `n` - number of evaluation points
        `delta` - distance between evaluation points
      Returns:
        Evaluation of the survival Function at x = 0,d,2d,..,(n-1)d
      See Also:
        `DiscPhaseVar.pmf(int, int)`

    - #### prob

          public double prob(double a,
                    double b)

      Description copied from interface: `PhaseVar`
      Computes the probability that this variable takes a value between a and b
      Specified by:
        `prob` in interface `PhaseVar`
      Parameters:
        `a` - inferior limit
        `b` - superior limit
      Returns:
        Probability that this variable takes a value between a and b
      See Also:
        `PhaseVar.prob(double, double)`

    - #### survival

          public double survival(double x)

      Description copied from interface: `PhaseVar`
      Evaluates the survival function at x
      Specified by:
        `survival` in interface `PhaseVar`
      Parameters:
        `x` - Evaluation point
      Returns:
        Evaluation of the survival Function at x = 1-F(x)=P(X>x)
      See Also:
        `PhaseVar.survival(double)`

    - #### survival

          public double[] survival(int n,
                          double delta)

      Description copied from interface: `PhaseVar`
      Evaluates the survival function at n values of x, starting with x=0, step delta
      Specified by:
        `survival` in interface `PhaseVar`
      Parameters:
        `n` - number of evaluation points
        `delta` - distance between evaluation points
      Returns:
        Evaluation of the survival Function at x = 0,d,2d,..,(n-1)d
      See Also:
        `PhaseVar.survival(int, double)`

    - #### lossFunction1

          public double lossFunction1(double x)

      Description copied from interface: `PhaseVar`
      Evaluates the loss function of order 1 at x
      Specified by:
        `lossFunction1` in interface `PhaseVar`
      Parameters:
        `x` - Evaluation point
      Returns:
        Evaluation of the loss function of order 1
      See Also:
        `PhaseVar.lossFunction1(double)`

    - #### lossFunction2

          public double lossFunction2(double x)

      Description copied from interface: `PhaseVar`
      Evaluates the loss function of order 2 at x
      Specified by:
        `lossFunction2` in interface `PhaseVar`
      Parameters:
        `x` - Evaluation point
      Returns:
        Evaluation of the loss function of order 2
      See Also:
        `PhaseVar.lossFunction2(double)`

    - #### quantil

          public double quantil(double p)

      Description copied from interface: `PhaseVar`
      Computes the quantile q of the distribution, such that F(q) = p
      Specified by:
        `quantil` in interface `PhaseVar`
      Parameters:
        `p` - probability such that F(q) = p
      Returns:
        The quantile q of the distribution, such that F(q) = p
      See Also:
        `PhaseVar.quantil(double)`

    - #### median

          public double median()

      Description copied from interface: `PhaseVar`
      Computes the median of the distribution
      Specified by:
        `median` in interface `PhaseVar`
      Returns:
        The median of the distribution
      See Also:
        `PhaseVar.median()`

    - #### sum

          public DiscPhaseVar sum(DiscPhaseVar v2,
                         DiscPhaseVar res)

      Description copied from interface: `DiscPhaseVar`
      Computes the sum of variables: res = A +B
      Specified by:
        `sum` in interface `DiscPhaseVar`
      Parameters:
        `v2` - Variable to sum to the original
        `res` - Variable to store the result
      Returns:
        Sum of Variables: res = A +B
      See Also:
        `DiscPhaseVar.sum(jphase.DiscPhaseVar, jphase.DiscPhaseVar)`

    - #### sum

          public DiscPhaseVar sum(DiscPhaseVar v2)

      Description copied from interface: `DiscPhaseVar`
      Computes the sum of variables: res = A +B
      Specified by:
        `sum` in interface `DiscPhaseVar`
      Parameters:
        `v2` - Variable to sum to the original
      Returns:
        Sum of Variables: res = A +B
      See Also:
        `DiscPhaseVar.sum(jphase.DiscPhaseVar)`

    - #### sumGeom

          public DiscPhaseVar sumGeom(double p)

      Description copied from interface: `DiscPhaseVar`
      Returns the sum of a geometric number of independent copies of this variable
      Specified by:
        `sumGeom` in interface `DiscPhaseVar`
      Parameters:
        `p` - Parameter of the geometric variable
      Returns:
        Sum of a geometric number of independent copies of this variable
      See Also:
        `DiscPhaseVar.sumGeom(double)`

    - #### mix

          public DiscPhaseVar mix(double p,
                         DiscPhaseVar v2,
                         DiscPhaseVar res)

      Description copied from interface: `DiscPhaseVar`
      Computes the distribution of the mix: res = A*p + B*(1-p)
      Specified by:
        `mix` in interface `DiscPhaseVar`
      Parameters:
        `p` - Portion of this variable in the mix (0<=p<=1)
        `v2` - Variable to mix with the original
        `res` - Variable to store the resulting distribution with the same number of phases of the original distribution
      Returns:
        Distribution of the mix: res = A*p + B*(1-p)
      See Also:
        `DiscPhaseVar.mix(double, jphase.DiscPhaseVar, jphase.DiscPhaseVar)`

    - #### mix

          public DiscPhaseVar mix(double p,
                         DiscPhaseVar v2)

      Description copied from interface: `DiscPhaseVar`
      Computes the distribution of the mix: res = A*p + B*(1-p)
      Specified by:
        `mix` in interface `DiscPhaseVar`
      Parameters:
        `p` - Portion of this variable in the mix (0<=p<=1) with the same number of phases of the original distribution
        `v2` - Variable to mix with the original
      Returns:
        Distribution of the mix: res = A*p + B*(1-p)
      See Also:
        `DiscPhaseVar.mix(double, jphase.DiscPhaseVar)`

    - #### min

          public DiscPhaseVar min(DiscPhaseVar v2,
                         DiscPhaseVar res)

      Description copied from interface: `DiscPhaseVar`
      Returns the minimum between the variable B and the original: res = min(A,B)
      Specified by:
        `min` in interface `DiscPhaseVar`
      Parameters:
        `v2` - Variable to compare with the original
        `res` - Variable to store the resulting distribution
      Returns:
        res = min(A,B)
      See Also:
        `DiscPhaseVar.min(jphase.DiscPhaseVar, jphase.DiscPhaseVar)`

    - #### min

          public DiscPhaseVar min(DiscPhaseVar v2)

      Description copied from interface: `DiscPhaseVar`
      Returns the minimum between the variable B and the original: res = min(A,B)
      Specified by:
        `min` in interface `DiscPhaseVar`
      Parameters:
        `v2` - Variable to compare with the original
      Returns:
        res = min(A,B)
      See Also:
        `DiscPhaseVar.min(jphase.DiscPhaseVar)`

    - #### max

          public DiscPhaseVar max(DiscPhaseVar v2,
                         DiscPhaseVar res)

      Description copied from interface: `DiscPhaseVar`
      Returns the maximum between the variable B and the original: res = max(A,B)
      Specified by:
        `max` in interface `DiscPhaseVar`
      Parameters:
        `v2` - Variable to compare with the original
        `res` - Variable to store the resulting distribution
      Returns:
        res = max(A,B)
      See Also:
        `DiscPhaseVar.max(jphase.DiscPhaseVar, jphase.DiscPhaseVar)`

    - #### max

          public DiscPhaseVar max(DiscPhaseVar v2)

      Description copied from interface: `DiscPhaseVar`
      Returns the maximum between the variable B and the original: res = max(A,B)
      Specified by:
        `max` in interface `DiscPhaseVar`
      Parameters:
        `v2` - Variable to compare with the original
      Returns:
        res = max(A,B)
      See Also:
        `DiscPhaseVar.max(jphase.DiscPhaseVar)`

    - #### toString

          public final java.lang.String toString()

      Description copied from interface: `JMarkovElement`
      This method returns a short String used in the user interface to describe this element. It is highly recommended that every class calls label(), using the following code:

           public final String toString() {
               return label();
           }

      Specified by:
        `toString` in interface `JMarkovElement`
      Specified by:
        `toString` in interface `DiscPhaseVar`
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A String label.
      See Also:
        `DiscPhaseVar.toString()`

    - #### label

          public java.lang.String label()

      Description copied from interface: `JMarkovElement`
      This method returns a short String used in the user interface to describe this element.
      Specified by:
        `label` in interface `JMarkovElement`
      Returns:
        A String label.
      See Also:
        `JMarkovElement.description()`

    - #### description

          public java.lang.String description()

      Description copied from interface: `JMarkovElement`
      This method return a complete verbal describtion of this element. This description may contain multiple text rows.
      Specified by:
        `description` in interface `JMarkovElement`
      Returns:
        A String describing this element.
      See Also:
        `JMarkovElement.label()`