#18349: One-fold tensor products: fix repr and document the behavior.
---------------------------------------+------------------------
Reporter: elixyre | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.7
Component: categories | Resolution:
Keywords: tensor, categories | Merged in:
Authors: Jean-Baptiste Priez | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------------------+------------------------
Comment (by nthiery):
Salut Jean-Baptiste,
`h` and `tensor([h])` are indeed distinct, the latter being a
(one-fold) tensor product:
{{{
sage: h = SymmetricFunctions(QQ).h()
sage: h1 = tensor([h])
sage: type(h1)
<class
'sage.combinat.free_module.CombinatorialFreeModule_Tensor_with_category'>
}}}
In particular, the basis is indexed by (singleton) tuples of
partitions, instead of partitions:
{{{
sage: h1.basis().keys().an_element()
([],)
sage: h.basis().keys().an_element()
[]
}}}
Given that a one-fold tensor product of a single space V as above is
trivially isomorphic to V, the above behavior may look disappointing
at first. Yet making the distinction explicit is on purpose. The
rationale is that this enables writing generic code in a uniform way
when constructing the tensor product of a list of spaces; otherwise
one would need to always special case the singleton list (btw:
ideally, we would want to support the empty list as well).
Note that we have the same behavior for e.g. one-fold cartesian
products:
{{{
sage: p2 = cartesian_product([Partitions()])
sage: p2
The cartesian product of (Partitions,)
sage: type(p2)
<class 'sage.sets.cartesian_product.CartesianProduct_with_category'>
sage: p2.an_element()
([],)
}}}
This being said, and unlike for cartesian products, the repr of
one-fold tensor products, as currently returned by
`CombinatorialFreeModule_Tensor_with_category._repr_`, is indeed very
misleading. So I am requalifying this ticket to fix this. Thanks for
reporting!
Would you have a suggestion for a good repr in this case?
We also probably want to highlight the above behavior in the
documentation of `tensor?`.
Cheers,
Nicolas
--
Ticket URL: <http://trac.sagemath.org/ticket/18349#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.