Fix is_partial_transformation#67
Fix is_partial_transformation#67james-d-mitchell wants to merge 2 commits intolibsemigroups:mainfrom
is_partial_transformation#67Conversation
|
I'm not sure what I implemented was correct, but the idea was for a transformation on 2 points to lift it to transformation on 16 points by setting that points 2 to 15 are fixed point. I'm not sure for partial transformations but lots of other code for permutations and probably transformations assume that. I don't know if all is properly tested either. If I'm not mistaken, according to this semantic, your counter-examples are not. |
|
Thanks for the comments @hivert, I don't completely follow what you've written. Is the argument As I understand it, equally if i.e. Another example, if This seems to be inconsistent with the first example |
|
@james-d-mitchell I answered quickly. Let me try to be more precise. My code is supposed to be a low level representation for partial/permutations/tranformations... To spare memory, to store a transformation of say T_2, I decide not to store the 2 and assume that it will be available from the context. As a consequence I'm in fact only dealing with element of S_16 /T_16 / PT_16. So elements of S_2 /T_2 / PT_2 are dealt by embedding the later into the former. That being said, to have a consistent embedding among these monoids I decided to complete with fixed points. Hence the code I intended to write --I'm not sure if it is right or wrong, an not really in a state where I can consistently check it. I'm not claiming this is a clever idea, but that was the one I had when I wrote the code. Having decided that, when I designed the other functions, I implicitly made the assumption that all element where actually in S_16 /T_16 / PT_16. So changing this semantic might break some other functions. This need to be checked. I hope I've made at least my intent clear now. |
|
@hivert and I discussed this earlier today and I think I now understand what this function is trying to do, and that my "fix" is not correct, i.e. this is more an issue of documentation rather than a bug in the code. As I understood our discussion
I'll close this PR when I've got a new one ready that adds this description to the documentation in another PR. |
This is an attempt to fix
is_partial_transformation, as far as I can tell the algorithm previously implemented did the following with inputepu8 v, size_t k:diffwhere the inputvdiffers from the identity;16values are<16or==0xFF, if not, returnfalse;diff == 16(meaning thatvis the identity) ordiff < kI don't think this is at all correct (at least it doesn't correspond to what I expect the function to do, but maybe you had something else in mind @hivert).
Some examples:
{0, 1, 17, 17, 17, ...}a partial transformation on the first 1 or 2 points, then the answer should be "yes", but 2 above fails.{0, 1, 255}a partial transformation for anyk, then the answer should be "yes", butdiffin 1 above is2, and so ifk = 2, then 3 above fails.I'm not sure if there's a better way of checking than the one I've implemented, in particular, I'm not sure if there's a better way to create
MASK.