- # There's no need to check the field since it already came
- # from an EJA. Likewise the axioms are guaranteed to be
- # satisfied, unless the guy writing this class sucks.
- #
- # If you want the basis to be orthonormalized, orthonormalize
- # the factors.
- FiniteDimensionalEJA.__init__(self,
- basis,
- jordan_product,
- inner_product,
- field=field,
- matrix_space=MS,
- orthonormalize=False,
- associative=associative,
- cartesian_product=True,
- check_field=False,
- check_axioms=False)
+ # Now create the vector space for the algebra, which will have
+ # its own set of non-ambient coordinates (in terms of the
+ # supplied basis).
+ degree = sum( f._matrix_span.ambient_vector_space().degree()
+ for f in factors )
+ V = VectorSpace(field, degree)
+ vector_basis = tuple( V(_all2list(b)) for b in self._matrix_basis )
+
+ # Save the span of our matrix basis (when written out as long
+ # vectors) because otherwise we'll have to reconstruct it
+ # every time we want to coerce a matrix into the algebra.
+ self._matrix_span = V.span_of_basis( vector_basis, check=False)
+
+ # Since we don't (re)orthonormalize the basis, the FDEJA
+ # constructor is going to set self._deortho_matrix to the
+ # identity matrix. Here we set it to the correct value using
+ # the deortho matrices from our factors.
+ self._deortho_matrix = matrix.block_diagonal(
+ [J._deortho_matrix for J in factors]
+ )
+
+ self._inner_product_matrix = matrix.block_diagonal(
+ [J._inner_product_matrix for J in factors]
+ )
+ self._inner_product_matrix._cache = {'hermitian': True}
+ self._inner_product_matrix.set_immutable()
+
+ # Building the multiplication table is a bit more tricky
+ # because we have to embed the entries of the factors'
+ # multiplication tables into the product EJA.
+ zed = self.zero()
+ self._multiplication_table = [ [zed for j in range(i+1)]
+ for i in range(n) ]
+
+ # Keep track of an offset that tallies the dimensions of all
+ # previous factors. If the second factor is dim=2 and if the
+ # first one is dim=3, then we want to skip the first 3x3 block
+ # when copying the multiplication table for the second factor.
+ offset = 0
+ for f in range(m):
+ phi_f = self.cartesian_embedding(f)
+ factor_dim = factors[f].dimension()
+ for i in range(factor_dim):
+ for j in range(i+1):
+ f_ij = factors[f]._multiplication_table[i][j]
+ e = phi_f(f_ij)
+ self._multiplication_table[offset+i][offset+j] = e
+ offset += factor_dim