What is the best way to fix the following failing preimage computation,
define in 'computePreimage' a local map lphi?
Code:
system("reference");
system("shared");
proc computeImage( parentRingRef, childRingRef, srcIdealName, dstIdealName )
{
def refRing = basering;
def localChildRing = link(childRingRef);
def localParentRing = link(parentRingRef);
setring localChildRing;
string mapCmd = "def " + dstIdealName + " = phi("+srcIdealName+");";
execute(mapCmd);
string exportCmd = "export( "+dstIdealName+");";
execute( exportCmd );
setring refRing;
kill localChildRing;
kill localParentRing;
return (0);
}
proc computePreimage (parentRingRef,childRingRef, srcIdealName, dstIdealName)
{
def localParentRing = link (parentRingRef);
def localChildRing = link (childRingRef);
def refRing = basering;
setring localParentRing;
string mapCmd = "def " + dstIdealName + " = preimage( localChildRing, phi, " + srcIdealName + ");";
execute( mapCmd );
string exportCmd = "export( " + dstIdealName + " );";
execute( exportCmd );
setring refRing;
kill localChildRing;
kill localParentRing;
return ( 0 );
}
proc testPreimage1()
{
ring parentRing = integer,(x,y,z),dp;
reference parentRingRef = parentRing;
ideal I = x^3+y;
ring childRing = integer,(X(1),X(2)),dp;
reference childRingRef = childRing;
setring childRing;
ideal cX = X(1)^3+X(2);
ideal mapIdeal = X(1),X(2);
export(mapIdeal);
map phi = parentRing, mapIdeal;
export(phi);
computeImage(parentRingRef, childRingRef, "I", "mappedI");
computePreimage(parentRingRef, childRingRef, "cX", "pX");
}
// fails:
testPreimage1();