-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
combinat/free module tensor construction #37451
combinat/free module tensor construction #37451
Conversation
Should we also do the same for the |
Co-authored-by: Matthias Köppe <[email protected]>
LGTM, but what about doing |
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') |
Yes, that's correct. |
ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 branch allows to change the base ring of a tensor product of free modules: