Skip to content

Commit

Permalink
Fix failing doctest and docbuild issue; make the code pass the linter…
Browse files Browse the repository at this point in the history
… with less readability.
  • Loading branch information
tscrim committed May 2, 2023
1 parent f1d82ca commit f50a218
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sage/algebras/lie_algebras/affine_lie_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class TwistedAffineLieAlgebra(AffineLieAlgebra):
A twisted affine Lie algebra is an affine Lie algebra for
type `X_N^{(r)}` with `r > 1`. We realize this inside an
untwisted affine Kac--Moody Lie algebra following Chapter 8
of [Kac1990]_.
of [Ka1990]_.
Let `\overline{\mathfrak{g}}` be the classical Lie algebra by
taking the index set `I \setminus \{\epsilon\}`, where
Expand Down Expand Up @@ -769,15 +769,18 @@ def __init__(self, R, cartan_type, kac_moody):
if self._cartan_type.dual().type() == 'F':
# For E_6^(2), we need to take into account the lack of index sets matching
reindex = {2: 4, 4: 3, 3: 2, 1: 1}

def build_root(O):
return Q._from_dict({reindex[i]: c * (ord // a[reindex[i]]) / len(O) for i, c in sum(O) if i in reindex},
remove_zeros=False)
elif self._cartan_type.type() == 'BC':
reindex = {n-i: i for i in range(finite_ct.rank())}

def build_root(O):
return Q._from_dict({reindex[i]: c * (ord // len(O)) for i, c in sum(O) if i in reindex},
remove_zeros=False)
else:

def build_root(O):
return Q._from_dict({i: c * (ord // a[i]) / len(O) for i, c in sum(O) if i in I},
remove_zeros=False)
Expand Down Expand Up @@ -955,20 +958,24 @@ def to_ambient(self):

if self._cartan_type.type() == 'BC':
mone = -one

def basis_map(r):
O = self._root_mapping[r]
return self._basic._from_dict({O[0]: one, O[1]: mone**(1+O[1].height())},
remove_zeros=False)
else:

def basis_map(r):
return self._basic._from_dict({s: one for s in self._root_mapping[r]}, remove_zeros=False)

if self._cartan_type.dual().type() == 'G':
zeta3 = self._basic.base_ring().gen()

def basis_alt(r):
return self._basic._from_dict({s: zeta3**ind for ind, s in enumerate(self._root_mapping[r])},
remove_zeros=False)
elif self._cartan_type.type() == 'BC':

def basis_alt(r):
O = self._root_mapping[r]
if len(O) == 1:
Expand All @@ -977,6 +984,7 @@ def basis_alt(r):
remove_zeros=False)
else:
mone = -one

def basis_alt(r):
return self._basic._from_dict({s: mone**ind for ind, s in enumerate(self._root_mapping[r])},
remove_zeros=False)
Expand Down
2 changes: 2 additions & 0 deletions src/sage/algebras/lie_algebras/classical_lie_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2237,9 +2237,11 @@ class LieAlgebraChevalleyBasis_simply_laced(LieAlgebraChevalleyBasis):
sage: L = LieAlgebra(QQ, cartan_type=['A', 2], epsilon=[(2, 1)])
sage: L.e(1).bracket(L.e(2))
E[alpha[1] + alpha[2]]
sage: L = LieAlgebra(QQ, cartan_type=['A', 2], epsilon=[(1, 2)])
sage: L.e(1).bracket(L.e(2))
-E[alpha[1] + alpha[2]]
"""
def __init__(self, R, cartan_type, epsilon):
"""
Expand Down

0 comments on commit f50a218

Please sign in to comment.