]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_algebra.py
eja: begin adding OctonionHermitianEJA.
[sage.d.git] / mjo / eja / eja_algebra.py
index 5bf597565b2ae292032c3f0a532763d7889cd2a8..e16fd97c4f0e55591728dc8204da3d941529380c 100644 (file)
@@ -2585,6 +2585,67 @@ class QuaternionHermitianEJA(ConcreteEJA, QuaternionMatrixEJA):
         n = ZZ.random_element(cls._max_random_instance_size() + 1)
         return cls(n, **kwargs)
 
+class OctonionHermitianEJA(FiniteDimensionalEJA, MatrixEJA):
+
+    def __init__(self, n, field=AA, **kwargs):
+        if n > 3:
+            # Otherwise we don't get an EJA.
+            raise ValueError("n cannot exceed 3")
+
+        # We know this is a valid EJA, but will double-check
+        # if the user passes check_axioms=True.
+        if "check_axioms" not in kwargs: kwargs["check_axioms"] = False
+
+        super().__init__(self._denormalized_basis(n,field),
+                         self.jordan_product,
+                         self.trace_inner_product,
+                         **kwargs)
+
+        # TODO: this could be factored out somehow, but is left here
+        # because the MatrixEJA is not presently a subclass of the
+        # FDEJA class that defines rank() and one().
+        self.rank.set_cache(n)
+        idV = self.matrix_space().one()
+        self.one.set_cache(self(idV))
+
+
+    @classmethod
+    def _denormalized_basis(cls, n, field):
+        """
+        Returns a basis for the space of octonion Hermitian n-by-n
+        matrices.
+
+        SETUP::
+
+            sage: from mjo.eja.eja_algebra import OctonionHermitianEJA
+
+        EXAMPLES::
+
+            sage: B = OctonionHermitianEJA._denormalized_basis(3)
+            sage: all( M.is_hermitian() for M in B )
+            True
+            sage: len(B)
+            27
+
+        """
+        from mjo.octonions import OctonionMatrixAlgebra
+        MS = OctonionMatrixAlgebra(n, field=field)
+        es = MS.entry_algebra().gens()
+
+        basis = []
+        for i in range(n):
+            for j in range(i+1):
+                if i == j:
+                    E_ii = MS.monomial( (i,j,es[0]) )
+                    basis.append(E_ii)
+                else:
+                    for e in es:
+                        E_ij  = MS.monomial( (i,j,e)             )
+                        E_ij += MS.monomial( (j,i,e.conjugate()) )
+                        basis.append(E_ij)
+
+        return tuple( basis )
+
 
 class HadamardEJA(ConcreteEJA):
     """