-
Notifications
You must be signed in to change notification settings - Fork 133
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
Adresses issue with equality/hashing on module orderings #3400
Adresses issue with equality/hashing on module orderings #3400
Conversation
Can't this be handled by matrices or similar like in the monomial Case? |
Hm, yes, I wonder whether this is correct:
If one only checks if |
It can but it is more involved, see theorem 2 here. I decided against this because it would go substantially beyond the addressed issue to implement this and because, as far as I can tell, we don't support any functionality for such general matrix orderings. If required, I am however happy to take a look at a canonical matrix form for the orderings we do support, maybe it's easier in this case. |
I apologize I don't quite understand what you mean. Do you have an example? |
I was thinking about the following situation: The polynomial ring has one variable and the module is free of rank one. Then |
Yes, good point. Ok, I will think of something else. |
Brief update: I am working on this but this will take a while. We will need canonical representations of module orderings and they will take a while to implement. |
0594f99
to
aaa3371
Compare
638df7c
to
b91308a
Compare
I've added equality and hashing by embedding the underlying module of the ordering in question into a new polynomial ring and computing the canonical matrix there, which is then used for equality checking and hashing. While this is not a unique representation of the ordering, it catches at least all reasonable cases that I could come up with. |
end | ||
|
||
function Base.:(==)(o1::ModuleOrdering, o2::ModuleOrdering) | ||
return canonical_matrix(o1) == canonical_matrix(o2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that == should compare the underlying modules of the orderings as well. And then same for the hash: the field M should be used there as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I completely understand why. If I have two different modules and I want to find out if both share the same ordering, how shall I do that? Note that also for MonomialOrdering
we do not compare the corresponding rings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, we should definitely keep it consistent and revert the change here. Sorry for the double work @RafaelDavidMohr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, it's reverted.
36118da
to
6a828bb
Compare
6e4aad5
to
b52dd72
Compare
Adds
==
and hashing forModuleOrdering
s.I don't know if this is the best solution, I essentially just circumvent what julia does by default when calling
==
on structs (which is to call===
on every field) by instead calling==
recursively on every field.If this is potentially to dangerous, let me know. It does fix #3347 on my machine.
Tag: @ederc