Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One-fold tensor products: fix repr and document the behavior #18349

Open
sagetrac-elixyre mannequin opened this issue May 1, 2015 · 5 comments
Open

One-fold tensor products: fix repr and document the behavior #18349

sagetrac-elixyre mannequin opened this issue May 1, 2015 · 5 comments

Comments

@sagetrac-elixyre
Copy link
Mannequin

sagetrac-elixyre mannequin commented May 1, 2015

Hello every one,

sage: h = SymmetricFunctions(QQ).h()
sage: tensor([h]) # I assume that return h?
Symmetric Functions over Rational Field in the homogeneous basis
sage: h == tensor([h])
False

It must be a little mistake but I don't find the good category code where change that issue.

CC: @nthiery @tscrim @fchapoton

Component: categories

Keywords: tensor

Author: Jean-Baptiste Priez

Issue created by migration from https://trac.sagemath.org/ticket/18349

@sagetrac-elixyre sagetrac-elixyre mannequin added this to the sage-6.7 milestone May 1, 2015
@sagetrac-elixyre
Copy link
Mannequin Author

sagetrac-elixyre mannequin commented May 1, 2015

comment:1

I suppose the bug is in ** sage.categories.covariant_functorial_construction.CovariantFunctorialConstruction.call ** but I don't understand what the code means.

@nthiery
Copy link
Contributor

nthiery commented May 2, 2015

comment:2

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

@nthiery nthiery changed the title Tensor product One-fold tensor products: fix repr and document the behavior. May 2, 2015
@nthiery nthiery changed the title One-fold tensor products: fix repr and document the behavior. One-fold tensor products: fix repr and document the behavior May 2, 2015
@sagetrac-elixyre
Copy link
Mannequin Author

sagetrac-elixyre mannequin commented May 3, 2015

comment:4

Thanks, it seems clear to me now.

Replying to @nthiery:

Would you have a suggestion for a good repr in this case?

I don't have any opinion, may be:

sage: h = Sym(QQ).h()
sage: tensor([h])
Tensor:[Symmetric Functions over Rational Field in the homogeneous basis]

?

Replying to @nthiery:

We also probably want to highlight the above behavior in the
documentation of tensor?.

May be...

In this way, I have an other stupid question, when we have a tensor product:

sage: S = NCSF(QQ).S()
sage: t = tensor([h, S])

There is a friendly way to recover h and S from t?

@nthiery
Copy link
Contributor

nthiery commented May 3, 2015

comment:5

At the price of breaking encapsulation, you can do t._sets. There should be a method t.tensor_factors(). It's probably been implemented by Mark, typically in #15832.

@mkoeppe mkoeppe modified the milestones: sage-6.7, sage-9.3 Sep 9, 2020
@mkoeppe
Copy link
Contributor

mkoeppe commented Feb 13, 2021

comment:7

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Feb 13, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 14, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Apr 1, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants