QR for square matrices