parameter(nmax=100)
dimension a(nmax,nmax),q(nmax,nmax),r(nmax,nmax),x(nmax),b(nmax),w(nmax)

n=3
a(1,1)=-1; a(1,2)= 1; a(1,3)= 1
a(2,1)= 2; a(2,2)=-2; a(2,3)= 2
a(3,1)= 3; a(3,2)= 3; a(3,3)=-3

print *,'A:'
print *,(A(1,i),i=1,3)
print *,(A(2,i),i=1,3)
print *,(A(3,i),i=1,3)

call qrdec(a,n,n,nmax,q,r)

print *,'q:'
print *,(q(1,i),i=1,3)
print *,(q(2,i),i=1,3)
print *,(q(3,i),i=1,3)

print *,'r:'
print *,(r(1,i),i=1,3)
print *,(r(2,i),i=1,3)
print *,(r(3,i),i=1,3)

b(1)=1; b(2)=2; b(3)=3;
call qrback(q,r,n,nmax,b,x,w)
print *,'b:'
print *,(b(i),i=1,3)
print *,'x:'
print *,(x(i),i=1,3)


end
