Fixing minor bug in QR factorization.

The code fixes a bug in the QR factorization.
The new code also takes advantage of the new Vector class.