]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/hurwitz.py: fix entry_algebra_gens() in HurwitzMatrixAlgebra
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 8 Apr 2026 13:59:37 +0000 (09:59 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 8 Apr 2026 13:59:37 +0000 (09:59 -0400)
Just like we did for MatrixAlgebra, add a special case for the
octonions in entry_algebra_gens(). The OctonionAlgebra uses gens()
for the multiplicative generators, so we only get five of them.

mjo/hurwitz.py

index a252cf6cfe86406ce7dd65adba9dbfdaddfa8be9..144b7e14bfa4c0b7ebfa602e0b9f17059636fbf1 100644 (file)
@@ -581,13 +581,19 @@ class HurwitzMatrixAlgebra(MatrixAlgebra):
             sage: Q = QuaternionAlgebra(AA,-1,-1)
             sage: HurwitzMatrixAlgebra(2, Q, AA).entry_algebra_gens()
             (1, i, j, k)
-            sage: O = Octonions()
+            sage: O = OctonionAlgebra(QQ)
             sage: HurwitzMatrixAlgebra(2, O, AA).entry_algebra_gens()
-            (e0, e1, e2, e3, e4, e5, e6, e7)
+            Family (1, i, j, k, l, li, lj, lk)
 
         """
-        gs = self.entry_algebra().gens()
-        one = self.entry_algebra().one()
+        A = self.entry_algebra()
+        if hasattr(A, "basis"):
+            # The gens() of the OctonionAlgebra are multiplicative
+            # generators, NOT a basis. (We expect a basis.)
+            return A.basis()
+
+        gs = A.gens()
+        one = A.one()
         if one in gs:
             return gs
         else: