-
-
Notifications
You must be signed in to change notification settings - Fork 649
Add faster implementations of matrix_from_* constructors to GF(2) and GF(2^e) #40435
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
while this should be correct (haven't read in detail), wouldn't it be better to consolidate the fast implementation into shared template somehow and each subclass only need to override one or two methods? Since virtual method are supported in Python, we already have The cost of dereferencing a single function pointer ought to be small enough, and the function pointer is known to be the same over all iterations. @tscrim any opinion? |
How's this for a replacement? In matrix_generic_dense.pyx:
In matrix1.pyx:
In matrix_gf2e_dense.pyx (for example):
|
I just have two comments:
|
Yes, sure! |
The poblem with |
Yes, a generic inefficient |
Thanks! Everything looks good to me. |
sagemathgh-40435: Add faster implementations of matrix_from_* constructors to GF(2) and GF(2^e) Dense matrices over GF(2) and GF(2^e) currently have slow performance for the following methods: - matrix_from_rows() - matrix_from_columns() - matrix_from_rows_and_columns() They are using the default implementation in matrix1.pyx which involves conversion of each element every time it is read or written. This PR puts direct naive implementations for these methods into both classes. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [X] The title is concise and informative. - [X] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [X] I have updated the documentation and checked the documentation preview. URL: sagemath#40435 Reported by: Biffo89 Reviewer(s): Xavier Caruso
sagemathgh-40435: Add faster implementations of matrix_from_* constructors to GF(2) and GF(2^e) Dense matrices over GF(2) and GF(2^e) currently have slow performance for the following methods: - matrix_from_rows() - matrix_from_columns() - matrix_from_rows_and_columns() They are using the default implementation in matrix1.pyx which involves conversion of each element every time it is read or written. This PR puts direct naive implementations for these methods into both classes. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [X] The title is concise and informative. - [X] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [X] I have updated the documentation and checked the documentation preview. URL: sagemath#40435 Reported by: Biffo89 Reviewer(s): Xavier Caruso
sagemathgh-40435: Add faster implementations of matrix_from_* constructors to GF(2) and GF(2^e) Dense matrices over GF(2) and GF(2^e) currently have slow performance for the following methods: - matrix_from_rows() - matrix_from_columns() - matrix_from_rows_and_columns() They are using the default implementation in matrix1.pyx which involves conversion of each element every time it is read or written. This PR puts direct naive implementations for these methods into both classes. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [X] The title is concise and informative. - [X] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [X] I have updated the documentation and checked the documentation preview. URL: sagemath#40435 Reported by: Biffo89 Reviewer(s): Xavier Caruso
sagemathgh-40435: Add faster implementations of matrix_from_* constructors to GF(2) and GF(2^e) Dense matrices over GF(2) and GF(2^e) currently have slow performance for the following methods: - matrix_from_rows() - matrix_from_columns() - matrix_from_rows_and_columns() They are using the default implementation in matrix1.pyx which involves conversion of each element every time it is read or written. This PR puts direct naive implementations for these methods into both classes. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [X] The title is concise and informative. - [X] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [X] I have updated the documentation and checked the documentation preview. URL: sagemath#40435 Reported by: Biffo89 Reviewer(s): Xavier Caruso
sagemathgh-40435: Add faster implementations of matrix_from_* constructors to GF(2) and GF(2^e) Dense matrices over GF(2) and GF(2^e) currently have slow performance for the following methods: - matrix_from_rows() - matrix_from_columns() - matrix_from_rows_and_columns() They are using the default implementation in matrix1.pyx which involves conversion of each element every time it is read or written. This PR puts direct naive implementations for these methods into both classes. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [X] The title is concise and informative. - [X] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [X] I have updated the documentation and checked the documentation preview. URL: sagemath#40435 Reported by: Biffo89 Reviewer(s): Xavier Caruso
Dense matrices over GF(2) and GF(2^e) currently have slow performance for the following methods:
They are using the default implementation in matrix1.pyx which involves conversion of each element every time it is read or written. This PR puts direct naive implementations for these methods into both classes.
📝 Checklist