#7145: Interval exchange transformations
-----------------------------+----------------------------------------------
Reporter: vdelecroix | Owner: vdelecroix
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.3
Component: combinatorics | Keywords:
Work_issues: | Author: Vincent Delecroix
Upstream: N/A | Reviewer:
Merged: |
-----------------------------+----------------------------------------------
Changes (by slabbe):
* cc: sage-combinat (removed)
* cc: slabbe (added)
* status: needs_review => needs_work
* upstream: => N/A
Comment:
First I must say that I am not expert at all in that field. I just know
some of Interval exchange transformations. So, Vincent, I read through
your patch today and I will post some small corrections in a patch soon. I
have also some comments (sometimes suggestions open to you) below :
I would gather those related functionalities under a same bag where the
user could found them (and all of them) more easily. For example.
{{{
sage: IET.[TAB]
}}}
or maybe
{{{
sage: from sage.combinat.iet.all import IET
sage: IET.[TAB]
}}}
For `constructor.py`, I suggest to
- Create a class `constructor` containing the functions `PermutationsIET`,
`PermutationIET`, `PermutationLI`, `GeneralizedPermutation`,
`RauzyDiagram`, `IntervalExchangeTransformation`.
- Create the object `IET = constructor()`
- Rename `PermutationsIET` to `PermutationsIET_iterator`
- Add a function named `IntervalExchangeTransformation` to the class
`constructor` that wrapped the constructor of `IET` in `iet.py`.
- Do we want `AbelianStratum`, `QuadraticStratum` and `AbelianStrata` to
be wrapped in `constructor` as well? I don't know, but if it is realated
to everything in iet folder, then it would clearly help the user to know
about it.
For `iet.py`
- Rename `IntervalExchangeTransformation.__mul__` to something like
multiply_lengths.
- Keep `IntervalExchangeTransformation.__mul__` for multiplication of two
IET.
- Change `IntervalExchangeTransformation._repr_` to look more like an IET
and less as two tuples. For example it could say Interval exchange
transformation from [0, 1[ to [0, 1[ of permutation ?.
- Rename `IntervalExchangeTransformation.copy` as `__copy__` or
`__deepcopy__` if it corresponds to what you want. This may applies to
many other classes in the files.
I would like the following to work :
{{{
sage: p = Permutation([3,2,1])
sage: t = IntervalExchangeTransformation(p, [0.6, 0.1, 0.3])
Traceback (most recent call last):
...
TypeError: cannot concatenate 'str' and 'int' objects
}}}
where labels of the intervals are facultative:
{{{
sage: t = IntervalExchangeTransformation(p, [0.6, 0.1, 0.3], labels='abc')
}}}
Why do the following doesn't work:
{{{
sage: p = Permutation([3,2,1])
sage: PermutationIET(p)
1 2 3
3 2 1
sage: PermutationIET([3,2,1])
Traceback (most recent call last):
...
ValueError: your argument can not be split in two parts
}}}
- I don't know if the numerous {{{_P_IET = PermutationIET}}} really help
the readability. I would not rename them and rather keep them as they are.
Or, if so, I would use `from this import longname as shortname` instead
because if shortname is new to me, than I don't have to go in the file
this to understand that shortname simply means longname.
For template.py :
I am getting the following :
{{{
sage -t "devel/sage-combinat/sage/combinat/iet/template.py"
**********************************************************************
File "/home/slabbe/sage-4.2/devel/sage-
combinat/sage/combinat/iet/template.py", line 1898:
sage: g == loads(dumps(g))
Exception raised:
Traceback (most recent call last):
File "/home/slabbe/sage-4.2/local/bin/ncadoctest.py", line 1231, in
run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/slabbe/sage-4.2/local/bin/sagedoctest.py", line 38, in
run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File "/home/slabbe/sage-4.2/local/bin/ncadoctest.py", line 1172, in
run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_50[5]>", line 1, in <module>
g == loads(dumps(g))###line 1898:
sage: g == loads(dumps(g))
File "sage_object.pyx", line 735, in
sage.structure.sage_object.dumps (sage/structure/sage_object.c:8008)
File "sage_object.pyx", line 165, in
sage.structure.sage_object.SageObject.dumps
(sage/structure/sage_object.c:2158)
PicklingError: Can't pickle <class 'sage.combinat.iet.labeled.Path'>:
attribute lookup sage.combinat.iet.labeled.Path failed
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7145#comment:3>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.