]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: check that the basis is rational when it's supposed to be.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 2 Dec 2020 14:07:08 +0000 (09:07 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 2 Dec 2020 14:07:08 +0000 (09:07 -0500)
mjo/eja/eja_algebra.py

index ec3dd1141a9f497acca26f6d09c830420dfb5d5d..70be6ed43bb8d091d6f2b4565400f368bd75b741 100644 (file)
@@ -1165,6 +1165,12 @@ class RationalBasisEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebr
                  check_field=True,
                  check_axioms=True):
 
+        if check_field:
+            # Abuse the check_field parameter to check that the entries of
+            # out basis (in ambient coordinates) are in the field QQ.
+            if not all( all(b_i in QQ for b_i in b.list()) for b in basis ):
+                raise TypeError("basis not rational")
+
         n = len(basis)
         vector_basis = basis