LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
QBDFundamentalMatrices.m
1% M = QBDFundamentalMatrices(B, L, F, matrices, precision, maxNumIt, method)
2%
3% Returns the fundamental matrices corresponding to the
4% given QBD. Matrices R, G and U can be returned
5% depending on the "matrices" parameter.
6%
7% The implementation is based on [1]_, please cite it if
8% you use this method.
9%
10% Parameters
11% ----------
12% B : matrix, shape (N,N)
13% The matrix corresponding to backward transitions
14% L : matrix, shape (N,N)
15% The matrix corresponding to local transitions
16% F : matrix, shape (N,N)
17% The matrix corresponding to forward transitions
18% matrices : string
19% Specifies which matrices are required. 'R' means
20% that only matrix 'R' is needed. 'UG' means that
21% matrices U and G are needed. Any combinations of
22% 'R', 'G' and 'U' are allowed, in any order.
23% precision : double, optional
24% The matrices are computed iteratively up to this
25% precision. The default value is 1e-14
26% maxNumIt : int, optional
27% The maximal number of iterations. The default value
28% is 50.
29% method : {"CR", "LR", "NI", "FI", "IS"}, optional
30% The method used to solve the matrix-quadratic
31% equation (CR: cyclic reduction, LR: logarithmic
32% reduction, NI: Newton iteration, FI: functional
33% iteration, IS: invariant subspace method). The
34% default is "CR". "CR" is the only supported
35% method in the Mathematica and Python implementation.
36%
37% Returns
38% -------
39% M : list of matrices
40% The list of calculated matrices in the order as
41% requested in the 'matrices' parameter.
42%
43% Notes
44% -----
45% Discrete and continuous QBDs are both supported, the
46% procedure auto-detects it based on the diagonal entries
47% of matrix L.
48%
49% References
50% ----------
51% .. [1] Bini, D. A., Meini, B., Steffé, S., Van Houdt,
52% B. (2006, October). Structured Markov chains
53% solver: software tools. In Proceeding from the
54% 2006 workshop on Tools for solving structured
55% Markov chains (p. 14). ACM.
56
57function varargout = QBDFundamentalMatrices (B, L, F, matrices, precision, maxNumIt, method)
58
59 if ~exist('precision','var')
60 precision = 1e-14;
61 end
62
63 if ~exist('maxNumIt','var')
64 maxNumIt = 50;
65 end
66
67 if ~exist('method','var')
68 method = 'CR';
69 end
70
71 if strcmp(method,'CR')
72 fun = @QBD_CR;
73 elseif strcmp(method,'LR')
74 fun = @QBD_LR;
75 elseif strcmp(method,'NI')
76 fun = @QBD_NI;
77 elseif strcmp(method,'IS')
78 fun = @QBD_IS;
79 elseif strcmp(method,'FI')
80 fun = @QBD_FI;
81 end
82
83 global BuToolsVerbose;
84
85 if strfind(matrices,'R')
86 [G,R] = feval (fun, B, L, F, 'MaxNumIt', maxNumIt, 'Verbose', BuToolsVerbose);
87 else
88 G = feval (fun, B, L, F, 'MaxNumIt', maxNumIt, 'Verbose', BuToolsVerbose);
89 end
90
91 ret = cell(1,length(matrices));
92 for i=1:length(matrices)
93 if matrices(i)=='G'
94 ret{i} = G;
95 elseif matrices(i)=='R'
96 ret{i} = R;
97 elseif matrices(i)=='U'
98 % we did not let smctools calculate U since there is a bug:
99 % QBD_EG does not convert matrix U back to continuous
100 ret{i} = L+F*G;
101 end
102 end
103 varargout=ret;
104end