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

Implement custom matrix-type row reduction scheme for exterior algebra Gröbner basis #34437

Open
tscrim opened this issue Aug 26, 2022 · 6 comments

Comments

@tscrim
Copy link
Collaborator

tscrim commented Aug 26, 2022

This is the main bottleneck in the the Gröbner basis code implemented in #34138. Sage's implementation is very inefficient (at least over QQ) as it creates a dense copy (when sparse, which the implementation in #34138 uses) and then does the row reduction on that. Doing the row reduction on that matrix also produces a copy that is then entry-wise copied back into the original matrix!

We implement a custom version of row reduction tailored to the GB computation. We also become very careful about our data structure:

We realize the matrix as a dictionary of the leading supports whose elements are lists of elements of the exterior algebra with that leading support. This way we do not need to create a lot of transient elements. It also makes swapping rows much faster and makes it clear which rows should do the reduction. This effectively "triangularizes" the matrix too.

Depends on #34138

CC: @trevorkarn

Component: linear algebra

Keywords: Gröbner basis, exterior algebra

Author: Travis Scrimshaw

Branch/Commit: public/algebras/improve_gb_echelon-34437 @ c40f258

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

@tscrim tscrim added this to the sage-9.7 milestone Aug 26, 2022
@tscrim
Copy link
Collaborator Author

tscrim commented Aug 26, 2022

Author: Travis Scrimshaw

@tscrim
Copy link
Collaborator Author

tscrim commented Aug 26, 2022

Commit: c40f258

@tscrim
Copy link
Collaborator Author

tscrim commented Aug 26, 2022

@tscrim
Copy link
Collaborator Author

tscrim commented Aug 26, 2022

comment:1

Here is my first attempt, which does seem to improve the speed that it does the linear algebra. There probably are much smarter things that could be done here, but even a naïve version over QQ helps quite a bit, at least for the larger case from the ~7s in M2 test noted in #34138. At least I am getting to the 105 x 256 matrix much faster, but it still is taking ages to do the computation.

I suspect you are correct that a much smarter selection algorithm is the key to getting the speed close to M2 speed.


Last 10 new commits:

ae696dbMerge branch 'public/algebras/exterior_algebra_index_set-32369' into public/algebras/exterior_groebner-34138
2637750Small doc tweak.
da58876Merge branch 'public/algebras/exterior_algebra_index_set-32369' into public/algebras/exterior_groebner-34138
140ac6cMigration of RAAG cohomology to Cython.
b227973Speeding up multiplication even further.
e7e84b7Special casing multiplication by a term.
36b6b20Doing reduction in place; being careful about duplicates.
8d30012Merge branch 'develop' into public/algebras/exterior_algebra_index_set-32369
f169b4eMerge branch 'public/algebras/exterior_algebra_index_set-32369' into public/algebras/exterior_groebner-34138
c40f258Initial custom matrix reduction implementation for exterior algebra GBs.

@tscrim
Copy link
Collaborator Author

tscrim commented Aug 31, 2022

F4 algorithm Peifer note

@tscrim
Copy link
Collaborator Author

tscrim commented Aug 31, 2022

comment:2

Attachment: math6140-2017a.pdf.gz

From Sectino 2.2.3 in the attached Peifer note, it seems like there is a much smarter algorithm that can be done. We can also reduce the computation to something involving more dense-like matrices too. So we have to pay some element conversions, but this seems small in comparison to the actual linear algebra involved.

@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Sep 19, 2022
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
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

2 participants