- # If our superalgebra is a subalgebra of something else, then
- # these vectors won't have the right coordinates for
- # V.span_of_basis() unless we use V.from_vector() on them.
- W = V.span_of_basis( V.from_vector(b.to_vector()) for b in basis )
-
- n = len(basis)
- mult_table = [[W.zero() for i in range(n)] for j in range(n)]
- ip_table = [ [ self._superalgebra.inner_product(basis[i],basis[j])
- for i in range(n) ]
- for j in range(n) ]
-
- for i in range(n):
- for j in range(n):
- product = basis[i]*basis[j]
- # product.to_vector() might live in a vector subspace
- # if our parent algebra is already a subalgebra. We
- # use V.from_vector() to make it "the right size" in
- # that case.
- product_vector = V.from_vector(product.to_vector())
- mult_table[i][j] = W.coordinate_vector(product_vector)
-
- self._inner_product_matrix = matrix(field, ip_table)
- natural_basis = tuple( b.natural_representation() for b in basis )
-
+ # The superalgebra constructor expects these to be in original matrix
+ # form, not algebra-element form.
+ matrix_basis = tuple( b.to_matrix() for b in basis )
+ def jordan_product(x,y):
+ return (self._superalgebra(x)*self._superalgebra(y)).to_matrix()