Conversation
e5d56cc to
9d32f31
Compare
|
Ok, caching makes some problems. The caching now depends on the base ring which is created with |
|
The remaining doctest failure is caused by the changed caching. We could adjust the |
This is even worse than you describe. Consider the following: when I request a univ poly ring with variable |
Yes, this is true but ideally the caching shouldn't depend on the arbitrary variables passed on creation. |
This was requested in #1993 (comment) (apparently by @thofma, but I don't find the comment; just the one where @fingolfin suggests this) Edit: found it: #1989 (comment) |
|
I specifically suggested to remove My reasoning for the removal was/is this: the primary reason we introduced universal polynomial rings in the first place was to accommodate users who are more used to systems like Mathematica and Maple, were you don't have to "define" variables or rings; if you need a new variable For this kind of users, we also want caching. So that they don't want have to worry why there are multiple "different" But if one gets different universal polynomials just depending on what the initial variables used where, that's defeating all of this. Of course this is bad: But here the fix should be to adjust the constructor: change function universal_polynomial_ring(R::Ring, varnames::Vector{Symbol}; cached::Bool=true, internal_ordering::Symbol=:lex)
@req !is_trivial(R) "Zero rings are currently not supported as coefficient ring."
T = elem_type(R)
U = mpoly_type(R)
S = Generic.UniversalPolyRing{T}(R, varnames, internal_ordering, cached)
return (S, gens(S))
endby replacing the return with return (S, gens(S, varnames)) |
|
(That said: if this is controversial (it seems to be; I totally forgot about those past conversations Lars dug up), then we can of course also restore the use of |
| ############################################################################### | ||
|
|
||
| function content(a::UniversalPolyRingElem) | ||
| function content(a::UniversalRingElem{<:MPolyRingElem}) |
There was a problem hiding this comment.
Is this really necessary given the definition of UniversalPolyRingElem above?
There was a problem hiding this comment.
No, it is not. But I thought that it would be better to not use the aliases where possible. Ideally they should just be there for increased backwards compatibility.
There was a problem hiding this comment.
Hmm, I think there is a lot of merit in keeping UniversalPolyRingElem around: it is easier to grasp and less technical than UniversalRingElem{<:MPolyRingElem}.
Plus, not changing it in this PR makes reviewing this PR that much easier, as I don't have to look over all those bits that don't really change anything ;-)
There was a problem hiding this comment.
I forgot about this comment... @lgoettgens suggested to move the aliases to src/Deprecations.jl, which is what I did now. Is this fine by you @fingolfin or do you still think that we should keep them?
There was a problem hiding this comment.
To keep this discussion here understandable on its own, let me repeat my argument. UniversalPolyRingElem{T} for a concrete T used to be a concrete type, but will not be concrete after this PR. Therefore, it should not be used as the eltype of a Vector etc. For places like here that just use it together with <: they would be fine to keep using. But I am not quite sure how to explain that in the docs and would thus just discourage use of the aliases altogether
25dd4d6 to
13e8404
Compare
|
I don't get this error message. Locally the respective line runs fine. |
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2274 +/- ##
==========================================
+ Coverage 88.12% 88.13% +0.01%
==========================================
Files 128 130 +2
Lines 32870 32871 +1
==========================================
+ Hits 28966 28971 +5
+ Misses 3904 3900 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d2069f5 to
bb2ed4f
Compare
|
This PR has conflicts |
44184a7 to
30117fc
Compare
|
Not anymore ;-) |
There was a problem hiding this comment.
IMO this file could be merged into src/UniversalRing.jl to have the code less splattered around
There was a problem hiding this comment.
I tried that before but I had some problems which forced me somehow to export and import stuff back and forth between AbstractAlgebra.Generic and AbstractAlgebra.
| zero(R::UniversalRing{T, U}) where {T, U} = UniversalRingElem{T, U}(zero(base_ring(R)), R) | ||
|
|
||
| one(R::UniversalRing{T, U}) where {T, U} = UniversalRingElem{T, U}(one(base_ring(R)), R) |
There was a problem hiding this comment.
| zero(R::UniversalRing{T, U}) where {T, U} = UniversalRingElem{T, U}(zero(base_ring(R)), R) | |
| one(R::UniversalRing{T, U}) where {T, U} = UniversalRingElem{T, U}(one(base_ring(R)), R) | |
| zero(R::UniversalRing{T, U}) where {T, U} = R(zero(base_ring(R))) | |
| one(R::UniversalRing{T, U}) where {T, U} = R(one(base_ring(R))) |
this should be equivalent but IMO better readable
There was a problem hiding this comment.
Yes, this should be equivalent but this involves an additional coercion check. Shouldn't it be possible to drop the type parameters as well, if we were to do it like you proposed?
| if length(a) != length(b) | ||
| return false | ||
| end | ||
| n1 = nvars(parent(data(a))) |
There was a problem hiding this comment.
why not upgrade here, as in isless below?
There was a problem hiding this comment.
I don't know apparently this is supposed to be faster.
There was a problem hiding this comment.
The fallback is implemented with an upgrade.
This finally introduces the universal ring (#2172). Ideally, I'd like to get this into 0.48. I'm not sure if the hashing is what we want. There is no documentation on what a ring should implement to be a base ring of a universal ring and there are currently no tests which test this for other rings besides multivariate polynomial rings.
Let's see what the tests say, the doctest will fail as I haven't adjusted them yet.