def inverse_ADJ(self, iszerofunc=_iszero):
        if not self.is_square:
            raise NonSquareMatrixError("A Matrix must be square to invert.")

        d = self.berkowitz_det()
        zero = d.equals(0)
        if zero is None:
            # if equals() can't decide, will rref be able to?
            ok = self.rref(simplify=True)[0]
            zero = any(iszerofunc(ok[j, j]) for j in range(ok.rows))
        if zero:
            raise ValueError("Matrix det == 0; not invertible.")

        return self.adjugate() / d
Calculates the inverse using the adjugate matrix and a determinant.
dataset/ETHPy150Open sympy/sympy/sympy/matrices/matrices.py/MatrixBase.inverse_ADJ