From c56a51b3989e0c9abb3a5c55d994e2104b1ba443 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 8 Apr 2026 20:09:32 -0400 Subject: [PATCH] mjo/misc.py: special case for Sage's octonions in _all2list() These have vector(), not to_vector(). --- mjo/misc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 -- 2.53.0