+
+ If the entries of the matrix themselves belong to a real vector
+ space (such as the complex numbers which can be thought of as
+ pairs of real numbers), they will also be expanded in vector form
+ and flattened into the list.
+
+ SETUP::
+
+ sage: from mjo.eja.eja_utils import _all2list
+ sage: from mjo.hurwitz import (QuaternionMatrixAlgebra,
+ ....: Octonions,
+ ....: OctonionMatrixAlgebra)
+
+ EXAMPLES::
+
+ sage: _all2list([[1]])
+ [1]
+
+ ::
+
+ sage: V1 = VectorSpace(QQ,2)
+ sage: V2 = MatrixSpace(QQ,2)
+ sage: x1 = V1([1,1])
+ sage: x2 = V1([1,-1])
+ sage: y1 = V2.one()
+ sage: y2 = V2([0,1,1,0])
+ sage: _all2list((x1,y1))
+ [1, 1, 1, 0, 0, 1]
+ sage: _all2list((x2,y2))
+ [1, -1, 0, 1, 1, 0]
+ sage: M = cartesian_product([V1,V2])
+ sage: _all2list(M((x1,y1)))
+ [1, 1, 1, 0, 0, 1]
+ sage: _all2list(M((x2,y2)))
+ [1, -1, 0, 1, 1, 0]
+
+ ::
+
+ sage: _all2list(Octonions().one())
+ [1, 0, 0, 0, 0, 0, 0, 0]
+ sage: _all2list(OctonionMatrixAlgebra(1).one())
+ [1, 0, 0, 0, 0, 0, 0, 0]
+
+ ::
+
+ sage: _all2list(QuaternionAlgebra(QQ, -1, -1).one())
+ [1, 0, 0, 0]
+ sage: _all2list(QuaternionMatrixAlgebra(1).one())
+ [1, 0, 0, 0]
+
+ ::
+
+ sage: V1 = VectorSpace(QQ,2)
+ sage: V2 = OctonionMatrixAlgebra(1,field=QQ)
+ sage: C = cartesian_product([V1,V2])
+ sage: x1 = V1([3,4])
+ sage: y1 = V2.one()
+ sage: _all2list(C( (x1,y1) ))
+ [3, 4, 1, 0, 0, 0, 0, 0, 0, 0]
+