Made QR factorization a templated method