Here is one way (I am not saying it is always a good strategy):

sage: R = Qp(2,type='floating-point',print_mode='terse')
sage: M = Matrix(R,4,[0, 0, 1, 1, 2^20, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1])
sage: Mi = (M.change_ring(QQ)^(-1)).change_ring(R)
sage: Mi

[1048575       0       0       1]
[      0       0       1 1048575]
[      1 1048575       1 1048575]
[1048576       1 1048575       1]
sage: M*Mi

[      1       0       0       0]
[      0       1       0       0]
[1048576       0       1       0]
[1048576       0       0       1]
sage: Mi*M

[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[0 0 0 1]


On 31 January 2018 at 10:29, Nils Bruin <nbr...@sfu.ca> wrote:

> On Tuesday, January 30, 2018 at 3:50:45 PM UTC, Simon Brandhorst wrote:
>>
>> sage: M = Matrix(R,4,[0, 0, 1, 1, 2^19, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1])
>> sage: M.inverse()
>> [     1048575            2            0            1]
>> [274878955520       524288            1      1048575]
>> [      524289       524287            1       524287]
>> [274877382656       524289      1048575       524289]
>>
>> Works.
>>
>
> Only in the sense that you don't get an error:
>
> sage: min([a.valuation() for a in (M*M^(-1)-M^0).list()])
> 1
>
> that's quite far from what it should be. With appropriate pivoting of
> course:
>
> sage: min([a.valuation() for a in (M*(P*(M*P)^(-1))-M^0).list()])
> 20
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to