from sage.matrix.matrix_space import MatrixSpace
from sage.misc.table import table
-from mjo.matrix_algebra import MatrixAlgebra
+from mjo.matrix_algebra import HurwitzMatrixAlgebra
class Octonion(IndexedFreeModuleElement):
def conjugate(self):
"""
return self._norm_squared().sqrt()
+ # The absolute value notation is typically used for complex numbers...
+ # and norm() isn't supported in AA, so this lets us use abs() in all
+ # of the division algebras we need.
+ abs = norm
+
def inverse(self):
r"""
Return the inverse of this element if it exists.
-class OctonionMatrixAlgebra(MatrixAlgebra):
+class OctonionMatrixAlgebra(HurwitzMatrixAlgebra):
r"""
The algebra of ``n``-by-``n`` matrices with octonion entries over
(a subfield of) the real numbers.
sage: O = Octonions(QQ)
sage: e0,e1,e2,e3,e4,e5,e6,e7 = O.gens()
sage: MS = OctonionMatrixAlgebra(2)
- sage: MS.from_list([ [e0+e4, e1+e5],
- ....: [e2-e6, e3-e7] ])
+ sage: MS([ [e0+e4, e1+e5],
+ ....: [e2-e6, e3-e7] ])
+---------+---------+
| e0 + e4 | e1 + e5 |
+---------+---------+
| e2 - e6 | e3 - e7 |
+---------+---------+
+ ::
+
+ sage: A1 = OctonionMatrixAlgebra(1,QQ)
+ sage: A2 = OctonionMatrixAlgebra(1,QQ)
+ sage: cartesian_product([A1,A2])
+ Module of 1 by 1 matrices with entries in Octonion algebra with
+ base ring Rational Field over the scalar ring Rational Field (+)
+ Module of 1 by 1 matrices with entries in Octonion algebra with
+ base ring Rational Field over the scalar ring Rational Field
+
TESTS::
sage: set_random_seed()