From b552c6f2ff883240e01ad2444c5051fc8716e72c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 2 Mar 2021 11:45:56 -0500 Subject: [PATCH] octonions: add list() method for octonion matrices. --- mjo/octonions.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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""" -- 2.43.2