-
Notifications
You must be signed in to change notification settings - Fork 120
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
Some more fixes #4142
base: master
Are you sure you want to change the base?
Some more fixes #4142
Conversation
experimental/DoubleAndHyperComplexes/src/Morphisms/simplified_complexes.jl
Outdated
Show resolved
Hide resolved
Yes, I'm already working on it. It's a bit annoying, because I had to work on the compute-server today, but there I can't put my login-credentials for GH. Thus, I manually copied the files via scp and this is what you get... |
f27b4d0
to
93c4575
Compare
@@ -1149,7 +1170,14 @@ function minimal_primes( | |||
end | |||
J = K | |||
end | |||
result = unique!(filter!(!is_one, vcat([minimal_primes(j; algorithm, factor_generators=false) for j in J]...))) | |||
# unique! seems to fail here. We have to do it manually. | |||
pre_result = filter!(!is_one, vcat([minimal_primes(j; algorithm, factor_generators=false) for j in J]...)) |
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.
pre_result = filter!(!is_one, vcat([minimal_primes(j; algorithm, factor_generators=false) for j in J]...)) | |
pre_result = filter!(!is_one, reduce(vcat, [minimal_primes(j; algorithm, factor_generators=false) for j in J])) |
save some allocations
src/Rings/mpoly-ideals.jl
Outdated
# Since most ideals implement `==`, they have to implement the hash function. | ||
# See issue #4143 for problems entailed. Interestingly, this does not yet fix | ||
# the failure of unique! on lists of ideals. | ||
function hash(I::Ideal, c::UInt) | ||
return hash(typeof(I), hash(base_ring(I), c)) | ||
end |
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.
I advocate for this solution now. It is a matter of fact that ideals can not be hashed in general and even for polynomial rings this is probably expensive if not impossible (we need to choose an ordering which might be a dead end for a specific ideal). Yet, the ==
function is vital to how we use ideals and we need to be able to use them in vectors/lists/dictionaries.
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.
Is it safe to hash the type? After all two mathematically equal objects may have different types.
(Thinking e.g. of IdealSheaf, RadicalIdealSheaf, PrimeIdealSheaf etc.)
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.
Is it safe to hash the type? After all two mathematically equal objects may have different types. (Thinking e.g. of IdealSheaf, RadicalIdealSheaf, PrimeIdealSheaf etc.)
It is only safe if you don't implement ==
between this type and other types. In your example, you shouldn't include the type in hashes.
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.
Ok, good to know. I was only following the suggestion by @benlorenz . But you're probably right.
Co-authored by afkafkafk13
On Fri, Sep 27, 2024 at 01:30:28AM -0700, Simon Brandhorst wrote:
@simonbrandhorst commented on this pull request.
> +# Since most ideals implement `==`, they have to implement the hash function.
+# See issue #4143 for problems entailed. Interestingly, this does not yet fix
+# the failure of unique! on lists of ideals.
+function hash(I::Ideal, c::UInt)
+ return hash(typeof(I), hash(base_ring(I), c))
+end
Is it safe to hash the type? After all two mathematically equal objects may have different types.
(Thinking e.g. of IdealSheaf, RadicalIdealSheaf, PrimeIdealSheaf etc.)
Tough one: Julia tries/ tried to make sure any number comparing equal
have the same hash. We don't - way too expensive.
Is there any situation where you want a dict or a set where the keys/
elements are different types and then catch that 2 objects of different
types are "the same"?
…
--
Reply to this email directly or view it on GitHub:
#4142 (comment)
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
Probably yes. For instance, it would make sense to introduce a lazy type for radical ideals, say |
Today's harvest from working on the elliptic surfaces.