enable coercion for tensor constructions#37413
enable coercion for tensor constructions#37413mantepse wants to merge 2 commits intosagemath:developfrom
Conversation
| CovariantFunctorialConstruction.__init__(self) | ||
| self._forced_category = category | ||
| from sage.categories.rings import Rings | ||
| if self._forced_category is not None: | ||
| codomain = self._forced_category | ||
| else: | ||
| codomain = Rings() | ||
| MultivariateConstructionFunctor.__init__(self, Rings(), codomain) |
There was a problem hiding this comment.
I added this blindly, by copy-pasting from CartesianProductFunctor. Rings() is almost certainly wrong, I have no idea how the correct category is chosen.
There was a problem hiding this comment.
The main thing of the _forced_category is to pass it along through the __call__ in the cartesian_product as the construction that is being used might need more conditions (e.g., if something was a ring constructed as a Cartesian product [of rings]). On its own, there isn't any use. Rings() is also too strong as a default category; Modules(base_ring.category()) is likely the best.
|
See also #37220. |
|
Some more info: |
|
Documentation preview for this PR (built with commit a5f15e1; changes) is ready! 🎉 |
|
(I'm not sure if commalg is the correct label, nor do I know anything about this topic) |
|
I found the following doctest in Unfortunately, there is no comment indicating why we wouldn't want such a coercion. I tried to override this in actually calls |
|
sorry, no clue about this code. |
|
It's possible that things are not working because there is no coercion, which is something that is checked. We might need to implement a custom |
|
That's not so good news... I was hoping you know everything :-) Concerning the Maybe there is an alternative for #37033 after all, but I don't see how I can convert some tensor product over |
|
Unfortunately I've done very little with the deep parts of the coercion pushout stuff. I can relearn it, but it has been 5+ years since I last touched it. Local imports in an You likely need a coercion from a module over the smaller base ring to the larger one like this: |
|
I'll try to take a look at this over the weekend. |
|
That would be wonderful! I'll be available most of the time! |
|
@roed314: I just prepared a very long answer to a reply to Nils Bruin. Doing so I had to check something in my code. This in turn lead me to discover a bug, which might slightly change things. I am too tired right now to fix the bug (it might not be easy), so please give me a night. This might reduce the problem to nothing, but I don't know yet. I'm sorry! Martin |
|
No problem! This stuff is tricky to get right. Let me know when you've fixed the problem. |
|
@roed314, as it turns out, at least the example I was stuck with now works. I simply forgot a It will take some time until I have more examples. Thank you so much for your readiness to help! |
|
I'll put this branch to sleep. The one little change I actually need is now in #37451. |
We want to allow acting with an extension of the base ring on a tensor product. For example: