Confusion with 1 x 1 matrices



On 6/10/07, Robert Dodier <robert.dodier at gmail.com> wrote:
>
> On 6/10/07, Nikos Apostolakis <nikos.ap at gmail.com> wrote:
> > ...Is there a good reason for two different methods for computing the
> inverse? is
> > one method more efficient in certain situations?
>
> The difference between A^^-1 and invert(A) is probably historical
> (although I say this without looking at the code).
>

The documentation is actually pretty clear.  A^^-1 does all its calculations
with canonical rational expressions (CRE), which is good if you expect
algebraic cancellation.  invert(A) does its calculations in general
representation, which can give you huge blow-up in the size of the result.

You'd think, then, that A^^-1 would be equivalent to invert(rat(A)), and it
is to a certain extent.  But unfortunately, CRE does not support bfloats, so
this doesn't work in that case, and if you want to use floats (or floating
coefficients), you have to remember to bind keepfloat:true. The invert
algorithm is also "not efficient for large matrices"; don't know if ^^-1 is
better.

I suspect, but am not sure, that neither one uses a very good algorithm for
the purely numeric case.

             -s