-
Notifications
You must be signed in to change notification settings - Fork 133
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
Resolution structure (and curve case) #3480
Conversation
Some tests still need to be adjusted. But other than that, I think this is rather fine as a working base. The adjustments can be made in the end, or at any time where we would like to have a good picture of the test suite. |
Thank you for the help and the preparation for monday. |
Currently untested: Framework for handling embedded setting. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #3480 +/- ##
==========================================
- Coverage 82.10% 82.10% -0.01%
==========================================
Files 566 567 +1
Lines 76123 76615 +492
==========================================
+ Hits 62504 62901 +397
- Misses 13619 13714 +95
|
Co-authored-by: Matthias Zach <[email protected]>
Co-authored-by: Matthias Zach <[email protected]>
Co-authored-by: Matthias Zach <[email protected]>
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.
@afkafkafk13 asked me to have a look at the technical side of this PR (I can't comment on the math). Overall it seems fine to me. I left a few suggestions, but they are mostly optional (maybe handle the one with the many calls to maps
which each allocate, but even that can be done later if you prefer)
len=length(maps(phi)) | ||
result=underlying_morphism(maps(phi)[1]) | ||
for i in 2:len | ||
result = compose(underlying_morphism(maps(phi)[i]), result) | ||
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.
If I understand your code right, then maps(phi)
each time returns a fresh copy of the vector maps. So better to call it only once. (This might affect other places, too, I didn't check)
len=length(maps(phi)) | |
result=underlying_morphism(maps(phi)[1]) | |
for i in 2:len | |
result = compose(underlying_morphism(maps(phi)[i]), result) | |
end | |
m = maps(phi) | |
len = length(m) | |
result = underlying_morphism(m[1]) | |
for i in 2:len | |
result = compose(underlying_morphism(m[i]), result) | |
end |
Alrernatively you could also use mapreduce
here:
len=length(maps(phi)) | |
result=underlying_morphism(maps(phi)[1]) | |
for i in 2:len | |
result = compose(underlying_morphism(maps(phi)[i]), result) | |
end | |
result = mapreduce(underlying_morphism, compose, maps(phi)) |
That should be equivalent... maybe the loop is clearer, though. Just wanted to mention it as an option
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 suggest not to return the fully composed morphism here, but an instance of CompositeCoveredSchemeMorphism
. Everything is already implemented for that one and like this all the special functionality for the latter will automatically be harvested.
@fingolfin : Thanks for having a look. I agree with your suggestions. Concerning the maps: I propose to introduce a method |
If IMHO at the very least this needs to be run by @fieker and @thofma. |
@@ -3,6 +3,36 @@ export center | |||
export exceptional_divisor | |||
export projection | |||
|
|||
@doc raw""" | |||
AbsDesingMor{ |
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.
AbsDesingMor{ | |
AbsDesingMor{ |
Please consider renaming to AbsDesingularizationMor
.
################################################################################################## | ||
# getters | ||
################################################################################################## | ||
maps(phi::AbsDesingMor) = copy(phi.maps) |
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.
Why copy? Typically our getters do not copy stuff. The user should assume that anything returned is unsafe to mutate?
... but it is a common pitfall
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.
@afkafkafk13 and I have talked about this. I suggested to return a copy. Otherwise, the chances are high that unsafe code leads to a mess with the internals of the structure. And this tends to be almost impossible to debug. The way to solve this, is to provide the getter with the index and encourage the user to use that instead of creating copies all over the place.
And I could live with morphisms
and morphism
below.
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.
taking your other suggestions for morphisms
instead of maps
into account, I would go for
morphisms(phi::AbsDesingMor) = phi.maps
morphisms_copy(phi::AbsDesingMor) = copy(phi.maps)
morphism(phi::AbsDesingMor, i::Int) = phi.maps[i]
Do you agree? Note that morphisms_copy is necessary at certain places, because the desingularization has to modify it by appending. I will carefully go through the existing code and change to morphisms_copy precisely, where it is necessary.
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.
No morphisms_copy
, please! morphisms
should create a copy each time and not give access to the internals. Such things have proved to be devastating in many instances. IMHO saving memory allocations has to be achieved by other means and this is also possible, e.g. by encouraging the use of morphism(phi, i)
.
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.
Typically our getters do not copy stuff.
I do not think that this is true. Even gens
for polynomial rings usually creates a copy. And it does so for good reasons.
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 then just morphisms(phi) and morphism(phi,i) giving back copies. I will make the appropriate changes.
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.
best rename .maps
to .morphisms
as well for consistency.
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.
Regarding copy
in morphisms
(and similar elsewhere in gens
etc.): for OSCAR 2.0 we could consider using a type like the one defined in https://github.com/bkamins/ReadOnlyArrays.jl which implements the AbstractArray
/ AbstractVector
interface by wrapping an existing array/vector and passing all operations through -- except anything that writes to the vector. The whole thing is basically "free" in terms of overhead.
But the downside is that the result is not a Vector
anymore -- code which accepts AbstractVector
will keep working, but surely a lot of code will need (trivial) adjustments -- hence this can't go into Oscar 1.x
In this regard, it would be much better if Array
just had a bit flag that turned any attempt to write to it into an error
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.
best rename
.maps
to.morphisms
as well for consistency.
That was part of the content of my last statement.
How about replacing |
@afkafkafk13 : I took the liberty to implement the In particular, I resolved the suggestion about the underlying morphism which I pointed out above. |
previously: Only for collaboration on this task!
Now: structure of desingularization framework plus curve case with naive choice of center as the testing ground for the structure