Skip to content

Commit

Permalink
Trac #26719: py3: fix doctests in symmetric group algebra
Browse files Browse the repository at this point in the history
URL: https://trac.sagemath.org/26719
Reported by: chapoton
Ticket author(s): Frédéric Chapoton
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager authored and vbraun committed Nov 19, 2018
2 parents 5d8ab92 + 05a8057 commit 7928e4c
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/sage/combinat/symmetric_group_algebra.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
r"""
Symmetric Group Algebra
"""
#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2007 Mike Hansen <[email protected]>,
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************
from __future__ import print_function, absolute_import
import itertools
import six
from six.moves import range

from sage.misc.cachefunc import cached_method, cached_function
from sage.misc.cachefunc import cached_method
from sage.misc.lazy_attribute import lazy_attribute
from sage.misc.superseded import deprecated_function_alias
from sage.combinat.combinatorial_algebra import CombinatorialAlgebra
Expand All @@ -23,7 +23,6 @@
from sage.combinat.tableau import Tableau, StandardTableaux_size, StandardTableaux_shape, StandardTableaux
from sage.algebras.group_algebra import GroupAlgebra_class
from sage.categories.weyl_groups import WeylGroups
from sage.categories.algebras import Algebras
from sage.rings.all import QQ, PolynomialRing
from sage.arith.all import factorial
from sage.matrix.all import matrix
Expand All @@ -32,6 +31,8 @@

# TODO: Remove this function and replace it with the class
# TODO: Create parents for other bases (such as the seminormal basis)


def SymmetricGroupAlgebra(R, W, category=None):
r"""
Return the symmetric group algebra of order ``W`` over the ring ``R``.
Expand Down Expand Up @@ -223,6 +224,7 @@ def SymmetricGroupAlgebra(R, W, category=None):
category = W.category()
return SymmetricGroupAlgebra_n(R, W, category.Algebras(R))


class SymmetricGroupAlgebra_n(GroupAlgebra_class):

def __init__(self, R, W, category):
Expand Down Expand Up @@ -1444,6 +1446,7 @@ def semi_rsw_element(self, k):
n = self.n
if n < k:
return self.zero()

def complement(xs):
res = list(range(1, n + 1))
for x in xs:
Expand All @@ -1452,7 +1455,7 @@ def complement(xs):
P = Permutations(n)
I = self._indices
return self.sum_of_monomials([I(P(complement(q) + list(q)))
for q in itertools.permutations(range(1, n+1), n-k)])
for q in itertools.permutations(range(1, n+1), int(n - k))])

def binary_unshuffle_sum(self, k):
r"""
Expand Down Expand Up @@ -1536,14 +1539,15 @@ def binary_unshuffle_sum(self, k):
n = self.n
if n < k:
return self.zero()

def complement(xs):
res = list(range(1, n + 1))
for x in xs:
res.remove(x)
return res
P = Permutations(n)
return self.sum_of_monomials([self._indices(P(list(q) + complement(q)))
for q in itertools.combinations(range(1, n+1), k)])
for q in itertools.combinations(range(1, n+1), int(k))])

def jucys_murphy(self, k):
r"""
Expand Down Expand Up @@ -1603,8 +1607,6 @@ def jucys_murphy(self, k):
res += self.monomial(self._indices(p))
return res



def seminormal_basis(self, mult='l2r'):
r"""
Return a list of the seminormal basis elements of ``self``.
Expand Down Expand Up @@ -1762,7 +1764,6 @@ def seminormal_basis(self, mult='l2r'):
basis.append(self.epsilon_ik(t1, t2, mult=mult))
return basis


def dft(self, form="seminormal", mult='l2r'):
"""
Return the discrete Fourier transform for ``self``.
Expand Down Expand Up @@ -2139,6 +2140,7 @@ def kappa(alpha):
n = sum(alpha)
return factorial(n) / StandardTableaux(alpha).cardinality()


def a(tableau, star=0, base_ring=QQ):
r"""
The row projection operator corresponding to the Young tableau
Expand Down Expand Up @@ -2205,6 +2207,7 @@ def a(tableau, star=0, base_ring=QQ):
rd = dict((P(h), one) for h in rs)
return sgalg._from_dict(rd)


def b(tableau, star=0, base_ring=QQ):
r"""
The column projection operator corresponding to the Young tableau
Expand Down Expand Up @@ -2467,6 +2470,7 @@ def e_ik(itab, ktab, star=0):
e_ik_cache[(it,kt)] = res
return res


def seminormal_test(n):
"""
Run a variety of tests to verify that the construction of the
Expand Down Expand Up @@ -2595,6 +2599,7 @@ def HeckeAlgebraSymmetricGroupT(R, n, q=None):

return HeckeAlgebraSymmetricGroup_t(R, n, q)


class HeckeAlgebraSymmetricGroup_generic(CombinatorialAlgebra):
def __init__(self, R, n, q=None):
"""
Expand Down Expand Up @@ -2640,7 +2645,6 @@ def q(self):
"""
return self._q


def _coerce_start(self, x):
"""
EXAMPLES::
Expand All @@ -2659,6 +2663,7 @@ def _coerce_start(self, x):
list(range(len(x)+1, self.n+1))))
raise TypeError


class HeckeAlgebraSymmetricGroup_t(HeckeAlgebraSymmetricGroup_generic):

def __init__(self, R, n, q=None):
Expand Down Expand Up @@ -2710,7 +2715,6 @@ def t_action_on_basis(self, perm, i):
z_elt = {perm_i:q, perm:q-1}
return self._from_dict(z_elt)


def t_action(self, a, i):
r"""
Return the product `T_i \cdot a`.
Expand All @@ -2727,7 +2731,6 @@ def t_action(self, a, i):
t_i = lambda x: self.t_action_on_basis(x, i)
return self._apply_module_endomorphism(a, t_i)


def _multiply_basis(self, perm1, perm2):
"""
EXAMPLES::
Expand Down

0 comments on commit 7928e4c

Please sign in to comment.