algorithm for LU decomposition