I compared the times with your PR's method and yours is faster but it is
further from being simplified. Simplification takes about 1.5 minutes.

The op count for the 5 solutions before and after simplifying are
[165, 181, 207, 249, 158, 155]
[251, 269, 295, 339, 246, 150]

Using the "quick" methods gives the following and only takes 40 seconds to
make the simplification:
[164, 148, 138, 135, 203, 196]
[171, 154, 147, 146, 343, 206]

It's interesting that the last two of the quick results are larger than
those of your PR.


On Sat, Jan 11, 2014 at 8:58 PM, raoulb <notifications@github.com> wrote:

> In sympy/solvers/solvers.py:
>
> > +        return M.inv()
> > +    n = M.rows
> > +    d = det(M)
> > +    if d is S.Zero:
> > +        raise ValueError("Matrix det == 0; not invertible.")
> > +    ret = zeros(n)
> > +    s1 = -1
> > +    for i in range(n):
> > +        s = s1 = -s1
> > +        for j in range(n):
> > +            di = det(M.minorMatrix(i, j))
> > +            ret[j, i] = s*di/d
> > +            s = -s
> > +    return ret
> > +
> > +
>
> In principle I like to implement the general methods first and then see if
> we need special cases
> for special input. Maybe we should see what we can do for the various
> types of input.
>
>    - symbolic / exact numeric / floats
>    - dense / sparse
>    - tiny / small / large / huge
>    - full rank / ...
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/sympy/sympy/pull/2755/files#r8812593>
> .
>