Skip to content

Commit

Permalink
set_option("..",bool,ring)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes14 committed Jun 14, 2024
1 parent adf1630 commit 721c1a8
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 8 deletions.
66 changes: 66 additions & 0 deletions deps/src/singular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,72 @@ JLCXX_MODULE define_julia_module(jlcxx::Module & Singular)
}
return old_value;
});
// all of the global setters return the previous value
Singular.method("set_option", [](std::string opt, bool value, ring r) {
bool old_value = false;
ring oldring=currRing;
if (r!=NULL) rChangeCurrRing(r);
if (false)
;
SETTER(si_opt_2, V_QUIET)
SETTER(si_opt_2, V_QRING)
SETTER(si_opt_2, V_SHOW_MEM)
SETTER(si_opt_2, V_YACC)
SETTER(si_opt_2, V_REDEFINE)
SETTER(si_opt_2, V_LOAD_LIB)
SETTER(si_opt_2, V_DEBUG_LIB)
SETTER(si_opt_2, V_LOAD_PROC)
SETTER(si_opt_2, V_DEF_RES)
SETTER(si_opt_2, V_SHOW_USE)
SETTER(si_opt_2, V_IMAP)
SETTER(si_opt_2, V_PROMPT)
SETTER(si_opt_2, V_NSB)
SETTER(si_opt_2, V_CONTENTSB)
SETTER(si_opt_2, V_CANCELUNIT)
SETTER(si_opt_2, V_MODPSOLVSB)
SETTER(si_opt_2, V_UPTORADICAL)
SETTER(si_opt_2, V_FINDMONOM)
SETTER(si_opt_2, V_COEFSTRAT)
SETTER(si_opt_2, V_IDLIFT)
SETTER(si_opt_2, V_LENGTH)
SETTER(si_opt_2, V_ALLWARN)
SETTER(si_opt_2, V_INTERSECT_ELIM)
SETTER(si_opt_2, V_INTERSECT_SYZ)
SETTER(si_opt_2, V_DEG_STOP)

SETTER(si_opt_1, OPT_PROT)
SETTER(si_opt_1, OPT_REDSB)
SETTER(si_opt_1, OPT_NOT_BUCKETS)
SETTER(si_opt_1, OPT_NOT_SUGAR)
SETTER(si_opt_1, OPT_INTERRUPT)
SETTER(si_opt_1, OPT_SUGARCRIT)
SETTER(si_opt_1, OPT_DEBUG)
SETTER(si_opt_1, OPT_REDTHROUGH)
SETTER(si_opt_1, OPT_NO_SYZ_MINIM)
SETTER(si_opt_1, OPT_RETURN_SB)
SETTER(si_opt_1, OPT_FASTHC)
SETTER(si_opt_1, OPT_OLDSTD)
SETTER(si_opt_1, OPT_STAIRCASEBOUND)
SETTER(si_opt_1, OPT_MULTBOUND)
SETTER(si_opt_1, OPT_DEGBOUND)
SETTER(si_opt_1, OPT_REDTAIL)
SETTER(si_opt_1, OPT_INTSTRATEGY)
SETTER(si_opt_1, OPT_FINDET)
SETTER(si_opt_1, OPT_INFREDTAIL)
SETTER(si_opt_1, OPT_SB_1)
SETTER(si_opt_1, OPT_NOTREGULARITY)
SETTER(si_opt_1, OPT_WEIGHTM)
else
{
std::cerr << "unknown option " << opt << std::endl;
}
if (r!=NULL)
{
r->options=si_opt_1;
rChangeCurrRing(oldring);
}
return old_value;
});

#undef SETTER

Expand Down
8 changes: 4 additions & 4 deletions src/ideal/ideal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -847,12 +847,12 @@ from the identity matrix only for local ring orderings.
function divrem(I::sideal{S}, G::sideal{S}; complete_reduction::Bool = false) where S <: SPolyUnion
check_parent(I, G)
R = base_ring(I)
old_redsb=libSingular.set_option("OPT_REDSB",complete_reduction)
old_redtail=libSingular.set_option("OPT_REDTAIL",complete_reduction)
old_redsb=libSingular.set_option("OPT_REDSB",complete_reduction,R.ptr)
old_redtail=libSingular.set_option("OPT_REDTAIL",complete_reduction,R.ptr)
ptr_T,ptr_Rest,ptr_U = GC.@preserve I G R libSingular.id_Lift(G.ptr, I.ptr, true,
false, true, R.ptr)
libSingular.set_option("OPT_REDSB",old_redsb)
libSingular.set_option("OPT_REDTAIL",old_redtail)
libSingular.set_option("OPT_REDSB",old_redsb,R.ptr)
libSingular.set_option("OPT_REDTAIL",old_redtail,R.ptr)
return (smodule{S}(R,ptr_T), sideal{S}(R,ptr_Rest), smodule{S}(R,ptr_U))
end

Expand Down
8 changes: 4 additions & 4 deletions src/module/module.jl
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@ from the identity matrix only for local ring orderings.
function divrem(I::smodule{S}, G::smodule{S}; complete_reduction::Bool = false) where S <: SPolyUnion
check_parent(I, G)
R = base_ring(I)
old_redsb=libSingular.set_option("OPT_REDSB",complete_reduction)
old_redtail=libSingular.set_option("OPT_REDTAIL",complete_reduction)
old_redsb=libSingular.set_option("OPT_REDSB",complete_reduction,R.ptr)
old_redtail=libSingular.set_option("OPT_REDTAIL",complete_reduction,R.ptr)
ptr_T,ptr_Rest,ptr_U = GC.@preserve I G R libSingular.id_Lift(G.ptr, I.ptr, true,
false, true, R.ptr)
libSingular.set_option("OPT_REDSB",old_redsb)
libSingular.set_option("OPT_REDTAIL",old_redtail)
libSingular.set_option("OPT_REDSB",old_redsb,R.ptr)
libSingular.set_option("OPT_REDTAIL",old_redtail,R.ptr)
return (smodule{S}(R,ptr_T), smodule{S}(R,ptr_Rest), smodule{S}(R,ptr_U))
end

Expand Down

0 comments on commit 721c1a8

Please sign in to comment.