Skip to content

Commit

Permalink
add prune_with_map_projection (#751)
Browse files Browse the repository at this point in the history
* add prune_with_map_projection

* test prune_with_map_projection

* Update src/module/module.jl

Co-authored-by: Max Horn <[email protected]>

* docstring for prune_with_map_projection

* Update src/module/module.jl

---------

Co-authored-by: Max Horn <[email protected]>
Co-authored-by: ederc <[email protected]>
  • Loading branch information
3 people authored Jan 23, 2024
1 parent 99dc516 commit f57e226
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/module/module.jl
Original file line number Diff line number Diff line change
@@ -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

###############################################################################
#
Expand Down Expand Up @@ -407,6 +408,23 @@ 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
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`
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)
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
Expand Down
5 changes: 5 additions & 0 deletions test/module/smodule-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f57e226

Please sign in to comment.