]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
octonions: add list() method for octonion matrices.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 2 Mar 2021 16:45:56 +0000 (11:45 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 2 Mar 2021 16:45:56 +0000 (11:45 -0500)
mjo/octonions.py

index a5f6dec0239f5f3e084fb4c1c12e791c0002cf9b..c2b829f98b9b49dbe078172a3669f0cb8b6406e4 100644 (file)
@@ -404,6 +404,28 @@ class OctonionMatrix(IndexedFreeModuleElement):
         return table(self.to_nested_list(), frame=True)._repr_()
 
 
+    def list(self):
+        r"""
+        Return one long list of this matrix's entries.
+
+        SETUP::
+
+            sage: from mjo.octonions import OctonionMatrixAlgebra
+
+        EXAMPLES::
+
+            sage: MS = OctonionMatrixAlgebra(3)
+            sage: E00e0 = MS.gens()[0]
+            sage: E00e3 = MS.gens()[3]
+            sage: (E00e0 + 2*E00e3).to_nested_list()
+            [[e0 + 2*e3, 0, 0], [0, 0, 0], [0, 0, 0]]
+            sage: (E00e0 + 2*E00e3).list()
+            [e0 + 2*e3, 0, 0, 0, 0, 0, 0, 0, 0]
+
+        """
+        return sum( self.to_nested_list(), [] )
+
+
     def __getitem__(self, indices):
         r"""