From: Michael Orlitzky Date: Fri, 10 Apr 2026 16:27:50 +0000 (-0400) Subject: mjo/clan/normal_decomposition_element.py: fix test indexing X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=e9234969c8267becc395e35c6bf01abf79b695ca;p=sage.d.git mjo/clan/normal_decomposition_element.py: fix test indexing 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. --- diff --git a/mjo/clan/normal_decomposition_element.py b/mjo/clan/normal_decomposition_element.py index b66543e..2c4140f 100644 --- a/mjo/clan/normal_decomposition_element.py +++ b/mjo/clan/normal_decomposition_element.py @@ -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 """