Add temporary naive transpose for GF(2^e)#40425
Add temporary naive transpose for GF(2^e)#40425Biffo89 wants to merge 6 commits intosagemath:developfrom
Conversation
|
With change, transpose times are a lot less. sage: fields = [GF(2**2),GF(2**4),GF(2**8),GF(2**16),GF(next_prime(2**20))] |
|
Just a minor note: please think about using markers to make code more readable in text for PR / Issues (typically multiline code will be enclosed with a line containing ``` before and the same one after). |
|
Code looks good to me, just two minor suggestions:
For this second item, this is notably to make the examples more robust and avoid assuming Sage will always choose |
|
Also, I think that the same comment as in #40435 applies. |
Co-authored-by: Xavier Caruso <xcaruso@users.noreply.github.com>
Co-authored-by: Xavier Caruso <xcaruso@users.noreply.github.com>
Co-authored-by: Xavier Caruso <xcaruso@users.noreply.github.com>
|
|
Yes, I agree. I was talking about the generic implementation. |
|
After #40435, do you want to close this PR? |
|
Covered by #40435 |
The transpose for matrices over GF(2^e) is currently extremely slow due to the lack of mzed_transpose in M4RIE. I have made a PR to add one (malb/m4rie#8), but in the mean time, this is a temporary performance fix direct in Sage.
Currently, the transpose is costly enough that for medium-sized matrices it takes a significant amount of the time of pivot_rows():
sage: fields = [GF(2**2),GF(2**4),GF(2**8),GF(2**16),GF(next_prime(2**20))]
sage: for field in fields:
....: M = matrix.random(field,512,512)
....: print(field)
....: timeit('M._clear_cache();M.transpose()')
....: timeit('M._clear_cache();M.pivot_rows()')
....:
Finite Field in z2 of size 2^2
5 loops, best of 3: 128 ms per loop
5 loops, best of 3: 145 ms per loop
Finite Field in z4 of size 2^4
5 loops, best of 3: 130 ms per loop
5 loops, best of 3: 139 ms per loop
Finite Field in z8 of size 2^8
5 loops, best of 3: 145 ms per loop
5 loops, best of 3: 155 ms per loop
Finite Field in z16 of size 2^16
5 loops, best of 3: 1.12 s per loop
5 loops, best of 3: 3.82 s per loop
Finite Field of size 1048583
625 loops, best of 3: 1.15 ms per loop
25 loops, best of 3: 33.6 ms per loop
📝 Checklist
⌛ Dependencies