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

SchubertPolynomialRing causes symmetrica and Sage to crash on bad input #12924

Closed
VivianePons opened this issue May 8, 2012 · 8 comments
Closed

Comments

@VivianePons
Copy link
Contributor

The SchubertPolynomialRing expects a permutation as an index. When a list is given which is not a permutation, the object is created anyway. The problem comes when one tries to expand the polynomial, if the index is not a valid permutation, it makes symmetrica crash which makes Sage crash !

sage: S = SchubertPolynomialRing(ZZ)                                  
sage: pol = S([2,1,3])
sage: pol.expand()
x0
sage: pol = S([2,1,1])
sage: pol.expand()
function: mult_apply_integer(2) 
python: function: mult_apply_integer(2) 
: Operation not permitted

So the idea would be to check when the polynomial is created that the input is correct and raise an exception at this point if it's not.

New behaviour is now :

sage: X = SchubertPolynomialRing(QQ)
sage: X._element_constructor_([1,2,1])
Traceback (most recent call last):
...
ValueError: The input [1, 2, 1] is not a valid permutation
sage: X._element_constructor_(Permutation([1,2,1]))
Traceback (most recent call last):
...
ValueError: The input [1, 2, 1] is not a valid permutation

Tests have been added into the documentation.

The patch is attached to the ticket and also available into Sage-Combinat

CC: @sagetrac-sage-combinat @nthiery

Component: combinatorics

Keywords: days38, Schubert polynomials

Author: Viviane Pons

Reviewer: Mike Hansen

Merged: sage-5.3.beta1

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

@VivianePons VivianePons added this to the sage-5.3 milestone May 8, 2012
@VivianePons VivianePons self-assigned this May 8, 2012
@VivianePons
Copy link
Contributor Author

Author: Viviane Pons

@VivianePons

This comment has been minimized.

@VivianePons
Copy link
Contributor Author

comment:1

Attachment: trac_12924-Schubert-polynomials-input-bug-vp.patch.gz

@VivianePons

This comment has been minimized.

@mwhansen
Copy link
Contributor

Reviewer: Mike Hansen

@mwhansen
Copy link
Contributor

comment:3

Attachment: trac_12924-doc_fix.patch.gz

I've fixed some of the formatting. If you're fine with these changes, you can mark this ticket as positive_review.

@VivianePons
Copy link
Contributor Author

comment:4

It's ok with me ! Thank's for the review

@jdemeyer
Copy link
Contributor

Merged: sage-5.3.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

3 participants