this algebra was constructed with ``check_axioms=False`` and
passed an invalid Jordan or inner-product.
"""
+ R = self.base_ring()
- # Used to check whether or not something is zero in an inexact
- # ring. This number is sufficient to allow the construction of
- # QuaternionHermitianEJA(2, field=RDF) with check_axioms=True.
- epsilon = 1e-16
+ # Used to check whether or not something is zero.
+ epsilon = R.zero()
+ if not R.is_exact():
+ # This choice is sufficient to allow the construction of
+ # QuaternionHermitianEJA(2, field=RDF) with check_axioms=True.
+ epsilon = 1e-16
for i in range(self.dimension()):
for j in range(self.dimension()):
z = self.gens()[k]
diff = (x*y).inner_product(z) - x.inner_product(y*z)
- if self.base_ring().is_exact():
- if diff != 0:
- return False
- else:
- if diff.abs() > epsilon:
- return False
+ if diff.abs() > epsilon:
+ return False
return True