Commit aaf9aa56 authored by conmccoid's avatar conmccoid
Browse files

Extrap: adapted Householder reflections further - no noticeable changes in results

parent 1fc46b22
......@@ -3,13 +3,19 @@ function [x_out,r_out]=ALGO_extrap_MPE_v3_20211119(F,X)
% with Householder reflections
[d,k] = size(F);
I=eye(d); Q=I; H = F;
R=F; H=zeros(d,k); %I=eye(d); Q=I;
x_out=zeros(d,k); r_out = zeros(k,1);
x_out(:,1)=X(:,1);r_out(1)=norm(F(:,1));
for i=1:min(d,k)
w = SUB_extrap_Householder_v1_20211119(H(:,i),i);
Q = (I-2*w*w')*Q;
H = (I-2*w*w')*H;
u = zeros(i,1); u(end)=1; u=H(1:i,1:i)\u; u=u/sum(u);
x_out(:,i) = X(:,1:i)*u;
r_out(i) = norm(F(:,1:i)*u);
w = SUB_extrap_Householder_v1_20211119(R(:,i),i);
% Q = Q - 2*Q*(w*w');
R = R - 2*(w*w')*R;
if i>1
H(1:i-1,i-1)=R(1:i-1,i)-R(1:i-1,i-1); H(i,i-1)=R(i,i);
u = zeros(i-1,1); u(1)=-R(1,1); u=H(1:i-1,1:i-1)\u;
u = [1;u] - [u;0];
x_out(:,i) = X(:,1:i)*u;
r_out(i) = norm(F(:,1:i)*u);
end
end
end
\ No newline at end of file
......@@ -2,7 +2,9 @@
% solve the equation x = Ax + b for random A and b
d = 40; n=2*d;
A = rand(d); A = A/norm(A); b = rand(d,1); x_true = -(A - eye(d)) \ b;
A = rand(d);
A = A/norm(A);
b = rand(d,1); x_true = -(A - eye(d)) \ b;
X = b;
for i=1:n
X(:,i+1) = A*X(:,i) + b;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment