Ticket #5790: trac_5790-partition.patch
| File trac_5790-partition.patch, 29.4 KB (added by nthiery, 8 months ago) |
|---|
-
sage/combinat/partition.py
# HG changeset patch # User Jason Bandlow <jbandlow@gmail.com> # Date 1245094287 14400 # Node ID 2ff13dd8cd34ecea9e252e092c14cc9b4e6856ab # Parent 55dc2c0593e8fae194803b4398e3d74dd798505b #5790 Updating some quirks in partition.py * deprecates r_core, r_quotient (and k_core) in favour of core and quotient, respectively. I also made core return a partition rather than a list. * rewrites the Partition() calling function to use keywords rather than named arguments. In the process I deprecated the core_and_quotient argument replacing it with Partition(core=?,quotient=?). * deprecated partition_sign in favour of sign and replaced the previous call to gap with plus or minus one as required. Almost all of the changes are to partition.py, however, the patch affects the following four files as they all called r_core or r_quotient: * sage/combinat/ktableau.py * sage/combinat/partition.py * sage/combinat/ribbon_tableau.py * sage/combinat/skew_partition.py * sage/combinat/sf/llt.py * sage/misc/misc.py diff --git a/sage/combinat/partition.py b/sage/combinat/partition.pya b 20 20 - Dan Drake (2009-03-28): deprecate RestrictedPartitions and implement 21 21 Partitions_parts_in 22 22 23 EXAMPLES: There are 5 partitions of the integer 4.24 25 ::23 EXAMPLES: 24 25 There are 5 partitions of the integer 4:: 26 26 27 27 sage: Partitions(4).cardinality() 28 28 5 … … 30 30 [[4], [3, 1], [2, 2], [2, 1, 1], [1, 1, 1, 1]] 31 31 32 32 We can use the method .first() to get the 'first' partition of a 33 number. 34 35 :: 33 number:: 36 34 37 35 sage: Partitions(4).first() 38 36 [4] 39 37 40 38 Using the method .next(), we can calculate the 'next' partition. 41 When we are at the last partition, None will be returned. 42 43 :: 39 When we are at the last partition, None will be returned:: 44 40 45 41 sage: Partitions(4).next([4]) 46 42 [3, 1] … … 48 44 True 49 45 50 46 We can use ``iter`` to get an object which iterates over the partitions one 51 by one to save memory. Note that when we do something like 52 ``for part in Partitions(4)`` this iterator is used in the background. 53 54 :: 47 by one to save memory. Note that when we do something like 48 ``for part in Partitions(4)`` this iterator is used in the background:: 55 49 56 50 sage: g = iter(Partitions(4)) 57 51 … … 95 89 96 90 The min_part options is complementary to max_part and selects 97 91 partitions having only 'large' parts. Here is the list of all 98 partitions of 4 with each part at least 2. 99 100 :: 92 partitions of 4 with each part at least 2:: 101 93 102 94 sage: Partitions(4, min_part=2).list() 103 95 [[4], [2, 2]] … … 119 111 120 112 Finally, here are the partitions of 4 with [1,1,1] as an inner 121 113 bound. Note that inner sets min_length to the length of its 122 argument. 123 124 :: 114 argument:: 125 115 126 116 sage: Partitions(4, inner=[1,1,1]).list() 127 117 [[2, 1, 1], [1, 1, 1, 1]] … … 143 133 [[7, 4], [6, 5], [6, 4, 1], [6, 3, 2], [5, 4, 2], [5, 3, 2, 1]] 144 134 145 135 Partition objects can also be created individually with the 146 Partition function. 147 148 :: 136 Partition function:: 149 137 150 138 sage: Partition([2,1]) 151 139 [2, 1] … … 154 142 methods that we can use. For example, we can get the conjugate of a 155 143 partition. Geometrically, the conjugate of a partition is the 156 144 reflection of that partition through its main diagonal. Of course, 157 this operation is an involution. 158 159 :: 145 this operation is an involution:: 160 146 161 147 sage: Partition([4,1]).conjugate() 162 148 [2, 1, 1, 1] … … 165 151 166 152 We can go back and forth between the exponential notations of a 167 153 partition. The exponential notation can be padded with extra 168 zeros. 169 170 :: 154 zeros:: 171 155 172 156 sage: Partition([6,4,4,2,1]).to_exp() 173 157 [1, 1, 0, 2, 0, 1] … … 180 164 sage: Partition([6,4,4,2,1]).to_exp(10) 181 165 [1, 1, 0, 2, 0, 1, 0, 0, 0, 0] 182 166 183 We can get the coordinates of the corners of a partition. 184 185 :: 167 We can get the coordinates of the corners of a partition:: 186 168 187 169 sage: Partition([4,3,1]).corners() 188 170 [[0, 3], [1, 2], [2, 0]] 189 171 190 We can compute the r-core and r-quotient of a partition and build 191 the partition back up from them. 192 193 :: 194 195 sage: Partition([6,3,2,2]).r_core(3) 172 We can compute the core and quotient of a partition and build 173 the partition back up from them:: 174 175 sage: Partition([6,3,2,2]).core(3) 196 176 [2, 1, 1] 197 sage: Partition([7,7,5,3,3,3,1]). r_quotient(3)177 sage: Partition([7,7,5,3,3,3,1]).quotient(3) 198 178 [[2], [1], [2, 2, 2]] 199 179 sage: p = Partition([11,5,5,3,2,2,2]) 200 sage: p. r_core(3)180 sage: p.core(3) 201 181 [] 202 sage: p. r_quotient(3)182 sage: p.quotient(3) 203 183 [[2, 1], [4], [1, 1, 1]] 204 sage: Partition(core _and_quotient=([],[[2, 1], [4], [1, 1, 1]]))184 sage: Partition(core=[],quotient=[[2, 1], [4], [1, 1, 1]]) 205 185 [11, 5, 5, 3, 2, 2, 2] 206 186 """ 207 187 #***************************************************************************** 208 188 # Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>, 209 189 # 210 190 # Distributed under the terms of the GNU General Public License (GPL) 211 #212 # This code is distributed in the hope that it will be useful,213 # but WITHOUT ANY WARRANTY; without even the implied warranty of214 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU215 # General Public License for more details.216 #217 # The full text of the GPL is available at:218 #219 191 # http://www.gnu.org/licenses/ 220 192 #***************************************************************************** 221 193 222 194 from sage.interfaces.all import gap, gp 223 195 from sage.rings.all import QQ, ZZ, infinity, factorial, gcd 224 from sage.misc.all import prod , sage_eval196 from sage.misc.all import prod 225 197 from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing 226 198 import sage.combinat.misc as misc 227 199 import sage.combinat.skew_partition … … 237 209 from integer_vector import IntegerVectors 238 210 from cartesian_product import CartesianProduct 239 211 from integer_list import IntegerListsLex 240 241 def Partition(l=None, exp=None, core_and_quotient=None): 242 """ 243 Returns a partition object. 244 245 Note that Sage uses the English convention for partitions and 246 tableaux. 247 248 EXAMPLES:: 249 212 from sage.functions.other import ceil 213 214 def Partition(mu=None, **keyword): 215 """ 216 A partition is a weakly decreasing ordered sequence of non-negative 217 integers. This function returns a Sage partition object which can 218 be specified in one of the following ways:: 219 220 * a list (the default) 221 * using exponential notation 222 * by beta numbers (TODO) 223 * specifying the core and the quotient 224 * specifying the core and the canonical quotient (TODO) 225 226 See the examples below. 227 228 Sage follows the usual python conventions when dealing with partitions, 229 so that the first part of the partition ``mu=Partition([4,3,2,2])`` is 230 ``mu[0]``, the second part is ``mu[1]`` and so on. As is usual, Sage ignores 231 trailing zeros at the end of partitions. 232 233 EXAMPLES:: 234 235 sage: Partition([3,2,1]) 236 [3, 2, 1] 237 sage: Partition([3,2,1,0]) 238 [3, 2, 1] 250 239 sage: Partition(exp=[2,1,1]) 251 240 [3, 2, 1, 1] 252 sage: Partition(core _and_quotient=([2,1], [[2,1],[3],[1,1,1]]))241 sage: Partition(core=[2,1], quotient=[[2,1],[3],[1,1,1]]) 253 242 [11, 5, 5, 3, 2, 2, 2] 254 sage: Partition([3,2,1])255 [3, 2, 1]256 243 sage: [2,1] in Partitions() 257 244 True 258 245 sage: [2,1,0] in Partitions() 259 246 False 260 sage: Partition([2,1,0])261 [2, 1]262 247 sage: Partition([1,2,3]) 263 248 Traceback (most recent call last): 264 249 ... 265 250 ValueError: [1, 2, 3] is not a valid partition 266 251 """ 267 number_of_arguments = 0 268 for arg in ['l', 'exp', 'core_and_quotient']: 269 if locals()[arg] is not None: 270 number_of_arguments += 1 271 272 if number_of_arguments != 1: 273 raise ValueError, "you must specify exactly one argument" 274 275 if l is not None: 276 l = [i for i in l if i != 0] 277 if l in Partitions_all(): 278 return Partition_class(l) 279 else: 280 raise ValueError, "%s is not a valid partition"%l 281 elif exp is not None: 282 return from_exp(exp) 283 else: 284 return from_core_and_quotient(*core_and_quotient) 285 286 287 def from_exp(a): 252 if mu is not None and len(keyword)==0: 253 mu = [i for i in mu if i != 0] 254 if mu in Partitions_all(): 255 return Partition_class(mu) 256 else: 257 raise ValueError, "%s is not a valid partition"%mu 258 elif 'beta_numbers' in keyword and len(keyword)==1: 259 raise NotImplementedError 260 elif 'exp' in keyword and len(keyword)==1: 261 return from_exp(keyword['exp']) 262 elif 'core' in keyword and 'quotient' in keyword and len(keyword)==2: 263 return from_core_and_quotient(keyword['core'], keyword['quotient']) 264 elif 'core' in keyword and 'canonical_quotient' in keyword and len(keyword)==2: 265 raise NotImplementedError 266 elif 'core_and_quotient' in keyword and len(keyword)==1: 267 from sage.misc.misc import deprecation 268 deprecation('"core_and_quotient=(*)" is deprecated. Use "core=[*], quotient=[*]" instead.') 269 return from_core_and_quotient(*keyword['core_and_quotient']) 270 else: 271 raise ValueError, 'incorrect syntax for Partition()' 272 273 def from_exp(exp): 288 274 """ 289 275 Returns a partition from its list of multiplicities. 290 291 EXAMPLES:: 292 293 sage: partition.from_exp([1,2,1]) 276 277 .. note:: 278 279 This function is for internal use only; 280 use Partition(exp=*) instead. 281 282 EXAMPLES:: 283 284 sage: Partition(exp=[1,2,1]) 294 285 [3, 2, 2, 1] 295 286 """ 296 297 287 p = [] 298 for i in reversed(range(len(a))): 299 p += [i+1]*a[i] 300 288 for i in reversed(range(len(exp))): 289 p += [i+1]*exp[i] 301 290 return Partition(p) 302 291 303 304 292 def from_core_and_quotient(core, quotient): 305 293 """ 306 Returns a partition from its r-core and r-quotient. 294 ** This function is being deprecated - use Partition(core=*, quotient=*) instead ** 295 296 Returns a partition from its core and quotient. 307 297 308 298 Algorithm from mupad-combinat. 309 299 310 EXAMPLES:: 311 312 sage: partition.from_core_and_quotient([2,1], [[2,1],[3],[1,1,1]]) 300 .. note:: 301 302 This function is for internal use only; 303 use Partition(core=*, quotient=*) instead. 304 305 EXAMPLES:: 306 307 sage: Partition(core=[2,1], quotient=[[2,1],[3],[1,1,1]]) 313 308 [11, 5, 5, 3, 2, 2, 2] 314 309 """ 315 from sage.functions.all import ceil316 310 length = len(quotient) 317 311 k = length*max( [ceil(len(core)/length),len(core)] + [len(q) for q in quotient] ) + length 318 312 v = [ core[i]-(i+1)+1 for i in range(len(core))] + [ -i + 1 for i in range(len(core)+1,k+1) ] … … 323 317 new_w += [ w[i][j] for j in range(len(quotient[i]), len(w[i])) ] 324 318 new_w.sort() 325 319 new_w.reverse() 326 return filter(lambda x: x != 0, [new_w[i-1]+i-1 for i in range(1, len(new_w)+1)]) 327 328 320 return Partition([new_w[i-1]+i-1 for i in range(1, len(new_w)+1)]) 321 329 322 class Partition_class(CombinatorialObject): 330 323 def ferrers_diagram(self): 331 324 """ … … 344 337 ***** 345 338 ** 346 339 * 347 sage: pi = Partitions(10).list()[11] ## [6,1,1,1,1]348 sage: print pi.ferrers_diagram()349 ******350 *351 *352 *353 *354 sage: pi = Partitions(10).list()[8] ## [6, 3, 1]355 sage: print pi.ferrers_diagram()356 ******357 ***358 *359 340 """ 360 341 return '\n'.join(['*'*p for p in self]) 361 342 … … 390 371 391 372 return sage.combinat.skew_partition.SkewPartition([self[:], p]) 392 373 393 def power(self, k):394 """ 395 partition_power( pi, k ) returns the partition corresponding to396 the `k`-th power of a permutation with cycle structure pi397 (thus describes the powermap ofsymmetric groups).374 def power(self, k): 375 """ 376 Returns the cycle type of the `k`-th power of any permutation 377 with cycle type ``self`` (thus describes the powermap of 378 symmetric groups). 398 379 399 380 Wraps GAP's PowerPartition. 400 381 … … 507 488 508 489 def sign(self): 509 490 r""" 510 partition_sign( pi ) returns the sign of a permutation with cycle 511 structure given by the partition pi. 491 Returns the sign of any permutation with cycle type ``self``. 512 492 513 493 This function corresponds to a homomorphism from the symmetric 514 494 group `S_n` into the cyclic group of order 2, whose kernel … … 516 496 `1` are called even partitions while partitions of sign 517 497 `-1` are called odd. 518 498 519 Wraps GAP's SignPartition.520 521 499 EXAMPLES:: 522 500 523 501 sage: Partition([5,3]).sign() … … 577 555 578 556 - http://en.wikipedia.org/wiki/Zolotarev's_lemma 579 557 """ 580 ans=gap.eval("SignPartition(%s)"%(self)) 581 return sage_eval(ans) 558 return (-1)**(self.size()-self.length()) 582 559 583 560 def up(self): 584 561 r""" … … 791 768 sage: Partition([5,4,2,1,1,1]).associated().associated() 792 769 [5, 4, 2, 1, 1, 1] 793 770 """ 794 795 771 return self.conjugate() 796 772 797 773 def arm(self, i, j): … … 1265 1241 def centralizer_size(self, t=0, q=0): 1266 1242 """ 1267 1243 Returns the size of the centralizer of any permutation of cycle type 1268 p. If m_i is the multiplicity of i as a part of p, this is given1244 ``self``. If m_i is the multiplicity of i as a part of p, this is given 1269 1245 by `\prod_i (i^m[i])*(m[i]!)`. Including the optional 1270 1246 parameters t and q gives the q-t analog which is the former product 1271 1247 times `\prod_{i=1}^{length(p)} (1 - q^{p[i]}) / (1 - t^{p[i]}).` … … 1292 1268 def aut(self): 1293 1269 r""" 1294 1270 Returns a factor for the number of permutations with cycle type 1295 self. self.aut() returns1271 ``self``. self.aut() returns 1296 1272 `1^{j_1}j_1! \cdots n^{j_n}j_n!` where `j_k` 1297 1273 is the number of parts in self equal to k. 1298 1274 … … 1416 1392 1417 1393 def r_core(self, length): 1418 1394 """ 1419 Returns the r-core of the partition p. The construction of the 1420 r-core can be visualized by repeatedly removing border strips of 1421 size r from p until this is no longer possible. The remaining 1422 partition is the r-core. 1423 1424 EXAMPLES:: 1425 1395 This function is deprecated. 1396 1397 EXAMPLES:: 1398 1426 1399 sage: Partition([6,3,2,2]).r_core(3) 1400 doctest:1: DeprecationWarning: r_core is deprecated. Please use core instead. 1427 1401 [2, 1, 1] 1428 sage: Partition([]).r_core(3) 1429 [] 1430 sage: Partition([8,7,7,4,1,1,1,1,1]).r_core(3) 1402 1403 Please use :meth:`core` instead:: 1404 1405 sage: Partition([6,3,2,2]).core(3) 1431 1406 [2, 1, 1] 1432 1433 TESTS:: 1434 1435 sage: Partition([3,3,3,2,1]).r_core(3) 1436 [] 1437 sage: Partition([10,8,7,7]).r_core(4) 1438 [] 1439 sage: Partition([21,15,15,9,6,6,6,3,3]).r_core(3) 1407 1408 """ 1409 from sage.misc.misc import deprecation 1410 deprecation('r_core is deprecated. Please use core instead.') 1411 return self.core(length) 1412 1413 def core(self, length): 1414 """ 1415 Returns the core of the partition -- in the literature the core is 1416 commonly referred to as the `k`-core, `p`-core, `r`-core, ... . The 1417 construction of the core can be visualized by repeatedly removing 1418 border strips of size `r` from ``self`` until this is no longer possible. 1419 The remaining partition is the core. 1420 1421 EXAMPLES:: 1422 1423 sage: Partition([6,3,2,2]).core(3) 1424 [2, 1, 1] 1425 sage: Partition([]).core(3) 1426 [] 1427 sage: Partition([8,7,7,4,1,1,1,1,1]).core(3) 1428 [2, 1, 1] 1429 1430 TESTS:: 1431 1432 sage: Partition([3,3,3,2,1]).core(3) 1433 [] 1434 sage: Partition([10,8,7,7]).core(4) 1435 [] 1436 sage: Partition([21,15,15,9,6,6,6,3,3]).core(3) 1440 1437 [] 1441 1438 """ 1442 1439 p = self … … 1463 1460 1464 1461 def r_quotient(self, length): 1465 1462 """ 1466 Returns the r-quotient of the partition p. The r-quotient is a list 1467 of r partitions, constructed in the following way. Label each cell 1468 in p with its content, modulo r. Let R_i be the set of rows ending 1469 in a box labelled i, and C_i be the set of columns ending in a box 1470 labelled i. Then the jth component of the r-quotient of p is the 1471 partition defined by intersecting R_j with C_j+1. 1472 1473 EXAMPLES:: 1474 1475 sage: Partition([7,7,5,3,3,3,1]).r_quotient(3) 1463 This function is deprecated. 1464 1465 EXAMPLES:: 1466 1467 sage: Partition([6,3,2,2]).r_quotient(3) 1468 doctest:1: DeprecationWarning: r_quotient is deprecated. Please use quotient instead. 1469 [[], [], [2, 1]] 1470 1471 Please use :meth:`quotient` instead:: 1472 1473 sage: Partition([6,3,2,2]).quotient(3) 1474 [[], [], [2, 1]] 1475 """ 1476 from sage.misc.misc import deprecation 1477 deprecation('r_quotient is deprecated. Please use quotient instead.') 1478 return self.quotient(length) 1479 1480 def quotient(self, length): 1481 """ 1482 Returns the quotient of the partition -- in the literature the 1483 core is commonly referred to as the `k`-core, `p`-core, `r`-core, ... . The 1484 quotient is a list of `r` partitions, constructed in the following 1485 way. Label each cell in `p` with its content, modulo `r`. Let `R_i` be 1486 the set of rows ending in a box labelled `i`, and `C_i` be the set of 1487 columns ending in a box labelled `i`. Then the `j`-th component of the 1488 quotient of `p` is the partition defined by intersecting `R_j` with 1489 `C_j+1`. 1490 1491 EXAMPLES:: 1492 1493 sage: Partition([7,7,5,3,3,3,1]).quotient(3) 1476 1494 [[2], [1], [2, 2, 2]] 1477 1495 1478 1496 TESTS:: 1479 1497 1480 sage: Partition([8,7,7,4,1,1,1,1,1]). r_quotient(3)1498 sage: Partition([8,7,7,4,1,1,1,1,1]).quotient(3) 1481 1499 [[2, 1], [2, 2], [2]] 1482 sage: Partition([10,8,7,7]). r_quotient(4)1500 sage: Partition([10,8,7,7]).quotient(4) 1483 1501 [[2], [3], [2], [1]] 1484 sage: Partition([6,3,3]). r_quotient(3)1502 sage: Partition([6,3,3]).quotient(3) 1485 1503 [[1], [1], [2]] 1486 sage: Partition([3,3,3,2,1]). r_quotient(3)1504 sage: Partition([3,3,3,2,1]).quotient(3) 1487 1505 [[1], [1, 1], [1]] 1488 sage: Partition([6,6,6,3,3,3]). r_quotient(3)1506 sage: Partition([6,6,6,3,3,3]).quotient(3) 1489 1507 [[2, 1], [2, 1], [2, 1]] 1490 sage: Partition([21,15,15,9,6,6,6,3,3]). r_quotient(3)1508 sage: Partition([21,15,15,9,6,6,6,3,3]).quotient(3) 1491 1509 [[5, 2, 1], [5, 2, 1], [7, 3, 2]] 1492 sage: Partition([21,15,15,9,6,6,3,3]). r_quotient(3)1510 sage: Partition([21,15,15,9,6,6,3,3]).quotient(3) 1493 1511 [[5, 2], [5, 2, 1], [7, 3, 1]] 1494 sage: Partition([14,12,11,10,10,10,10,9,6,4,3,3,2,1]). r_quotient(5)1512 sage: Partition([14,12,11,10,10,10,10,9,6,4,3,3,2,1]).quotient(5) 1495 1513 [[3, 3], [2, 2, 1], [], [3, 3, 3], [1]] 1496 1514 """ 1497 1515 p = self … … 3984 4002 3985 4003 EXAMPLES:: 3986 4004 3987 sage: print ferrers_diagram([5,5,2,1])4005 sage: print Partition([5,5,2,1]).ferrers_diagram() 3988 4006 ***** 3989 4007 ***** 3990 4008 ** 3991 4009 * 3992 sage: pi = partitions_list(10)[30] ## [6,1,1,1,1] 3993 sage: print ferrers_diagram(pi) 3994 ****** 3995 * 3996 * 3997 * 3998 * 3999 sage: pi = partitions_list(10)[33] ## [6, 3, 1] 4000 sage: print ferrers_diagram(pi) 4001 ****** 4002 *** 4003 * 4004 """ 4005 return '\n'.join(['*'*p for p in pi]) 4010 """ 4011 from sage.misc.misc import deprecation 4012 deprecation('"ferrers_diagram deprecated. Use Partition(pi).ferrers_diagram() instead') 4013 return Partition(pi).ferrers_diagram() 4006 4014 4007 4015 4008 4016 def ordered_partitions(n,k=None): … … 4243 4251 def partition_power(pi,k): 4244 4252 """ 4245 4253 partition_power( pi, k ) returns the partition corresponding to 4246 the `k`-th power of a permutation with cycle structure pi4254 the `k`-th power of a permutation with cycle structure ``pi`` 4247 4255 (thus describes the powermap of symmetric groups). 4248 4256 4249 4257 Wraps GAP's PowerPartition. … … 4277 4285 4278 4286 def partition_sign(pi): 4279 4287 r""" 4280 partition_sign( pi ) returns the sign of a permutation with cycle 4288 ** This function is being deprecated -- use Partition(*).sign() instead. ** 4289 4290 Partition( pi ).sign() returns the sign of a permutation with cycle 4281 4291 structure given by the partition pi. 4282 4292 4283 4293 This function corresponds to a homomorphism from the symmetric … … 4285 4295 is exactly the alternating group `A_n`. Partitions of sign 4286 4296 `1` are called even partitions while partitions of sign 4287 4297 `-1` are called odd. 4288 4289 Wraps GAP's SignPartition.4290 4291 EXAMPLES:: 4292 4293 sage: partition_sign([5,3])4298 4299 This function is deprecated: use Partition( pi ).sign() instead. 4300 4301 EXAMPLES:: 4302 4303 sage: Partition([5,3]).sign() 4294 4304 1 4295 sage: partition_sign([5,2])4305 sage: Partition([5,2]).sign() 4296 4306 -1 4297 4307 4298 4308 Zolotarev's lemma states that the Legendre symbol … … 4322 4332 sage: p = PermutationGroupElement('(1, 2, 4, 8, 5, 10, 9, 7, 3, 6)') 4323 4333 sage: p.sign() 4324 4334 -1 4325 sage: partition_sign([10])4335 sage: Partition([10]).sign() 4326 4336 -1 4327 4337 sage: kronecker_symbol(11,2) 4328 4338 -1 … … 4338 4348 1 4339 4349 sage: kronecker_symbol(3,11) 4340 4350 1 4341 sage: partition_sign([5,1,1,1,1,1])4351 sage: Partition([5,1,1,1,1,1]).sign() 4342 4352 1 4343 4353 4344 4354 In both cases, Zolotarev holds. … … 4347 4357 4348 4358 - http://en.wikipedia.org/wiki/Zolotarev's_lemma 4349 4359 """ 4350 ans=gap.eval("SignPartition(%s)"%(pi)) 4351 return sage_eval(ans) 4360 from sage.misc.misc import deprecation 4361 deprecation('"partition_sign deprecated. Use Partition(pi).sign() instead') 4362 return Partition(pi).sign() 4352 4363 4353 4364 def partition_associated(pi): 4354 4365 """ 4366 ** This function is being deprecated -- use Partition(*).conjugate() instead. ** 4367 4355 4368 partition_associated( pi ) returns the "associated" (also called 4356 4369 "conjugate" in the literature) partition of the partition pi which 4357 4370 is obtained by transposing the corresponding Ferrers diagram. 4358 4371 4359 4372 EXAMPLES:: 4360 4373 4361 sage: partition_associated([2,2])4374 sage: Partition([2,2]).conjugate() 4362 4375 [2, 2] 4363 sage: partition_associated([6,3,1])4376 sage: Partition([6,3,1]).conjugate() 4364 4377 [3, 2, 2, 1, 1, 1] 4365 sage: print ferrers_diagram([6,3,1])4378 sage: print Partition([6,3,1]).ferrers_diagram() 4366 4379 ****** 4367 4380 *** 4368 4381 * 4369 sage: print ferrers_diagram([3,2,2,1,1,1])4382 sage: print Partition([6,3,1]).conjugate().ferrers_diagram() 4370 4383 *** 4371 4384 ** 4372 4385 ** … … 4374 4387 * 4375 4388 * 4376 4389 """ 4377 return list(Partition(pi).conjugate()) 4378 4390 from sage.misc.misc import deprecation 4391 deprecation('"partition_associated deprecated. Use Partition(pi).conjugte() instead') 4392 return Partition(pi).conjugate() 4393 -
sage/combinat/ribbon_tableau.py
diff --git a/sage/combinat/ribbon_tableau.py b/sage/combinat/ribbon_tableau.py
a b 143 143 """ 144 144 if shape in partition.Partitions(): 145 145 shape = partition.Partition(shape) 146 shape = skew_partition.SkewPartition([shape, shape. r_core(length)])146 shape = skew_partition.SkewPartition([shape, shape.core(length)]) 147 147 else: 148 148 shape = skew_partition.SkewPartition(shape) 149 149 … … 881 881 sage: a = SkewPartition([[8,7,6,5,1,1],[2,1,1]]) 882 882 sage: weight = [3,3,2] 883 883 sage: k = 3 884 sage: s = SemistandardMultiSkewTableaux(a. r_quotient(k),weight)884 sage: s = SemistandardMultiSkewTableaux(a.quotient(k),weight) 885 885 sage: len(s.list()) 886 886 34 887 887 sage: RibbonTableaux(a,weight,k).cardinality() -
sage/combinat/sf/llt.py
diff --git a/sage/combinat/sf/llt.py b/sage/combinat/sf/llt.py
a b 146 146 147 147 elif isinstance(skp, list) and skp[0] in sage.combinat.skew_partition.SkewPartitions(): 148 148 #skp is a list of skew partitions 149 skp = [sage.combinat.partition.Partition(core _and_quotient=([], skp[i][0])) for i in range(len(skp))]150 skp += [sage.combinat.partition.Partition(core _and_quotient=([], skp[i][1])) for i in range(len(skp))]149 skp = [sage.combinat.partition.Partition(core=[], quotient=skp[i][0]) for i in range(len(skp))] 150 skp += [sage.combinat.partition.Partition(core=[], quotient=skp[i][1]) for i in range(len(skp))] 151 151 mu = sage.combinat.partition.Partitions(ZZ(sum( [ s.size() for s in skp] ) / self.level())) 152 152 153 153 154 154 elif isinstance(skp, list) and skp[0] in sage.combinat.partition.Partitions(): 155 155 #skp is a list of partitions 156 skp = sage.combinat.partition.Partition(core _and_quotient=([], skp))156 skp = sage.combinat.partition.Partition(core=[], quotient=skp) 157 157 mu = sage.combinat.partition.Partitions( ZZ(sum(skp) / self.level() )) 158 158 else: 159 159 raise ValueError, "LLT polynomials not defined for %s"%skp -
sage/combinat/skew_partition.py
diff --git a/sage/combinat/skew_partition.py b/sage/combinat/skew_partition.py
a b 452 452 return G 453 453 454 454 455 def r_quotient(self, k): 455 def r_quotient(self, length): 456 """ *** deprecate *** """ 457 from sage.misc.misc import deprecation 458 deprecation('r_quotient is deprecated. Use quotient instead.') 459 return self.quotient(self,length) 460 461 def quotient(self, k): 456 462 """ 457 463 The quotient map extended to skew partitions. 458 464 459 465 EXAMPLES:: 460 466 461 sage: SkewPartition([[3, 3, 2, 1], [2, 1]]). r_quotient(2)467 sage: SkewPartition([[3, 3, 2, 1], [2, 1]]).quotient(2) 462 468 [[[3], []], [[], []]] 463 469 """ 464 470 ## k-th element is the skew partition built using the k-th partition of the 465 471 ## k-quotient of the outer and the inner partition. 466 472 ## This bijection is only defined if the inner and the outer partition 467 473 ## have the same core 468 if self.inner(). r_core(k) == self.outer().r_core(k):469 rqinner = self.inner(). r_quotient(k)470 rqouter = self.outer(). r_quotient(k)474 if self.inner().core(k) == self.outer().core(k): 475 rqinner = self.inner().quotient(k) 476 rqouter = self.outer().quotient(k) 471 477 return [ SkewPartition_class([rqouter[i],rqinner[i]]) for i in range(k) ] 472 478 else: 473 479 raise ValueError, "quotient map is only defined for skew partitions with inner and outer partitions having the same core" -
sage/misc/misc.py
diff --git a/sage/misc/misc.py b/sage/misc/misc.py
a b 1909 1909 """ 1910 1910 TESTS:: 1911 1911 1912 sage: f = attrcall(' r_core', 3)1912 sage: f = attrcall('core', 3) 1913 1913 sage: loads(dumps(f)) 1914 *. r_core(3)1914 *.core(3) 1915 1915 """ 1916 1916 self.name = name 1917 1917 self.args = args … … 1924 1924 1925 1925 EXAMPLES:: 1926 1926 1927 sage: f = attrcall(' r_core', 3)1927 sage: f = attrcall('core', 3) 1928 1928 sage: f(Partition([4,2])) 1929 1929 [4, 2] 1930 1930 """ … … 1937 1937 1938 1938 EXAMPLES:: 1939 1939 1940 sage: attrcall(' r_core', 3)1941 *. r_core(3)1940 sage: attrcall('core', 3) 1941 *.core(3) 1942 1942 sage: attrcall('hooks', flatten=True) 1943 1943 *.hooks(flatten=True) 1944 1944 sage: attrcall('hooks', 3, flatten=True) … … 1971 1971 1972 1972 EXAMPLES:: 1973 1973 1974 sage: f = attrcall(' r_core', 3); f1975 *. r_core(3)1974 sage: f = attrcall('core', 3); f 1975 *.core(3) 1976 1976 sage: [f(p) for p in Partitions(5)] 1977 1977 [[2], [1, 1], [1, 1], [3, 1, 1], [2], [2], [1, 1]] 1978 1978 """
