1function R=GIM1_R(A,A0hat,Gamma,Dual,varargin)
2% Newton Iteration
for GI/M/1-Type Markov Chains, exploiting low-rank A0
4% R=GIM1_R(A,A0hat,Gamma,Dual) computes the minimal nonnegative solution to the
5% matrix equation R = A0 + R A1 + R^2 A2 + R^3 A3 + ... + R^N A_N,
6% where A = [A1 A2 A3 ... AN] has m rows and m*N columns and
is
7% a nonnegative matrix. A0
is also nonnegative and can be written as
8% A0 = Gamma*A0hat, where Gamma and A0hat are mxr and rxm matrices,
9% respectively. (A0+A1+A2+...+AN)
is irreducible and stochastic.
11% The parameter Dual specifies whether the Ramaswami or Bright
12% duals
is used. This parameter can take on 3 values:
14%
'B': Uses the Bright dual
15%
'R': Uses the Ramaswami dual
16%
'A': Automatic, uses the Bright dual for a positive
17% recurrent chain and the Ramaswami dual otherwise
21% See MG1_NI_LRA0 for the supported optional parameters
27% compute invariant vector of A and the drift
28% drift > 1: positive recurrent GIM1, drift < 1: transient GIM1
29sumA=A(:,dega*m+1:end);
31% beta = (A_maxd)e + (A_maxd + A_maxd-1)e + ... + (Amaxd+...+A1)e
33 sumA=sumA+A(:,i*m+1:(i+1)*m);
34 beta=beta+sum(sumA,2);
40if (strcmp(Dual,
'R')|(strcmp(Dual,
'A') & drift <=1 )) % RAM dual
41 % compute the RAM Dual process
42 A0hat=diag(theta.^(-1))*A0hat
';
43 Gamma=Gamma'*diag(theta);
45 A(:,i*m+1:(i+1)*m)=diag(theta.^(-1))*A(:,i*m+1:(i+1)*m)
'*diag(theta);
48 if (drift > 1) % A -> positive recurrent GIM1
49 % compute the Caudal characteristic of A
51 else % A -> transient GIM1 (=recurrent MG1)
54 % compute invariant vector of A0+A1*eta+A2*eta^2+...+A_N*eta^N
55 sumAeta=eta^dega*A(:,dega*m+1:end);
57 sumAeta=sumAeta+eta^i*A(:,i*m+1:(i+1)*m);
59 theta=stat(sumAeta+(1-eta)*eye(m));
60 % compute the Bright Dual process
61 A0hat=eta^(-1)*diag(theta.^(-1))*A0hat';
62 Gamma=Gamma
'*diag(theta);
64 A(:,i*m+1:(i+1)*m)=eta^(i-1)*diag(theta.^(-1))*A(:,i*m+1:(i+1)*m)'*diag(theta);
68G=MG1_NI_LRA0(A(:,m+1:end),A0hat,Gamma,varargin{:});
70if (strcmp(Dual,
'R')|(strcmp(Dual,
'A') & drift <=1 )) % RAM dual
71 R=diag(theta.^(-1))*G
'*diag(theta);
73 R=diag(theta.^(-1))*G'*diag(theta)*eta;