1function pi=GIM1_pi(B,R,varargin)
2%GIM1_pi Stationary vector of a GI/M/1-Type Markov Chain [Neuts]
4% pi=GIM1_pi(B,R) computes the stationary vector of a GI/M/1-Type
5% Markov chain with a transition matrix of the form
13% the input matrix R
is the minimal nonnegative solution to the matrix
14% equation R = A0 + R A1 + R^2 A2 + ... + R^maxa Amaxa
15% The input matrix B equals [B1; B2; ...; Bmaxb].
19% MaxNumComp: Maximum number of components (
default: 500)
20% Verbose: The accumulated probability mass
is printed at every
21% n steps when set to n (default:0)
22% Boundary: Allows solving the GI/M/1 Type MC with a more general
27%
P = B3 A2 A1 A0 0 ...
30% the parameter value contains the matrix [B0; A1; A2; ...;
32% The matrices B0 and Bi, i > 1, need not to be square.
48for i=1:size(OptionNames,1)
49 options.(deblank(OptionNames(i,:)))=[];
54options.MaxNumComp=500;
57% Parse Optional Parameters
58options=ParseOptPara(options,OptionNames,OptionTypes,OptionValues,varargin);
63if( max(temp<-100*eps) )
64 error('MATLAB:QBD_pi:InvalidRInput',...
65 'The spectral radius of R
is not below 1: QBD
is not pos. recurrent');
68if (isempty(options.Boundary))
70 BR=B((maxb-1)*m+1:end,:);
72 BR=R*BR+B((i-1)*m+1:i*m,:);
74 pi=stat(BR); % compute pi_0
75 pi=pi/(pi*temp*ones(m,1)); % normalize pi_0
78 while (sumpi < 1-10^(-10) && numit < 1+options.MaxNumComp)
79 pi(numit+1,1:m)=pi(numit,:)*R; % compute pi_(numit+1)
81 sumpi=sumpi+sum(pi(numit,:));
82 if (~mod(numit,options.Verbose))
83 fprintf('Accumulated mass after %d iterations: %d\n',numit,sumpi);
89 mb=size(B,2) % number of states of boundary level
90 maxbm1=(size(B,1)-mb)/m % maxb - 1
91 BR1=B(mb+(maxbm1-1)*m+1:end,:);
93 BR1=R*BR1+B(mb+(i-1)*m+1:mb+i*m,:);
95 maxa=(size(options.Boundary,1)-mb)/m
96 BR0=options.Boundary(mb+(maxa-1)*m+1:end,:);
99 BR0=R*BR0+options.Boundary(mb+(i-1)*m+1:mb+i*m,:);
101 pi0=stat([B(1:mb,:) options.Boundary(1:mb,:); BR0 BR1]); % compute pi_0 and pi_1
102 pi0=pi0/(pi0(1:mb)*ones(mb,1)+pi0(mb+1:end)*temp*ones(m,1)); % normalize
105 sumpi=sum(pi0)+sum(pi);
107 while (sumpi < 1-10^(-10) && numit < options.MaxNumComp)
108 pi(numit+1,1:m)=pi(numit,:)*R; % compute pi_(numit+1)
110 sumpi=sumpi+sum(pi(numit,:));
111 if (~mod(numit,options.Verbose))
112 fprintf('Accumulated mass after %d iterations: %d\n',numit,sumpi);
116 pi=[pi0 reshape(pi',1,[])];
120if (numit == 1+options.MaxNumComp)
121 warning('Maximum Number of Components %d reached',numit-1);