zero = self.parent().octonions().zero()
return sum( (self[i,i] for i in range(self.nrows())), zero )
+ def matrix_space(self):
+ r"""
+
+ SETUP::
+
+ sage: from mjo.octonions import OctonionMatrixAlgebra
+
+ TESTS::
+
+ sage: set_random_seed()
+ sage: MS = OctonionMatrixAlgebra(2)
+ sage: MS.random_element().matrix_space()
+ Module of 2 by 2 matrices with octonion entries over the
+ scalar ring Algebraic Real Field
+
+ """
+ return self.parent()
+
class OctonionMatrixAlgebra(CombinatorialFreeModule):
r"""
prefix=prefix,
bracket='(')
+ def _repr_(self):
+ return ("Module of %d by %d matrices with octonion entries"
+ " over the scalar ring %s" %
+ (self.nrows(), self.ncols(), self.base_ring()) )
+
def octonions(self):
r"""
Return the Octonion algebra that our elements' entries come from.