1function R=GIM1_R(A0,Ahat,Gamma,Dual,varargin)
2% Newton Iteration
for GI/M/1-Type Markov Chains, exploiting low-rank Ai,
5% R=GIM1_R(A0,Ahat,Gamma,Dual) computes the minimal nonnegative solution to the
6% matrix equation R = A0 + R A1 + R^2 A2 + R^3 A3 + ... + R^N A_N,
7% where A0, A1,...,AN are mxm nonnegative matrices such that
8% (A0+A1+A2+...+AN)
is irreducible and stochastic.
9% Ai can be written as Ai = Aihat*Gamma,
for i = 1,...,N, with Aihat mxr
10% matrices and Gamma an rxm matrix.
11% Ahat = [A1hat A2hat A3hat ... ANhat] has m rows and r*N columns.
13% The parameter Dual specifies whether the Ramaswami or Bright
14% duals
is used. This parameter can take on 3 values:
16%
'B': Uses the Bright dual
17%
'R': Uses the Ramaswami dual
18%
'A': Automatic, uses the Bright dual for a positive
19% recurrent chain and the Ramaswami dual otherwise
23% See MG1_NI_LRAi for the supported optional parameters
31 A(:,i*m+1:(i+1)*m)=Ahat(:,(i-1)*r+1:i*r)*Gamma;
34% compute invariant vector of A and the drift
35% drift > 1: positive recurrent GIM1, drift < 1: transient GIM1
36sumA=A(:,dega*m+1:end);
38% beta = (A_maxd)e + (A_maxd + A_maxd-1)e + ... + (Amaxd+...+A1)e
40 sumA=sumA+A(:,i*m+1:(i+1)*m);
41 beta=beta+sum(sumA,2);
47if (strcmp(Dual,
'R')|(strcmp(Dual,
'A') & drift <=1 )) % RAM dual
48 % compute the RAM Dual process
49 A0=diag(theta.^(-1))*A0
'*diag(theta);
50 Gamma=diag(theta.^(-1))*Gamma';
51 Ahatnew=zeros(r,m*dega);
53 Ahatnew(:,(i-1)*m+1:i*m)=Ahat(:,(i-1)*r+1:i*r)
'*diag(theta);
56 if (drift > 1) % A -> positive recurrent GIM1
57 % compute the Caudal characteristic of A
59 else % A -> transient GIM1 (=recurrent MG1)
62 % compute invariant vector of A0+A1*eta+A2*eta^2+...+A_N*eta^N
63 sumAeta=eta^dega*A(:,dega*m+1:end);
65 sumAeta=sumAeta+eta^i*A(:,i*m+1:(i+1)*m);
67 theta=stat(sumAeta+(1-eta)*eye(m));
68 % compute the Bright Dual process
69 A0=eta^(-1)*diag(theta.^(-1))*A0'*diag(theta);
70 Gamma=diag(theta.^(-1))*Gamma
';
71 Ahatnew=zeros(r,m*dega);
73 Ahatnew(:,(i-1)*m+1:i*m)=eta^(i-1)*Ahat(:,(i-1)*r+1:i*r)'*diag(theta);
77G=MG1_NI_LRAi(A0,Ahatnew,Gamma,varargin{:});
79if (strcmp(Dual,
'R')|(strcmp(Dual,
'A') & drift <=1 )) % RAM dual
80 R=diag(theta.^(-1))*G
'*diag(theta);
82 R=diag(theta.^(-1))*G'*diag(theta)*eta;