]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: insist that operator matrix base ring matches its domain's.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 29 Aug 2019 15:41:04 +0000 (11:41 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 29 Aug 2019 15:41:04 +0000 (11:41 -0400)
mjo/eja/eja_operator.py

index 4b72e5783210b51cd6d8d658f0f5d4e8c40a7f57..0e898b59fb9d8a99090da6f4baec3e49df51d9cd 100644 (file)
@@ -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):
             ...