- @staticmethod
- def __classcall_private__(cls, elt):
- superalgebra = elt.parent()
-
- # First compute the vector subspace spanned by the powers of
- # the given element.
- V = superalgebra.vector_space()
- eja_basis = [superalgebra.one()]
- basis_vectors = [superalgebra.one().vector()]
- W = V.span_of_basis(basis_vectors)
- for exponent in range(1, V.dimension()):
- new_power = elt**exponent
- basis_vectors.append( new_power.vector() )
- try:
- W = V.span_of_basis(basis_vectors)
- eja_basis.append( new_power )
- except ValueError:
- # Vectors weren't independent; bail and keep the
- # last subspace that worked.
- break
-
- # Make the basis hashable for UniqueRepresentation.
- eja_basis = tuple(eja_basis)
-
- # Now figure out the entries of the right-multiplication
- # matrix for the successive basis elements b0, b1,... of
- # that subspace.
- F = superalgebra.base_ring()
- mult_table = []
- for b_right in eja_basis:
- b_right_rows = []
- # The first row of the right-multiplication matrix by
- # b1 is what we get if we apply that matrix to b1. The
- # second row of the right multiplication matrix by b1
- # is what we get when we apply that matrix to b2...
- #
- # IMPORTANT: this assumes that all vectors are COLUMN
- # vectors, unlike our superclass (which uses row vectors).
- for b_left in eja_basis:
- # Multiply in the original EJA, but then get the
- # coordinates from the subalgebra in terms of its
- # basis.
- this_row = W.coordinates((b_left*b_right).vector())
- b_right_rows.append(this_row)
- b_right_matrix = matrix(F, b_right_rows)
- mult_table.append(b_right_matrix)
-
- for m in mult_table:
- m.set_immutable()
- mult_table = tuple(mult_table)
-
- # The rank is the highest possible degree of a minimal
- # polynomial, and is bounded above by the dimension. We know
- # in this case that there's an element whose minimal
- # polynomial has the same degree as the space's dimension
- # (remember how we constructed the space?), so that must be
- # its rank too.
- rank = W.dimension()
-
- # EJAs are power-associative, and this algebra is nothin but
- # powers.
- assume_associative=True
-
- # TODO: Un-hard-code this. It should be possible to get the "next"
- # name based on the parent's generator names.
- names = 'f'
- names = normalize_names(W.dimension(), names)
-
- cat = superalgebra.category().Associative()
-
- # TODO: compute this and actually specify it.
- natural_basis = None
-
- fdeja = super(FiniteDimensionalEuclideanJordanElementSubalgebra, cls)
- return fdeja.__classcall__(cls,
- F,
- mult_table,
- rank,
- eja_basis,
- W,
- assume_associative=assume_associative,
- names=names,
- category=cat,
- natural_basis=natural_basis)
-
- def __init__(self,
- field,
- mult_table,
- rank,
- eja_basis,
- vector_space,
- assume_associative=True,
- names='f',
- category=None,
- natural_basis=None):
-
- self._superalgebra = eja_basis[0].parent()
- self._vector_space = vector_space
- self._eja_basis = eja_basis
-
- fdeja = super(FiniteDimensionalEuclideanJordanElementSubalgebra, self)
+ def __init__(self, superalgebra, basis, category=None, check_axioms=True):
+ self._superalgebra = superalgebra
+ V = self._superalgebra.vector_space()
+ field = self._superalgebra.base_ring()
+ if category is None:
+ category = self._superalgebra.category()
+
+ # A half-assed attempt to ensure that we don't collide with
+ # the superalgebra's prefix (ignoring the fact that there
+ # could be super-superelgrbas in scope). If possible, we
+ # try to "increment" the parent algebra's prefix, although
+ # this idea goes out the window fast because some prefixen
+ # are off-limits.
+ prefixen = [ 'f', 'g', 'h', 'a', 'b', 'c', 'd' ]
+ try:
+ prefix = prefixen[prefixen.index(self._superalgebra.prefix()) + 1]
+ except ValueError:
+ prefix = prefixen[0]
+
+ # 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 )
+
+
+ self._vector_space = W
+
+ fdeja = super(FiniteDimensionalEuclideanJordanSubalgebra, self)