-
Notifications
You must be signed in to change notification settings - Fork 135
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
allow ==
for two groups/group elements in fewer cases
#4196
Conversation
If `_check_compatible` for the two groups in question returns `false` then throw an exception. Note that the result is not based only on the types of the arguments but also on the groups.
# For two `GAPGroupElem`s, | ||
# if no specialized method is applicable then no `==` comparison is allowed. | ||
function ==(x::GAPGroupElem, y::GAPGroupElem) | ||
_check_compatible(parent(x), parent(y); error = false) || throw(ArgumentError("parents of x and y are not compatible")) | ||
throw(ArgumentError("== is not implemented for the given types")) | ||
end |
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.
once Nemocas/AbstractAlgebra.jl#1853 is available, this method can be removed. maybe add this as a comment
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.
My point of view is:
If the compatibility check returns false
then we are sure that the question for ==
is not allowed,
but if the compatibility check returns true
then likely there is a new subtype of GAPGroupElem
for which a ==
method should be provided.
(Currently we have just the subtypes BasicGAPGroupElem
and MatrixGroupElem
.)
# For two `GAPGroupElem`s, | ||
# if no specialized method is applicable then no `==` comparison is allowed. | ||
function ==(x::GAPGroupElem, y::GAPGroupElem) | ||
_check_compatible(parent(x), parent(y); error = false) || throw(ArgumentError("parents of x and y are not compatible")) |
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.
Same here as above
…#4196) * allow `==` for two groups/group elements in fewer cases If `_check_compatible` for the two groups in question returns `false` then throw an exception. Note that the result is not based only on the types of the arguments but also on the groups. * address a comment
If
_check_compatible
for the two groups in question returnsfalse
then throw an exception.Note that the result is not based only on the types of the arguments but also on the groups.
This addresses one of the questions from #4191.