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 - Access local ring elements outside the procedure
Author Message
  Post subject:  Re: Access local ring elements outside the procedure  Reply with quote
One can not return (from a procedure) an object belonging to a ring which did not exist at the start of the procedure.
What you can do:
inside your procedure:
- create a ring inside the procedure
- create an object in this ring
- export the object (so it will not destroyed at the end of the procedure)
- return the ring
after the return:
- change into the returned ring
- access the object
see for an example: solve from solve.lib
Post Posted: Thu Apr 11, 2019 4:34 pm
  Post subject:  Access local ring elements outside the procedure  Reply with quote
I am writing a small procedure. I am defining a ring inside the procedure (depending upon the parameter to the proc). The some computations are done and then procedure returns objects in this ring. Here is a sample code:

Code:
    LIB "ring.lib";
    int p = 7; // primality of p or prime power is checked beforehand.
   
    proc mytest( int n )
    {
        ring Qz = (0,z),x,dp;
        minpoly = rootofUnity( n );
        poly i = z^(n-1);
        return (i);
    }
    ring dummy;
    mytest(7);

I am getting the following message:
Quote:
? ring change during procedure call test: dummy -> Qz (level 1)

I also tried with `export Qz`, just before return, but doesnt help. Any solution?

Not sure if this is relevant: It seems the command `test` is already defined!!!
Code:
> test(4);
// ** Gerhard, use the option command
>



-- VInay
Post Posted: Thu Apr 11, 2019 8:36 am


It is currently Fri May 13, 2022 10:57 am
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group