]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/clan/normal_decomposition.py: use random_clan() in some tests
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 10 Apr 2026 00:53:49 +0000 (20:53 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 10 Apr 2026 00:53:49 +0000 (20:53 -0400)
mjo/clan/normal_decomposition.py

index 8ffcc62b0ff3ec24fb2f1c69312cd8b66b04b85c..3bfc97f0e95225c2314ff202df7532bbcf61cd8e 100644 (file)
@@ -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