Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
FusionRing becomes a class
Browse files Browse the repository at this point in the history
  • Loading branch information
dwbump committed Oct 19, 2018
1 parent cda3cce commit 0555717
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions src/sage/combinat/root_system/weyl_characters.py
Expand Up @@ -757,24 +757,6 @@ def level(self, wt):
"""
return ZZ(2*wt.inner_product(self._highest)/self._hip)

def fusion_basis(self):
"""
For FusionRings, this method returns the finite canonical basis
as a list.
EXAMPLES::
sage: B22=FusionRing("B2",2)
sage: B22.fusion_basis()
[B22(0,0), B22(0,1), B22(1,0), B22(2,0), B22(1,1), B22(0,2)]
"""
if self._k is None:
raise ValueError("fusion_basis method is only available for FusionRings")
fw = self._space.fundamental_weights()
def next_level(wt):
return [wt + la for la in fw if self.level(wt + la) <= self._k]
B = RecursivelyEnumeratedSet([self._space.zero()], next_level)
return [self._element_constructor_(x) for x in B]

def _dual_helper(self, wt):
"""
If `w_0` is the long Weyl group element and `wt` is an
Expand Down Expand Up @@ -2134,7 +2116,7 @@ def demazure_lusztig(self, i, v):
except Exception:
raise ValueError("unknown index {}".format(i))

def FusionRing(ct, k, base_ring=ZZ, prefix=None, style="coroots"):
class FusionRing(WeylCharacterRing):
r"""
INPUT:
Expand Down Expand Up @@ -2163,4 +2145,30 @@ def FusionRing(ct, k, base_ring=ZZ, prefix=None, style="coroots"):
A22(0,1) + A22(2,0),
A22(1,0) + A22(0,2)]
"""
return WeylCharacterRing(ct, base_ring=base_ring, prefix=prefix, style=style, k=k)
@staticmethod
def __classcall__(cls, ct, k, base_ring=ZZ, prefix=None, style="coroots"):
return super(FusionRing, cls).__classcall__(cls, ct, base_ring=base_ring, prefix=prefix, style=style, k=k)

def fusion_basis(self):
"""
For FusionRings, this method returns the finite canonical basis
as a list.
EXAMPLES::
sage: B22=FusionRing("B2",2)
sage: B22.fusion_basis()
[B22(0,0), B22(0,1), B22(1,0), B22(2,0), B22(1,1), B22(0,2)]
"""
if self._k is None:
raise ValueError("fusion_basis method is only available for FusionRings")
fw = self._space.fundamental_weights()
def next_level(wt):
return [wt + la for la in fw if self.level(wt + la) <= self._k]
B = RecursivelyEnumeratedSet([self._space.zero()], next_level)
return [self._element_constructor_(x) for x in B]

class Element(WeylCharacterRing.Element):
def fusion_weight(self):
if len(self.monomial_coefficients()) != 1:
raise ValueError("fusion weight is valid for basis elements only")
return self.leading_support()

0 comments on commit 0555717

Please sign in to comment.