'Computes the determinant of a matrix.  If the matrix
is at most 3x3, a hard-coded formula is used.
Otherwise, the determinant using the method `method`.
Possible values for "method":
bareis
berkowitz
lu'

def det(self, method='bareiss'):

    method = method.lower()
    if (method == 'bareis'):
        method = 'bareiss'
    if (method == 'det_lu'):
        method = 'lu'
    if (method not in ('bareiss', 'berkowitz', 'lu')):
        raise ValueError(("Determinant    method    '%s'    unrecognized" % method))
    if (self.rows != self.cols):
        raise NonSquareMatrixError()
    n = self.rows
    if (n == 0):
        return S.One
    elif (n == 1):
        return self[(0, 0)]
    elif (n == 2):
        return ((self[(0, 0)] * self[(1, 1)]) - (self[(0, 1)] * self[(1, 0)]))
    elif (n == 3):
        return (((((((self[(0, 0)] * self[(1, 1)]) * self[(2, 2)]) + ((self[(0, 1)] * self[(1, 2)]) * self[(2, 0)])) + ((self[(0, 2)] * self[(1, 0)]) * self[(2, 1)])) - ((self[(0, 2)] * self[(1, 1)]) * self[(2, 0)])) - ((self[(0, 0)] * self[(1, 2)]) * self[(2, 1)])) - ((self[(0, 1)] * self[(1, 0)]) * self[(2, 2)]))
    if (method == 'bareiss'):
        return self._eval_det_bareiss()
    elif (method == 'berkowitz'):
        return self._eval_det_berkowitz()
    elif (method == 'lu'):
        return self._eval_det_lu()
