Skip to content

Row rank profile / row pivots: direct extraction from echelon form over prime fields #40579

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

vneiger
Copy link
Contributor

@vneiger vneiger commented Aug 12, 2025

Fixes #40572

  • ensure the use of the LUdivine / LQUP strategy with the flag FfpackSlabRecursive
  • extract row rank profile using FFPACK's RankProfileFromLU

Concerning the first point, this strategy was already the one used in the single threaded case, since it is the default method in the FFPACK implementation. However it was not the default in the multi threaded case, which means there was actually a bug in Sage when calling _echelonize_linbox(efd=False) with 2 or more threads:

sage: mat = matrix(GF(3), [[1,0,1,0],[1,0,0,0],[1,0,0,0],[0,1,0,0]])
sage: mat.echelon_form()
[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[0 0 0 0]
sage: Parallelism().set("linbox", nproc=2)
sage: mat = matrix(GF(3), [[1,0,1,0],[1,0,0,0],[1,0,0,0],[0,1,0,0]])
sage: mat.echelon_form()
[1 0 0 0]
[0 0 1 0]
[0 1 0 0]
[0 0 0 0]

(the latter does not meet Sage's requirements of the reduced row echelon form)

Some more complete tests concerning the row rank profile are to be done before merging.

@vneiger vneiger added the gsoc: 2025 Tag for GSoC2025 issues/PRs label Aug 12, 2025
@vneiger
Copy link
Contributor Author

vneiger commented Aug 12, 2025

@Biffo89 : to add to the tests, could you please check if that solves your issue in PR #40508 ? thanks.

Copy link

github-actions bot commented Aug 12, 2025

Documentation preview for this PR (built with commit c8a927f; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

…s and pivot_rows when either of them is asked for
@vneiger
Copy link
Contributor Author

vneiger commented Aug 14, 2025

The previous version was not working correctly due to the row rank profile not being preserved by the used Gaussian elimination. The latest commits switched to the PLUQ method for which FFPACK guarantees to preserve both rank profiles. The class also overrides pivots and pivot_rows to ensure that when either of them is called, both rank profiles are cached (to avoid an unnecessary call to echelon_form when the other rank profile is requested).

It seems that the echelonization methods could be simplified and could also easily provide access to the transformation, but this is another issue.

@vneiger vneiger marked this pull request as ready for review August 15, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc: 2025 Tag for GSoC2025 issues/PRs s: needs review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make LinBox echelonization compute and cache both row and column rank profiles
1 participant