Skip to content

Commit

Permalink
sagemathgh-39609: some minor details in fusion_double
Browse files Browse the repository at this point in the history
    
in particular removing unused imports

some pep8 cleanup

and adding some typing annotations

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#39609
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
  • Loading branch information
Release Manager committed Mar 2, 2025
2 parents 095a601 + 18d10b1 commit bbc6cd8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/sage/algebras/fusion_rings/fusion_double.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
from sage.misc.cachefunc import cached_method
from sage.sets.set import Set
from sage.rings.number_field.number_field import CyclotomicField
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.ideal import Ideal
from sage.matrix.constructor import matrix


Expand Down Expand Up @@ -152,7 +150,7 @@ def __classcall_private__(cls, G, prefix='s', inject_variables=False):
F.inject_variables()
return F

def __init__(self, G, prefix='s'):
def __init__(self, G, prefix='s') -> None:
"""
EXAMPLES::
Expand Down Expand Up @@ -194,7 +192,7 @@ def __init__(self, G, prefix='s'):
CombinatorialFreeModule.__init__(self, ZZ, list(self._names),
prefix=prefix, bracket=False, category=cat)

def _repr_(self):
def _repr_(self) -> str:
"""
EXAMPLES::
Expand Down Expand Up @@ -575,6 +573,7 @@ def global_q_dimension(self, base_coercion=True):
r"""
Return the global quantum dimension, which is the sum of the squares of the
quantum dimensions of the simple objects.
For the Drinfeld double, it is the square of the order of the underlying quantum group.
EXAMPLES::
Expand Down Expand Up @@ -614,7 +613,7 @@ def total_q_order(self, base_coercion=True):

D_minus = D_plus = total_q_order

def is_multiplicity_free(self, verbose=False):
def is_multiplicity_free(self, verbose=False) -> bool:
"""
Return ``True`` if all fusion coefficients are at most 1.
Expand Down Expand Up @@ -642,7 +641,7 @@ def is_multiplicity_free(self, verbose=False):
return False
return True

return all(self.N_ijk(i,j,k) <= 1 for i in self.basis()
return all(self.N_ijk(i, j, k) <= 1 for i in self.basis()
for j in self.basis() for k in self.basis())

@cached_method
Expand Down Expand Up @@ -705,7 +704,8 @@ def product_on_basis(self, a, b):
q1 + q2 + q5 + q6 + q7
"""
d = {k.support_of_term(): val for k in self.basis()
if (val := self.N_ijk(self.monomial(a),self.monomial(b),self.dual(k)))}
if (val := self.N_ijk(self.monomial(a), self.monomial(b),
self.dual(k)))}
return self._from_dict(d, remove_zeros=False)

def group(self):
Expand Down Expand Up @@ -737,7 +737,7 @@ def get_fmatrix(self, *args, **kwargs):
return self.fmats

class Element(CombinatorialFreeModule.Element):
def is_simple_object(self):
def is_simple_object(self) -> bool:
r"""
Determine whether ``self`` is a simple object (basis element) of the fusion ring.
Expand All @@ -755,7 +755,7 @@ def g(self):
class representative `g` and an irreducible character `\chi` of
the centralizer of `g`.
Returns the conjugacy class representative of the underlying
This returns the conjugacy class representative of the underlying
group corresponding to a simple object. See also :meth:`char`.
EXAMPLES::
Expand Down Expand Up @@ -794,7 +794,7 @@ class representative `g` and an irreducible character `\chi` of

def ribbon(self, base_coercion=True):
"""
The twist or ribbon of the simple object.
Return the twist or ribbon of the simple object.
EXAMPLES::
Expand Down Expand Up @@ -840,7 +840,7 @@ def twist(self, reduced=True):
zeta = P.field().gen()
rib = self.ribbon()
norm = 2 * P._cyclotomic_order
for k in range(4*P._cyclotomic_order):
for k in range(4 * P._cyclotomic_order):
if zeta ** k == rib:
return k / norm

Expand Down Expand Up @@ -895,4 +895,4 @@ def q_dimension(self, base_coercion=True):
"""
if not self.is_simple_object():
raise ValueError("quantum dimension is only available for simple objects")
return self.parent().s_ij(self,self.parent().one())
return self.parent().s_ij(self, self.parent().one())

0 comments on commit bbc6cd8

Please sign in to comment.