-
Notifications
You must be signed in to change notification settings - Fork 126
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
Adds free resolutions over quotient rings by using Singular.sres
#4134
Merged
afkafkafk13
merged 17 commits into
oscar-system:master
from
RafaelDavidMohr:rm/fres-quotient-ring
Sep 30, 2024
Merged
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6b9dcc6
adapt module gens to quotient rings
RafaelDavidMohr f8a555b
adjusts signatures of `prune_with_map` and `_presentation_minimal`
RafaelDavidMohr 3d35d0a
Merge branch 'master' into rm/fres-quotient-ring
RafaelDavidMohr 6925b56
compute free resolutions over quotients with sres
RafaelDavidMohr f47f456
updates docu
RafaelDavidMohr 14c7ab3
adds test
RafaelDavidMohr 452dd02
fix tests
RafaelDavidMohr 8588359
fix another test
RafaelDavidMohr 71cbe8c
Add dispatch for singular-to-oscar conversion [no ci].
HechtiDerLachs 5c2a895
Enable length shortcut.
HechtiDerLachs bb81af4
Update src/Modules/UngradedModules/ModuleGens.jl
HechtiDerLachs 16985d5
Fix tests.
HechtiDerLachs 846a464
fix test
RafaelDavidMohr 11bf9f4
fix test
RafaelDavidMohr de3ec65
fix test
RafaelDavidMohr 3db4e44
Bump Singular compat
lgoettgens 64f6b44
Update src/Modules/UngradedModules/ModuleGens.jl
lgoettgens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,22 +261,52 @@ end | |
|
||
Convert a Singular vector to a free module element. | ||
""" | ||
function (F::FreeMod)(s::Singular.svector) | ||
pos = Int[] | ||
values = [] | ||
function (F::FreeMod{<:MPolyRingElem})(s::Singular.svector) | ||
Rx = base_ring(F) | ||
R = base_ring(Rx) | ||
for (i, e, c) = s | ||
f = Base.findfirst(==(i), pos) | ||
if f === nothing | ||
push!(values, MPolyBuildCtx(base_ring(F))) | ||
f = length(values) | ||
push!(pos, i) | ||
R = coefficient_ring(Rx) | ||
ctx = MPolyBuildCtx(Rx) | ||
|
||
# shortcut in order not to allocate the dictionary | ||
if isone(length(s)) | ||
(i, e, c) = first(s) | ||
push_term!(ctx, R(c), e) | ||
return FreeModElem(sparse_row(Qx, [(i, finish(ctx))])) | ||
HechtiDerLachs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end | ||
|
||
cache = IdDict{Int, typeof(ctx)}() | ||
for (i, e, c) in s | ||
ctx = get!(cache, i) do | ||
MPolyBuildCtx(Rx) | ||
end | ||
push_term!(ctx, R(c), e) | ||
end | ||
return FreeModElem(sparse_row(Rx, [(i, finish(ctx)) for (i, ctx) in cache]), F) | ||
end | ||
|
||
# TODO: move this eventually | ||
length(s::Singular.svector) = Int(Singular.libSingular.pLength(s.ptr)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move this to Singular.jl before merging this PR. Sorting this out afterwards is more of a hassle than doing it right the first time
lgoettgens marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
function (F::FreeMod{<:MPolyQuoRingElem})(s::Singular.svector) | ||
Qx = base_ring(F)::MPolyQuoRing | ||
Rx = base_ring(Qx)::MPolyRing | ||
R = coefficient_ring(Rx) | ||
ctx = MPolyBuildCtx(Rx) | ||
|
||
# shortcut in order not to allocate the dictionary | ||
if isone(length(s)) | ||
(i, e, c) = first(s) | ||
push_term!(ctx, R(c), e) | ||
return FreeModElem(sparse_row(Qx, [(i, Qx(finish(ctx)))])) | ||
end | ||
|
||
cache = IdDict{Int, typeof(ctx)}() | ||
for (i, e, c) in s | ||
ctx = get!(cache, i) do | ||
MPolyBuildCtx(Rx) | ||
end | ||
push_term!(values[f], R(c), e) | ||
push_term!(ctx, R(c), e) | ||
end | ||
pv = Tuple{Int, elem_type(Rx)}[(pos[i], base_ring(F)(finish(values[i]))) for i=1:length(pos)] | ||
return FreeModElem(sparse_row(base_ring(F), pv), F) | ||
return FreeModElem(sparse_row(Qx, [(i, Qx(finish(ctx))) for (i, ctx) in cache]), F) | ||
end | ||
|
||
# After creating the required infrastruture in Singular, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Singular's sres sets a default of nvars(basering) modules to be computed, if no length is specified. It might be better for compatibility to document this fallback instead of throwing 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.
Thank you for taking a look. Having this default nvars(basering) length is the same they had in Macaulay2, they told me that they removed this at some point for clarity for the users.
But if you prefer to have this default, I will of course make the appropriate changes.