From bf51162c586555866d19b90a7444bb02bd1c0727 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 29 Aug 2019 11:41:04 -0400 Subject: [PATCH] eja: insist that operator matrix base ring matches its domain's. --- mjo/eja/eja_operator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mjo/eja/eja_operator.py b/mjo/eja/eja_operator.py index 4b72e57..0e898b5 100644 --- a/mjo/eja/eja_operator.py +++ b/mjo/eja/eja_operator.py @@ -13,6 +13,8 @@ class FiniteDimensionalEuclideanJordanAlgebraOperator(Map): F = domain_eja.base_ring() if not (F == codomain_eja.base_ring()): raise ValueError("domain and codomain must have the same base ring") + if not (F == mat.base_ring()): + raise ValueError("domain and matrix must have the same base ring") # We need to supply something here to avoid getting the # default Homset of the parent FiniteDimensionalAlgebra class, @@ -88,10 +90,11 @@ class FiniteDimensionalEuclideanJordanAlgebraOperator(Map): different EJAs, that should blow up:: sage: J1 = RealSymmetricEJA(2) + sage: id1 = identity_matrix(J1.base_ring(), 3) sage: J2 = JordanSpinEJA(3) - sage: id = identity_matrix(QQ, 3) - sage: f = FiniteDimensionalEuclideanJordanAlgebraOperator(J1,J1,id) - sage: g = FiniteDimensionalEuclideanJordanAlgebraOperator(J2,J2,id) + sage: id2 = identity_matrix(J2.base_ring(), 3) + sage: f = FiniteDimensionalEuclideanJordanAlgebraOperator(J1,J1,id1) + sage: g = FiniteDimensionalEuclideanJordanAlgebraOperator(J2,J2,id2) sage: f + g Traceback (most recent call last): ... -- 2.43.2