-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
AffineGroup elements should be hashable #38381
Labels
Comments
+1 on this. The element is meant to be immutable, so the |
vbraun
pushed a commit
to vbraun/sage
that referenced
this issue
Dec 6, 2024
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Fixes sagemath#38381 and makes sure the defining parts of the group element are immutable. ### 📝 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 <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#38508 Reported by: Travis Scrimshaw Reviewer(s): Frédéric Chapoton, Matthias Köppe, Travis Scrimshaw
vbraun
pushed a commit
to vbraun/sage
that referenced
this issue
Dec 8, 2024
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Fixes sagemath#38381 and makes sure the defining parts of the group element are immutable. ### 📝 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 <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#38508 Reported by: Travis Scrimshaw Reviewer(s): Frédéric Chapoton, Matthias Köppe, Travis Scrimshaw
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem Description
Currently
AffineGroup
elements do not implement hash and so can not be used as dictionary keys.Currently the internal variables of
AffineGroupElement
are mutable, but thematrix
method is cached suggesting that the values are expected to be immutable. This makes it possible to produce (far fetched) bugs wherematrix
returns something incompatible with the current state of the transformation:Proposed Solution
set_immutable()
on the parameters_A
and_b
in the constructor.Alternatives Considered
If mutability is desired (for some reason I'm not aware of), then the
matrix
method should not be cached to avoid the bug above. In this case, I would imagine we'd also want to implement something explaining how to change the values.Additional Information
No response
Is there an existing issue for this?
The text was updated successfully, but these errors were encountered: