- 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()!
- coords = sum( a*b for (a,b)
- in zip(elt.to_vector(),
- self.superalgebra().vector_space().basis()) )
- return self.from_vector(self.vector_space().coordinate_vector(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()
+ if elt in self.superalgebra():
+ return super()._element_constructor_(elt.to_matrix())
+ else:
+ return super()._element_constructor_(elt)