LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
AcyclicPHFromME.m
1% [beta, B] = AcyclicPHFromME(alpha, A, maxSize, precision)
2%
3% Transforms an arbitrary matrix-exponential representation
4% to an acyclic phase-type representation. (see [1]_).
5%
6% Parameters
7% ----------
8% alpha : matrix, shape (1,N)
9% Initial vector of the distribution
10% A : matrix, shape (N,N)
11% Matrix parameter of the distribution
12% maxSize : int, optional
13% The maximum number of phases for the result.
14% The default value is 100.
15% precision : double, optional
16% Vector and matrix entries smaller than the precision
17% are considered to be zeros. The default value is 1e-14.
18%
19% Returns
20% -------
21% beta : matrix, shape (1,M)
22% The initial probability vector of the Markovian
23% acyclic representation
24% B : matrix, shape (M,M)
25% Transient generator matrix of the Markovian
26% acyclic representation
27%
28% Notes
29% -----
30% Raises an error if no Markovian acyclic representation
31% has been found.
32%
33% References
34% ----------
35% .. [1] Mocanu, S., Commault, C.: "Sparse representations of
36% phase-type distributions," Stoch. Models 15, 759-778
37% (1999)
38
39function [beta, B] = AcyclicPHFromME (alpha, A, maxSize, precision)
40
41 if ~exist('precision','var')
42 precision = 1e-14;
43 end
44
45 if ~exist('maxSize','var')
46 maxSize = 100;
47 end
48
49 global BuToolsCheckInput;
50
51 if isempty(BuToolsCheckInput)
52 BuToolsCheckInput = true;
53 end
54
55 if BuToolsCheckInput && ~CheckMERepresentation(alpha, A)
56 error('AcyclicPHFromME: Input isn''t a valid ME distribution!');
57 end
58
59 G = TransformToAcyclic (A, maxSize, precision);
60
61 % find transformation matrix
62 T = SimilarityMatrix (A, G);
63 gamma = real(alpha*T);
64
65 if min(gamma) > -precision
66 beta = gamma;
67 B = G;
68 else
69 [beta, B] = ExtendToMarkovian (gamma, G, maxSize, precision);
70 end
71
72 if ~CheckPHRepresentation(beta, B, precision)
73 error('AcyclicPHFromME: No acyclic representation found up to the given size and precision!');
74 end
75end