From 1ae592d8c831a70b17b9b02d10b5e75ddc7a9fc8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 22 Feb 2026 12:44:48 -0500 Subject: [PATCH] mjo/clan: eliminate UnitalClan 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 | 32 +------------------------------- mjo/clan/clan_element.py | 2 +- mjo/clan/normal_decomposition.py | 25 ++++++++++++++++++------- mjo/clan/t_algebra_clan.py | 4 ++-- mjo/clan/vinberg_clan.py | 2 ++ 5 files changed, 24 insertions(+), 41 deletions(-) diff --git a/mjo/clan/clan.py b/mjo/clan/clan.py index d543135..56ada41 100644 --- a/mjo/clan/clan.py +++ b/mjo/clan/clan.py @@ -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) diff --git a/mjo/clan/clan_element.py b/mjo/clan/clan_element.py index b64211d..8c402ea 100644 --- a/mjo/clan/clan_element.py +++ b/mjo/clan/clan_element.py @@ -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): diff --git a/mjo/clan/normal_decomposition.py b/mjo/clan/normal_decomposition.py index 0bb945d..89ca025 100644 --- a/mjo/clan/normal_decomposition.py +++ b/mjo/clan/normal_decomposition.py @@ -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] diff --git a/mjo/clan/t_algebra_clan.py b/mjo/clan/t_algebra_clan.py index 7a8ccd3..24c9d25 100644 --- a/mjo/clan/t_algebra_clan.py +++ b/mjo/clan/t_algebra_clan.py @@ -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 diff --git a/mjo/clan/vinberg_clan.py b/mjo/clan/vinberg_clan.py index 52d0d99..958cd96 100644 --- a/mjo/clan/vinberg_clan.py +++ b/mjo/clan/vinberg_clan.py @@ -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 -- 2.51.0