function u = house2(x) % % compute householder transformation % this is an unstable version. % % written by Ming Gu for Math 221, Fall 2008 % x = x(:); n = length(x); if (norm(x) == 0) u = ones(n,1)/sqrt(n); return; end x(1) = x(1) -norm(x); u = x/norm(x);