# HG changeset patch
# User Florent Hivert <Florent.Hivert@univ-rouen.fr>
# Date 1307030246 -7200
# Node ID 4d758d4183a839a68243dd26a0d8278d3c51af38
# Parent d207d1e9001fb3f702a8fd0cabc97efb02da1368
#11412 fix partitions from core and quotients: review patch
diff --git a/sage/combinat/partition.py b/sage/combinat/partition.py
|
a
|
b
|
def from_core_and_quotient(core, quotien |
| 323 | 323 | |
| 324 | 324 | sage: Partition(core=[2,1], quotient=[[2,1],[3],[1,1,1]]) |
| 325 | 325 | [11, 5, 5, 3, 2, 2, 2] |
| 326 | | sage: test = lambda x, k: x == Partition(core=x.core(k),quotient=x.quotient(k)) |
| 327 | | sage: all(test(mu,k) for k in range(1,5) for n in range(10) for mu in Partitions(n)) |
| | 326 | |
| | 327 | TESTS: We check that #11412 is actually fixed:: |
| | 328 | |
| | 329 | sage: test = lambda x, k: x == Partition(core=x.core(k), |
| | 330 | ... quotient=x.quotient(k)) |
| | 331 | sage: all(test(mu,k) for k in range(1,5) |
| | 332 | ... for n in range(10) for mu in Partitions(n)) |
| 328 | 333 | True |
| 329 | | sage: test2 = lambda core, mus: \ |
| 330 | | Partition(core=core, quotient=mus).core(len(mus)) == core and \ |
| 331 | | Partition(core=core, quotient=mus).quotient(len(mus)) == mus |
| 332 | | sage: all(test2(core,tuple(mus)) for k in range(1,10) for n_core in range(10-k) for core in Partitions(n_core) if core.core(k) == core for n_mus in range(10-k) for mus in PartitionTuples(n_mus,k)) |
| | 334 | sage: test2 = lambda core, mus: ( |
| | 335 | ... Partition(core=core, quotient=mus).core(len(mus)) == core |
| | 336 | ... and |
| | 337 | ... Partition(core=core, quotient=mus).quotient(len(mus)) == mus) |
| | 338 | sage: all(test2(core,tuple(mus)) |
| | 339 | ... for k in range(1,10) |
| | 340 | ... for n_core in range(10-k) |
| | 341 | ... for core in Partitions(n_core) |
| | 342 | ... if core.core(k) == core |
| | 343 | ... for n_mus in range(10-k) |
| | 344 | ... for mus in PartitionTuples(n_mus,k)) |
| 333 | 345 | True |
| 334 | 346 | """ |
| 335 | 347 | length = len(quotient) |
| … |
… |
def from_core_and_quotient(core, quotien |
| 346 | 358 | new_w += [ w[i][j] for j in range(lq,lw)] |
| 347 | 359 | new_w.sort(reverse=True) |
| 348 | 360 | return Partition([new_w[i]+i for i in range(len(new_w))]) |
| 349 | | |
| | 361 | |
| 350 | 362 | class Partition_class(CombinatorialObject): |
| 351 | 363 | def ferrers_diagram(self): |
| 352 | 364 | """ |