Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pivoting for Gaussian elimination on matrices over p-adics #17272

Closed
roed314 opened this issue Nov 1, 2014 · 16 comments
Closed

Use pivoting for Gaussian elimination on matrices over p-adics #17272

roed314 opened this issue Nov 1, 2014 · 16 comments

Comments

@roed314
Copy link
Contributor

roed314 commented Nov 1, 2014

sage: R = ZpCA(5,5,print_mode='val-unit')
sage: A = matrix(R,3,3,[250,2369,1147,106,927,362,90,398,2483])
sage: A
[5^3 * 2 + O(5^5)    2369 + O(5^5)    1147 + O(5^5)]
[    106 + O(5^5)     927 + O(5^5)     362 + O(5^5)]
[ 5 * 18 + O(5^5)     398 + O(5^5)    2483 + O(5^5)]
sage: A.det()
2634 + O(5^5)
sage: ~A
Traceback (most recent call last):
...
ZeroDivisionError: input matrix must be nonsingular

The problem is that Sage doesn't pivot when doing Gaussian elimination:

sage: K = R.fraction_field()
sage: A.change_ring(K).augment(identity_matrix(K,3))._echelon_classical()
[       1 + O(5^2)           O(5^-1)           O(5^-1)           O(5^-1)            O(5^2)   5^-1 * 7 + O(5)]
[           O(5^2)        1 + O(5^2)       13 + O(5^2)        4 + O(5^2)            O(5^5) 5^2 * 19 + O(5^4)]
[           O(5^3)            O(5^0)            O(5^0)            O(5^0)        1 + O(5^2)   5^-1 * 8 + O(5)]

Component: linear algebra

Author: Eran Assaf

Branch/Commit: 2bd0f37

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/17272

@roed314 roed314 added this to the sage-6.4 milestone Nov 1, 2014
@assaferan
Copy link
Mannequin

assaferan mannequin commented Apr 4, 2018

@assaferan
Copy link
Mannequin

assaferan mannequin commented Apr 4, 2018

Commit: db5591c

@assaferan
Copy link
Mannequin

assaferan mannequin commented Apr 4, 2018

comment:2

Hi,
I have added partial pivoting and scaled partial pivoting to the code,
including some examples for doctesting.
For now, I set scaled partial pivoting to be the default algorithm only for discrete valuation fields. This is until we will have a better framework for general valuation rings.

Also, I have not implemented complete pivoting, as it is only rarely needed and very inefficient.


New commits:

db5591cD

@assaferan
Copy link
Mannequin

assaferan mannequin commented Apr 4, 2018

Author: Eran Assaf

@assaferan assaferan mannequin added the s: needs review label Apr 4, 2018
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 4, 2018

Changed commit from db5591c to a05823a

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 4, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

a380cf9Using partial pivoting resulted in many more accurate results for p-adic modular forms
a05823aFixed a bug in scaled partial pivoting

@tscrim
Copy link
Collaborator

tscrim commented May 5, 2018

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented May 5, 2018

comment:4

Not all methods have a doctest. Also, do you want to c(p)def some of the methods? Since they are currently python methods, I don't see the point of the sig_check(). Also, there seems to be some code redundancy, is there a way you could mitigate that?

@tscrim tscrim modified the milestones: sage-6.4, sage-8.3 May 5, 2018
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 17, 2018

Changed commit from a05823a to 23e6363

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 17, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

23e6363Added several doctests, cpdefined the functions and mitigated some of the code redundancy.

@assaferan
Copy link
Mannequin

assaferan mannequin commented May 21, 2018

comment:6

Hi,
I cpdef'd the functions, and mitigated the code redundancy. Also added doctests where they were none.

@assaferan assaferan mannequin added s: needs review and removed s: needs work labels May 21, 2018
@tscrim
Copy link
Collaborator

tscrim commented May 22, 2018

comment:7

I did a little bit of cleanup. In particular, I factored out the classical algorithm to simplify the code to help keep it fast. If my changes are good, then you can set a positive review.


New commits:

0584db7Merge branch 'u/assaferan/use_pivoting_for_gaussian_elimination_on_matrices_over_p_adics' of git://trac.sagemath.org/sage into u/tscrim/pivot_gaussian_elimination_p_adics-17272
2bd0f37Some code cleanup.

@tscrim
Copy link
Collaborator

tscrim commented May 22, 2018

@tscrim
Copy link
Collaborator

tscrim commented May 22, 2018

Changed commit from 23e6363 to 2bd0f37

@assaferan
Copy link
Mannequin

assaferan mannequin commented May 23, 2018

comment:8

The changes seem to be in order, hence I'm setting to a positive review.

@vbraun
Copy link
Member

vbraun commented May 27, 2018

Changed branch from u/tscrim/pivot_gaussian_elimination_p_adics-17272 to 2bd0f37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants