Opened 5 years ago
Last modified 5 years ago
#824 new bug
pSubstPoly() causes crash when called from Singular.jl
Reported by: | steenpass | Owned by: | somebody |
---|---|---|---|
Priority: | minor | Milestone: | 4-2-0 and higher |
Component: | dontKnow | Version: | 4-1-0 |
Keywords: | Cc: |
Description
The following julia code gives an error:
using Cxx using Singular function substitute_variable(p::Singular.spoly{T}, x::Singular.spoly{T}, z::Singular.spoly{T}) where T R = parent(p) index_var = findfirst(Singular.gens(R), x) @assert index_var != 0 p_ptr = p.ptr z_ptr = z.ptr R_ptr = R.ptr res_ptr = icxx""" const ring origin = currRing; rChangeCurrRing($R_ptr); poly res = pSubstPoly(pCopy($p_ptr), $index_var, $z_ptr); // poly res = pSubst(pCopy($p_ptr), $index_var, $z_ptr); rChangeCurrRing(origin); res; """ R(res_ptr) end R = Nemo.ResidueRing(Nemo.FlintZZ, 32003) S, (x_0, x_1) = Singular.PolynomialRing(R, ["x_0", "x_1"]) p = x_0 q = substitute_variable(p, x_0, S(5)); q # this works gc() q # error
Note that this works if pSubstPoly() is replaced by pSubst(), so most likely, Singular does not use the correct API to handle the Nemo coefficients. Therefore, this is probably a bug in the Singular kernel.
Thanks to Bill for tracking this down!
Change History (2)
comment:1 Changed 5 years ago by
comment:2 Changed 5 years ago by
Hi Yue,
true, this would be possible and it's actually a good suggestion. But it doesn't solve the problem that p_SubstPoly() yields an error.
Best, Andreas
Note: See
TracTickets for help on using
tickets.
Hi Andreas,
possibly stupid question: why are you not using p_Copy and p_Subst/p_SubstPoly instead of pCopy and pSubstPoly/pSubst? That way you don't have to change the current ring (I think the latter ones are just shortcuts for calling the former ones with currRing).
best regards, Yue.