Skip to content

Commit

Permalink
mres_with_map for smodule
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes14 committed Sep 1, 2023
1 parent 8eaafd6 commit b3be727
Show file tree
Hide file tree
Showing 2 changed files with 32 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
12 changes: 12 additions & 0 deletions test/resolution/sresolution-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,15 @@ 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, x + 1, x*y + 1, y)
v2 = vector(R, x^2 + 1, 2x + 3y, x)

M = Singular.Module(R, v1, v2)
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 b3be727

Please sign in to comment.