Exemple #1
0
void
pari_var_init(void)
{
  long i;
  varentries = (entree**) pari_calloc((MAXVARN+1)*sizeof(entree*));
  varpriority = (long*)pari_malloc((MAXVARN+2)*sizeof(long)) + 1;
  varpriority[-1] = 1-LONG_MAX;
  h_polvar = hash_create_str(100, 0);
  nvar = 0; max_avail = MAXVARN;
  max_priority = min_priority = 0;
  (void)fetch_user_var("x");
  (void)fetch_user_var("y");
  /* initialize so that people can use pol_x(i) directly */
  for (i = 2; i <= (long)MAXVARN; i++) varpriority[i] = -i;
  /* reserve varnum 1..9 for static temps with predictable priority wrt x */
  nvar = 10;
  min_priority = -MAXVARN;
}
void
init_test(void)	  /* void */
{
  GEN p1;
  GEN p2;	  /* vec */
  p = pol_x(fetch_user_var("p"));
  d = pol_x(fetch_user_var("d"));
  f = pol_x(fetch_user_var("f"));
  /*allocatemem(800000000); */
  p = stoi(65537);
  d = gadd(genrand(powis(gen_2, 7)), powis(gen_2, 7));
  p1 = gaddgs(d, 1);
  {
    long x;
    p2 = cgetg(gtos(p1)+1, t_VEC);
    for (x = 1; gcmpsg(x, p1) <= 0; ++x)
      gel(p2, x) = genrand(p);
  }
  f = p2;
  gel(f, 1) = gen_1;
  f = gtopoly(f, -1);
  return;
}