I think I found out.

There is an assertion in `tensor_constructor` which is too strict, and 
`plethysm` should return an element of the parent, not of the tensor 
product.  I'll open a ticket.

Martin

"""
sage: S = SymmetricFunctions(QQ)
sage: S.inject_shorthands()
sage: t = tensor([s[1,1], h[2]])
sage: P = TwoPositions(S.s(), S.h())
sage: x = P(t)
sage: 2*x
sage: h[2](x)
"""
def from_ch_characters(t):
    P = TwoPositions(*t.parent()._sets)
    return P(t)

class TwoPositionsElement(CombinatorialFreeModule_Tensor.Element):
    pass


from sage.combinat.free_module import CombinatorialFreeModule_Tensor, 
CartesianProductWithFlattening
class TwoPositions(CombinatorialFreeModule_Tensor):
    def __init__(self, *modules):
        cat = HopfAlgebrasWithBasis(QQ).TensorProducts()
        CombinatorialFreeModule_Tensor.__init__(self,
                                                modules,
                                                category = cat)

    @cached_method
    def tensor_constructor(self, modules):
        assert(module in ModulesWithBasis(self.base_ring()) for module in 
modules)
        # assert(tensor(modules) == self)
        # a list l such that l[i] is True if modules[i] is readily a tensor 
product
        is_tensor = [isinstance(module, CombinatorialFreeModule_Tensor) for 
module in modules]
        # the tensor_constructor, on basis elements
        result = self.monomial * CartesianProductWithFlattening(is_tensor) 
#.
        # TODO: make this into an element of Hom( A x B, C ) when those 
will exist
        for i in range(0, len(modules)):
            result = modules[i]._module_morphism(result, position = i, 
codomain = self)
        return result

    def __repr__(self):
        return "TwoPositions in %s"%(self._sets,)

    Element = TwoPositionsElement

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to