]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/clan/normal_decomposition_element.py: fix test indexing
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 10 Apr 2026 16:27:50 +0000 (12:27 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 10 Apr 2026 16:27:50 +0000 (12:27 -0400)
The test for the Ishi inner product had the indices all messed up.
Not only were i and r switched, but r should be zero under the Ishi
convention.

mjo/clan/normal_decomposition_element.py

index b66543e1ea3f0b83e43c0c10a0c6a8f3c553b1e8..2c4140faca3eca557f569cffa97a3f903f60b150 100644 (file)
@@ -10,6 +10,13 @@ class NormalDecompositionElement(ClanElement):
     lexicographically and then within each component the basis
     elements (i,j,k) ordered arbitrarily.
 
+    ..NOTE::
+
+        In the Vinberg (upper triangular) convention, we start at the
+        left and build the clan down and to the right. In the Ishi
+        (lower triangular) convention, we start on the right and build
+        up and to the left.
+
     SETUP::
 
         sage: from mjo.clan.random import random_clan
@@ -18,19 +25,25 @@ class NormalDecompositionElement(ClanElement):
 
     In my "Automorphisms of hyperbolic polynomials" paper, I claim
     that the following inner product is zero if and only if the clan
-    product itself is zero::
+    product itself is zero. First test on the basis, and then a bunch
+    of random elements for good measure::
 
         sage: C = random_clan(nontrivial=True)
         sage: while C.rank() < 2:
         ....:     # need rank >= 2 for the off-diagonal to exist
         ....:     C = random_clan(nontrivial=True)
-        sage: r = C.rank() - 1
-        sage: j = ZZ.random_element(r)
-        sage: xs = ( C.random_element().elt(r,j) for _ in range(10) )
-        sage: ys = ( C.random_element().elt(r,j) for _ in range(10) )
+        sage: r = 0  # Ishi convention
+        sage: all( x.inner_product(y).is_zero() == (x*y).is_zero()
+        ....:      for i in range(1, C.rank())
+        ....:      for x in C.basis()
+        ....:      for y in C.basis()
+        ....:      if x.elt(i, r) == x and y.elt(i, r) == y )
+        True
         sage: all( x.inner_product(y).is_zero() == (x*y).is_zero()
-        ....:      for x in xs
-        ....:      for y in ys )
+        ....:      for i in range(1, C.rank())
+        ....:      for _ in range(1000)
+        ....:      if (x := C.random_element().elt(i, r))
+        ....:      if (y := C.random_element().elt(i, r)) )
         True
 
     """