- @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)
- fdeja.__init__(field,
- mult_table,
- rank,
- assume_associative=assume_associative,
- names=names,
- category=category,
- natural_basis=natural_basis)
-
-
- def vector_space(self):
+ def __init__(self, superalgebra, basis, **kwargs):
+ self._superalgebra = superalgebra
+ V = self._superalgebra.vector_space()
+ field = self._superalgebra.base_ring()
+
+ # 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 = ["b","c","d","e","f","g","h","l","m"]
+ try:
+ prefix = prefixen[prefixen.index(self._superalgebra.prefix()) + 1]
+ except ValueError:
+ prefix = prefixen[0]
+
+ # 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()
+
+ def inner_product(x,y):
+ return self._superalgebra(x).inner_product(self._superalgebra(y))
+
+ super().__init__(matrix_basis,
+ jordan_product,
+ inner_product,
+ field=field,
+ prefix=prefix,
+ **kwargs)
+
+
+
+ def _element_constructor_(self, elt):