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

add method "tensor_factors" to tensor products #34393

Closed
fchapoton opened this issue Aug 20, 2022 · 70 comments
Closed

add method "tensor_factors" to tensor products #34393

fchapoton opened this issue Aug 20, 2022 · 70 comments

Comments

@fchapoton
Copy link
Contributor

so that one can easily access them

CC: @tscrim

Component: categories

Author: Frédéric Chapoton

Branch: b81dbf0

Reviewer: Matthias Koeppe, Travis Scrimshaw

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

@fchapoton fchapoton added this to the sage-9.7 milestone Aug 20, 2022
@fchapoton
Copy link
Contributor Author

comment:2

meeting an unexpected issue with Schur algebras.. to be investigated

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 20, 2022

comment:3
+            def construction(self):
...
+                return [tensor, *self._reduction[1]]

This can't possibly be correct code to be included in the category. _reduction is set by UniqueRepresentation, so it's under control of implementation classes, not the category

@fchapoton
Copy link
Contributor Author

comment:4

Replying to @mkoeppe:

+            def construction(self):
...
+                return [tensor, *self._reduction[1]]

This can't possibly be correct code to be included in the category. _reduction is set by UniqueRepresentation, so it's under control of implementation classes, not the category

ok, right. Any better idea ? My final aim would be to have tensor products of morphisms..

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 21, 2022

comment:5

No better idea than having CombinatorialFreeModule_Tensor.__init__ (or other implementation classes) save the info that you need

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 21, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

4f8adeaanother try

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 21, 2022

Changed commit from 7fc6333 to 4f8adea

@fchapoton
Copy link
Contributor Author

comment:7

The information seems to be stored in _sets. Let us try.

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 21, 2022

comment:8

That's an implementation detail, so I think the method components should be @abstract_method(optional=True) in the category, and the implementation should go to CombinatorialFreeModule_Tensor

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 21, 2022

comment:9

