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

Bug in product of Schur symmetric functions #15397

Closed
zabrocki mannequin opened this issue Nov 11, 2013 · 21 comments
Closed

Bug in product of Schur symmetric functions #15397

zabrocki mannequin opened this issue Nov 11, 2013 · 21 comments

Comments

@zabrocki
Copy link
Mannequin

zabrocki mannequin commented Nov 11, 2013

For partitions with first part >123 the product of Schur functions has problems.

sage: s = SymmetricFunctions(QQ).s()
sage: s[121,1]*s[2,1] # ok
s[121, 2, 1, 1] + s[121, 2, 2] + s[121, 3, 1] + s[122, 1, 1, 1] + 2*s[122, 2, 1] + s[122, 3] + s[123, 1, 1] + s[123, 2]
sage: s[122,1]*s[2,1] # not ok
2*s[1]

Upstream: Reported upstream. Developers acknowledge bug.

CC: @sagetrac-sage-combinat @anneschilling @asbuch @mguaypaq @saliola @darijgr @sagetrac-tfeulner

Component: combinatorics

Keywords: symmetrica, lrcalc, symmetric functions

Author: Mike Zabrocki

Reviewer: Anne Schilling

Merged: sage-5.13.beta3

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

@zabrocki zabrocki mannequin added this to the sage-5.13 milestone Nov 11, 2013
@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 11, 2013

comment:1

This bug was reported to me by Mercedes Rosas. I haven't experimented yet to identify the problem precisely.

Since the product of Schur functions is done with lrcalc (which may or may not be where the bug is) I included Anders Buch in the cc of the developers list (this is the 'report upstream').

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 11, 2013

comment:2

Remark:

I do not have similarly incorrect answers with the product of monomial symmetric functions.

sage: m = SymmetricFunctions(QQ).m()
sage: m[122,1]*m[2,1]
2*m[122, 2, 1, 1] + 2*m[122, 2, 2] + m[122, 3, 1] + m[123, 2, 1] + m[123, 3] + 2*m[124, 1, 1] + m[124, 2]
sage: m[600,1]*m[2,1]
2*m[600, 2, 1, 1] + 2*m[600, 2, 2] + m[600, 3, 1] + m[601, 2, 1] + m[601, 3] + 2*m[602, 1, 1] + m[602, 2]

@zabrocki zabrocki mannequin changed the title Bug in product of symmetric functions Bug in product of Schur symmetric functions Nov 11, 2013
@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 11, 2013

comment:4

My first test indicates that the bug does not lie in lrcalc, but is actually a problem in symmetrica.

sage: s = SymmetricFunctions(QQ).s()
sage: symmetrica.mult_schur_schur(s[122,1],s[2,1])
2*s[1]

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 11, 2013

Changed upstream from Reported upstream. No feedback yet. to none

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 11, 2013

comment:6

One fix for this bug could be to switch the product from symmetrica to lrcalc since the problem seems to be within symmetrica:

sage: import sage.libs.lrcalc.lrcalc as lrcalc
sage: sage.libs.lrcalc.lrcalc.mult([122,1],[2,1])
{[122, 2, 1, 1]: 1,
 [122, 2, 2]: 1,
 [122, 3, 1]: 1,
 [123, 1, 1, 1]: 1,
 [123, 2, 1]: 2,
 [123, 3]: 1,
 [124, 1, 1]: 1,
 [124, 2]: 1}

lrcalc seems to have a known reported bug in #14625 (to my eye, significantly less serious). Any advice?

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 11, 2013

comment:7

You can test the symmetrica bug is also triggered on the website for symmetrica
at this link. Enter [1,122] and [1,2] and the same bug appears. I suppose in any case it is worth digging around again in the symmetrica code to identify the problem.

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 11, 2013

comment:8

An email message was sent to the addresses at the website for symmetrica as well as to Axel Kohnert (Nicolas indicated that he might be a contact for symmetrica).

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 11, 2013

Upstream: Reported upstream. No feedback yet.

@anneschilling
Copy link

comment:11

Wow, this is a terrible bug!!! One option would be to do the computations using lrcalc since we already have an interface to it and in addition ask Anders Buch to try to fix the lrcalc bug reported in #14625.

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 12, 2013

comment:12

I am not sure if "Developers acknowledge bug." is quite accurate, but will have to do for now. Axel Kohnert has been seriously hurt and is unconscious. Adalbert Kerber from Bayreuth acknowledged the bug report though.

I am posting here a patch to change the multiplication from symmetrica to lrcalc. I don't consider it quite ready for review, but it seems to solve the problem. As a happy side effect it also seems to have a serious speedup.

sage: s = SymmetricFunctions(QQ).s()
sage: P = list(reversed(range(1,8)))
sage: %time s(P)*s(P);

has a speedup from 169.30s to 27.75s running on sage cloud.

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 12, 2013

Changed upstream from Reported upstream. No feedback yet. to Reported upstream. Developers acknowledge bug.

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 12, 2013

comment:13

Doing some more experimenting I have found minor modifications of how to trigger the bug and the second example has very bad behavior:

sage: s[123,1]*s[1,1]
2*s[1]
sage: s[123]*s[2,1]
ValueError                                Traceback (most recent call last)
...
ValueError: [0, 0, ..., 0, 122, 2, 1] is not an element of Partitions

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 12, 2013

comment:14

I guess I shouldn't have stopped there because:

sage: s([125])*s([3])
RuntimeError                              Traceback (most recent call last)
...
RuntimeError: Segmentation fault

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 12, 2013

Attachment: trac_15397_fix_with_lrcalc.patch.gz

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 12, 2013

comment:15

I don't see the fix for symmetrica. There is clearly a bug there that one can recreate on their website.

The attached patch changes _multiply to _multiply_basis and then calls lrcalc.mult. I believe that given what the former _multiply function did, it should have been a _multiply_basis all along. I also added three doctests.

That does not mean that the bug in symmetrica should not be fixed. The following command causes a Segmentation fault

sage: symmetrica.mult_schur_schur([125],[3])

My recommendation is to review this patch and move on to fixing the problems with lrcalc mentioned in #14625. Anders Buch has a version 1.1.7 of lrcalc while the version in Sage now is 1.1.6.

@zabrocki zabrocki mannequin added the s: needs review label Nov 12, 2013
@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 12, 2013

Changed keywords from none to symmetrica, lrcalc, symmetric functions

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 12, 2013

Author: Mike Zabrocki

@anneschilling
Copy link

comment:19

The fix looks good to me!

@anneschilling
Copy link

Reviewer: Anne Schilling

@zabrocki
Copy link
Mannequin Author

zabrocki mannequin commented Nov 13, 2013

comment:21

The bug in symmetrica was moved to ticket #15407

@jdemeyer
Copy link

Merged: sage-5.13.beta3

@zabrocki zabrocki mannequin mentioned this issue Jan 26, 2020
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

2 participants