]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/clan: eliminate UnitalClan
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 22 Feb 2026 17:44:48 +0000 (12:44 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 22 Feb 2026 17:44:48 +0000 (12:44 -0500)
We can add Unital() in NormalDecomposition anyway, because following
Vinberg we assume that they have one. But even if they didn't, the
unit element would be a property of each individual clan.

mjo/clan/clan.py
mjo/clan/clan_element.py
mjo/clan/normal_decomposition.py
mjo/clan/t_algebra_clan.py
mjo/clan/vinberg_clan.py

index d543135375679f5cff0b8f1779742eb241538a58..56ada41ffbf30ec6fc1f6a33abdafc0ebfbace15 100644 (file)
@@ -7,7 +7,6 @@ correspond to the homogeneous convex cones.
 
 from sage.categories.category_types import Category_over_base_ring
 from sage.combinat.free_module import CombinatorialFreeModule
-from sage.rings.rational_field import QQ
 
 class Clans(Category_over_base_ring):
     r"""
@@ -45,6 +44,7 @@ class Clan(CombinatorialFreeModule):
     correspond to unital clans).
     """
     from mjo.clan.clan_element import ClanElement as Element
+    from sage.rings.rational_field import QQ
 
     def __init__(self,
                  vector_space,
@@ -121,33 +121,3 @@ class Clan(CombinatorialFreeModule):
 
         """
         return self._mt[i][j]
-
-
-class UnitalClan(Clan):
-    r"""
-    A clan with a unit element.
-
-    These correspond to homogeneous convex cones, and vice-versa.
-    Not much here except a constructor that ensures we are using
-    a ``Unital()`` category.
-    """
-    def __init__(self,
-                 vector_space,
-                 clan_product,
-                 inner_product,
-                 scalar_field=QQ,
-                 category=None,
-                 prefix=None,
-                 bracket=False):
-
-        category = Clans(scalar_field).or_subcategory(category).Unital()
-
-        # Use the vector_space basis keys so we can convert
-        # easily between them.
-        super().__init__(vector_space,
-                         clan_product,
-                         inner_product,
-                         scalar_field=scalar_field,
-                         category=category,
-                         prefix=prefix,
-                         bracket=bracket)
index b64211d65eebc698b1e0efbdb3d08e88de31fffc..8c402ea09a508805a2f7d26e1504f5bb7cb0bce8 100644 (file)
@@ -2,7 +2,7 @@ from sage.modules.with_basis.indexed_element import IndexedFreeModuleElement
 
 class ClanElement(IndexedFreeModuleElement):
     """
-    An element of a :class:`UnitalClan`.
+    An element of a :class:`Clan`.
     """
 
     def lift(self):
index 0bb945d25ed346bbc1acd845446fdf0086e8d26b..89ca02536f7b2c812f877f630957a827de274977 100644 (file)
@@ -1,24 +1,35 @@
-from mjo.clan.clan import UnitalClan
+from mjo.clan.clan import Clan, Clans
 
-class NormalDecomposition(UnitalClan):
+class NormalDecomposition(Clan):
     r"""
-    A unital clan for which a normal decomposition is available.
-    This is needed to compute the rank of the cone, and the clan trace
-    as defined by Ishi.
+    A clan for which a normal decomposition is available. This is
+    needed to compute the rank of the cone, and the clan trace as
+    defined by Ishi.
+
+    Vinberg says that we can do this for non-unital clans, but then
+    the entire section is devoted to clans with a unit. Rather than
+    try to figure out what parts of that are essential, we assume a
+    unit element too.
     """
     from mjo.clan.normal_decomposition_element import (
         NormalDecompositionElement as Element
     )
 
-    from sage.rings.rational_field import QQ
     def __init__(self,
                  vector_space,
                  clan_product,
                  inner_product,
-                 scalar_field=QQ,
+                 scalar_field=None,
                  category=None,
                  prefix=None,
                  bracket=False):
+
+        if scalar_field is None:
+            from sage.rings.rational_field import QQ
+            scalar_field = QQ
+
+        category = Clans(scalar_field).or_subcategory(category).Unital()
+
         # The normal decomposition assumes that we already have a
         # lower-triangular (Ishi) basis of the form (i,j,k).
         self._rank = 1 + max( k[0]
index 7a8ccd351dddd170482d1d9a3369409d58a32ddb..24c9d25a4900eb1d489ae598b55c0e1889781389 100644 (file)
@@ -1,5 +1,3 @@
-from sage.rings.rational_field import QQ
-
 from mjo.clan.normal_decomposition import NormalDecomposition
 
 
@@ -236,6 +234,7 @@ class RealSymmetricClan(TAlgebraClan):
         [0 0 0]
 
     """
+    from sage.rings.rational_field import QQ
     def __init__(self, n, scalar_field=QQ, **kwargs):
         from sage.matrix.matrix_space import MatrixSpace
         Mn = MatrixSpace(scalar_field, n)
@@ -345,6 +344,7 @@ class ComplexHermitianClan(TAlgebraClan):
         └─────────┴──────────┴───┘
 
     """
+    from sage.rings.rational_field import QQ
     def __init__(self, n, scalar_field=QQ, **kwargs):
         from mjo.hurwitz import ComplexMatrixAlgebra
         from sage.rings.qqbar import QQbar
index 52d0d99dc638accb2b351ee91b595a3c88758966..958cd96082d6321732e3a01c632e6d45b5a4934d 100644 (file)
@@ -144,6 +144,8 @@ class VinbergClan(NormalDecomposition):
                self._S2((1,1,1))*v[(2,2,1)] )
         return (M1,M2)
 
+
+    from sage.rings.rational_field import QQ
     def __init__(self, scalar_field=QQ, **kwargs):
         from sage.matrix.matrix_space import MatrixSpace
         from sage.modules.free_module import VectorSpace