sage: from mjo.misc import _all2list
sage: from mjo.hurwitz import (QuaternionMatrixAlgebra,
- ....: Octonions,
....: OctonionMatrixAlgebra)
EXAMPLES::
::
- 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]
[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