function [X,Y] = cr_struct(R1,R2,R3,R4,R5,R6) % [X,Y]=CR_STRUCT(R1,R2,R3,R4,R5,R6) applies CR to the structured UQME % obtained by the simple tranformation % R1, R2, R3, R4, R5, R6: initial matrices % X, Y: limit of the sequence (X_k) and (Y_k), respectively tol = 1e-13; kmax = 30; n = size(R2,2); RR1 = R1; RR2 = R2; RR3 = R3; RR5 = R5; % CR step err = 1; k = 0; while err > tol && k < kmax S = R5 + R4*R3; W = S\[R2+R4*R1,R6]; Y = W(:,1:n); Z = W(:,n+1:end); X = R3*Y - R1; T = R3*Z; R3 = R3 - R1*T; R4 = R4 - R6*Y; R5 = R5 - R2*T; R1 = -R1*X; R2 = -R2*X; R6 = -R6*Z; k = k+1; err = min(norm(R6,1),max(norm(R1,1),norm(R2,1))); end X = -(RR5 + R4*RR3)\(RR2 + R4*RR1); Y = R3/R5; if k == kmax disp('Warning: reached the maximum number of iterations') enD