1function G=MG1_NI_LRA0(A, A0hat, Gamma, varargin)
2% Newton Iteration
for M/G/1-Type Markov Chains, exploiting low-rank A0
4% G=MG1_NI_LRA0(A, A0hat, Gamma) solves G = A0 + A1 G + ... + A_N G^N,
5% where A = [A1 A2 A3 ... AN] has m rows and m*N columns and
is
6% a nonnegative matrix. A0
is also nonnegative and can be written as
7% A0 = A0hat*Gamma, where A0hat and Gamma are mxr and rxm matrices,
8% respectively. (A0+A1+A2+...+AN)
is irreducible and stochastic.
12% Mode: method used to solve the linear system at each iteration
13%
'DirectSum': solves the system directly
14%
'RealSchur': applies a real Schur decomposition (default)
15%
'ComplexSchur': applies a complex Schur decomposition
16% MaxNumIt: Maximum number of iterations (default: 50)
17% EpsilonValue: Required accuracy, used as stop criterium (default:10^(-14))
18% Verbose: The residual error
is printed at each step when set to 1,
30OptionValues{1}=[
'DirectSum ';
36for i=1:size(OptionNames,1)
37 options.(deblank(OptionNames(i,:)))=[];
41options.Mode='RealSchur';
44options.EpsilonValue=10^(-14);
46% Parse Optional Parameters
47options=ParseOptPara(options,OptionNames,OptionTypes,OptionValues,varargin);
49% check whether G
is known explicitly
50G=MG1_EG([A0hat*Gamma A],options.Verbose);
63while(check > options.EpsilonValue && numit < options.MaxNumIt)
66 %Compute B: matrices premultiplying Y_k, and C: right-hand side
67 B = zeros(m, (N+1)*r);
68 B(:,(N-1)*r+1:N*r) = A(:,(N-1)*m+1:N*m)*Ghat;
71 B(:,i*r+1:(i+1)*r) = A(:,i*m+1:(i+1)*m)*Ghat + B(:,(i+1)*r+1:(i+2)*r)*K;
73 C = Ghat - B(:,1:r) - A0hat;
74 B = reshape( [reshape(B(:,r+1:end),r*m,N); zeros((m-r)*m,N)], m,N*m);
76 B(:,i*m+1:(i+1)*m) = B(:,i*m+1:i*m+r)*Gamma;
78 %B = A(:,m+1:end) + B;
80 B(:,1:m) = B(:,1:m) - eye(m);
82 if strfind(options.Mode,'RealSchur') > 0
83 Y = solveSylvPowersRealSchur_FW(K, B, C);
84 elseif strfind(options.Mode,'ComplexSchur') > 0
85 Y = solveSylvPowersComplexSchur_FW(K, B, C);
87 Y = solveSylvPowersDirectSum(K, B, C);
91 check=norm(Ghat-Gold,inf);
93 if (~mod(numit,options.Verbose))
94 fprintf('Check after %d iterations: %d\n',numit,check);
99if (numit == options.MaxNumIt)
100 warning('Maximum Number of Iterations %d reached',numit);
103if (options.Verbose>0)
105 temp=A(:,end-m+1:end);
107 temp=A(:,(i-1)*m+1:i*m)+temp*G;
109 res_norm=norm(G-temp,inf);
110 fprintf('Final Residual Error for G: %d\n',res_norm);