Skip to content
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

Implementation of permutohedron intervals #12569

Closed
SamueleGiraudo opened this issue Feb 23, 2012 · 22 comments
Closed

Implementation of permutohedron intervals #12569

SamueleGiraudo opened this issue Feb 23, 2012 · 22 comments

Comments

@SamueleGiraudo
Copy link

We implement a new method in the class Permutation which enables to compute the permutations of intervals of the permutohedron.

Apply:

Component: combinatorics

Keywords: Permutations, Permutohedron

Author: Samuele Giraudo, Frédéric Chapoton

Reviewer: Frédéric Chapoton, Nathann Cohen

Merged: sage-5.10.beta1

Issue created by migration from https://trac.sagemath.org/ticket/12569

@SamueleGiraudo
Copy link
Author

Attachment: trac_12569-permutohedron_intervals-sg.patch.gz

Tested on Sage 4.8, combinat branch

@sagetrac-elixyre
Copy link
Mannequin

sagetrac-elixyre mannequin commented Jan 8, 2013

comment:2

Like in my previous post... this patch isn't in combinat branch...

@fchapoton
Copy link
Contributor

comment:3

Hello,

could you please add documentation to the first function ? one indirect doctest would be fine, for example,

EXAMPLES:: 	 
    sage: Permutation([2, 1, 4, 5, 3]).right_permutohedron_interval(Permutation([2, 5, 4, 1, 3])) # indirect doctest
    [[2, 1, 4, 5, 3], [2, 1, 5, 4, 3], [2, 4, 1, 5, 3], [2, 4, 5, 1, 3], [2, 5, 1, 4, 3], [2, 5, 4, 1, 3]] 

then the bot will be happy.
Cheers,

F

@hivert
Copy link

hivert commented Jan 12, 2013

comment:4

then the bot will be happy.

But Sphinx, the documentation generator, will be disturbed if you don't put a
blank line after EXAMPLE::. So the correct markup is:

EXAMPLES::

    sage: Permutation([2, 1, 4, 5, 3]).right_permutohedron_interval(Permutation([2, 5, 4, 1, 3])) # indirect doctest
    [[2, 1, 4, 5, 3], [2, 1, 5, 4, 3], [2, 4, 1, 5, 3], [2, 4, 5, 1, 3], [2, 5, 1, 4, 3], [2, 5, 4, 1, 3]] 

Florent

@fchapoton

This comment has been minimized.

@fchapoton
Copy link
Contributor

comment:5

I have added the doc.

patchbot, apply trac_12569-permutohedron_intervals-sg-v2.patch

@fchapoton
Copy link
Contributor

comment:6

New patch with minor changes, including one doctest for one of the raise exceptions.

There remains to add a doctest for the other raise exception.

@fchapoton
Copy link
Contributor

comment:7

I have added the doctest

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Mar 9, 2013

comment:8

Helloooooooooooooo !!

Same remark as in #12571 : could you add those new methods to the index ? Besides, wouldn't it be possible to also call "inverse" in the second add_edge(...) line ?

Oh, yeah... Ad wouldn't it make sense to update inversions to index its results from 1 to n instead of 0 to n-1, assuming nobody agrees that permutations should themselves go from 0 to n-1 ?

Nathann

@fchapoton
Copy link
Contributor

comment:9

Here is a new patch.

I have changed the behavior of inversions, also improving very slightly its speed. Let us see if this causes problems elsewhere.

I do not think one can use .inverse in the second add_edge line

I have added both methods to the index

I have taken the opportunity to make a very light clean up (using pyflakes to remove a few unused import and unused variables)

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Mar 12, 2013

comment:10

Sorry, I meant "inversions" not "inverse".

for i in xrange(len(other) - 1) for j in xrange(i, len(other)) if other[i] < other[j]]

really looks like a computation of inversions, doesn't it ? O_o

Nathann

@fchapoton
Copy link
Contributor

comment:11

No, it is a computation of 'not inversions' in fact.

It seems that the change of the behaviour inversions triggers a few doc tests in the rest of sage.. Some in graphs stuff, see the bot report.

@fchapoton
Copy link
Contributor

@fchapoton
Copy link
Contributor

Work Issues: doc tests

@fchapoton
Copy link
Contributor

comment:12

new patch, correcting some doctests. There remains other doctests failing.

for the bot:

apply trac_12569-permutohedron_intervals-sg-v2.patch

@fchapoton

This comment has been minimized.

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Apr 26, 2013

Changed author from Samuele Giraudo to Samuele Giraudo, Frédéric Chapoton

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Apr 26, 2013

comment:13

Helloooooooooooooooo !!!

I again spent a couple of minutes trying to check if there was anything wrong with the graph whose linear extensions you return, but modulo the fact that I am biologically unable to check if it is not "left" instead of "right" and which is the largest among 12 and 21, everything seems good :-D

Good to go !

Nathann

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Apr 26, 2013

Changed reviewer from Frédéric Chapoton to Frédéric Chapoton, Nathann Cohen

@jdemeyer
Copy link

Changed work issues from doc tests to none

@jdemeyer
Copy link

Merged: sage-5.10.beta1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants