From: Michael Orlitzky Date: Thu, 4 Mar 2021 15:20:46 +0000 (-0500) Subject: eja: unbreak the trace_inner_product() for MatrixEJAs. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=77f0119f043a9ceac891dc82229e550574a2a03f;p=sage.d.git eja: unbreak the trace_inner_product() for MatrixEJAs. --- diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index afe0a67..abf2aa3 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -1733,11 +1733,9 @@ class MatrixEJA: 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 @@ -2735,6 +2733,25 @@ class OctonionHermitianEJA(FiniteDimensionalEJA, MatrixEJA): 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): """