LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
AcyclicDPHFromMG.m
1% [beta, B] = AcyclicDPHFromMG(alpha, A, precision)
2%
3% Transforms a matrix-geometric representation to an acyclic
4% DPH representation of the same size, if possible.
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% precision : double, optional
13% Vector and matrix entries smaller than the precision
14% are considered to be zeros. The default value is 1e-14.
15%
16% Returns
17% -------
18% beta : matrix, shape (1,M)
19% The initial probability vector of the acyclic discrete
20% phase-type representation
21% B : matrix, shape (M,M)
22% Transition probability matrix of the acyclic discrete
23% phase-type representation
24%
25% Notes
26% -----
27% Contrary to 'AcyclicPHFromME' of the 'ph' package, this
28% procedure is not able to extend the size in order to obtain
29% a Markovian initial vector.
30%
31% Raises an error if A has complex eigenvalues. In this case
32% the transformation to an acyclic representation is not
33% possible
34
35function [beta,B] = AcyclicDPHFromMG (alpha, A, prec)
36
37 if ~exist('prec','var')
38 prec = 10^-14;
39 end
40
41 global BuToolsCheckInput;
42
43 if isempty(BuToolsCheckInput)
44 BuToolsCheckInput = true;
45 end
46
47 if BuToolsCheckInput && ~CheckMGRepresentation(alpha, A)
48 error('AcyclicDPHFromMG: Input isn''t a valid MG distribution!');
49 end
50
51 lambda = eig(A);
52
53 if max(abs(imag(lambda)))>prec
54 error('AcyclicDPHFromMG: The input matrix has complex eigenvalue!');
55 end
56
57 lambda2 = EigSort(lambda);
58 lambda3 = lambda2(lambda2~=lambda2(end));
59 mx = diag(lambda2)+diag(1-lambda3, 1);
60 T = SimilarityMatrix (A, mx);
61 beta = alpha*T;
62 B = mx;
63
64 if ~CheckDPHRepresentation (beta, B, prec)
65 error('AcyclicDPHFromMG: No acyclic representation found!');
66 end
67end