and correspodingly
def LU(A):
    size=A.shape[0]
    U=A.copy()
    L=np.eye(size)
    for i in xrange(size):
        L[i+1:,i]=(U[i+1:,i]/U[i,i])
        U[i+1:,i:] -= np.outer(L[i+1:,i], U[i,i:])
    return L,U