From: Michael Orlitzky Date: Tue, 2 Mar 2021 16:45:56 +0000 (-0500) Subject: octonions: add list() method for octonion matrices. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=b552c6f2ff883240e01ad2444c5051fc8716e72c;p=sage.d.git octonions: add list() method for octonion matrices. --- diff --git a/mjo/octonions.py b/mjo/octonions.py index a5f6dec..c2b829f 100644 --- a/mjo/octonions.py +++ b/mjo/octonions.py @@ -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"""