function [q,r]=myqr(a)

[m,n]=size(a);
r=a;
q=eye(m);
for k=1:min(m-1,n)
   u=myhouse(r(k:m,k));
   r(k:m,k:n)=r(k:m,k:n)-2*u*(u'*r(k:m,k:n));
   q(k:m,1:m)=q(k:m,1:m)-2*u*(u'*q(k:m,1:m));
end
q=q';
r=triu(r);
