]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: make a BilinearFormEJA test do what it says.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 9 Jun 2020 11:41:47 +0000 (07:41 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 9 Jun 2020 11:41:47 +0000 (07:41 -0400)
mjo/eja/eja_algebra.py

index 689a3db016437d1e6eda5c6372e52a3513896671..374af5498160180ff449d84c0d59d9f2f1db5f42 100644 (file)
@@ -1994,23 +1994,20 @@ class BilinearFormEJA(FiniteDimensionalEuclideanJordanAlgebra, KnownRankEJA):
 
         TESTS:
 
-        Ensure that this is one-half of the trace inner-product::
+        Ensure that this is one-half of the trace inner-product when
+        the algebra isn't just the reals (when ``n`` isn't one). This
+        is in Faraut and Koranyi, and also my "On the symmetry..."
+        paper::
 
             sage: set_random_seed()
-            sage: n = ZZ.random_element(5)
-            sage: M = matrix.random(QQ, n-1, algorithm='unimodular')
+            sage: n = ZZ.random_element(2,5)
+            sage: M = matrix.random(QQ, max(0,n-1), algorithm='unimodular')
             sage: B = M.transpose()*M
             sage: J = BilinearFormEJA(n, B=B)
-            sage: eis = VectorSpace(M.base_ring(), M.ncols()).basis()
-            sage: V = J.vector_space()
-            sage: sis = [ J.from_vector(V([0] + (M.inverse()*ei).list()))
-            ....:         for ei in eis ]
-            sage: actual = [ sis[i]*sis[j]
-            ....:            for i in range(n-1)
-            ....:            for j in range(n-1) ]
-            sage: expected = [ J.one() if i == j else J.zero()
-            ....:              for i in range(n-1)
-            ....:              for j in range(n-1) ]
+            sage: x = J.random_element()
+            sage: y = J.random_element()
+            sage: x.inner_product(y) == (x*y).trace()/2
+            True
 
         """
         xvec = x.to_vector()
@@ -2019,6 +2016,7 @@ class BilinearFormEJA(FiniteDimensionalEuclideanJordanAlgebra, KnownRankEJA):
         ybar = yvec[1:]
         return x[0]*y[0] + (self._B*xbar).inner_product(ybar)
 
+
 class JordanSpinEJA(FiniteDimensionalEuclideanJordanAlgebra, KnownRankEJA):
     """
     The rank-2 simple EJA consisting of real vectors ``x=(x0, x_bar)``