return tuple(S)
+def _mat2vec(m):
+ return vector(m.base_ring(), m.list())
+
+def _vec2mat(v):
+ return matrix(v.base_ring(), sqrt(v.degree()), v.list())
+
def _multiplication_table_from_matrix_basis(basis):
"""
At least three of the five simple Euclidean Jordan algebras have the
field = basis[0].base_ring()
dimension = basis[0].nrows()
- def mat2vec(m):
- return vector(field, m.list())
-
- def vec2mat(v):
- return matrix(field, dimension, v.list())
-
V = VectorSpace(field, dimension**2)
- W = V.span( mat2vec(s) for s in basis )
+ W = V.span( _mat2vec(s) for s in basis )
# Taking the span above reorders our basis (thanks, jerk!) so we
# need to put our "matrix basis" in the same order as the
# (reordered) vector basis.
- S = tuple( vec2mat(b) for b in W.basis() )
+ S = tuple( _vec2mat(b) for b in W.basis() )
Qs = []
for s in S:
# why we're computing rows here and not columns.
Q_rows = []
for t in S:
- this_row = mat2vec((s*t + t*s)/2)
+ this_row = _mat2vec((s*t + t*s)/2)
Q_rows.append(W.coordinates(this_row))
Q = matrix(field, W.dimension(), Q_rows)
Qs.append(Q)