Opened 9 years ago

Closed 9 years ago

#11412 closed defect (fixed)

bug in the creation of partitions starting from a core and a tuple of quotients

Reported by: pdehaye Owned by:
Priority: critical Milestone: sage-4.7.1
Component: combinatorics Keywords: partition core quotient
Cc: mhansen, hivert Merged in: sage-4.7.1.alpha3
Authors: Paul-Olivier Dehaye Reviewers: Florent Hivert
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #11165 Stopgaps:

Description (last modified by hivert)

the Partition(core=????,quotient=???) construction is broken in some very specific cases, even after applying #11165. For instance, after patching with #11165:

sage: Partition(core=[2,1],quotient=([],[1,1,1,1,1,1,1]))
[4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1]
sage: Partition(core=[3,2,1],quotient=([],[1,1,1,1,1,1,1]))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (3247, 0))

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

/Volumes/Scratch/Users/duser1/sage/<ipython console> in <module>()

/Users/duser1/sage/local/lib/python2.6/site-packages/sage/combinat/partition.pyc in Partition(mu, **keyword)
    262         return from_exp(keyword['exp'])
    263     elif 'core' in keyword and 'quotient' in keyword and len(keyword)==2:
--> 264         return from_core_and_quotient(keyword['core'], keyword['quotient'])
    265     elif 'core' in keyword and 'canonical_quotient' in keyword and len(keyword)==2:
    266         raise NotImplementedError

/Users/duser1/sage/local/lib/python2.6/site-packages/sage/combinat/partition.pyc in from_core_and_quotient(core, quotient)
    314     new_w = []
    315     for i in range(length):
--> 316         new_w += [ w[i][j] + length*quotient[i][j] for j in range(len(quotient[i]))]
    317         new_w += [ w[i][j] for j in range(len(quotient[i]), len(w[i])) ]
    318     new_w.sort()

IndexError: list index out of range

works in the first case, fails in the second. the code is also badly documented. patch coming shortly.

apply:

Attachments (2)

trac_11412-partition_creation_from_core_quotient_big-pod.patch (2.4 KB) - added by pdehaye 9 years ago.
to be applied after #11165 (affects the doctests)
trac_11412-partition_from_core_quotient-review-fh.patch (2.3 KB) - added by hivert 9 years ago.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by pdehaye

to be applied after #11165 (affects the doctests)

comment:1 Changed 9 years ago by pdehaye

  • Status changed from new to needs_review

comment:2 Changed 9 years ago by hivert

  • Authors set to Paul-Olivier Dehaye
  • Dependencies set to #11165
  • Owner changed from sage-combinat to (none)
  • Reviewers set to Florent Hivert

comment:3 follow-up: Changed 9 years ago by hivert

  • Description modified (diff)

Hi Paul-Olivier,

Thanks for debugging this one. Your modifications looks good to me. I just uploaded a review patch which improve the typesetting of your added tests. If you would be kind enough to review my patch you can put a positive review on my behalf.

Cheers,

Florent

comment:4 in reply to: ↑ 3 Changed 9 years ago by pdehaye

  • Status changed from needs_review to positive_review

Looks good to me. Thanks, still learning...

comment:5 Changed 9 years ago by jdemeyer

  • Merged in set to sage-4.7.1.alpha3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.