Matrix row reduction is very slow
See original GitHub issueHi,
I’ve tried to use this library to row reduce a (quite) big matrix over a finite field. It succeeded and took quite a huge time in comparison with a naïve implementation.
As an example I copy paste the timing from the jupyter notebook.
with: https://www.nayuki.io/page/gauss-jordan-elimination-over-any-field
mat.reduced_row_echelon_form()
CPU times: user 4min 15s, sys: 18.7 ms, total: 4min 15s
Wall time: 4min 15s
with galois:
MM_reduced = MM.row_reduce()
CPU times: user 4h 21min 24s, sys: 3.06 s, total: 4h 21min 27s
Wall time: 4h 21min 28s
the matrix, for reference is sparse and defined over a 128-bit prime, the shape is: 513x1025
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:18 (7 by maintainers)
Top Results From Across the Web
Row Reduction Part 2/2: How to Get Faster [Passing Linear ...
Row Reduction Algorithm: 3:09 Worked through solutions: 6:15 13:53 15:05 16:07At 14:50, the top right entry should be a 5 not a 6....
Read more >Why my Power BI Matrix or Table Visual is SLOW - RADACAD
Summary. Your matrix and table visuals are not slow because of Power BI! They are slow because of the bad data model, and...
Read more >FiniteFields package is very slow. Any fast substitute for ...
One can improve on this by writing a direct row reduction using a list representation form the field elements. This would require working ......
Read more >as.matrix on a distance object is extremely slow; how to make ...
What does dist return? This function always returns a vector, holding the lower triangular part (by column) of the full matrix.
Read more >Slow Matrices? Try Lists. - Brodie Gaslam
A classic row-wise operation is to sum values by row. This is easily done with rowSums for matrices. For lists, we can use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ddddavidee I pushed another performance improvement to that branch. You’ll likely see another speed up.
@nayuki, what I meant is that the same computation took a very different time (~60x times) changing from your code to the one in galois… and I was thinking that there was a problem somewhere…
@mhostetter I pulled the branch and re-tried the computation (with some other small changes, I used lru_cache from functools, and shortcut the ‘division-by-one’ case, and now the computation for the very same matrix takes less than two minutes (
Wall time: 1min 43s
)