Add commutator functions#431
Open
Joseph-Edwards wants to merge 7 commits intolibsemigroups:mainfrom
Open
Conversation
Member
|
Thanks @Joseph-Edwards, I'm happy with the keyword argument stuff you've proposed (in fact, in light of our recent conversation about this, I think maybe |
de6820b to
966a41f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds bindings and tests for the functions
commutatorandadd_commutator_rule.There was a slight hiccup here, because Pybind11 binds C++ chars as Python strings (with a few extra steps). This was causing some issues with overload resolution for the functions with the optional$[x, y] = \epsilon$ with inverses given by $[x, y] = z$ with inverses inferred from the presentation"? It is reasonable to want to be able to do either of these things, but difficult to express your intent to Python, because
idparameter. Specifically, doesadd_commutator_rule(p, x, y, z)mean "add the commutator rulez" or does it mean "add the commutator ruleidhas the same type as the other parameters.To get around this, I've made the parameter
ida keyword-only argument (see PEP 3102 for more info). Therefore, if we want to specify a non-standard identity, we need to explicitly provide it as a keyword argument (e.g.add_commutator_rule(p, x, y, id=z)). I've tried to make this clear in the doc, but if I'm happy to add more detail if it's needed.I don't think we've added any keyword-only arguments before, so I needed to make a few tweaks to some of our scripts and helpers to accommodate this.