(self)
return prod.expand()
Compute matrix determinant using LU decomposition

        Note that this method fails if the LU decomposition itself
        fails. In particular, if the matrix has no inverse this method
        will fail.

        TODO: Implement algorithm for sparse matrices (SFF),
        http://www.eecis.udel.edu/~saunders/papers/sffge/it5.ps.

        See Also
        ========

        det
        det_bareis
        berkowitz_det
Compute matrix determinant using LU decomposition
Compute matrix determinant using LU decomposition
def det_LU_decomposition(self):
        """Compute matrix determinant using LU decomposition

        Note that this method fails if the LU decomposition itself
        fails. In particular, if the matrix has no inverse this method
        will fail.

        TODO: Implement algorithm for sparse matrices (SFF),
        http://www.eecis.udel.edu/~saunders/papers/sffge/it5.ps.

        See Also
        ========

        det
        det_bareis
        berkowitz_det
        """
        if not self.is_square:
            raise NonSquareMatrixError()
        if not self:
            return S.One

        M, n = self.copy(), self.rows
        p, prod = [], 1
        l, u, p = M.LUdecomposition()
        if len(p) % 2:
            prod = -1

        for k in range(n):
            prod = prod*u[k, k]*l[k, k]

        return prod.expand()
def det_LU_decomposition ( self ) : if not self . is_square : raise NonSquareMatrixError ( ) if not self : return S . One M , n = self . copy ( ) , self . rows p , prod = [ ] , 1 l , u , p = M . LUdecomposition ( ) if len ( p ) % 2 : prod = - 1 for k in range ( n ) : prod = prod * u [ k , k ] * l [ k , k ] return prod . expand ( )