Simple question: modulo



On 1/27/08, Stavros Macrakis <macrakis at alum.mit.edu> wrote:

> m: matrix( [15,2,7],  [8,10,23],  [0,2,8])$
> determinant(m) => 494        <<<<<<<<< calculate over Z
> modulus:23;
>    => 23
> rm:rat(m);
>   =>  matrix([-8,2,7],[8,10,0],[0,2,8])
>  determinant(rm);        <<<<<<<<<<<<  calculate over Z23
>    => 11
> rm^^-1;                        <<<<<<<<<<<<<< inverse over Z23
>   => matrix([1,4,2],[-10,-10,3],[-9,-9,8])
>  rm . rm^^-1;
>   => matrix([1,0,0],[0,1,0],[0,0,1])

Stavros, I'm adding these examples to the testsuite, if that's OK with you.

I've noticed something that seems like a bug.
rm is a CRE matrix and some functions of rm, e.g. determinant(rm)
and rm . rm^^-1 are also CRE's, but rm^^-1 is not.
Shouldn't rm^^-1 also be a CRE matrix?
In contrast, invert(rm) does yield a CRE matrix; I guess rm^^-1
goes down a different path in the code. Maybe foo^^-1 should
simply punt to invert(foo) ??

There is the global flag ratmx which seems to effectively coerce
ordinary matrices to CRE, but apart from that it seems like operations
on CRE matrices should yield CRE's.

best,

Robert