X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Foctonions.py;fp=mjo%2Foctonions.py;h=c2b829f98b9b49dbe078172a3669f0cb8b6406e4;hb=b552c6f2ff883240e01ad2444c5051fc8716e72c;hp=a5f6dec0239f5f3e084fb4c1c12e791c0002cf9b;hpb=079e0d896e1a12e3e7f08b6b09dfe2697d2feb0c;p=sage.d.git 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"""