def trace_inner_product(X,Y):
r"""
A trace inner-product for matrices that aren't embedded in the
- reals.
+ reals. It takes MATRICES as arguments, not EJA elements.
"""
- # We take the norm (absolute value) because Octonions() isn't
- # smart enough yet to coerce its one() into the base field.
- return (X*Y).trace().real().abs()
+ return (X*Y).trace().real()
class RealEmbeddedMatrixEJA(MatrixEJA):
@staticmethod
return tuple( basis )
+ @staticmethod
+ def trace_inner_product(X,Y):
+ r"""
+ The octonions don't know that the reals are embedded in them,
+ so we have to take the e0 component ourselves.
+
+ SETUP::
+
+ sage: from mjo.eja.eja_algebra import OctonionHermitianEJA
+
+ TESTS::
+
+ sage: J = OctonionHermitianEJA(2,field=QQ,orthonormalize=False)
+ sage: I = J.one().to_matrix()
+ sage: J.trace_inner_product(I, -I)
+ -2
+
+ """
+ return (X*Y).trace().real().coefficient(0)
class HadamardEJA(ConcreteEJA):
"""