Class APHKt
-
- All Implemented Interfaces:
public final class APHKt
-
-
Method Summary
Modifier and Type Method Description final static Pair<DoubleArray, Matrix>aph_simplify(DoubleArray a1, Matrix T1, DoubleArray a2, Matrix T2, Double p1, Double p2, ConvolutionPattern pattern)Simplifies/combines two APH distributions using a specified pattern. final static Pair<DoubleArray, Matrix>aph_convpara(List<Pair<DoubleArray, Matrix>> distributions)Performs convolution on parallel structure with any number of elements. final static Pair<DoubleArray, Matrix>aph_convseq(List<Pair<DoubleArray, Matrix>> distributions)Performs convolution on sequential structure with any number of elements. final static MatrixCellaph_rand(Integer K)Generates a random APH (acyclic phase-type) distribution as a MAP. final static Pair<MatrixCell, Boolean>aph_fit(Double e1, Double e2, Double e3, Integer nmax)Fits an APH distribution to match first three moments. final static Pair<DoubleArray, DoubleArray>ph2hyper(MatrixCell PH)Converts a hyper-exponential PH distribution to its rate/probability form. final static DoubleArrayhyper_rand(DoubleArray rates, DoubleArray probs, Integer nSamples)Generates random samples from a hyper-exponential distribution. -
-
Method Detail
-
aph_simplify
final static Pair<DoubleArray, Matrix> aph_simplify(DoubleArray a1, Matrix T1, DoubleArray a2, Matrix T2, Double p1, Double p2, ConvolutionPattern pattern)
Simplifies/combines two APH distributions using a specified pattern.
- Parameters:
a1- Initial probability vector of first distributionT1- Rate matrix of first distributiona2- Initial probability vector of second distributionT2- Rate matrix of second distributionp1- Branch probability for first distribution (for BRANCH pattern)p2- Branch probability for second distribution (for BRANCH pattern)pattern- Convolution pattern to use- Returns:
Pair of (combined alpha, combined T)
-
aph_convpara
final static Pair<DoubleArray, Matrix> aph_convpara(List<Pair<DoubleArray, Matrix>> distributions)
Performs convolution on parallel structure with any number of elements.
- Parameters:
distributions- List of pairs (alpha, T) for each distribution- Returns:
Combined (alpha, T)
-
aph_convseq
final static Pair<DoubleArray, Matrix> aph_convseq(List<Pair<DoubleArray, Matrix>> distributions)
Performs convolution on sequential structure with any number of elements.
- Parameters:
distributions- List of pairs (alpha, T) for each distribution- Returns:
Combined (alpha, T)
-
aph_rand
final static MatrixCell aph_rand(Integer K)
Generates a random APH (acyclic phase-type) distribution as a MAP.
- Parameters:
K- Order of the APH distribution (default: 2)- Returns:
MAP representation {D0, D1}
-
aph_fit
final static Pair<MatrixCell, Boolean> aph_fit(Double e1, Double e2, Double e3, Integer nmax)
Fits an APH distribution to match first three moments.
Implementation based on: A.Bobbio, A.Horvath, M.Telek, "Matching three moments with minimal acyclic phase type distributions", Stochastic Models 21:303-326, 2005.
- Parameters:
e1- First moment (mean)e2- Second momente3- Third momentnmax- Maximum order to try (default: 10)- Returns:
Pair of (fitted MAP, isExact flag)
-
ph2hyper
final static Pair<DoubleArray, DoubleArray> ph2hyper(MatrixCell PH)
Converts a hyper-exponential PH distribution to its rate/probability form.
- Parameters:
PH- Phase-type distribution as {D0, D1}- Returns:
Pair of (rates, probabilities)
-
hyper_rand
final static DoubleArray hyper_rand(DoubleArray rates, DoubleArray probs, Integer nSamples)
Generates random samples from a hyper-exponential distribution.
- Parameters:
rates- Exponential ratesprobs- Selection probabilitiesnSamples- Number of samples- Returns:
Array of samples
-
-
-
-