Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Partition().to_exp() should return Sage Integers
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Oct 11, 2014
1 parent 6996fd8 commit 24020fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/sage/combinat/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -3101,11 +3101,16 @@ def to_exp(self, k=0):
[1, 2, 1]
sage: Partition([3,2,2,1]).to_exp(5)
[1, 2, 1, 0, 0]
TESTS::
sage: [parent(x) for x in Partition([3,2,2,1]).to_exp(5)]
[Integer Ring, Integer Ring, Integer Ring, Integer Ring, Integer Ring]
"""
p = self
if len(p) > 0:
k = max(k, p[0])
a = [ 0 ] * (k)
a = [ZZ.zero()] * k
for i in p:
a[i-1] += 1
return a
Expand Down

0 comments on commit 24020fe

Please sign in to comment.