From e6a97298e3bd565b460c024d6edf53421ef9f201 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 7 Nov 2020 13:00:23 -0500 Subject: [PATCH] eja: fix two more tests to work in dimension zero. --- mjo/eja/eja_element.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index de12bb1..9436468 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -796,8 +796,9 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): sage: set_random_seed() sage: J = JordanSpinEJA.random_instance() + sage: n = J.dimension() sage: x = J.random_element() - sage: x == x.coefficient(0)*J.one() or x.degree() == 2 + sage: x.degree() == min(n,2) or (x == x.coefficient(0)*J.one()) True TESTS: @@ -1085,16 +1086,18 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): sage: set_random_seed() sage: x = JordanSpinEJA.random_instance().random_element() sage: x_vec = x.to_vector() + sage: Q = matrix.identity(x.base_ring(), 0) sage: n = x_vec.degree() - sage: x0 = x_vec[0] - sage: x_bar = x_vec[1:] - sage: A = matrix(AA, 1, [x_vec.inner_product(x_vec)]) - sage: B = 2*x0*x_bar.row() - sage: C = 2*x0*x_bar.column() - sage: D = matrix.identity(AA, n-1) - sage: D = (x0^2 - x_bar.inner_product(x_bar))*D - sage: D = D + 2*x_bar.tensor_product(x_bar) - sage: Q = matrix.block(2,2,[A,B,C,D]) + sage: if n > 0: + ....: x0 = x_vec[0] + ....: x_bar = x_vec[1:] + ....: A = matrix(x.base_ring(), 1, [x_vec.inner_product(x_vec)]) + ....: B = 2*x0*x_bar.row() + ....: C = 2*x0*x_bar.column() + ....: D = matrix.identity(x.base_ring(), n-1) + ....: D = (x0^2 - x_bar.inner_product(x_bar))*D + ....: D = D + 2*x_bar.tensor_product(x_bar) + ....: Q = matrix.block(2,2,[A,B,C,D]) sage: Q == x.quadratic_representation().matrix() True -- 2.44.2