1% [beta, B] = AcyclicPHFromME(alpha, A, maxSize, precision)
3% Transforms an arbitrary matrix-exponential representation
4% to an acyclic phase-type representation. (see [1]_).
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.
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
30% Raises an error if no Markovian acyclic representation
35% .. [1] Mocanu, S., Commault, C.:
"Sparse representations of
36% phase-type distributions," Stoch. Models 15, 759-778
39function [beta, B] = AcyclicPHFromME (alpha, A, maxSize, precision)
41 if ~exist(
'precision',
'var')
45 if ~exist(
'maxSize',
'var')
49 global BuToolsCheckInput;
51 if isempty(BuToolsCheckInput)
52 BuToolsCheckInput = true;
55 if BuToolsCheckInput && ~CheckMERepresentation(alpha, A)
56 error('AcyclicPHFromME: Input isn''t a valid ME distribution!');
59 G = TransformToAcyclic (A, maxSize, precision);
61 % find transformation matrix
62 T = SimilarityMatrix (A, G);
63 gamma = real(alpha*T);
65 if min(gamma) > -precision
69 [beta, B] = ExtendToMarkovian (gamma, G, maxSize, precision);
72 if ~CheckPHRepresentation(beta, B, precision)
73 error('AcyclicPHFromME: No acyclic representation found up to the given size and precision!');