Ticket #5790: trac_5790-partition.patch

File trac_5790-partition.patch, 29.4 KB (added by nthiery, 8 months ago)

Apply only this one

  • 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.py
    a b  
    2020- Dan Drake (2009-03-28): deprecate RestrictedPartitions and implement 
    2121  Partitions_parts_in 
    2222 
    23 EXAMPLES: There are 5 partitions of the integer 4. 
    24  
    25 :: 
     23EXAMPLES: 
     24 
     25There are 5 partitions of the integer 4:: 
    2626 
    2727    sage: Partitions(4).cardinality() 
    2828    5 
     
    3030    [[4], [3, 1], [2, 2], [2, 1, 1], [1, 1, 1, 1]] 
    3131 
    3232We can use the method .first() to get the 'first' partition of a 
    33 number. 
    34  
    35 :: 
     33number:: 
    3634 
    3735    sage: Partitions(4).first() 
    3836    [4] 
    3937 
    4038Using the method .next(), we can calculate the 'next' partition. 
    41 When we are at the last partition, None will be returned. 
    42  
    43 :: 
     39When we are at the last partition, None will be returned:: 
    4440 
    4541    sage: Partitions(4).next([4]) 
    4642    [3, 1] 
     
    4844    True 
    4945 
    5046We 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 :: 
     47by one to save memory.  Note that when we do something like 
     48``for part in Partitions(4)`` this iterator is used in the background:: 
    5549 
    5650    sage: g = iter(Partitions(4)) 
    5751 
     
    9589 
    9690The min_part options is complementary to max_part and selects 
    9791partitions having only 'large' parts. Here is the list of all 
    98 partitions of 4 with each part at least 2. 
    99  
    100 :: 
     92partitions of 4 with each part at least 2:: 
    10193 
    10294    sage: Partitions(4, min_part=2).list() 
    10395    [[4], [2, 2]] 
     
    119111 
    120112Finally, here are the partitions of 4 with [1,1,1] as an inner 
    121113bound. Note that inner sets min_length to the length of its 
    122 argument. 
    123  
    124 :: 
     114argument:: 
    125115 
    126116    sage: Partitions(4, inner=[1,1,1]).list() 
    127117    [[2, 1, 1], [1, 1, 1, 1]] 
     
    143133    [[7, 4], [6, 5], [6, 4, 1], [6, 3, 2], [5, 4, 2], [5, 3, 2, 1]] 
    144134 
    145135Partition objects can also be created individually with the 
    146 Partition function. 
    147  
    148 :: 
     136Partition function:: 
    149137 
    150138    sage: Partition([2,1]) 
    151139    [2, 1] 
     
    154142methods that we can use. For example, we can get the conjugate of a 
    155143partition. Geometrically, the conjugate of a partition is the 
    156144reflection of that partition through its main diagonal. Of course, 
    157 this operation is an involution. 
    158  
    159 :: 
     145this operation is an involution:: 
    160146 
    161147    sage: Partition([4,1]).conjugate() 
    162148    [2, 1, 1, 1] 
     
    165151 
    166152We can go back and forth between the exponential notations of a 
    167153partition. The exponential notation can be padded with extra 
    168 zeros. 
    169  
    170 :: 
     154zeros:: 
    171155 
    172156    sage: Partition([6,4,4,2,1]).to_exp() 
    173157    [1, 1, 0, 2, 0, 1] 
     
    180164    sage: Partition([6,4,4,2,1]).to_exp(10) 
    181165    [1, 1, 0, 2, 0, 1, 0, 0, 0, 0] 
    182166 
    183 We can get the coordinates of the corners of a partition. 
    184  
    185 :: 
     167We can get the coordinates of the corners of a partition:: 
    186168 
    187169    sage: Partition([4,3,1]).corners() 
    188170    [[0, 3], [1, 2], [2, 0]] 
    189171 
    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) 
     172We can compute the core and quotient of a partition and build 
     173the partition back up from them:: 
     174 
     175    sage: Partition([6,3,2,2]).core(3) 
    196176    [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) 
    198178    [[2], [1], [2, 2, 2]] 
    199179    sage: p = Partition([11,5,5,3,2,2,2]) 
    200     sage: p.r_core(3) 
     180    sage: p.core(3) 
    201181    [] 
    202     sage: p.r_quotient(3) 
     182    sage: p.quotient(3) 
    203183    [[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]]) 
    205185    [11, 5, 5, 3, 2, 2, 2] 
    206186""" 
    207187#***************************************************************************** 
    208188#       Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>,  
    209189# 
    210190#  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 of 
    214 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
    215 #    General Public License for more details. 
    216 # 
    217 #  The full text of the GPL is available at: 
    218 # 
    219191#                  http://www.gnu.org/licenses/ 
    220192#***************************************************************************** 
    221193 
    222194from sage.interfaces.all import gap, gp 
    223195from sage.rings.all import QQ, ZZ, infinity, factorial, gcd 
    224 from sage.misc.all import prod, sage_eval 
     196from sage.misc.all import prod 
    225197from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing 
    226198import sage.combinat.misc as misc 
    227199import sage.combinat.skew_partition 
     
    237209from integer_vector import IntegerVectors 
    238210from cartesian_product import CartesianProduct 
    239211from 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      
     212from sage.functions.other import ceil 
     213 
     214def 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] 
    250239        sage: Partition(exp=[2,1,1]) 
    251240        [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]]) 
    253242        [11, 5, 5, 3, 2, 2, 2] 
    254         sage: Partition([3,2,1]) 
    255         [3, 2, 1] 
    256243        sage: [2,1] in Partitions() 
    257244        True 
    258245        sage: [2,1,0] in Partitions() 
    259246        False 
    260         sage: Partition([2,1,0]) 
    261         [2, 1] 
    262247        sage: Partition([1,2,3]) 
    263248        Traceback (most recent call last): 
    264249        ... 
    265250        ValueError: [1, 2, 3] is not a valid partition 
    266251    """ 
    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 
     273def from_exp(exp): 
    288274    """ 
    289275    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]) 
    294285        [3, 2, 2, 1] 
    295286    """ 
    296  
    297287    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] 
    301290    return Partition(p) 
    302291 
    303  
    304292def from_core_and_quotient(core, quotient): 
    305293    """ 
    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. 
    307297     
    308298    Algorithm from mupad-combinat. 
    309299     
    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]]) 
    313308        [11, 5, 5, 3, 2, 2, 2] 
    314309    """ 
    315     from sage.functions.all import ceil 
    316310    length = len(quotient) 
    317311    k = length*max( [ceil(len(core)/length),len(core)] + [len(q) for q in quotient] ) + length 
    318312    v = [ core[i]-(i+1)+1 for i in range(len(core))] + [ -i + 1 for i in range(len(core)+1,k+1) ] 
     
    323317        new_w += [ w[i][j] for j in range(len(quotient[i]), len(w[i])) ] 
    324318    new_w.sort() 
    325319    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 
    329322class Partition_class(CombinatorialObject): 
    330323    def ferrers_diagram(self): 
    331324        """ 
     
    344337            ***** 
    345338            ** 
    346339            *         
    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             * 
    359340        """ 
    360341        return '\n'.join(['*'*p for p in self]) 
    361342 
     
    390371 
    391372        return sage.combinat.skew_partition.SkewPartition([self[:], p]) 
    392373         
    393     def power(self,k): 
    394         """ 
    395         partition_power( pi, k ) returns the partition corresponding to 
    396         the `k`-th power of a permutation with cycle structure pi 
    397         (thus describes the powermap of symmetric 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). 
    398379         
    399380        Wraps GAP's PowerPartition. 
    400381         
     
    507488 
    508489    def sign(self): 
    509490        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``. 
    512492         
    513493        This function corresponds to a homomorphism from the symmetric 
    514494        group `S_n` into the cyclic group of order 2, whose kernel 
     
    516496        `1` are called even partitions while partitions of sign 
    517497        `-1` are called odd. 
    518498         
    519         Wraps GAP's SignPartition. 
    520          
    521499        EXAMPLES:: 
    522500         
    523501            sage: Partition([5,3]).sign() 
     
    577555 
    578556        - http://en.wikipedia.org/wiki/Zolotarev's_lemma 
    579557        """ 
    580         ans=gap.eval("SignPartition(%s)"%(self)) 
    581         return sage_eval(ans) 
     558        return (-1)**(self.size()-self.length()) 
    582559 
    583560    def up(self): 
    584561        r""" 
     
    791768            sage: Partition([5,4,2,1,1,1]).associated().associated() 
    792769            [5, 4, 2, 1, 1, 1] 
    793770        """ 
    794  
    795771        return self.conjugate() 
    796772 
    797773    def arm(self, i, j): 
     
    12651241    def centralizer_size(self, t=0, q=0): 
    12661242        """ 
    12671243        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 given 
     1244        ``self``. If m_i is the multiplicity of i as a part of p, this is given 
    12691245        by `\prod_i (i^m[i])*(m[i]!)`. Including the optional 
    12701246        parameters t and q gives the q-t analog which is the former product 
    12711247        times `\prod_{i=1}^{length(p)} (1 - q^{p[i]}) / (1 - t^{p[i]}).` 
     
    12921268    def aut(self): 
    12931269        r""" 
    12941270        Returns a factor for the number of permutations with cycle type 
    1295         self. self.aut() returns 
     1271        ``self``. self.aut() returns 
    12961272        `1^{j_1}j_1! \cdots n^{j_n}j_n!` where `j_k` 
    12971273        is the number of parts in self equal to k. 
    12981274         
     
    14161392 
    14171393    def r_core(self, length): 
    14181394        """ 
    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 
    14261399            sage: Partition([6,3,2,2]).r_core(3) 
     1400            doctest:1: DeprecationWarning: r_core is deprecated. Please use core instead. 
    14271401            [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) 
    14311406            [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) 
    14401437            [] 
    14411438        """ 
    14421439        p = self 
     
    14631460 
    14641461    def r_quotient(self, length): 
    14651462        """ 
    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) 
    14761494            [[2], [1], [2, 2, 2]] 
    14771495         
    14781496        TESTS:: 
    14791497         
    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) 
    14811499            [[2, 1], [2, 2], [2]] 
    1482             sage: Partition([10,8,7,7]).r_quotient(4) 
     1500            sage: Partition([10,8,7,7]).quotient(4) 
    14831501            [[2], [3], [2], [1]] 
    1484             sage: Partition([6,3,3]).r_quotient(3) 
     1502            sage: Partition([6,3,3]).quotient(3) 
    14851503            [[1], [1], [2]] 
    1486             sage: Partition([3,3,3,2,1]).r_quotient(3) 
     1504            sage: Partition([3,3,3,2,1]).quotient(3) 
    14871505            [[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) 
    14891507            [[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) 
    14911509            [[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) 
    14931511            [[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) 
    14951513            [[3, 3], [2, 2, 1], [], [3, 3, 3], [1]] 
    14961514        """ 
    14971515        p = self 
     
    39844002     
    39854003    EXAMPLES:: 
    39864004     
    3987         sage: print ferrers_diagram([5,5,2,1]) 
     4005        sage: print Partition([5,5,2,1]).ferrers_diagram() 
    39884006        ***** 
    39894007        ***** 
    39904008        ** 
    39914009        *         
    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() 
    40064014 
    40074015 
    40084016def ordered_partitions(n,k=None): 
     
    42434251def partition_power(pi,k): 
    42444252    """ 
    42454253    partition_power( pi, k ) returns the partition corresponding to 
    4246     the `k`-th power of a permutation with cycle structure pi 
     4254    the `k`-th power of a permutation with cycle structure ``pi`` 
    42474255    (thus describes the powermap of symmetric groups). 
    42484256     
    42494257    Wraps GAP's PowerPartition. 
     
    42774285 
    42784286def partition_sign(pi): 
    42794287    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 
    42814291    structure given by the partition pi. 
    42824292     
    42834293    This function corresponds to a homomorphism from the symmetric 
     
    42854295    is exactly the alternating group `A_n`. Partitions of sign 
    42864296    `1` are called even partitions while partitions of sign 
    42874297    `-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() 
    42944304        1 
    4295         sage: partition_sign([5,2]) 
     4305        sage: Partition([5,2]).sign() 
    42964306        -1 
    42974307     
    42984308    Zolotarev's lemma states that the Legendre symbol 
     
    43224332        sage: p = PermutationGroupElement('(1, 2, 4, 8, 5, 10, 9, 7, 3, 6)') 
    43234333        sage: p.sign() 
    43244334        -1 
    4325         sage: partition_sign([10]) 
     4335        sage: Partition([10]).sign() 
    43264336        -1 
    43274337        sage: kronecker_symbol(11,2) 
    43284338        -1 
     
    43384348        1 
    43394349        sage: kronecker_symbol(3,11) 
    43404350        1 
    4341         sage: partition_sign([5,1,1,1,1,1]) 
     4351        sage: Partition([5,1,1,1,1,1]).sign() 
    43424352        1 
    43434353     
    43444354    In both cases, Zolotarev holds. 
     
    43474357 
    43484358    - http://en.wikipedia.org/wiki/Zolotarev's_lemma 
    43494359    """ 
    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() 
    43524363 
    43534364def partition_associated(pi): 
    43544365    """ 
     4366    ** This function is being deprecated -- use Partition(*).conjugate() instead.  ** 
     4367 
    43554368    partition_associated( pi ) returns the "associated" (also called 
    43564369    "conjugate" in the literature) partition of the partition pi which 
    43574370    is obtained by transposing the corresponding Ferrers diagram. 
    43584371     
    43594372    EXAMPLES:: 
    43604373     
    4361         sage: partition_associated([2,2]) 
     4374        sage: Partition([2,2]).conjugate() 
    43624375        [2, 2] 
    4363         sage: partition_associated([6,3,1]) 
     4376        sage: Partition([6,3,1]).conjugate() 
    43644377        [3, 2, 2, 1, 1, 1] 
    4365         sage: print ferrers_diagram([6,3,1]) 
     4378        sage: print Partition([6,3,1]).ferrers_diagram() 
    43664379        ****** 
    43674380        *** 
    43684381        * 
    4369         sage: print ferrers_diagram([3,2,2,1,1,1]) 
     4382        sage: print Partition([6,3,1]).conjugate().ferrers_diagram() 
    43704383        *** 
    43714384        ** 
    43724385        ** 
     
    43744387        * 
    43754388        * 
    43764389    """ 
    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  
    143143    """ 
    144144    if shape in partition.Partitions(): 
    145145        shape = partition.Partition(shape) 
    146         shape = skew_partition.SkewPartition([shape, shape.r_core(length)]) 
     146        shape = skew_partition.SkewPartition([shape, shape.core(length)]) 
    147147    else: 
    148148        shape = skew_partition.SkewPartition(shape) 
    149149 
     
    881881            sage: a = SkewPartition([[8,7,6,5,1,1],[2,1,1]]) 
    882882            sage: weight = [3,3,2] 
    883883            sage: k = 3 
    884             sage: s = SemistandardMultiSkewTableaux(a.r_quotient(k),weight) 
     884            sage: s = SemistandardMultiSkewTableaux(a.quotient(k),weight) 
    885885            sage: len(s.list()) 
    886886            34 
    887887            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  
    146146             
    147147        elif isinstance(skp, list) and skp[0] in sage.combinat.skew_partition.SkewPartitions(): 
    148148            #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))] 
    151151            mu = sage.combinat.partition.Partitions(ZZ(sum( [ s.size() for s in skp] ) / self.level())) 
    152152 
    153153             
    154154        elif isinstance(skp, list) and skp[0] in sage.combinat.partition.Partitions(): 
    155155            #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) 
    157157            mu = sage.combinat.partition.Partitions( ZZ(sum(skp) / self.level() )) 
    158158        else: 
    159159            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  
    452452        return G 
    453453 
    454454 
    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): 
    456462        """ 
    457463        The quotient map extended to skew partitions. 
    458464         
    459465        EXAMPLES:: 
    460466         
    461             sage: SkewPartition([[3, 3, 2, 1], [2, 1]]).r_quotient(2) 
     467            sage: SkewPartition([[3, 3, 2, 1], [2, 1]]).quotient(2) 
    462468            [[[3], []], [[], []]] 
    463469        """ 
    464470        ## k-th element is the skew partition built using the k-th partition of the 
    465471        ## k-quotient of the outer and the inner partition. 
    466472        ## This bijection is only defined if the inner and the outer partition 
    467473        ## 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) 
    471477            return [ SkewPartition_class([rqouter[i],rqinner[i]]) for i in range(k) ] 
    472478        else: 
    473479            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  
    19091909        """ 
    19101910        TESTS:: 
    19111911         
    1912             sage: f = attrcall('r_core', 3) 
     1912            sage: f = attrcall('core', 3) 
    19131913            sage: loads(dumps(f)) 
    1914             *.r_core(3) 
     1914            *.core(3) 
    19151915        """ 
    19161916        self.name = name 
    19171917        self.args = args 
     
    19241924         
    19251925        EXAMPLES:: 
    19261926         
    1927             sage: f = attrcall('r_core', 3) 
     1927            sage: f = attrcall('core', 3) 
    19281928            sage: f(Partition([4,2])) 
    19291929            [4, 2] 
    19301930        """ 
     
    19371937         
    19381938        EXAMPLES:: 
    19391939         
    1940             sage: attrcall('r_core', 3) 
    1941             *.r_core(3) 
     1940            sage: attrcall('core', 3) 
     1941            *.core(3) 
    19421942            sage: attrcall('hooks', flatten=True) 
    19431943            *.hooks(flatten=True) 
    19441944            sage: attrcall('hooks', 3, flatten=True) 
     
    19711971     
    19721972    EXAMPLES:: 
    19731973     
    1974         sage: f = attrcall('r_core', 3); f 
    1975         *.r_core(3) 
     1974        sage: f = attrcall('core', 3); f 
     1975        *.core(3) 
    19761976        sage: [f(p) for p in Partitions(5)] 
    19771977        [[2], [1, 1], [1, 1], [3, 1, 1], [2], [2], [1, 1]] 
    19781978    """