This repository was archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
py3: fix doctests in symmetric group algebra
- Loading branch information
Frédéric Chapoton
committed
Nov 19, 2018
1 parent
f894105
commit 05a8057
Showing
1 changed file
with
16 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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 | ||
|
@@ -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``. | ||
|
@@ -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): | ||
|
@@ -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: | ||
|
@@ -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""" | ||
|
@@ -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""" | ||
|
@@ -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``. | ||
|
@@ -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``. | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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): | ||
""" | ||
|
@@ -2640,7 +2645,6 @@ def q(self): | |
""" | ||
return self._q | ||
|
||
|
||
def _coerce_start(self, x): | ||
""" | ||
EXAMPLES:: | ||
|
@@ -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): | ||
|
@@ -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`. | ||
|
@@ -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:: | ||
|