Skip to content

Commit

Permalink
Merge pull request #705 from hannes14/hs/mres_with_map
Browse files Browse the repository at this point in the history
mres_with_map for smodule
  • Loading branch information
ederc authored Sep 6, 2023
2 parents 8601fa2 + 7566d61 commit 06dc843
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/module/module.jl
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,26 @@ function mres(I::smodule{spoly{T}}, max_length::Int) where T <: Nemo.FieldElem
return sresolution{spoly{T}}(R, r, Bool(minimal), false)
end

@doc raw"""
mres_with_map(id::smodule{spoly{T}}, max_length::Int) where T <: Nemo.FieldElem
Compute a minimal (free) resolution of the given module up to the maximum
given length. The module must be over a polynomial ring over a field.
The result is given as a resolution, whose i-th entry is
the syzygy module of the previous module, starting with the given module.
The `max_length` can be set to $0$ if the full free resolution is required.
Returns the resolution R and the transformation matrix of id to R[1].
"""
function mres_with_map(I::smodule{spoly{T}}, max_length::Int) where T <: Nemo.FieldElem
R = base_ring(I)
if max_length == 0
max_length = nvars(R)
# TODO: consider qrings
end
r, TT_ptr = GC.@preserve I R libSingular.id_mres_map(I.ptr, Cint(max_length + 1), R.ptr)
return sresolution{spoly{T}}(R, r, true, false),smatrix{spoly{T}}(R,TT_ptr)
end

@doc raw"""
nres(id::smodule{spoly{T}}, max_length::Int) where T <: Nemo.FieldElem
Expand Down
13 changes: 13 additions & 0 deletions test/resolution/sresolution-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,16 @@ end
@test iszero(M1*M2)
@test iszero(M2*M3)
end

@testset "sresolution.mres_module" begin
R, (x, y) = polynomial_ring(QQ, ["x", "y"])

v1 = vector(R, y )
v2 = vector(R, x)
v3 = vector(R, x+y)

M = Singular.Module(R, v1, v2, v3)
L,TT = mres_with_map(M,0)
@test iszero(Singular.Matrix(M)*TT-Singular.Matrix(L[1]))
@test iszero(Singular.Matrix(L[1])*Singular.Matrix(L[2]))
end

0 comments on commit 06dc843

Please sign in to comment.