'Returns (L, U, perm) where L is a lower triangular matrix with unit
diagonal, U is an upper triangular matrix, and perm is a list of row
swap index pairs. If A is the original matrix, then
A = (L*U).permuteBkwd(perm), and the row permutation matrix P such
that P*A = L*U can be computed by P=eye(A.row).permuteFwd(perm).
See documentation for LUCombined for details about the keyword argument
rankcheck, iszerofunc, and simpfunc.
Examples
>>> from sympy import Matrix
>>> a = Matrix([[4, 3], [6, 3]])
>>> L, U, _ = a.LUdecomposition()
>>> L
Matrix([
[  1, 0],
[3/2, 1]])
>>> U
Matrix([
[4,    3],
[0, -3/2]])
See Also
cholesky
LDLdecomposition
QRdecomposition
LUdecomposition_Simple
LUdecompositionFF
LUsolve'

def LUdecomposition(self, iszerofunc=_iszero, simpfunc=None, rankcheck=False):

    (combined, p) = self.LUdecomposition_Simple(iszerofunc=iszerofunc, simpfunc=simpfunc, rankcheck=rankcheck)
    def entry_L(i, j):
        if (i < j):
            return S.Zero
        elif (i == j):
            return S.One
        elif (j < combined.cols):
            return combined[(i, j)]
        return S.Zero
    def entry_U(i, j):
        return (S.Zero if (i > j) else combined[(i, j)])
    L = self._new(combined.rows, combined.rows, entry_L)
    U = self._new(combined.rows, combined.cols, entry_U)
    return (L, U, p)
