#15439: sage/combinat/matrices/latin.py: isotopism method uses product of
permutations
-------------------------------------------------+-------------------------
Reporter: darij | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-5.13
Component: combinatorics | Resolution:
Keywords: permutation, combinat, latin | Merged in:
square | Reviewers:
Authors: | Work issues:
Report Upstream: N/A | Commit:
Branch: | Stopgaps:
Dependencies: |
-------------------------------------------------+-------------------------
Comment (by darij):
Hi Nathan,
Replying to [comment:1 ncohen]:
> 4) This code has *NOTHING* to do there. Its only purpose is to accept
any kind of permutation input on 0..n-1 and to output a permutation on
1..n. It's like this code should appear in the constructor of
`Permutations`, with a flag `translate_from_0n_to_1n=True`
Good point. I'm not sure if I want to add a `translate_from_0n_to_1n`
variable to the `Permutation` constructor (that constructor is already
quite complex, and it gets called a hell lot). But maybe we should add a
function to `sage/combinat/permutation.py` which constructs a permutation
from its "left shift by 1"?
> 1) I did not know what an isotopism was either, and it looks like we
could add a link toward the following Wikipedia page if we patch this file
:
http://en.wikipedia.org/wiki/Latin_square#Equivalence_classes_of_Latin_squares
+1 for the link. It just doesn't have much to do with the `isotopism`
method; it probably should be in the `apply_isotopism` docstring.
> 2) "Morally", this '*' can be any of the two actions, as it should only
apply to permutations with disjoint supports : this part of the function
builds a permutation from a 'cycles notation', i.e. {{{'(1,2,3)(4,5)'}}}.
It builds a permutation for each cycle and multiplies the results, so both
actions should be fine.
OK, good point -- it seems that the `isotopism` method is indeed meant to
take disjoint cycles, whence the order is irrelevant. But I'm saying
"seems" because to me, too, it's far from clear from the docstring. If we
can confirm than this is what's meant, it should be rather easy to avoid
the use of `*` and probably even gain some speed this way.
> 3) Morally, this part of the code is made for disjoint cycles notations,
but nothing actually checks that. And given a permutation in cycle
notation (as a string) {{{'(1,2,3)(4,5)'}}}, don't you have the very same
problem knowing in which order they should be applied ? Or is that clear
for everybody ? I honestly ask the question, I personally always used
permutations like function composition, and all that happens with this
left/right action is beyond me `:-P`
For quite a long time I believed that everyone agreed `pq` would mean
"first do `q`, then `p`", apart from maybe some 19th century British
authors (who would be unreadable anyway). But it turned out that the
opposite convention is still around in Britain :(
> 5) Having something like `Permutations.global_options` which redefines
the meaning of {{{'*'}}} is ***__criminal__***.
The `global_options` constructor is just a new way to handle these global
variables, but the global variable determining order of multiplication is
not new. I guess it's nuclear waste from the olden days of Sage.
In #15174 it surfaced that with `Permutations.global_options(mult) ==
'l2r'`, the Hecke algebra (a deformation of the symmetric group algebra)
would have its multiplication opposite of that of the symmetric group
algebra, whereas with `Permutations.global_options(mult) == 'r2l'` it
would not be an algebra at all (associativity would not hold). I believe
this has been around for ages. You've gotta love our mess...
--
Ticket URL: <http://trac.sagemath.org/ticket/15439#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.