From 544193876b06551625eefc35583b03992dc19a1a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 9 Apr 2026 20:53:49 -0400 Subject: [PATCH] mjo/clan/normal_decomposition.py: use random_clan() in some tests --- mjo/clan/normal_decomposition.py | 35 ++++++++++++-------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/mjo/clan/normal_decomposition.py b/mjo/clan/normal_decomposition.py index 8ffcc62..3bfc97f 100644 --- a/mjo/clan/normal_decomposition.py +++ b/mjo/clan/normal_decomposition.py @@ -13,6 +13,7 @@ class NormalDecomposition(Clan): SETUP:: + sage: from mjo.clan.random import random_clan sage: from mjo.clan.vinberg_clan import VinbergClan sage: from mjo.clan.jordan_spin_clan import JordanSpinClan sage: from mjo.clan.t_algebra_clan import (ComplexHermitianClan, @@ -28,19 +29,13 @@ class NormalDecomposition(Clan): hyperbolic polynomials" paper, although in Vinberg's notation we would "delete" the ``r``th idempotent leaving a superdiagonal:: - sage: clans = [VinbergClan(), - ....: RealSymmetricClan(4), - ....: ComplexHermitianClan(3), - ....: JordanSpinClan(5)] + sage: C = random_clan() sage: all( - ....: all( - ....: (bi*bj).coefficient((0,0,1)).is_zero() - ....: for bi in C.basis() - ....: for bj in C.basis() - ....: if not bi == C.idempotent(0) - ....: and not bj == C.idempotent(0) - ....: ) - ....: for C in clans + ....: (bi*bj).coefficient((0,0,1)).is_zero() + ....: for bi in C.basis() + ....: for bj in C.basis() + ....: if not bi == C.idempotent(0) + ....: and not bj == C.idempotent(0) ....: ) True @@ -48,22 +43,18 @@ class NormalDecomposition(Clan): this subalgebra. Rather than create a true, non-unital subclan, we can just set the coordinates of the first idempotent to zero. - sage: clans = [VinbergClan(), - ....: RealSymmetricClan(4), - ....: ComplexHermitianClan(3), - ....: JordanSpinClan(5)] - sage: def subunit(C): - ....: # Unit of the subclan - ....: return sum(C.idempotent(i) for i in range(1, C.rank())) sage: def subelt(C): ....: # random subclan element + ....: if C.rank() == 0: + ....: return C.zero() ....: x = C.random_element() ....: return x - x.coefficient((0,0,1))*C.idempotent(0) + sage: C = random_clan() + sage: subclan_unit = C.sum(C.idempotent(i) + ....: for i in range(1, C.rank())) sage: all( - ....: x.leftreg().trace() == u.inner_product_vinberg(x) - ....: for C in clans + ....: x.leftreg().trace() == subclan_unit.inner_product_vinberg(x) ....: for x in [subelt(C) for _ in range(10)] - ....: if (u := subunit(C)) ....: ) True -- 2.53.0