From 9c76b52599f19b534ca6b0754e3e77304b77f6df Mon Sep 17 00:00:00 2001 From: Hans Schoenemann Date: Mon, 22 Jan 2024 14:27:07 +0100 Subject: [PATCH 1/5] add prune_with_map_projection --- src/module/module.jl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/module/module.jl b/src/module/module.jl index af52fb695..1d5a83d8d 100644 --- a/src/module/module.jl +++ b/src/module/module.jl @@ -1,5 +1,6 @@ export jet, minimal_generating_set, ModuleClass, rank, smodule, slimgb, - eliminate, modulo, lift, division, divrem, prune_with_map + eliminate, modulo, lift, division, divrem, prune_with_map, + prune_with_map_projection ############################################################################### # @@ -407,6 +408,21 @@ function prune_with_map(I::smodule{spoly{T}}) where T <: Nemo.FieldElem return smodule{spoly{T}}(R, r),smatrix{spoly{T}}(R,TT_ptr) end +@doc raw""" + prune_with_map_projection(id::smodule{spoly{T}}) where T <: Nemo.FieldElem + +Returns the module R minimally embedded in a free module such that the +corresponding factor modules are isomorphic, +the transformation matrix of id to R and a projection p +which maps gen(i) to gen(p[i]). +""" +function prune_with_map_projection(I::smodule{spoly{T}}) where T <: Nemo.FieldElem + R = base_ring(I) + a = Vector{Int32}() + r, TT_ptr = GC.@preserve I R libSingular.id_prune_map_v(I.ptr, a, R.ptr) + return smodule{spoly{T}}(R, r),smatrix{spoly{T}}(R,TT_ptr),a +end + @doc raw""" nres(id::smodule{spoly{T}}, max_length::Int) where T <: Nemo.FieldElem From fb7a0cdcb22ae3e4faaacdd40145714833ddbba2 Mon Sep 17 00:00:00 2001 From: Hans Schoenemann Date: Mon, 22 Jan 2024 14:41:54 +0100 Subject: [PATCH 2/5] test prune_with_map_projection --- test/module/smodule-test.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/module/smodule-test.jl b/test/module/smodule-test.jl index b5c6c293f..46c0ffe8a 100644 --- a/test/module/smodule-test.jl +++ b/test/module/smodule-test.jl @@ -324,4 +324,9 @@ end @test G[1] == vector(R, z) @test T[3,1] == R(1) + G,T,p = prune_with_map_projection(M) + @test p[1] == 1 + @test p[2] == 1 + @test p[3] == 2 + end From afb211e344a77b6c8bfb28e06afa377bfa07b14f Mon Sep 17 00:00:00 2001 From: Hans Schoenemann Date: Mon, 22 Jan 2024 14:55:46 +0100 Subject: [PATCH 3/5] Update src/module/module.jl Co-authored-by: Max Horn --- src/module/module.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module/module.jl b/src/module/module.jl index 1d5a83d8d..baa8f865a 100644 --- a/src/module/module.jl +++ b/src/module/module.jl @@ -411,7 +411,7 @@ end @doc raw""" prune_with_map_projection(id::smodule{spoly{T}}) where T <: Nemo.FieldElem -Returns the module R minimally embedded in a free module such that the +Return the module `R` minimally embedded in a free module such that the corresponding factor modules are isomorphic, the transformation matrix of id to R and a projection p which maps gen(i) to gen(p[i]). From 8cc02b79110af87d856d71ebfacf7e2fd55f1c60 Mon Sep 17 00:00:00 2001 From: Hans Schoenemann Date: Mon, 22 Jan 2024 15:30:51 +0100 Subject: [PATCH 4/5] docstring for prune_with_map_projection --- src/module/module.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/module/module.jl b/src/module/module.jl index baa8f865a..b32dc281b 100644 --- a/src/module/module.jl +++ b/src/module/module.jl @@ -411,10 +411,12 @@ end @doc raw""" prune_with_map_projection(id::smodule{spoly{T}}) where T <: Nemo.FieldElem -Return the module `R` minimally embedded in a free module such that the -corresponding factor modules are isomorphic, -the transformation matrix of id to R and a projection p -which maps gen(i) to gen(p[i]). +Returns a module `R`, a transformation matrix `M` and a projection map `p` +satisfying the following properties: `R` is minimally embedded in a free +module `parent(R)` such that the quotient `parent(R)/R` is isomorphic to +`parent(id)/id`, with `M` together with the projection given by the vector `p` +describing this isomorphism. +`p` maps `gen(parent(id),i)` to `gen(parent(R),p[i])` """ function prune_with_map_projection(I::smodule{spoly{T}}) where T <: Nemo.FieldElem R = base_ring(I) From ee96d7540aad51dbe234d29a362272f99e584cee Mon Sep 17 00:00:00 2001 From: ederc Date: Mon, 22 Jan 2024 19:36:35 +0100 Subject: [PATCH 5/5] Update src/module/module.jl --- src/module/module.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module/module.jl b/src/module/module.jl index b32dc281b..f780674d8 100644 --- a/src/module/module.jl +++ b/src/module/module.jl @@ -411,7 +411,7 @@ end @doc raw""" prune_with_map_projection(id::smodule{spoly{T}}) where T <: Nemo.FieldElem -Returns a module `R`, a transformation matrix `M` and a projection map `p` +Return a module `R`, a transformation matrix `M` and a projection map `p` satisfying the following properties: `R` is minimally embedded in a free module `parent(R)` such that the quotient `parent(R)/R` is isomorphic to `parent(id)/id`, with `M` together with the projection given by the vector `p`