-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
cartesian product of algebra has troubles with base_ring #19225
Comments
comment:1
solves this bug, but then
|
This comment has been minimized.
This comment has been minimized.
comment:3
This still happens in SageMath 8.0.beta12. |
Commit: |
comment:4
There are several related problems here, and it seems best to solve them together:
The attached branch fixes the above problems essentially by getting rid of the method Some occurrences of |
Author: Peter Bruin |
comment:5
Replying to @pjbruin:
-1 to getting rid of this mechanism. It means you can no longer simply inherit from, e.g., Perhaps an improvement would be for Also, technically, an implementation of
I've been told that this is faster too.
This is an immediate -1 from me because they are the same object (in the mathematical sense), just expressed in terms of different bases. So there should, and needs, to be a bidirectional coercion. The fact that this needs to be removed is a very strong indication to me that this is not the correct fix.
However, the fact that |
comment:6
Replying to @tscrim:
This is not true; if you do this, then everything should work in the same way as before except the default coercion map is now discovered by
|
comment:7
Replying to @tscrim:
By definition, when |
comment:8
Replying to @tscrim:
If you look at the code of
|
comment:9
Replying to @tscrim:
Bidirectional coercions should always be avoided, for at least two reasons:
|
comment:10
Replying to @tscrim:
That is true; I was careless here and will fix that. |
comment:11
Replying to @pjbruin:
It is the last thing run by I am also very strongly opposed to implementing coercions using super calls within categories. First, there are technical limitations. Second, it can be natural that you do not want to call You also are likely to get a speed regression when finding if coercions exists because of the extra walk up through the category MRO. |
comment:12
Replying to @pjbruin:
I just don't quite agree with the phrasing as it makes it seem like |
comment:13
Replying to @pjbruin:
Ah, right. Sorry, I missed the change in
I never claimed this was a bug. However, I am worried about speed regressions here from walking up the MRO, as well as enforcing it could lead to some mathematical issues because possible (natural) coercion is inversely proportional to the amount of structure. See my other reply.
I see this as an enforcement of the category requirements. However, it does have a cost when constructing the parents, and I agree that it should be avoiding.
No, that is not true. You are adding a coercion map. So you can always add additional coercions. With
It only freezes
In some ways that is a workaround, but it also gives you finer control. |
comment:14
Replying to @pjbruin:
IMO, ambiguity is the correct thing. They are different representations of the same parent, and in general, why should one be preferred over the other? For PBW bases here, the natural monomial basis is "better" in some sense, but since you created the special PBW basis, you probably want the PBW. What about for things like symmetric functions or Iwahori-Hecke algebras that have several bases that all sit on equal footing? Excuse a little theatrics, but my first thought was, "that's horrifying". I believe I understand why this happens, but I feel that is more of a problem of a bad caching mechanism in the coercion framework. It also puts a much heavier burden on someone writing code because you will have to avoid all coercion cycles. My initial thought is also that you cannot get around this by specifying conversion maps because it puts the other parent as the key. I could see it making the non-coercion direction slower if the inverse map was implemented by inverting one a |
comment:16
I am now working on a more minimal solution. After splitting off part of it into #29225, I realised that time has progressed by exactly 104 tickets... |
Dependencies: #29225 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:20
Replying to @tscrim:
It doesn't seem this happens, because
Yes, but I prefer to do this on a separate ticket. For Jordan algebras it is trivial, for matrix algebras it requires adding a one-line
The error reported in this ticket occurs inside an |
comment:21
Replying to @pjbruin:
I guess I was misremembering, so it is a bit harder to define an action using
Ah, I see the issue. The categories of Cartesian products of modules is incomparable (in the poset category) with unital algebras. However, this is an argument for keeping a (cached) method |
comment:22
Replying to @tscrim:
Yes, this has more to do with automatically constructing the "right" parent as in push-outs and functorial constructions.
Yes, exactly.
I don't think there is a problem here; the
I don't like this very much; it sounds like an ad-hoc way of enforcing a certain order different from the method resolution order. Also, this would mean that |
comment:23
Replying to @pjbruin:
I think I am convinced now that this is okay. Aince the coercion framework doesn't register a coercion from a parent I am not fully convinced that we should go through another super call of Side note: A slight inconsistency I noticed
but since |
Reviewer: Travis Scrimshaw |
comment:24
Replying to @tscrim:
Indeed, it shouldn't matter when or how the coercion was registered.
This was actually more or less how the previous branch (from 2017) worked, but from your comments at the time it seemed that you were against this...
OK, thank you for the review! |
comment:25
Replying to @pjbruin:
I was because I didn't see the necessity of changing the coercion registration mechanism and I wanted it to be done at initialization. I am still a little hesitant about doing it because it feels like it gives a little less control (or at least automatically) with how objects register coercions (e.g., there could be a natural coercion between objects as modules but not as graded modules), but the implementation just has to be more specific with the |
Changed branch from u/pbruin/19225-cartesian_product_algebra to |
comment:27
Unfortunately I cannot infer from the comments what one has to do if one has used the "ugly _no_generic_basering_coercion hack" in the past. Shall one simply remove that attribute? Or what else to implement? It is really unfortunate that clicking on the branch of a closed ticket doesn't provide information on what the ticket changed (or at least clicking on the branch for THIS ticket and searching for the string "_no_generic_basering_coercion" doesn't show a result). |
Changed commit from |
comment:28
Of course I didn't empty the "commit" field on purpose. |
comment:29
Replying to @simon-king-jena:
... and when I tried to fill it with its old value, it didn't help. I infer that the commit field of a closed ticket is of no use. |
comment:30
Replying to @simon-king-jena:
You can try removing it. If that doesn't work, you can implement a
In this case, that happens because |
comment:31
Replying to @pjbruin:
Thank you! As it turns out, removing the attribute did work in my application. |
…asering_coercion In `sage.categories.unital_algebras.UnitalAlgebras`, remove the check for the attribute `_no_generic_basering_coercion`, which was deprecated in sagemath#19225. This means that this attribute is now completely ignored by the coercion framework. URL: sagemath#37115 Reported by: Peter Bruin Reviewer(s): Marc Mezzarobba
…asering_coercion In `sage.categories.unital_algebras.UnitalAlgebras`, remove the check for the attribute `_no_generic_basering_coercion`, which was deprecated in sagemath#19225. This means that this attribute is now completely ignored by the coercion framework. URL: sagemath#37115 Reported by: Peter Bruin Reviewer(s): Marc Mezzarobba
…asering_coercion In `sage.categories.unital_algebras.UnitalAlgebras`, remove the check for the attribute `_no_generic_basering_coercion`, which was deprecated in sagemath#19225. This means that this attribute is now completely ignored by the coercion framework. URL: sagemath#37115 Reported by: Peter Bruin Reviewer(s): Marc Mezzarobba
…asering_coercion In `sage.categories.unital_algebras.UnitalAlgebras`, remove the check for the attribute `_no_generic_basering_coercion`, which was deprecated in sagemath#19225. This means that this attribute is now completely ignored by the coercion framework. URL: sagemath#37115 Reported by: Peter Bruin Reviewer(s): Marc Mezzarobba
…asering_coercion In `sage.categories.unital_algebras.UnitalAlgebras`, remove the check for the attribute `_no_generic_basering_coercion`, which was deprecated in sagemath#19225. This means that this attribute is now completely ignored by the coercion framework. URL: sagemath#37115 Reported by: Peter Bruin Reviewer(s): Marc Mezzarobba
…asering_coercion In `sage.categories.unital_algebras.UnitalAlgebras`, remove the check for the attribute `_no_generic_basering_coercion`, which was deprecated in sagemath#19225. This means that this attribute is now completely ignored by the coercion framework. URL: sagemath#37115 Reported by: Peter Bruin Reviewer(s): Marc Mezzarobba
Depends on #29225
CC: @roed314 @behackl @pjbruin @nthiery
Component: coercion
Author: Peter Bruin
Branch:
dcc25ea
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/19225
The text was updated successfully, but these errors were encountered: