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 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 
> does use partial pivoting. It would be nice to have "natively" in sage and 
> would be easy to program and would be nice to have for non-square matrices. 
> The code is easily adapted (see 
> https://git.sagemath.org/sage.git/commit?id=f2ccf44acc673458aba3cf92d7692c7a92a505b6
>  
> for a POC).
>
> Partial pivoting for p-adic PLU decomposition would be straightforward to 
> implement as well, and very worthwhile to have. It's well-known that matrix 
> inversion is tricky business numerically, even for well-conditioned 
> matrices, but with pivoting one should get reasonable results in a lot more 
> cases. p-adics might be a little better behaved, but fundamentally the same 
> numerical considerations play a role.
>
> 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, 1])
>> sage: M.det()
>> 1048575
>> sage: M.inverse()
>>
>> ---------------------------------------------------------------------------
>> ZeroDivisionError                         Traceback (most recent call 
>> last)
>> ....
>>
>> ZeroDivisionError: input matrix must be nonsingular
>>
>> 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. 
>>
>

-- 
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