]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_algebra.py
eja: fix the matrix EJA trace inner-product.
[sage.d.git] / mjo / eja / eja_algebra.py
index d7010bcfd63ff838c0219dc7208a9b8e1988c889..1cf6fa51dd2626df1e75dcaeab95fc743000130f 100644 (file)
@@ -1737,7 +1737,7 @@ class MatrixEJA:
         """
         # 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().abs()
+        return (X*Y).trace().real().abs()
 
 class RealEmbeddedMatrixEJA(MatrixEJA):
     @staticmethod
@@ -2641,7 +2641,13 @@ class OctonionHermitianEJA(FiniteDimensionalEJA, MatrixEJA):
                 else:
                     for e in es:
                         E_ij  = MS.monomial( (i,j,e)             )
-                        E_ij += MS.monomial( (j,i,e.conjugate()) )
+                        ec = e.conjugate()
+                        # If the conjugate has a negative sign in front
+                        # of it, (j,i,ec) won't be a monomial!
+                        if (j,i,ec) in MS.indices():
+                            E_ij += MS.monomial( (j,i,ec) )
+                        else:
+                            E_ij -= MS.monomial( (j,i,-ec) )
                         basis.append(E_ij)
 
         return tuple( basis )