-
Notifications
You must be signed in to change notification settings - Fork 7
Add an mzed_transpose function #8
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
Conversation
Cool, can you add tests? |
Since you're aiming for performance, maybe check how this compares with a transpose of a GF(2) matrix that has the same storage cost? Carlo Wood spent a lot of time making that one fast, if my memory serves. |
Thanks for the tests, they look good. What are the benchmark results for you? |
I realised I had a few mistakes in the benchmark file. The results for me are about a 4x speedup for all sizes over the naive version. The performance is admittedly slower than for GF(2) but still a good improvement. I'll try a further optimisation on the number of __mzd_read_bits calls, but I can't spend but more time on this at the moment as it's just instrumental to an addition to Sage which makes use of the transpose, and GF(2^e) was particularly slow. ...... |
Cool, that's a tidy speed-up. I agree "perfect is the enemy of good enough" and I'm happy to merge this. For documentation, could you also compare: for
This should be the same "stuff" in memory when ignoring structure? This gives people who want to improve stuff further in the future a sense of what should be possible. I can also run it when I get around to it. |
I've added the final optimisation, bulking the reads as well as the writes. This gets the smaller fields performing a lot closer to the larger ones. ............................................................................................................ |
A fairly-optimised transpose function for matrices, as this is missing from Sage.
Tests and benchmarks added, now memory safe with a speedup of ~4.5-12x over naive transpose.