% Script P1
% Checks out SpecialHess

randn('seed',0)
clc
n = 7;
v = randn(n,1); v = v/norm(v);
A = randn(n,n);
[Q,H] = SpecialHess(A,v);
fprintf('norm(Q''*Q - I) = %10.3e\n',norm(Q'*Q - eye(n,n)))
fprintf('norm(Q''*A*Q - H) = %10.3e\n',norm(Q'*A*Q - H))
fprintf('norm(Q(:,1) - v) = %10.3e\n',norm(Q(:,1) - v))
Q = Q
H = H