Annegret Weng on Tue, 27 Jun 2000 20:31:52 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Garbage collection


Dear PARI Lovers,

I have a problem with my stack. Sometimes I get the error:
          
            the PARI stack overflows !

I think I found the part of my program which is responsible for it but I
do not know what to do. The program itself works and if I do not get the
error I get the right answer. My only problem is the stack. 

I wrote the following function:

GEN summand(GEN matrix, GEN delta, GEN epsilon, GEN ganz_vector, int prec)
{
  long ltop;
  
  /*some calculation - I think this is not important to find my problem
  but maybe it helps*/
  GEN zwischen1,zwischen2;
  GEN vector1=gadd(delta,ganz_vector);
  zwischen1=gmul(gmul(vector1,matrix),gtrans(vector1));
  zwischen2=gmul(gdeux,gmul(vector1,gtrans(epsilon)));
  zwischen1=gadd(zwischen1,zwischen2);
  zwischen1=gmul(gmul(zwischen1,gi),mppi(prec));
  
  ltop=avma;
  return gerepileupto(ltop,gexp(zwischen1,prec));
}

Then I have a command 

(*)  ltop=avma;
     summe=gerepileupto(ltop,gadd(summe,(GEN) 
summand(omega,delta,epsilon,x_vector,prec)));


I have initialized "summe" before.
Now I put 

   cout << avma << endl;

before and after the lines (*) and I can see that the value of avma has
increased. Why?  I haven't created any new variable. If I do not have the
gerepileupto-command in (*) it is worse.

The value of avma increases between 20 and 60. This is not very much but I
am running through a loop and it sums up. So at the end I get the error
stated above.

Thank you very much for every help!

Best regards,
Annegret Weng