function Z = happly(U, X)
%HAPPLY Apply Householder reflections.
% Z = happly(U, X), with U from hqr
% computes Q*X without actually computing Q.
    H = @(u,x) x - 2*u*(u'*x);
    Z = X;
    [~,n] = size(U);
    for j = n:-1:1
        Z = H(U(:,j),Z);
    end
end
