- 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()
+ if elt in self.superalgebra():
+ return super()._element_constructor_(elt.to_matrix())
+ else:
+ return super()._element_constructor_(elt)