I have a CombinatorialFreeModule whose basis is a set of tuples. I want to define a linear transformation that permutes the two first components of a tuple in the basis. As a minimal example, that's what I tried:
def Action(k):
V = CombinatorialFreeModule(SR, [(1,0,0),(0,1,0)], prefix="")
e = V.basis()
f = lambda x: ((-1)^(k - x[2]))*V.basis()[(x[1],x[0],x[2])]
return V.hom([f(x) for x in e.keys()], V)
However, I get the following error when I compute Action(1) (I have parameters in the case I am interested in, but this is a minimal example):
unable to convert [-[(0, 1, 0)], -[(1, 0, 0)]] to an element of Set of Morphisms from Free module generated by {(1, 0, 0), (0, 1, 0)} over Symbolic Ring to Free module generated by {(1, 0, 0), (0, 1, 0)} over Symbolic Ring in Category of finite dimensional vector spaces with basis over Symbolic Ring
Is there a way to correct that? As my real basis is much more bigger than that, I don't want to just define the image of each vector separately.