Ticket #5931: dict.patch

File dict.patch, 2.3 KB (added by jdc, 10 years ago)

Replaces both e.patch and doc.patch; relative to 3.4

  • sage/combinat/symmetric_group_algebra.py

    diff -r 5c0961ff033d sage/combinat/symmetric_group_algebra.py
    a b  
    412412e_cache = {}
    413413def e(tableau, star=0):
    414414    """
     415    The unnormalized Young projection operator.
     416
    415417    EXAMPLES::
    416418   
    417419        sage: from sage.combinat.symmetric_group_algebra import e
     
    419421        [1, 2] + [2, 1]
    420422        sage: e([[1],[2]])
    421423        [1, 2] - [2, 1]
     424
     425    There are differing conventions for the order of the symmetrizers
     426    and antisymmetrizers.  This example illustrates our conventions::
     427
     428        sage: e([[1,2],[3]])
     429        [1, 2, 3] + [2, 1, 3] - [3, 1, 2] - [3, 2, 1]
    422430    """
    423431    t = Tableau(tableau)
    424432    if star:
     
    428436    permutation_options['mult'] = 'l2r'
    429437   
    430438    if t in e_cache:
    431         res =  e_cache[t]
     439        res = e_cache[t]
    432440    else:
    433         rs = t.row_stabilizer()
    434         cs = t.column_stabilizer()
     441        rs = t.row_stabilizer().list()
     442        cs = t.column_stabilizer().list()
    435443        n = t.size()
    436444
    437445        QSn = SymmetricGroupAlgebra(QQ, n)
     446        one = QQ(1)
     447        P = permutation.Permutation
    438448
    439         res = 0
    440         for h in rs:
    441             for v in cs:
    442                 res += v.sign() * QSn( (h*v).list() )
     449        rd = dict((P(h), one) for h in rs)
     450        sym = QSn._from_dict(rd)
     451
     452        cd = dict((P(v), v.sign()*one) for v in cs)
     453        antisym = QSn._from_dict(cd)
     454
     455        res = antisym*sym
     456
    443457        e_cache[t] = res
    444458
    445459    permutation_options['mult'] = mult   
     
    448462ehat_cache = {}
    449463def e_hat(tab, star=0):
    450464    """
     465    The Young projection operator, an idempotent in the rational group algebra.
     466
    451467    EXAMPLES::
    452468   
    453469        sage: from sage.combinat.symmetric_group_algebra import e_hat
     
    455471        1/6*[1, 2, 3] + 1/6*[1, 3, 2] + 1/6*[2, 1, 3] + 1/6*[2, 3, 1] + 1/6*[3, 1, 2] + 1/6*[3, 2, 1]
    456472        sage: e_hat([[1],[2]])
    457473        1/2*[1, 2] - 1/2*[2, 1]
     474
     475    There are differing conventions for the order of the symmetrizers
     476    and antisymmetrizers.  This example illustrates our conventions::
     477
     478        sage: e_hat([[1,2],[3]])
     479        1/3*[1, 2, 3] + 1/3*[2, 1, 3] - 1/3*[3, 1, 2] - 1/3*[3, 2, 1]
    458480    """
    459481    t = Tableau(tab)
    460482    if star: