From: Michael Orlitzky Date: Thu, 9 Apr 2026 00:09:32 +0000 (-0400) Subject: mjo/misc.py: special case for Sage's octonions in _all2list() X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=c56a51b3989e0c9abb3a5c55d994e2104b1ba443;p=sage.d.git mjo/misc.py: special case for Sage's octonions in _all2list() These have vector(), not to_vector(). --- diff --git a/mjo/misc.py b/mjo/misc.py index f4406a1..31e77b4 100644 --- a/mjo/misc.py +++ b/mjo/misc.py @@ -16,7 +16,6 @@ def _all2list(x): sage: from mjo.misc import _all2list sage: from mjo.hurwitz import (QuaternionMatrixAlgebra, - ....: Octonions, ....: OctonionMatrixAlgebra) EXAMPLES:: @@ -44,7 +43,7 @@ def _all2list(x): :: - sage: _all2list(Octonions().one()) + sage: _all2list(OctonionAlgebra(QQ).one()) [1, 0, 0, 0, 0, 0, 0, 0] sage: _all2list(OctonionMatrixAlgebra(1).one()) [1, 0, 0, 0, 0, 0, 0, 0] @@ -67,6 +66,10 @@ def _all2list(x): [3, 4, 1, 0, 0, 0, 0, 0, 0, 0] """ + if hasattr(x, 'vector'): + # Works on octonions, which have vector() but not to_vector(). + return x.vector().list() + if hasattr(x, 'to_vector'): # This works on matrices of e.g. octonions directly, without # first needing to convert them to a list of octonions and