LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
MG1FundamentalMatrix.m
1% G = MG1FundamentalMatrix(A, precision, maxNumIt, method)
2%
3% Returns matrix G corresponding to the M/G/1 type Markov
4% chain defined by matrices A.
5%
6% Matrix G is the minimal non-negative solution of the
7% following matrix equation:
8%
9% .. math::
10% G = A_0 + A_1 G + A_2 G^2 + A_3 G^3 + \dots.
11%
12% The implementation is based on [1]_, please cite it if
13% you use this method.
14%
15% Parameters
16% ----------
17% A : length(M) list of matrices of shape (N,N)
18% Matrix blocks of the M/G/1 type generator from
19% 0 to M-1.
20% precision : double, optional
21% Matrix G is computed iteratively up to this
22% precision. The default value is 1e-14
23% maxNumIt : int, optional
24% The maximal number of iterations. The default value
25% is 50.
26% method : {"CR", "RR", "NI", "FI", "IS"}, optional
27% The method used to solve the matrix-quadratic
28% equation (CR: cyclic reduction, RR: Ramaswami
29% reduction, NI: Newton iteration, FI: functional
30% iteration, IS: invariant subspace method). The
31% default is "CR".
32%
33% Returns
34% -------
35% G : matrix, shape (N,N)
36% The G matrix of the M/G/1 type Markov chain.
37% (G is stochastic.)
38%
39% References
40% ----------
41% .. [1] Bini, D. A., Meini, B., Steffé, S., Van Houdt,
42% B. (2006, October). Structured Markov chains
43% solver: software tools. In Proceeding from the
44% 2006 workshop on Tools for solving structured
45% Markov chains (p. 14). ACM.
46
47function G = MG1FundamentalMatrix (A, precision, maxNumIt, method)
48
49 if ~exist('precision','var')
50 precision = 1e-14;
51 end
52
53 if ~exist('maxNumIt','var')
54 maxNumIt = 50;
55 end
56
57 if ~exist('method','var')
58 method = 'CR';
59 end
60
61 if strcmp(method,'CR')
62 fun = @MG1_CR;
63 elseif strcmp(method,'RR')
64 fun = @MG1_RR;
65 elseif strcmp(method,'NI')
66 fun = @MG1_NI;
67 elseif strcmp(method,'IS')
68 fun = @MG1_IS;
69 elseif strcmp(method,'FI')
70 fun = @MG1_FI;
71 end
72
73 global BuToolsVerbose;
74
75 N = size(A{1},2);
76 Am = zeros(N, N*length(A));
77 for i=1:length(A)
78 Am(:,(i-1)*N+1:i*N) = A{i};
79 end
80
81 G = feval (fun, Am, 'MaxNumIt', maxNumIt, 'Verbose', double(BuToolsVerbose), 'EpsilonValue', precision);
82end