#11412: bug in the creation of partitions starting from a core and a tuple of
quotients
------------------------------+---------------------------------------------
   Reporter:  pdehaye         |          Owner:                         
       Type:  defect          |         Status:  needs_review           
   Priority:  critical        |      Milestone:  sage-4.7.1             
  Component:  combinatorics   |       Keywords:  partition core quotient
Work_issues:                  |       Upstream:  N/A                    
   Reviewer:  Florent Hivert  |         Author:  Paul-Olivier Dehaye    
     Merged:                  |   Dependencies:  #11165                 
------------------------------+---------------------------------------------

Old description:

> 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.

New description:

 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```:

  - [attachment:trac_11412-partition_creation_from_core_quotient_big-
 pod.patch]
  - [attachment:trac_11412-partition_from_core_quotient-review-fh.patch]

--

Comment(by hivert):

 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

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11412#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.

Reply via email to