- def __init__(self, elt):
- superalgebra = elt.parent()
-
- # First compute the vector subspace spanned by the powers of
- # the given element.
- V = superalgebra.vector_space()
- superalgebra_basis = [superalgebra.one()]
- basis_vectors = [superalgebra.one().to_vector()]
- W = V.span_of_basis(basis_vectors)
- for exponent in range(1, V.dimension()):
- new_power = elt**exponent
- basis_vectors.append( new_power.to_vector() )
- try:
- W = V.span_of_basis(basis_vectors)
- superalgebra_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.
- superalgebra_basis = tuple(superalgebra_basis)
-
- # Now figure out the entries of the right-multiplication
- # matrix for the successive basis elements b0, b1,... of
- # that subspace.
- field = superalgebra.base_ring()
- mult_table = []
- for b_right in superalgebra_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 superalgebra_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).to_vector())
- b_right_rows.append(this_row)
- b_right_matrix = matrix(field, b_right_rows)
- mult_table.append(b_right_matrix)
-
- for m in mult_table:
- m.set_immutable()
- mult_table = tuple(mult_table)
-
- # TODO: We'll have to redo this and make it unique again...
- prefix = 'f'
-
- # 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()
-
- category = superalgebra.category().Associative()
- natural_basis = tuple( b.natural_representation()
- for b in superalgebra_basis )