%% Hessenbergův tvar matice pomocí Householderovy transformace

format short
Ap=randi([-5 5],5);

%

function H=HhM(x)
% function H=HhM(x)
% Householder matrix such that Hx=ce_1
c=norm(x);
if c==0
    H=NaN;
    return
end
u=x;
if x(1)>0
    u(1)=u(1)+c;
else
    u(1)=u(1)-c;
end
H=eye(length(x))-2/(u'*u)*u*u';
end