Post a reply
Username:
Note:If not registered, provide any username. For more comfort, register here.
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:
Font size:
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.
   

Topic review - using references to rings and preimage computing
Author Message
  Post subject:  Re: using references to rings and preimage computing  Reply with quote
hannes wrote:
If you want to fix it, export parentRing.

To avoid usage of global variables,
my solution was to define a local map object in the procedure instead
utilizing the 'mapIdeal'.

What amount of overhead is produced by creating a map object?
Are the entries of 'mapIdeal' copied each time?
Post Posted: Mon Jul 01, 2013 1:49 pm
  Post subject:  Re: using references to rings and preimage computing  Reply with quote
hannes wrote:
[...] Another point: assignment of rings is always via reference, no need to
use system(reference) or system(shared) for that.


Are you sure, that there is no need for ring references?

It was for me impossible to set ring attributes without using references:

Code:
system("reference");

proc setAttrib( rng, attrubuteName, attributeVal)
{
   attrib( rng, attrubuteName, attributeVal);
}

proc setAttribOfRef( pRngRef, attrubuteName, attributeVal)
{
   attrib( pRngRef ,attrubuteName, attributeVal);
}


proc minimalExample()
{
   string attributeName = "name";
   string attributeVal  = "it works!";

   ring parentRing = integer,(x,y,z),dp;
   
   setAttrib( parentRing,attributeName,attributeVal);
   if ( attrib( parentRing, attributeName )<> attributeVal ) 
   { print("setting attrubute by passing ordinary copy failed"); }
   else   { print("setting attrubute by passing ordinary copy succeeded"); }

   reference rngRef =  parentRing;

   setAttribOfRef(  rngRef,attributeName,attributeVal);
   if ( attrib( parentRing, attributeName )<> attributeVal ) 
   { print("setting attrubute by passing reference failed"); }
   else  { print("setting attrubute by passing reference succeeded !"); }
}


minimalExample();
Post Posted: Mon Jul 01, 2013 12:43 am
  Post subject:  Re: using references to rings and preimage computing  Reply with quote
The preimage ring of phi (parentRing) is a local variable of testPreimage1
and therefore not available in computeImage.

If you want to fix it, export parentRing.

Another point: assignment of rings is always via reference, no need to
use system(reference) or system(shared) for that.
Post Posted: Fri Jun 28, 2013 3:22 am
  Post subject:  using references to rings and preimage computing  Reply with quote
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();

Post Posted: Thu Jun 27, 2013 11:44 am


It is currently Sun Dec 17, 2017 9:34 pm
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group