-
-
Notifications
You must be signed in to change notification settings - Fork 600
Updated random_diagonal_matrix function so it works for any ring #39374
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
Updated random_diagonal_matrix function so it works for any ring #39374
Conversation
…o only return a matrix over the rational field.
Documentation preview for this PR (built with commit 13d74a3; changes) is ready! 🎉 |
…ion of random_matrix. Removed redundant check to see if the base ring provided was teh rationals. Moved doctest from tests to examples. Use the matrix.identity function for the eigenvector_matrix instead.
Thanks for doing this. It looks good, but I have a few minor suggestions. lines 244-248, I think it would be good to keep the same format as the other input docs, i.e., start with "creates ...". Maybe: "creates a diagonalizable matrix. If the base ring is line 3069: I think it would be more clear to say: "the desired parent of the square matrix (a matrix space)" lines 3075-3076 sound repetitive because "If the ring used is line 3252: The signature of |
…the matrix.identity call also suggested by Dave Morris.
LGTM. If there are no other comments in the next couple of days, I will set to positive review on Thursday. |
Oops, Also, I realized that the new doctest is incomplete because it doesn't actually verify that the method produces a diagonalizable matrix (and users would probably like to see sample output), so please replace it with something like the following:
|
…izable algorihtm of random_matrix. Added verification of diagonalizability to the doctest for a random diagonal matrix of GF(3).
Fixed diagonalizable algorithm space and added to the doctests. |
There haven't been any other comments, and |
sagemathgh-39374: Updated random_diagonal_matrix function so it works for any ring Fixes sagemath#24801. Added functionality to random_diagonal_matrix that allows a random matrix to be generated using an arbitrary ring instead of only the rational numbers. If the matrix of rational numbers is requested the integer ring is used in place of the rational ring to keep most of the functionality the same. Also updated the function documentation to reflect this change and added and extra test with the example from issue sagemath#24801. ### 📝 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. - [ X] I have linked a relevant issue or discussion. - [ X] I have created tests covering the changes. - [ X] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies URL: sagemath#39374 Reported by: Noel-Roemmele Reviewer(s):
sagemathgh-39374: Updated random_diagonal_matrix function so it works for any ring Fixes sagemath#24801. Added functionality to random_diagonal_matrix that allows a random matrix to be generated using an arbitrary ring instead of only the rational numbers. If the matrix of rational numbers is requested the integer ring is used in place of the rational ring to keep most of the functionality the same. Also updated the function documentation to reflect this change and added and extra test with the example from issue sagemath#24801. ### 📝 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. - [ X] I have linked a relevant issue or discussion. - [ X] I have created tests covering the changes. - [ X] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies URL: sagemath#39374 Reported by: Noel-Roemmele Reviewer(s):
sagemathgh-39374: Updated random_diagonal_matrix function so it works for any ring Fixes sagemath#24801. Added functionality to random_diagonal_matrix that allows a random matrix to be generated using an arbitrary ring instead of only the rational numbers. If the matrix of rational numbers is requested the integer ring is used in place of the rational ring to keep most of the functionality the same. Also updated the function documentation to reflect this change and added and extra test with the example from issue sagemath#24801. ### 📝 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. - [ X] I have linked a relevant issue or discussion. - [ X] I have created tests covering the changes. - [ X] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies URL: sagemath#39374 Reported by: Noel-Roemmele Reviewer(s):
sagemathgh-39374: Updated random_diagonal_matrix function so it works for any ring Fixes sagemath#24801. Added functionality to random_diagonal_matrix that allows a random matrix to be generated using an arbitrary ring instead of only the rational numbers. If the matrix of rational numbers is requested the integer ring is used in place of the rational ring to keep most of the functionality the same. Also updated the function documentation to reflect this change and added and extra test with the example from issue sagemath#24801. ### 📝 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. - [ X] I have linked a relevant issue or discussion. - [ X] I have created tests covering the changes. - [ X] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies URL: sagemath#39374 Reported by: Noel-Roemmele Reviewer(s):
Fixes #24801. Added functionality to random_diagonal_matrix that allows a random matrix to be generated using an arbitrary ring instead of only the rational numbers. If the matrix of rational numbers is requested the integer ring is used in place of the rational ring to keep most of the functionality the same. Also updated the function documentation to reflect this change and added and extra test with the example from issue #24801.
📝 Checklist
⌛ Dependencies