added functions for QR decomposition of a matrix