Skip to content

Commit

Permalink
add prune_with_map
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes14 committed Dec 4, 2023
1 parent ed40378 commit df11ddd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Pidfile = "1.3"
Pkg = "1.6"
Random = "1.6"
RandomExtensions = "0.4.2"
Singular_jll = "~403.210.1000"
Singular_jll = "~403.211.1100"
Statistics = "1.6"
julia = "1.6"
lib4ti2_jll = "1.6.10"
Expand Down
6 changes: 3 additions & 3 deletions deps/src/ideals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ auto id_mres_map_helper(sip_sideal * I, int n, ring R)
return std::make_tuple(s, TT);
}

auto id_prune_map_helper(sip_sideal * I, ring R)
auto id_prune_map_v_helper(sip_sideal * I, int* v, ring R)
{
auto origin = currRing;
rChangeCurrRing(R);
ideal T;
ideal s = idMinEmbedding_with_map(I, NULL, T);
ideal s = idMinEmbedding_with_map_v(I, NULL, T, v);
matrix TT = id_Module2Matrix(T, currRing);
rChangeCurrRing(origin);
return std::make_tuple(s, TT);
Expand Down Expand Up @@ -404,7 +404,7 @@ void singular_define_ideals(jlcxx::Module & Singular)

Singular.method("id_res", &id_res_helper);
Singular.method("id_mres_map", &id_mres_map_helper);
Singular.method("id_prune_map", &id_prune_map_helper);
Singular.method("id_prune_map_v", &id_prune_map_v_helper);

Singular.method("id_Slimgb", &id_Slimgb_helper);

Expand Down
16 changes: 10 additions & 6 deletions src/module/module.jl
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,20 @@ function mres_with_map(I::smodule{spoly{T}}, max_length::Int) where T <: Nemo.Fi
end

@doc raw"""
prune_with_map(id::smodule{spoly{T}}) where T <: Nemo.FieldElem
prune_with_map(I::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
and the transformation matrix of id to R.
Returns the module N minimally embedded in a free module such that the
corresponding factor modules are isomorphic. Returns
the transformation matrix M of I to N, and a map of generators A:
R^n/I -- M --> R^n/N -- A --> R^n'/A(N).
A maps as: gen(i) -> gen(A[i])
"""
function prune_with_map(I::smodule{spoly{T}}) where T <: Nemo.FieldElem
R = base_ring(I)
r, TT_ptr = GC.@preserve I R libSingular.id_prune_map(I.ptr, R.ptr)
return smodule{spoly{T}}(R, r),smatrix{spoly{T}}(R,TT_ptr)
n = rank(I)
A = Array{Int}(undef, n)
r, TT_ptr = GC.@preserve I R libSingular.id_prune_v_map(I.ptr, A, R.ptr)
return smodule{spoly{T}}(R, r),smatrix{spoly{T}}(R,TT_ptr),A
end

@doc raw"""
Expand Down

0 comments on commit df11ddd

Please sign in to comment.