Skip to content
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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
23 changes: 13 additions & 10 deletions src/Modules/UngradedModules/ModuleGens.jl
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ function (F::FreeMod{<:MPolyRingElem})(s::Singular.svector)
ctx = MPolyBuildCtx(Rx)

# shortcut in order not to allocate the dictionary
# if isone(length(s)) # TODO: length doesn't work!
# (i, e, c) = first(s)
# push_term!(ctx, R(c), e)
# return FreeModElem(sparse_row(Qx, [(i, finish(ctx))]))
# end
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
Expand All @@ -283,18 +283,21 @@ function (F::FreeMod{<:MPolyRingElem})(s::Singular.svector)
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))
Copy link
Member

Choose a reason for hiding this comment

The 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


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)) # TODO: length doesn't work!
# (i, e, c) = first(s)
# push_term!(ctx, R(c), e)
# return FreeModElem(sparse_row(Qx, [(i, Qx(finish(ctx)))]))
# end
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
Expand Down
Loading