LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
GIM1_NI_LRAi.m
1function R=GIM1_R(A0,Ahat,Gamma,Dual,varargin)
2% Newton Iteration for GI/M/1-Type Markov Chains, exploiting low-rank Ai,
3% for i=1,...,N.
4%
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.
12%
13% The parameter Dual specifies whether the Ramaswami or Bright
14% duals is used. This parameter can take on 3 values:
15%
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
20%
21% Optional Parameters:
22%
23% See MG1_NI_LRAi for the supported optional parameters
24
25m=size(A0,1);
26r=size(Gamma,1);
27dega=size(Ahat,2)/r;
28A=zeros(m,m*(dega+1));
29A(:,1:m)=A0;
30for i=1:dega
31 A(:,i*m+1:(i+1)*m)=Ahat(:,(i-1)*r+1:i*r)*Gamma;
32end
33
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);
37beta=sum(sumA,2);
38% beta = (A_maxd)e + (A_maxd + A_maxd-1)e + ... + (Amaxd+...+A1)e
39for i=dega-1:-1:1
40 sumA=sumA+A(:,i*m+1:(i+1)*m);
41 beta=beta+sum(sumA,2);
42end
43sumA=sumA+A(:,1:m);
44theta=stat(sumA);
45drift=theta*beta;
46
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);
52 for i=1:dega
53 Ahatnew(:,(i-1)*m+1:i*m)=Ahat(:,(i-1)*r+1:i*r)'*diag(theta);
54 end
55else % Bright dual
56 if (drift > 1) % A -> positive recurrent GIM1
57 % compute the Caudal characteristic of A
58 eta=GIM1_Caudal(A);
59 else % A -> transient GIM1 (=recurrent MG1)
60 eta=MG1_Decay(A);
61 end
62 % compute invariant vector of A0+A1*eta+A2*eta^2+...+A_N*eta^N
63 sumAeta=eta^dega*A(:,dega*m+1:end);
64 for i=dega-1:-1:0
65 sumAeta=sumAeta+eta^i*A(:,i*m+1:(i+1)*m);
66 end
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);
72 for i=1:dega
73 Ahatnew(:,(i-1)*m+1:i*m)=eta^(i-1)*Ahat(:,(i-1)*r+1:i*r)'*diag(theta);
74 end
75end
76
77G=MG1_NI_LRAi(A0,Ahatnew,Gamma,varargin{:});
78
79if (strcmp(Dual,'R')|(strcmp(Dual,'A') & drift <=1 )) % RAM dual
80 R=diag(theta.^(-1))*G'*diag(theta);
81else % Bright dual
82 R=diag(theta.^(-1))*G'*diag(theta)*eta;
83end