]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/matrix_algebra.py: use Sage's octonions in all tests
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 9 Apr 2026 00:27:25 +0000 (20:27 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 9 Apr 2026 00:30:35 +0000 (20:30 -0400)
mjo/matrix_algebra.py

index 5df5c21119a188f1ea89130136ceaf79cf780630..e2b51681ab14ad94583619bee97a9a969f61c19d 100644 (file)
@@ -298,7 +298,6 @@ class MatrixAlgebra(CombinatorialFreeModule):
 
         SETUP::
 
-            sage: from mjo.hurwitz import Octonions
             sage: from mjo.matrix_algebra import MatrixAlgebra
 
         EXAMPLES:
@@ -311,27 +310,6 @@ class MatrixAlgebra(CombinatorialFreeModule):
 
         Octonions::
 
-            sage: A = MatrixAlgebra(1, Octonions(), QQ)
-            sage: e = A.entry_algebra_gens()
-            sage: A._entry_algebra_element_to_vector(e[0])
-            (1, 0, 0, 0, 0, 0, 0, 0)
-            sage: A._entry_algebra_element_to_vector(e[1])
-            (0, 1, 0, 0, 0, 0, 0, 0)
-            sage: A._entry_algebra_element_to_vector(e[2])
-            (0, 0, 1, 0, 0, 0, 0, 0)
-            sage: A._entry_algebra_element_to_vector(e[3])
-            (0, 0, 0, 1, 0, 0, 0, 0)
-            sage: A._entry_algebra_element_to_vector(e[4])
-            (0, 0, 0, 0, 1, 0, 0, 0)
-            sage: A._entry_algebra_element_to_vector(e[5])
-            (0, 0, 0, 0, 0, 1, 0, 0)
-            sage: A._entry_algebra_element_to_vector(e[6])
-            (0, 0, 0, 0, 0, 0, 1, 0)
-            sage: A._entry_algebra_element_to_vector(e[7])
-            (0, 0, 0, 0, 0, 0, 0, 1)
-
-        Sage OctonionAlgebra::
-
             sage: O = OctonionAlgebra(QQ)
             sage: A = MatrixAlgebra(1, O, QQ)
             sage: e = A.entry_algebra_gens()
@@ -391,22 +369,21 @@ class MatrixAlgebra(CombinatorialFreeModule):
 
         SETUP::
 
-            sage: from mjo.hurwitz import Octonions
             sage: from mjo.matrix_algebra import MatrixAlgebra
 
         TESTS::
 
-            sage: O = Octonions(QQ)
-            sage: e = O.gens()
-            sage: e[2]*e[1]
-            -e3
-            sage: A = MatrixAlgebra(2,O,QQ)
-            sage: A.product_on_basis( (0,0,e[2]), (0,0,e[1]) )
-            â\94\8câ\94\80â\94\80â\94\80â\94\80â\94\80â\94¬â\94\80â\94\80â\94\80â\94\90
-            │ -e3 │ 0 │
-            â\94\9câ\94\80â\94\80â\94\80â\94\80â\94\80â\94¼â\94\80â\94\80â\94\80â\94¤
-            │ 0   │ 0 │
-            â\94\94â\94\80â\94\80â\94\80â\94\80â\94\80â\94´â\94\80â\94\80â\94\80â\94\98
+            sage: O = OctonionAlgebra(QQ)
+            sage: i,j,k,l = O.gens()
+            sage: k*j
+            i
+            sage: A = MatrixAlgebra(2, O, QQ)
+            sage: A.product_on_basis( (0,0,k), (0,0,j) )
+            ┌───┬───┐
+            │ i │ 0 │
+            ├───┼───┤
+            │ 0 │ 0 │
+            └───┴───┘
 
         """
         (i,j,e1) = mon1
@@ -485,10 +462,8 @@ class MatrixAlgebra(CombinatorialFreeModule):
                 # to/from_vector() methods are available.
                 return self.entry_algebra()(e_ij)
             except TypeError:
-                # We have to pass through vectors to convert from the
-                # given entry algebra to ours. Otherwise we can fail to
-                # convert an element of (for example) Octonions(QQ) to
-                # Octonions(AA).
+                # Pass through vectors as a generic way to convert
+                # from the given entry algebra to ours.
                 return self.entry_algebra().from_vector(e_ij.to_vector())
 
         def entry_to_element(i,j,entry):