Package jline.lang.processes
Class CME
- All Implemented Interfaces:
Serializable,Copyable
A Concentrated Matrix Exponential (CME) distribution.
A CME is the matrix-exponential distribution of odd order 2*n+1 whose squared
coefficient of variation is (numerically) minimal for that order, from the tables of
Horvath, Horvath and Telek. Its SCV decays as O(1/n^2) and therefore goes far below
the Erlang bound 1/order attainable by a phase-type distribution of the same order:
order 101 gives SCV 3.9e-4, where Erlang-101 gives 9.9e-3.
The density of the unit-mean CME with n harmonic terms is
f(x) = mu1*exp(-mu1*x)*(c + sum_k [a_k*cos(k*w*mu1*x) + b_k*sin(k*w*mu1*x)])
with w = omega, which is exactly alpha*expm(A*x)*(-A*e) for the block-diagonal
A = blkdiag(-mu1, mu1*[-1 -k*w; k*w -1], k=1..n). The parameters a, b, c, omega and
mu1 are read from the same iltcme.json table used by the CME inverse Laplace
transform, see
iltcme.
The process type stays ME: a CME is a matrix-exponential representation, so every
solver gate, sn.procid entry and JSON key that accepts ME accepts it unchanged.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class jline.lang.processes.ME
ME.NegativeDensityScan -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCME(double mean, int order) Creates a concentrated matrix-exponential distribution. -
Method Summary
Modifier and TypeMethodDescriptionstatic CMEfitMeanAndSCV(double mean, double scv) Creates the lowest-order CME with the given mean whose SCV is at most the target.doubleGets the mean the distribution was constructed with.static doublegetMinSCV(int order) Gets the tabulated minimal SCV attained by a CME of the given order.intgetOrder()Gets the CME order, i.e.static int[]Gets the sorted list of CME orders (phase counts) present in the table.static Matrix[]representation(int order) Builds the unit-mean (alpha, A) matrix-exponential form of a CME.static iltcme.CmeEntrytableEntry(int order) Selects the CME table entry realizing the given number of phases.Methods inherited from class jline.lang.processes.ME
fitMoments, fromErlang, fromExp, fromHyperExp, getA, getAlpha, getMean, getNumberOfPhases, getProcess, getSCV, getVar, sample, scanNegativeDensityMethods inherited from class jline.lang.processes.Markovian
acf, D, embedded, embeddedProb, evalCDF, evalCDF, evalLST, evalMeanT, evalVarT, getACF, getACF, getEmbedded, getEmbeddedProb, getIDC, getIDI, getInitProb, getMoments, getMu, getPhi, getRate, getSkewness, getSubgenerator, getVariance, idc, idi, initProb, mean, moments, mu, numberOfPhases, numPhases, phi, process, rate, sample, scv, setMean, setProcess, setRate, skewness, subgenerator, var, varianceMethods inherited from class jline.lang.processes.Distribution
evalProbInterval, getName, getNumParams, getParam, getSupport, isContinuous, isDisabled, isDiscrete, isImmediate, isMarkovian, name, numParams, param, setNumParams, setParam, support
-
Constructor Details
-
CME
public CME(double mean, int order) Creates a concentrated matrix-exponential distribution.- Parameters:
mean- the mean of the distribution (positive and finite)order- the number of phases, an odd integer 2*n+1 with n present in the table- Throws:
IllegalArgumentException- if the mean is not positive or the order is not tabulated
-
-
Method Details
-
getOrder
public int getOrder()Gets the CME order, i.e. the number of phases.- Returns:
- the number of phases
-
getConfiguredMean
public double getConfiguredMean()Gets the mean the distribution was constructed with.- Returns:
- the mean
-
tableEntry
Selects the CME table entry realizing the given number of phases. The table is keyed by the number of harmonic terms n, so an order of 2*n+1 phases maps to the entries with that n. Several entries can share an n (the "full" and "approx" optimizations), and the most concentrated one is taken, matching the selection rule of the CME inverse Laplace transform.- Parameters:
order- the number of phases- Returns:
- the selected table entry
- Throws:
IllegalArgumentException- if the order is not an odd integer or is not tabulated
-
getSupportedOrders
public static int[] getSupportedOrders()Gets the sorted list of CME orders (phase counts) present in the table.- Returns:
- the available orders in increasing order
-
getMinSCV
public static double getMinSCV(int order) Gets the tabulated minimal SCV attained by a CME of the given order.- Parameters:
order- the number of phases- Returns:
- the minimal squared coefficient of variation
-
fitMeanAndSCV
Creates the lowest-order CME with the given mean whose SCV is at most the target.- Parameters:
mean- the target meanscv- the target squared coefficient of variation, an upper bound: the lowest tabulated order whose minimal SCV does not exceed it is selected, so the result is at least as concentrated as requested- Returns:
- the CME of that order rescaled to the requested mean
- Throws:
IllegalArgumentException- if no tabulated order reaches the requested SCV
-
representation
Builds the unit-mean (alpha, A) matrix-exponential form of a CME. A = blkdiag(-mu1, mu1*[-1 -k*w; k*w -1], k=1..n) reproduces the exponential envelope in its first phase and the k-th harmonic in its k-th 2x2 rotation block, since expm(mu1*x*[-1 -kw; kw -1]) is exp(-mu1*x) times the rotation by k*w*mu1*x. The entries of alpha follow by matching -alpha*expm(A*x)*A*e term by term: with wk = k*w and d = 2*(1+wk^2), alpha_0 = c, alpha_{2k-1} = ((1+wk)*a_k - (1-wk)*b_k)/d, alpha_{2k} = ((1-wk)*a_k + (1+wk)*b_k)/d. The result has unit mean and sums to one, as any (alpha, A) whose density integrates to one must.- Parameters:
order- the number of phases- Returns:
- a two-element array holding the row vector alpha and the matrix A
-