[sage-devel] Re: Inverse of a p-adic matrix fails. Is this a bug?

2018-01-30 Thread Simon King
Hi! I am afraid I don't know a definitive answer to your question. But at least I find the following a bit strange: sage: d = M.det() sage: d == -1 True sage: d == 0 False So, the inversion of M should work, I think. Let us do compute the inverse "manually" (i.e., by applying Gaussian e

[sage-devel] Re: Inverse of a p-adic matrix fails. Is this a bug?

2018-01-31 Thread Nils Bruin
I found this over CC and RR as well: the generic matrix inversion in sage (which is probably what is getting invoked) looks like it's based on straight-up row reduction: No pivoting (which it wouldn't know how to do in the generic case). For CC and RR there's PLU decomposition in mpmath which d

[sage-devel] Re: Inverse of a p-adic matrix fails. Is this a bug?

2018-01-31 Thread Nils Bruin
On Tuesday, January 30, 2018 at 3:50:45 PM UTC, Simon Brandhorst wrote: > > The following may be a bug or me not understanding p-adic floating point > computations: > > > 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

[sage-devel] Re: Inverse of a p-adic matrix fails. Is this a bug?

2018-01-31 Thread Nils Bruin
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() > [ 1048575201] > [274878955520 5242881 1048575] > [ 524289

[sage-devel] Re: Inverse of a p-adic matrix fails. Is this a bug?

2018-01-31 Thread Julian RĂ¼th
Hi Simon, Linear Algebra is known to have issues over the p-adics in Sage. The generic algorithms used are mostly unaware of precision issues. Xavier Caruso has been working on improving Sage's Linear Algebra capabilities for example at https://trac.sagemath.org/ticket/23505 and https://trac.s

[sage-devel] Re: Inverse of a p-adic matrix fails. Is this a bug?

2018-01-31 Thread Kiran Kedlaya
Would it make sense to implement a "generic pivot" method, which takes as an argument a function that does the pivot selection (that would then be handled separately over RR/CC vs p-adics)? Kiran On Wednesday, January 31, 2018 at 2:16:42 AM UTC-8, Nils Bruin wrote: > > I found this over CC and

Re: [sage-devel] Re: Inverse of a p-adic matrix fails. Is this a bug?

2018-01-31 Thread John Cremona
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

Re: [sage-devel] Re: Inverse of a p-adic matrix fails. Is this a bug?

2018-01-31 Thread Simon Brandhorst
Thank you for your replies. For the application I had in mind it seems that 'floating-point' numbers are not suitable. I was doing computations in sage: R = Zp(2,type='fixed-mod') 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().base_ring() 2-adic Fiel