2 % @brief Solves level-dependent QBD processes
using matrix continued fractions
4 % @author QORE Lab, Imperial College London (Algorithm by Phung-Duc et al.)
8 % @brief Solves level-dependent QBD processes
using matrix continued fractions
11 % This function implements Algorithm 1 from
"A Simple Algorithm for the Rate
12 % Matrices of Level-Dependent QBD Processes" by Phung-Duc, Masuyama, Kasahara,
13 % and Takahashi (2010), QTNA Conference.
15 % It computes the rate matrices R^(n)
for an ergodic level-dependent QBD
16 % process with a finite number of levels, and optionally the stationary
19 % For a level-dependent QBD with levels 0, 1, ..., N, the infinitesimal
20 % generator has block-tridiagonal structure:
22 % Q^(0)_1 Q^(0)_0 O O ... O
23 % Q^(1)_2 Q^(1)_1 Q^(1)_0 O ... O
24 % O Q^(2)_2 Q^(2)_1 Q^(2)_0 ... O
25 % ... ... ... ... ... ...
26 % O O O ... Q^(N)_2 Q^(N)_1
28 % where Q_0^(n) are upward transitions (level n to n+1), Q_1^(n) are local
29 % transitions (within level n), and Q_2^(n) are downward transitions
34 % [R, pi] = ldqbd(Q0, Q1, Q2)
35 % [R, pi] = ldqbd(Q0, Q1, Q2, options)
40 % <tr><th>Name<th>Description
41 % <tr><td>Q0<td>Cell array {Q0^(0), Q0^(1), ..., Q0^(N-1)} - upward transitions
42 % <tr><td>Q1<td>Cell array {Q1^(0), Q1^(1), ..., Q1^(N)} - local transitions
43 % <tr><td>Q2<td>Cell array {Q2^(1), Q2^(2), ..., Q2^(N)} - downward transitions
44 % <tr><td>options<td>Optional struct with fields: epsilon (default 1e-10),
45 % maxIter (default 1000), verbose (default false)
50 % <tr><th>Name<th>Description
51 % <tr><td>R<td>Cell array {R^(1), R^(2), ..., R^(N)} - rate matrices
52 % <tr><td>pi<td>Row vector [pi_0, pi_1, ..., pi_N] - stationary distribution
56 % T. Phung-Duc, H. Masuyama, S. Kasahara, Y. Takahashi,
"A Simple Algorithm
57 % for the Rate Matrices of Level-Dependent QBD Processes", QTNA 2010.
59 % @see ldqbd_R, ldqbd_pi
61function [R, pi] = ldqbd(Q0, Q1, Q2, varargin)
64if nargin >= 4 && ~isempty(varargin{1})
65 options = varargin{1};
70if ~isfield(options,
'epsilon'), options.epsilon = 1e-10; end
71if ~isfield(options,
'maxIter'), options.maxIter = 1000; end
72if ~isfield(options,
'verbose'), options.verbose =
false; end
74% Determine number of levels
75N = length(Q1) - 1; % Maximum level
78 fprintf(
'LD-QBD Solver: N=%d levels, epsilon=%.2e\n', N, options.epsilon);
81% Compute all R matrices
using ldqbd_R
82R = ldqbd_R(Q0, Q1, Q2, options);
84% Compute stationary distribution
if requested
using ldqbd_pi
86 pi = ldqbd_pi(R, Q0, Q1, Q2, options);