From 6e0da798fd89daa493d06ac0af45fbd989d4ac28 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 9 Jun 2020 07:41:47 -0400 Subject: [PATCH] eja: make a BilinearFormEJA test do what it says. --- mjo/eja/eja_algebra.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 689a3db..374af54 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -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)`` -- 2.44.2