Opened 6 years ago

Closed 6 years ago

#18423 closed defect (fixed)

Restricted partitions doesn't like getting a partition as "outer" input

Reported by: darij Owned by:
Priority: major Milestone: sage-6.7
Component: combinatorics Keywords: partition, IntegerListsLex,
Cc: tscrim, aschilling, jdemeyer Merged in:
Authors: Nicolas M. Thiéry Reviewers: Darij Grinberg
Report Upstream: N/A Work issues:
Branch: b7305fb (Commits, GitHub, GitLab) Commit: b7305fb1b79a9d328efc4e1cb394fabecb0c4c41
Dependencies: Stopgaps:

Status badges

Description

sage: Partitions(5, inner=Partition([2,1]), outer=Partition([3,2]))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-13-b4958b2a2c2a> in <module>()
----> 1 Partitions(Integer(5), inner=Partition([Integer(2),Integer(1)]), outer=Partition([Integer(3),Integer(2)]))

/scratch/sage-6.4.beta2/src/sage/misc/classcall_metaclass.pyx in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (build/cythonized/sage/misc/classcall_metaclass.c:1269)()
    323         """
    324         if cls.classcall is not None:
--> 325             return cls.classcall(cls, *args, **kwds)
    326         else:
    327             # Fast version of type.__call__(cls, *args, **kwds)

/scratch/sage-6.4.beta2/local/lib/python2.7/site-packages/sage/combinat/partition.pyc in __classcall_private__(cls, n, **kwargs)
   4997             kwargs['element_class'] = Partition
   4998             kwargs['global_options'] = Partitions.global_options
-> 4999             return IntegerListsLex(n, **kwargs)
   5000         else:
   5001             raise ValueError("n must be an integer or be equal to one of "+

/scratch/sage-6.4.beta2/src/sage/misc/classcall_metaclass.pyx in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (build/cythonized/sage/misc/classcall_metaclass.c:1269)()
    323         """
    324         if cls.classcall is not None:
--> 325             return cls.classcall(cls, *args, **kwds)
    326         else:
    327             # Fast version of type.__call__(cls, *args, **kwds)

/scratch/sage-6.4.beta2/local/lib/python2.7/site-packages/sage/combinat/integer_list.pyc in __classcall_private__(cls, n, **kwargs)
    815             return DisjointUnionEnumeratedSets(Family(n, lambda i: IntegerListsLex(i, **kwargs)))
    816         else:
--> 817             return typecall(cls, n=n, **kwargs)
    818 
    819     def __init__(self,

/scratch/sage-6.4.beta2/src/sage/misc/classcall_metaclass.pyx in sage.misc.classcall_metaclass.typecall (build/cythonized/sage/misc/classcall_metaclass.c:1673)()
    490             TypeError: Argument 'cls' has incorrect type (expected type, got classobj)
    491     """
--> 492     return (<PyTypeObject*>type).tp_call(cls, args, kwds)
    493 
    494 # Class for timing::

/scratch/sage-6.4.beta2/local/lib/python2.7/site-packages/sage/combinat/integer_list.pyc in __init__(self, n, length, min_length, max_length, floor, ceiling, min_part, max_part, min_slope, max_slope, min_sum, max_sum, name, category, element_constructor, element_class, global_options, check)
    909             self._floor_or_ceiling_is_function = True
    910         else:
--> 911             raise ValueError("Unable to parse value of parameter ceiling")
    912         self._ceiling = Envelope(ceiling, sign=1,
    913                                min_part=  self._min_part,  max_part= self._max_part,

ValueError: Unable to parse value of parameter ceiling

This would work perfectly well if I passed outer=[3,2] instead; also the format of inner doesn't seem to matter.

Change History (6)

comment:1 Changed 6 years ago by nthiery

On it ...

comment:2 Changed 6 years ago by nthiery

  • Branch set to u/nthiery/restricted_partitions_doesn_t_like_getting_a_partition_as__outer__input

comment:3 Changed 6 years ago by nthiery

  • Authors set to Nicolas M. Thiéry
  • Commit set to b7305fb1b79a9d328efc4e1cb394fabecb0c4c41
  • Status changed from new to needs_review

This was probably broken by #17979, and the fix is easy (IntegerListsLex takes lists/tuples as input for ceiling and floor).


New commits:

b7305fb18423: fix Partitions(..., outer=Partition(...))

comment:4 Changed 6 years ago by darij

  • Status changed from needs_review to positive_review

comment:5 Changed 6 years ago by darij

  • Reviewers set to Darij Grinberg

Nice, thank you!

comment:6 Changed 6 years ago by vbraun

  • Branch changed from u/nthiery/restricted_partitions_doesn_t_like_getting_a_partition_as__outer__input to b7305fb1b79a9d328efc4e1cb394fabecb0c4c41
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.