Also the method name is not specific enough. How about tensor_factors (this mirrors cartesian_factors, which is already in use?

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 21, 2022

comment:10

And this can be moved to a larger category - at least to FreeModules, where it would apply to sage.tensor.modules.tensor_free_module.TensorFreeModule

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 21, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

dae2fb5change "components" to "tensor_factors"

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 21, 2022

Changed commit from 4f8adea to dae2fb5

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 21, 2022

comment:12

Replying to @mkoeppe:

And this can be moved to a larger category - at least to FreeModules, where it would apply to sage.tensor.modules.tensor_free_module.TensorFreeModule

Make that Modules. (The category FreeModules only exists on my wishlist - #30164 - not in code.)

@fchapoton fchapoton changed the title add method "components" to tensor products add method "tensor_factors" to tensor products Aug 21, 2022
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 21, 2022

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

638ba61add tensor_factors method to tensor products

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 21, 2022

Changed commit from dae2fb5 to 638ba61

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 21, 2022

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

d4c8b90add tensor_factors method to tensor products

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 21, 2022

Changed commit from 638ba61 to d4c8b90

@tscrim
Copy link
Collaborator

tscrim commented Aug 22, 2022

comment:16

Replying to @mkoeppe:

That's an implementation detail, so I think the method components should be @abstract_method(optional=True) in the category, and the implementation should go to CombinatorialFreeModule_Tensor

I would actually go one step further and make it explicitly an @abstract_method like Sets().CartesianProducts() does with cartesian_factors(). Then you could implement

def construction(self):
   return (TensorProductFunctor(self.category()), self.tensor_factors())

again following Sets().CartesianProducts().

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 22, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

d0972e6trying to use the suggestions about tensor construction

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 22, 2022

Changed commit from d4c8b90 to d0972e6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 22, 2022

Changed commit from d0972e6 to eba9d16

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 22, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

eba9d16detail fix

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 22, 2022

comment:19
+                sage: F = CombinatorialFreeModule(ZZ, [1,2])
+                sage: F.__custom_name = "F"
+                sage: G = CombinatorialFreeModule(ZZ, [3,4])
+                sage: G.__custom_name = "G"

Is there a reason why you don't use F.rename("F") here?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 22, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

c862151rather use rename

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 26, 2022

comment:51

No objections here

@tscrim
Copy link
Collaborator

tscrim commented Aug 27, 2022

Reviewer: Matthias Koeppe, Travis Scrimshaw

@vbraun
Copy link
Member

vbraun commented Aug 30, 2022

comment:53
sage -t --long --warn-long 49.3 --random-seed=123 src/sage/categories/modules.py
**********************************************************************
File "src/sage/categories/modules.py", line 942, in sage.categories.modules.Modules.TensorProducts.ParentMethods.t
ensor_factors
Failed example:
    M.construction()
Expected:
    doctest:warning...
    DeprecationWarning: implementations of Modules().TensorProducts() now must define the method tensor_factors
    See https://trac.sagemath.org/34393 for details.
Got:
    doctest:warning
      File "/home/release/Sage/src/bin/sage-runtests", line 154, in <module>
        err = DC.run()
      File "/home/release/Sage/src/sage/doctest/control.py", line 1384, in run
        self.run_doctests()
      File "/home/release/Sage/src/sage/doctest/control.py", line 1059, in run_doctests
        self.dispatcher.dispatch()
      File "/home/release/Sage/src/sage/doctest/forker.py", line 2021, in dispatch
        self.parallel_dispatch()
      File "/home/release/Sage/src/sage/doctest/forker.py", line 1916, in parallel_dispatch
        w.start()  # This might take some time
      File "/home/release/Sage/src/sage/doctest/forker.py", line 2190, in start
        super().start()
      File "/home/release/Sage/local/var/lib/sage/venv-python3.10.5/lib/python3.10/multiprocessing/process.py", li
ne 121, in start
        self._popen = self._Popen(self)
      File "/home/release/Sage/local/var/lib/sage/venv-python3.10.5/lib/python3.10/multiprocessing/context.py", li
ne 224, in _Popen
        return _default_context.get_context().Process._Popen(process_obj)
      File "/home/release/Sage/local/var/lib/sage/venv-python3.10.5/lib/python3.10/multiprocessing/context.py", li
ne 277, in _Popen
        return Popen(process_obj)
      File "/home/release/Sage/local/var/lib/sage/venv-python3.10.5/lib/python3.10/multiprocessing/popen_fork.py",
 line 19, in __init__
        self._launch(process_obj)
      File "/home/release/Sage/local/var/lib/sage/venv-python3.10.5/lib/python3.10/multiprocessing/popen_fork.py",
 line 71, in _launch
        code = process_obj._bootstrap(parent_sentinel=child_r)
      File "/home/release/Sage/local/var/lib/sage/venv-python3.10.5/lib/python3.10/multiprocessing/process.py", line 315, in _bootstrap
        self.run()
      File "/home/release/Sage/src/sage/doctest/forker.py", line 2162, in run
        task(self.options, self.outtmpfile, msgpipe, self.result_queue)
      File "/home/release/Sage/src/sage/doctest/forker.py", line 2492, in __call__
        doctests, extras = self._run(runner, options, results)
      File "/home/release/Sage/src/sage/doctest/forker.py", line 2544, in _run
        result = runner.run(test)
      File "/home/release/Sage/src/sage/doctest/forker.py", line 866, in run
        return self._run(test, compileflags, out)
      File "/home/release/Sage/src/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/release/Sage/src/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.categories.modules.Modules.TensorProducts.ParentMethods.tensor_factors[7]>", line 1, in <module>
        M.construction()
      File "/home/release/Sage/src/sage/combinat/free_module.py", line 475, in construction
        c = super().construction()
      File "/home/release/Sage/src/sage/categories/modules.py", line 917, in construction
        deprecation(34393, "implementations of Modules().TensorProducts() now must define the method tensor_factors")
      File "/home/release/Sage/src/sage/misc/superseded.py", line 99, in deprecation
        warning(trac_number, message, DeprecationWarning, stacklevel)
      File "/home/release/Sage/src/sage/misc/superseded.py", line 180, in warning
        warn(message, warning_class, stacklevel)
      File "/home/release/Sage/local/var/lib/sage/venv-python3.10.5/lib/python3.10/warnings.py", line 109, in _showwarnmsg
        sw(msg.message, msg.category, msg.filename, msg.lineno,
    :
    DeprecationWarning: implementations of Modules().TensorProducts() now must define the method tensor_factors
    See https://trac.sagemath.org/34393 for details.
    (VectorFunctor, Integer Ring)
**********************************************************************

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

dd6cc0eMerge branch 'u/chapoton/tensor_components' in 9.7.rc0
b81dbf0fix doctest

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

Changed commit from 7e75938 to b81dbf0

@fchapoton
Copy link
Contributor Author

comment:55

doctest fixed, back to needs review

@vbraun
Copy link
Member

vbraun commented Sep 22, 2022

Changed branch from u/chapoton/tensor_components to b81dbf0

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 2, 2022

comment:59

Replying to Matthias Köppe:

Also, maybe instead of just requiring the method tensor_factors, how about specifying a method just like CombinatorialFreeModule.tensor_constructor?

From its domain, the tensor factors can be read off.

I've opened #34628 for this

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 2, 2022

Changed commit from b81dbf0 to none

kryzar pushed a commit to kryzar/sage that referenced this issue Feb 6, 2023
…ghestWeightModules in quantum_group_gap

This fails with `gap_packages` installed since sagemath#34393.

However, there is another failure for the submodules. I do not think
subobjects of tensor products should have a tensor product structure.

URL: https://trac.sagemath.org/34635
Reported by: tscrim
Ticket author(s): Travis Scrimshaw
Reviewer(s): Matthias Koeppe
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

4 participants