combinat/free module tensor construction#37451
Merged
vbraun merged 10 commits intosagemath:developfrom Apr 12, 2024
Merged
Conversation
This was referenced Feb 24, 2024
mkoeppe
reviewed
Feb 24, 2024
Collaborator
|
Should we also do the same for the |
Co-authored-by: Matthias Köppe <mkoeppe@math.ucdavis.edu>
Collaborator
|
LGTM, but what about doing |
Contributor
Author
Like so? diff --git a/src/sage/combinat/free_module.py b/src/sage/combinat/free_module.py
index 2f153396fc0..5daabd153fb 100644
--- a/src/sage/combinat/free_module.py
+++ b/src/sage/combinat/free_module.py
@@ -505,6 +505,15 @@ class CombinatorialFreeModule(UniqueRepresentation, Module, IndexedGenerators):
sage: T.change_ring(QQ)
Free module generated by {'a', 'b', 'c'} over Rational Field
# Free module generated by {'a', 'b', 'c'} over Rational Field
+
+ sage: G = CombinatorialFreeModule(ZZ, ['x','y']); G
+ Free module generated by {'x', 'y'} over Integer Ring
+ sage: T = F.cartesian_product(G); T
+ Free module generated by {'a', 'b', 'c'} over Integer Ring
+ (+) Free module generated by {'x', 'y'} over Integer Ring
+ sage: T.change_ring(QQ)
+ Free module generated by {'a', 'b', 'c'} over Rational Field
+ (+) Free module generated by {'x', 'y'} over Rational Field
"""
if R is self.base_ring():
return self
@@ -515,7 +524,8 @@ class CombinatorialFreeModule(UniqueRepresentation, Module, IndexedGenerators):
if isinstance(functor, VectorFunctor):
return functor(R)
from sage.categories.tensor import TensorProductFunctor
- if isinstance(functor, TensorProductFunctor):
+ from sage.categories.cartesian_product import CartesianProductFunctor
+ if isinstance(functor, (TensorProductFunctor, CartesianProductFunctor)):
return functor([f.change_ring(R) for f in args])
raise NotImplementedError('the method change_ring() has not yet been implemented') |
Collaborator
|
Yes, that's correct. |
Contributor
Author
|
ready |
tscrim
approved these changes
Apr 9, 2024
Collaborator
tscrim
left a comment
There was a problem hiding this comment.
Thank you; once a green bot, then you can set a positive review.
Be aware that the extra large PEP8 stuff might result in a merge conflict. I think there is nothing that will conflict now, but I am not 100% certain.
|
Documentation preview for this PR (built with commit c8e1693; changes) is ready! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch allows to change the base ring of a tensor product of free modules: