returns column-matrix solving the linear problem of matrix mat and column-matrix vec via QR decomposition.