LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
GIM1_NI_LRA0.m
1function R=GIM1_R(A,A0hat,Gamma,Dual,varargin)
2% Newton Iteration for GI/M/1-Type Markov Chains, exploiting low-rank A0
3%
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.
10%
11% The parameter Dual specifies whether the Ramaswami or Bright
12% duals is used. This parameter can take on 3 values:
13%
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
18%
19% Optional Parameters:
20%
21% See MG1_NI_LRA0 for the supported optional parameters
22
23A=[Gamma*A0hat A];
24m=size(A,1);
25dega=size(A,2)/m-1;
26
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);
30beta=sum(sumA,2);
31% beta = (A_maxd)e + (A_maxd + A_maxd-1)e + ... + (Amaxd+...+A1)e
32for i=dega-1:-1:1
33 sumA=sumA+A(:,i*m+1:(i+1)*m);
34 beta=beta+sum(sumA,2);
35end
36sumA=sumA+A(:,1:m);
37theta=stat(sumA);
38drift=theta*beta;
39
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);
44 for i=1:dega
45 A(:,i*m+1:(i+1)*m)=diag(theta.^(-1))*A(:,i*m+1:(i+1)*m)'*diag(theta);
46 end
47else % Bright dual
48 if (drift > 1) % A -> positive recurrent GIM1
49 % compute the Caudal characteristic of A
50 eta=GIM1_Caudal(A);
51 else % A -> transient GIM1 (=recurrent MG1)
52 eta=MG1_Decay(A);
53 end
54 % compute invariant vector of A0+A1*eta+A2*eta^2+...+A_N*eta^N
55 sumAeta=eta^dega*A(:,dega*m+1:end);
56 for i=dega-1:-1:0
57 sumAeta=sumAeta+eta^i*A(:,i*m+1:(i+1)*m);
58 end
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);
63 for i=1:dega
64 A(:,i*m+1:(i+1)*m)=eta^(i-1)*diag(theta.^(-1))*A(:,i*m+1:(i+1)*m)'*diag(theta);
65 end
66end
67
68G=MG1_NI_LRA0(A(:,m+1:end),A0hat,Gamma,varargin{:});
69
70if (strcmp(Dual,'R')|(strcmp(Dual,'A') & drift <=1 )) % RAM dual
71 R=diag(theta.^(-1))*G'*diag(theta);
72else % Bright dual
73 R=diag(theta.^(-1))*G'*diag(theta)*eta;
74end