- if elt not in self.superalgebra():
- raise ValueError("not an element of this subalgebra")
-
- # The extra hackery is because foo.to_vector() might not live
- # in foo.parent().vector_space()! Subspaces of subspaces still
- # have user bases in the ambient space, though, so only one
- # level of coordinate_vector() is needed. In other words, if V
- # is itself a subspace, the basis elements for W will be of
- # the same length as the basis elements for V -- namely
- # whatever the dimension of the ambient (parent of V?) space is.
- V = self.superalgebra().vector_space()
- W = self.vector_space()
-
- # Multiply on the left because basis_matrix() is row-wise.
- ambient_coords = elt.to_vector()*V.basis_matrix()
- W_coords = W.coordinate_vector(ambient_coords)
- return self.from_vector(W_coords)
-
-
-
- def natural_basis_space(self):
- """
- Return the natural basis space of this algebra, which is identical
- to that of its superalgebra.
-
- This is correct "by definition," and avoids a mismatch when the
- subalgebra is trivial (with no natural basis to infer anything
- from) and the parent is not.
- """
- return self.superalgebra().natural_basis_space()