Commit 07fa4a21 authored by Conor McCoid's avatar Conor McCoid
Browse files

Extrap: playing around with Householder version for overdetermined systems

parent ebecf0cc
...@@ -6,13 +6,19 @@ function [x_out,r_out]=ALGO_extrap_MPE_v3_20211119(F,X) ...@@ -6,13 +6,19 @@ function [x_out,r_out]=ALGO_extrap_MPE_v3_20211119(F,X)
R=F; H=zeros(d,k); %I=eye(d); Q=I; R=F; H=zeros(d,k); %I=eye(d); Q=I;
x_out=zeros(d,k); r_out = zeros(k,1); x_out=zeros(d,k); r_out = zeros(k,1);
x_out(:,1)=X(:,1);r_out(1)=norm(F(:,1)); x_out(:,1)=X(:,1);r_out(1)=norm(F(:,1));
for i=1:min(d,k) for i=1:k
w = SUB_extrap_Householder_v1_20211119(R(:,i),i); if i<=d
w = SUB_extrap_Householder_v1_20211119(R(:,i),i);
% Q = Q - 2*Q*(w*w'); % Q = Q - 2*Q*(w*w');
R = R - 2*(w*w')*R; R = R - 2*(w*w')*R;
end
if i>1 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); ind=1:min(i-1,d);
u = zeros(i-1,1); u(1)=-R(1,1); u=H(1:i-1,1:i-1)\u; H(ind,i-1)=R(ind,i)-R(ind,i-1);
if i<=d
H(i,i-1)=R(i,i);
end
u = zeros(min(i-1,d),1); u(1)=-R(1,1); u=H(ind,1:i-1)\u;
u = [1;u] - [u;0]; u = [1;u] - [u;0];
x_out(:,i) = X(:,1:i)*u; x_out(:,i) = X(:,1:i)*u;
r_out(i) = norm(F(:,1:i)*u); r_out(i) = norm(F(:,1:i)*u);
......
% Example - Extrapolation: fixed point iteration on linear function % Example - Extrapolation: fixed point iteration on linear function
% solve the equation x = Ax + b for random A and b % solve the equation x = Ax + b for random A and b
d = 40; n=2*d; d = 10; n=2*d;
A = rand(d); A = rand(d);
A = A/norm(A); % A = A/norm(A);
b = rand(d,1); x_true = -(A - eye(d)) \ b; b = rand(d,1); x_true = -(A - eye(d)) \ b;
X = b; X = b;
for i=1:n for i=1:n
......
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