the entries come from a commutative and associative ring. This
is problematic in several interesting matrix algebras, like those
where the entries are quaternions or octonions.
+
+ SETUP::
+
+ sage: from mjo.matrix_algebra import MatrixAlgebra
+
+ EXAMPLES::
+
+ The existence of a unit element is determined dynamically::
+
+ sage: MatrixAlgebra(ZZ,ZZ,2).one()
+ +---+---+
+ | 1 | 0 |
+ +---+---+
+ | 0 | 1 |
+ +---+---+
+
"""
Element = MatrixAlgebraElement
if "Unital" in entry_algebra.category().axioms():
category = category.Unital()
+ entry_one = entry_algebra.one()
+ self.one = lambda: sum( (self.monomial((i,i,entry_one))
+ for i in range(self.nrows()) ),
+ self.zero() )
+
if "Associative" in entry_algebra.category().axioms():
category = category.Associative()
class HurwitzMatrixAlgebra(MatrixAlgebra):
Element = HurwitzMatrixAlgebraElement
-
- def one(self):
- r"""
- SETUP::
-
- sage: from mjo.matrix_algebra import HurwitzMatrixAlgebra
-
- """
- return sum( (self.monomial((i,i,self.entry_algebra().one()))
- for i in range(self.nrows()) ),
- self.zero() )
-
-