I certainly want to be able to create 0x0 matrices, and would insist
that the determinant is 1.  So it seems consistent to say that such a
matrix is invertible; and then there isn't much choice for the
inverse!

John

2009/2/7 Florent Hivert <[email protected]>:
>
>      Dear Martin Albrecht,
>
> Thanks for your quick answer.
>
>> > So my question is the following: is there a specific reason why this test
>> > has been written ?
>>
>> I wrote that doctest, because that behaviour is consistent with other
>> matrices.
>>
>> sage: A = random_matrix(GF(127),0,0)
>> sage: A^(-1)
>> Traceback (most recent call last)
>> ...
>> ZeroDivisionError:
>>
>> sage: A = random_matrix(QQ,0,0)
>> sage: A^(-1)
>> ---------------------------------------------------------------------------
>> Traceback (most recent call last)
>> ...
>> ZeroDivisionError:
>>
>>
>> I have no strong feelings about how things should behave as long as it is
>> consistent.
>
> Neither do I. Actually, As you pointed out, the main problem was more that
> this behavior was only tested for Matrix_mod2_dense, and not for the other
> type of matrices. Moreover you made me realize something even worse.
> For any type of matrices, sage were completely inconsistent since ~a and
> a^(-1) did not returns the same result:
>    sage: A = random_matrix(QQ,0,0)
>    sage:
>    sage: A^(-1)
>    ---------------------------------------------------------------------------
>    ZeroDivisionError                         Traceback (most recent call last)
> wheras:
>    sage: ~A
>    []
>
> Basically my patch delegate the choice to ~ to raise an error or not.
>
>> I suggest, to add doctests to catch these for the various matrix
>> types while you're changing the behaviour.
>
> Ok... I'll try not to forget any kind of matrices.
>
> I also hope there will be not too much kind where this case is not properly
> handled. One community question : suppose that this happen and that I don't
> find the correct way to fix it (no one knows about strange data structure :-))
> is this ok to post a patch that test the problem and raise a doc error and to
> add a trac ticket for this specific problem ?
>
> Cheers,
>
> Florent
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to