- # 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))
+ # 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)