18#define CHECK_IDEAL_MWALK  
   23#define INVEPS_SMALL_IN_FRACTAL   
   24#define INVEPS_SMALL_IN_MPERTVECTOR   
   25#define INVEPS_SMALL_IN_TRAN   
   27#define FIRST_STEP_FRACTAL  
   91VAR clock_t xtif, xtstd, xtlift, xtred, xtnw;
 
   92VAR clock_t xftostd, xtextra, xftinput, to;
 
  105  return (
unsigned long*)
omAlloc0(maxnr*
sizeof(
unsigned long));
 
  109  return (
int*)
omAlloc0(maxnr*
sizeof(
int));
 
  349  ideal shdl=strat->
Shdl;
 
  357static void TimeString(clock_t tinput, clock_t tostd, clock_t tif,clock_t tstd,
 
  358                       clock_t tlf,clock_t tred, clock_t tnw, 
int step)
 
  360  double totm = ((double) (clock() - tinput))/1000000;
 
  361  double ostd,mostd, mif, mstd, mlf, mred, mnw, mxif,mxstd,mxlf,mxred,mxnw,tot;
 
  363  Print(
"\n// total time = %.2f sec", totm);
 
  364  Print(
"\n// tostd = %.2f sec = %.2f", ostd=((
double) tostd)/1000000,
 
  365        mostd=((((
double) tostd)/1000000)/totm)*100);
 
  366  Print(
"\n// tif   = %.2f sec = %.2f", ((
double) tif)/1000000,
 
  367        mif=((((
double) tif)/1000000)/totm)*100);
 
  368  Print(
"\n// std   = %.2f sec = %.2f", ((
double) tstd)/1000000,
 
  369        mstd=((((
double) tstd)/1000000)/totm)*100);
 
  370  Print(
"\n// lift  = %.2f sec = %.2f", ((
double) tlf)/1000000,
 
  371        mlf=((((
double) tlf)/1000000)/totm)*100);
 
  372  Print(
"\n// ired  = %.2f sec = %.2f", ((
double) tred)/1000000,
 
  373        mred=((((
double) tred)/1000000)/totm)*100);
 
  374  Print(
"\n// nextw = %.2f sec = %.2f", ((
double) tnw)/1000000,
 
  375        mnw=((((
double) tnw)/1000000)/totm)*100);
 
  376  PrintS(
"\n Time for the last step:");
 
  377  Print(
"\n// xinfo = %.2f sec = %.2f", ((
double) xtif)/1000000,
 
  378        mxif=((((
double) xtif)/1000000)/totm)*100);
 
  379  Print(
"\n// xstd  = %.2f sec = %.2f", ((
double) xtstd)/1000000,
 
  380        mxstd=((((
double) xtstd)/1000000)/totm)*100);
 
  381  Print(
"\n// xlift = %.2f sec = %.2f", ((
double) xtlift)/1000000,
 
  382        mxlf=((((
double) xtlift)/1000000)/totm)*100);
 
  383  Print(
"\n// xired = %.2f sec = %.2f", ((
double) xtred)/1000000,
 
  384        mxred=((((
double) xtred)/1000000)/totm)*100);
 
  385  Print(
"\n// xnextw= %.2f sec = %.2f", ((
double) xtnw)/1000000,
 
  386        mxnw=((((
double) xtnw)/1000000)/totm)*100);
 
  388  tot=mostd+mif+mstd+mlf+mred+mnw+mxif+mxstd+mxlf+mxred+mxnw;
 
  389  double res = (double) 100 - tot;
 
  390  Print(
"\n// &%d&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f&%.2f(%.2f)\\ \\",
 
  391        step, ostd, totm, mostd,mif,mstd,mlf,mred,mnw,mxif,mxstd,mxlf,mxred,mxnw,tot,
res,
 
  392        ((((
double) xtextra)/1000000)/totm)*100);
 
  395static void TimeStringFractal(clock_t tinput, clock_t tostd, clock_t tif,clock_t tstd,
 
  396                       clock_t textra, clock_t tlf,clock_t tred, clock_t tnw)
 
  399  double totm = ((double) (clock() - tinput))/1000000;
 
  400  double ostd, mostd, mif, mstd, mextra, mlf, mred, mnw, tot, 
res;
 
  401  Print(
"\n// total time = %.2f sec", totm);
 
  402  Print(
"\n// tostd = %.2f sec = %.2f", ostd=((
double) tostd)/1000000,
 
  403        mostd=((((
double) tostd)/1000000)/totm)*100);
 
  404  Print(
"\n// tif   = %.2f sec = %.2f", ((
double) tif)/1000000,
 
  405        mif=((((
double) tif)/1000000)/totm)*100);
 
  406  Print(
"\n// std   = %.2f sec = %.2f", ((
double) tstd)/1000000,
 
  407        mstd=((((
double) tstd)/1000000)/totm)*100);
 
  408  Print(
"\n// xstd  = %.2f sec = %.2f", ((
double) textra)/1000000,
 
  409        mextra=((((
double) textra)/1000000)/totm)*100);
 
  410  Print(
"\n// lift  = %.2f sec = %.2f", ((
double) tlf)/1000000,
 
  411        mlf=((((
double) tlf)/1000000)/totm)*100);
 
  412  Print(
"\n// ired  = %.2f sec = %.2f", ((
double) tred)/1000000,
 
  413        mred=((((
double) tred)/1000000)/totm)*100);
 
  414  Print(
"\n// nextw = %.2f sec = %.2f", ((
double) tnw)/1000000,
 
  415        mnw=((((
double) tnw)/1000000)/totm)*100);
 
  416  tot = mostd+mif+mstd+mextra+mlf+mred+mnw;
 
  417  res = (double) 100.00-tot;
 
  418  Print(
"\n// &%.2f &%.2f&%.2f &%.2f &%.2f &%.2f &%.2f &%.2f &%.2f&%.2f&%.2f\\ \\ ",
 
  419        ostd,totm,mostd,mif,mstd,mextra,mlf,mred,mnw,tot,
res);
 
  423#ifdef CHECK_IDEAL_MWALK 
  428  Print(
"\n//  ideal %s =  ", st);
 
  429  for(
i=0; 
i<nL-1; 
i++)
 
  495  Print(
"\n// intvec %s =  ", ch);
 
  497  for(
int i=0; 
i<nV; 
i++)
 
  501  Print(
"%d;", (*iv)[nV]);
 
  514  Print(
"%d) ==> (", (*iva)[nV]);
 
  519  Print(
"%d) := (", (*ivb)[nV]);
 
  525  Print(
"%d)", (*ivc)[nV]);
 
  532static inline long gcd(
const long a, 
const long b)
 
  534  long r, p0 = a, p1 = 
b;
 
  588static void cancel(mpz_t zaehler, mpz_t nenner)
 
  593  mpz_gcd(
g, zaehler, nenner);
 
  595  mpz_div(zaehler , zaehler, 
g);
 
  596  mpz_div(nenner ,  nenner, 
g);
 
  603static int isVectorNeg(
intvec* omega)
 
  625  mpz_init_set_ui(sing_int,  2147483647);
 
  638    mpz_set_si(zvec, (*weight)[
i-1]);
 
  640    mpz_add(zsum, zsum, zmul);
 
  643  wgrad = mpz_get_ui(zsum);
 
  645  if(mpz_cmp(zsum, sing_int)>0)
 
  650      PrintS(
"\n// ** OVERFLOW in \"MwalkInitialForm\": ");
 
  651      mpz_out_str( stdout, 10, zsum);
 
  652      PrintS(
" is greater than 2147483647 (max. integer representation)");
 
  671  int max = 0, maxtemp;
 
  694  mpz_init_set_ui(sing_int,  2147483647);
 
  707    mpz_set_si(zvec, (*weight)[
i-1]);
 
  709    mpz_add(ztmp, ztmp, zmul);
 
  711  mpz_init_set(
result, ztmp);
 
  729  mpz_t maxtmp; mpz_init(maxtmp);
 
  731  poly hg, in_w_g = 
NULL;
 
  739    if(mpz_cmp(maxtmp, 
max)>0)
 
  741      mpz_set(
max, maxtmp);
 
  747      if(mpz_cmp(maxtmp, 
max)==0)
 
  767  ideal Gomega = 
idInit(nG, 1);
 
  769  for(
i=nG-1; 
i>=0; 
i--)
 
  789    PrintS(
"//** the result may be WRONG, i.e. 0!!\n");
 
  799  for(
i=nG-1; 
i>=0; 
i--)
 
  835static inline long Mlcm(
long &i1, 
long &i2)
 
  837  long temp = 
gcd(i1, i2);
 
  838  return ((i1 / temp)* i2);
 
  851  for(
i=n-1; 
i>=0; 
i--)
 
  867  for(
i=n-1; 
i>=0; 
i--)
 
  869    (*result)[
i] = (*a)[
i] - (*b)[
i];
 
  882  for(
i=nR-1; 
i>=0; 
i--)
 
  899  for (
i=0; 
i<niv; 
i++)
 
  901    if ((*u)[
i] != (*
v)[
i])
 
  971    (*ivm)[
i] = (*iv)[
i];
 
  975    (*ivm)[
i*nR+
i-1] = 1;
 
  992    (*ivm)[
i] = (*iv)[
i];
 
  998      (*ivm)[
j+
i*nR] = (*iw)[
j+
i*nR];
 
 1012  for(
i=nR-1; 
i>=0; 
i--)
 
 1098  if(pdeg > nV || pdeg <= 0)
 
 1100    WerrorS(
"//** The perturbed degree is wrong!!");
 
 1109  mpz_t *pert_vector = (mpz_t*)
omAlloc(nV*
sizeof(mpz_t));
 
 1110  mpz_t *pert_vector1 = (mpz_t*)
omAlloc(nV*
sizeof(mpz_t));
 
 1114    mpz_init_set_si(pert_vector[
i], (*ivtarget)[
i]);
 
 1115    mpz_init_set_si(pert_vector1[
i], (*ivtarget)[
i]);
 
 1119  int ntemp, maxAi, maxA=0;
 
 1120  for(
i=1; 
i<pdeg; 
i++)
 
 1122    maxAi = (*ivtarget)[
i*nV];
 
 1127    for(
j=
i*nV+1; 
j<(
i+1)*nV; 
j++)
 
 1129      ntemp = (*ivtarget)[
j];
 
 1146  mpz_t tot_deg; mpz_init(tot_deg);
 
 1147  mpz_t maxdeg; mpz_init(maxdeg);
 
 1148  mpz_t inveps; mpz_init(inveps);
 
 1151  for(
i=nG-1; 
i>=0; 
i--)
 
 1154     if (mpz_cmp(maxdeg,  tot_deg) > 0 )
 
 1156       mpz_set(tot_deg, maxdeg);
 
 1161  mpz_mul_ui(inveps, tot_deg, maxA);
 
 1162  mpz_add_ui(inveps, inveps, 1);
 
 1166#ifdef INVEPS_SMALL_IN_MPERTVECTOR 
 1167  if(mpz_cmp_ui(inveps, pdeg)>0 && pdeg > 3)
 
 1170    mpz_fdiv_q_ui(inveps, inveps, pdeg);
 
 1175  mpz_out_str(stdout, 10, inveps);
 
 1180  for( 
i=1; 
i < pdeg; 
i++ )
 
 1184      mpz_mul(pert_vector[
j], pert_vector[
j], inveps);
 
 1185      if((*ivtarget)[
i*nV+
j]<0)
 
 1187        mpz_sub_ui(pert_vector[
j], pert_vector[
j],-(*ivtarget)[
i*nV+
j]);
 
 1191        mpz_add_ui(pert_vector[
j], pert_vector[
j],(*ivtarget)[
i*nV+
j]);
 
 1198  mpz_init_set_ui(sing_int,  2147483647);
 
 1201  mpz_init_set_ui(check_int,  100000);
 
 1205  mpz_set(ztemp, pert_vector[0]);
 
 1208    mpz_gcd(ztemp, ztemp, pert_vector[
i]);
 
 1209    if(mpz_cmp_si(ztemp, 1)  == 0)
 
 1214  if(mpz_cmp_si(ztemp, 1) != 0)
 
 1218      mpz_divexact(pert_vector[
i], pert_vector[
i], ztemp);
 
 1224    if(mpz_cmp(pert_vector[
i], check_int)>=0)
 
 1228        mpz_fdiv_q_ui(pert_vector1[
j], pert_vector[
j], 100);
 
 1239    (*result)[
i] = mpz_get_si(pert_vector1[
i]);
 
 1240    if(mpz_cmp(pert_vector1[
i], sing_int)>=0)
 
 1250      (*result)[
i] = mpz_get_si(pert_vector[
i]);
 
 1251      if(mpz_cmp(pert_vector[
i], sing_int)>=0)
 
 1257          PrintS(
"\n// ** OVERFLOW in \"MPertvectors\": ");
 
 1258          mpz_out_str( stdout, 10, pert_vector[
i]);
 
 1259          PrintS(
" is greater than 2147483647 (max. integer representation)");
 
 1260          Print(
"\n//  So vector[%d] := %d is wrong!!", 
i+1, (*
result)[
i]);
 
 1268      Print(
"\n// %d element(s) of it is overflow!!", ntrue);
 
 1273  mpz_clear(sing_int);
 
 1274  mpz_clear(check_int);
 
 1309  if(pdeg > nV || pdeg <= 0)
 
 1311    WerrorS(
"//** The perturbed degree is wrong!!");
 
 1316    (*pert_vector)[
i]=(*ivtarget)[
i];
 
 1324  int ntemp, maxAi, maxA=0;
 
 1325  for(
i=1; 
i<pdeg; 
i++)
 
 1327    maxAi = (*ivtarget)[
i*nV];
 
 1328    for(
j=
i*nV+1; 
j<(
i+1)*nV; 
j++)
 
 1330      ntemp = (*ivtarget)[
j];
 
 1340  int inveps, tot_deg = 0, maxdeg;
 
 1343  for(
i=nG-1; 
i>=0; 
i--)
 
 1347    if (maxdeg > tot_deg )
 
 1354  inveps = (tot_deg * maxA) + 1;
 
 1356#ifdef INVEPS_SMALL_IN_FRACTAL 
 1358  if(inveps > pdeg && pdeg > 3)
 
 1360    inveps = inveps / pdeg;
 
 1364  PrintS(
"\n// the \"big\" inverse epsilon %d", inveps);
 
 1368  for ( 
i=1; 
i < pdeg; 
i++ )
 
 1372      (*pert_vector)[
j] = inveps*((*pert_vector)[
j]) + (*ivtarget)[
i*nV+
j];
 
 1376  int temp = (*pert_vector)[0];
 
 1379    temp = 
gcd(temp, (*pert_vector)[
i]);
 
 1389      (*pert_vector)[
i] = (*pert_vector)[
i] / temp;
 
 1408    (*ivM)[
i*nV + 
i] = 1;
 
 1428    (*ivM)[(
i+1)*nV - 
i] = -1;
 
 1439  int nV = ivstart->
length();
 
 1444    (*ivM)[
i] = (*ivstart)[
i];
 
 1448    (*ivM)[
i*nV + 
i-1] = 1;
 
 1459  int nV = ivstart->
length();
 
 1464    (*ivM)[
i] = (*ivstart)[
i];
 
 1472    (*ivM)[(
i+1)*nV - 
i] = -1;
 
 1500  for(
i=nV-1; 
i>=0; 
i--)
 
 1521  int ntemp, maxAi, maxA=0;
 
 1524    maxAi = (*ivtarget)[
i*nV];
 
 1529    for(
j=
i*nV+1; 
j<(
i+1)*nV; 
j++)
 
 1531      ntemp = (*ivtarget)[
j];
 
 1541    maxA = maxA + maxAi;
 
 1546  mpz_t tot_deg; mpz_init(tot_deg);
 
 1547  mpz_t maxdeg; mpz_init(maxdeg);
 
 1548  mpz_t inveps; mpz_init(inveps);
 
 1551  for(
i=nG-1; 
i>=0; 
i--)
 
 1554    if (mpz_cmp(maxdeg,  tot_deg) > 0 )
 
 1556      mpz_set(tot_deg, maxdeg);
 
 1562  mpz_mul_ui(inveps, tot_deg, maxA);
 
 1563  mpz_add_ui(inveps, inveps, 1);
 
 1566#ifdef INVEPS_SMALL_IN_FRACTAL 
 1567  if(mpz_cmp_ui(inveps, nV)>0 && nV > 3)
 
 1569    mpz_cdiv_q_ui(inveps, inveps, nV);
 
 1577  mpz_t *ivtemp=(mpz_t *)
omAlloc(nV*
sizeof(mpz_t));
 
 1578  mpz_t *pert_vector=(mpz_t *)
omAlloc(niv*
sizeof(mpz_t));
 
 1580  for(
i=0; 
i < nV; 
i++)
 
 1582    mpz_init_set_si(ivtemp[
i], (*ivtarget)[
i]);
 
 1583    mpz_init_set_si(pert_vector[
i], (*ivtarget)[
i]);
 
 1586  mpz_t ztmp; mpz_init(ztmp);
 
 1593      mpz_mul(ztmp, inveps, ivtemp[
j]);
 
 1594      if((*ivtarget)[
i*nV+
j]<0)
 
 1596        mpz_sub_ui(ivtemp[
j], ztmp, -(*ivtarget)[
i*nV+
j]);
 
 1600        mpz_add_ui(ivtemp[
j], ztmp,(*ivtarget)[
i*nV+
j]);
 
 1606      mpz_init_set(pert_vector[
i*nV+
j],ivtemp[
j]);
 
 1612  mpz_init_set_ui(sing_int,  2147483647);
 
 1618  mpz_set(ztmp, pert_vector[0]);
 
 1619  for(
i=0; 
i<niv; 
i++)
 
 1621    mpz_gcd(ztmp, ztmp, pert_vector[
i]);
 
 1622    if(mpz_cmp_si(ztmp, 1)==0)
 
 1628  for(
i=0; 
i<niv; 
i++)
 
 1630    mpz_divexact(pert_vector[
i], pert_vector[
i], ztmp);
 
 1631    (* result)[
i] = mpz_get_si(pert_vector[
i]);
 
 1636  for(
i=0; 
i<niv; 
i++)
 
 1638    if(mpz_cmp(pert_vector[
i], sing_int)>0)
 
 1645        Print(
"\n// Xlev = %d and the %d-th element is", 
Xnlev,  
i+1);
 
 1646        PrintS(
"\n// ** OVERFLOW in \"Mfpertvector\": ");
 
 1647        mpz_out_str( stdout, 10, pert_vector[
i]);
 
 1648        PrintS(
" is greater than 2147483647 (max. integer representation)");
 
 1649        Print(
"\n//  So vector[%d] := %d is wrong!!", 
i+1, (*
result)[
i]);
 
 1663  mpz_clear(sing_int);
 
 1745       F->m[
i] = 
pAdd(F->m[
i], idLG->m[
j]);
 
 1804    if((*iva)[
i] - (*ivb)[
i] != 0)
 
 1826  for(
i=1; 
i < (
vec->length()); 
i++)
 
 2241  mpz_t t_zaehler, t_nenner;
 
 2242  mpz_init(t_zaehler);
 
 2245  mpz_t s_zaehler, s_nenner, temp, MwWd;
 
 2246  mpz_init(s_zaehler);
 
 2253  mpz_set_ui(sing_int,  2147483647);
 
 2255  mpz_t sing_int_half;
 
 2256  mpz_init(sing_int_half);
 
 2257  mpz_set_ui(sing_int_half,  3*(1073741824/2));
 
 2259  mpz_t deg_w0_p1, deg_d0_p1;
 
 2260  mpz_init(deg_w0_p1);
 
 2261  mpz_init(deg_d0_p1);
 
 2285    for (
j=0; 
j<nRing; 
j++)
 
 2287      (*diff_weight1)[
j] = (*curr_weight)[
j];
 
 2291      for(
j=0; 
j<nRing; 
j++)
 
 2293        (*curr_weight)[
j] = (*diff_weight1)[
j];
 
 2295      for(
j=0; 
j<nRing; 
j++)
 
 2297        (*diff_weight1)[
j] = ((*diff_weight1)[
j] + 5) / 10;
 
 2303      for(
j=0; 
j<nRing; 
j++)
 
 2305        (*diff_weight1)[
j] = (*curr_weight)[
j];
 
 2310        (*curr_weight)[
j] = (*diff_weight1)[
j];
 
 2312        (*diff_weight1)[
j] = ((*diff_weight1)[
j] + 5) / 10;
 
 2317  intvec* diff_weight = 
MivSub(target_weight, curr_weight);
 
 2320  for (
j=0; 
j<nG; 
j++)
 
 2335        mpz_sub(s_zaehler, deg_w0_p1, MwWd);
 
 2336        if(mpz_cmp(s_zaehler, t_null) != 0)
 
 2339          mpz_sub(s_nenner, MwWd, deg_d0_p1);
 
 2341          if( (mpz_cmp(s_zaehler,t_null) > 0 &&
 
 2342               mpz_cmp(s_nenner, s_zaehler)>=0) ||
 
 2343              (mpz_cmp(s_zaehler, t_null) < 0 &&
 
 2344               mpz_cmp(s_nenner, s_zaehler)<=0))
 
 2347            if (mpz_cmp(s_zaehler, t_null) < 0)
 
 2349              mpz_neg(s_zaehler, s_zaehler);
 
 2350              mpz_neg(s_nenner, s_nenner);
 
 2354            cancel(s_zaehler, s_nenner);
 
 2356            if(mpz_cmp(t_nenner, t_null) != 0)
 
 2358              mpz_mul(sztn, s_zaehler, t_nenner);
 
 2359              mpz_mul(sntz, s_nenner, t_zaehler);
 
 2361              if(mpz_cmp(sztn,sntz) < 0)
 
 2363                mpz_add(t_nenner, t_null, s_nenner);
 
 2364                mpz_add(t_zaehler,t_null, s_zaehler);
 
 2369              mpz_add(t_nenner, t_null, s_nenner);
 
 2370              mpz_add(t_zaehler,t_null, s_zaehler);
 
 2380  mpz_t *
vec=(mpz_t*)
omAlloc(nRing*
sizeof(mpz_t));
 
 2385  if(mpz_cmp(t_nenner, t_null) == 0)
 
 2388    PrintS(
"\n//MwalkNextWeightCC: t_nenner=0\n");
 
 2391    diff_weight = 
ivCopy(curr_weight);
 
 2396  if(mpz_cmp_si(t_nenner, 1)==0 && mpz_cmp_si(t_zaehler,1)==0)
 
 2399    diff_weight = 
ivCopy(target_weight); 
 
 2406  gcd_tmp = (*curr_weight)[0];
 
 2408  for (
j=1; 
j<nRing; 
j++)
 
 2410    gcd_tmp = 
gcd(gcd_tmp, (*curr_weight)[
j]);
 
 2418    for (
j=0; 
j<nRing; 
j++)
 
 2420      gcd_tmp = 
gcd(gcd_tmp, (*diff_weight)[
j]);
 
 2429    for (
j=0; 
j<nRing; 
j++)
 
 2431      (*curr_weight)[
j] =  (*curr_weight)[
j]/gcd_tmp;
 
 2432      (*diff_weight)[
j] =  (*diff_weight)[
j]/gcd_tmp;
 
 2436#ifdef  NEXT_VECTORS_CC 
 2437  Print(
"\n// gcd of the weight vectors (current and target) = %d", gcd_tmp);
 
 2441  PrintS(
"\n// t_zaehler: ");  mpz_out_str( stdout, 10, t_zaehler);
 
 2442  PrintS(
", t_nenner: ");  mpz_out_str( stdout, 10, t_nenner);
 
 2450  for (
j=0; 
j<nRing; 
j++)
 
 2452    mpz_set_si(dcw, (*curr_weight)[
j]);
 
 2453    mpz_mul(s_nenner, t_nenner, dcw);
 
 2455    if( (*diff_weight)[
j]>0)
 
 2457      mpz_mul_ui(s_zaehler, t_zaehler, (*diff_weight)[
j]);
 
 2461      mpz_mul_ui(s_zaehler, t_zaehler, -(*diff_weight)[
j]);
 
 2462      mpz_neg(s_zaehler, s_zaehler);
 
 2464    mpz_add(sntz, s_nenner, s_zaehler);
 
 2465    mpz_init_set(
vec[
j], sntz);
 
 2467#ifdef NEXT_VECTORS_CC 
 2468    Print(
"\n//   j = %d ==> ", 
j);
 
 2470    mpz_out_str( stdout, 10, t_nenner);
 
 2471    Print(
" * %d)", (*curr_weight)[
j]);
 
 2472    PrintS(
" + ("); mpz_out_str( stdout, 10, t_zaehler);
 
 2473    Print(
" * %d) =  ",  (*diff_weight)[
j]);
 
 2474    mpz_out_str( stdout, 10, s_nenner);
 
 2476    mpz_out_str( stdout, 10, s_zaehler);
 
 2477    PrintS(
" = "); mpz_out_str( stdout, 10, sntz);
 
 2478    Print(
" ==> vector[%d]: ", 
j); mpz_out_str(stdout, 10, 
vec[
j]);
 
 2487      if(mpz_cmp_si(ggt,1) != 0)
 
 2489        mpz_gcd(ggt, ggt, sntz);
 
 2494  if(mpz_cmp_si(ggt,1) != 0)
 
 2496    for (
j=0; 
j<nRing; 
j++)
 
 2501#ifdef  NEXT_VECTORS_CC 
 2502  PrintS(
"\n// gcd of elements of the vector: ");
 
 2503  mpz_out_str( stdout, 10, ggt);
 
 2506  for (
j=0; 
j<nRing; 
j++)
 
 2508    (*diff_weight)[
j] = mpz_get_si(
vec[
j]);
 
 2513  for (
j=0; 
j<nRing; 
j++)
 
 2515    if(mpz_cmp(
vec[
j], sing_int)>=0)
 
 2520        PrintS(
"\n// ** OVERFLOW in \"MwalkNextWeightCC\": ");
 
 2521        mpz_out_str( stdout, 10, 
vec[
j]);
 
 2522        PrintS(
" is greater than 2147483647 (max. integer representation)\n");
 
 2529   delete diff_weight1;
 
 2530   mpz_clear(t_zaehler);
 
 2531   mpz_clear(t_nenner);
 
 2532   mpz_clear(s_zaehler);
 
 2533   mpz_clear(s_nenner);
 
 2538   mpz_clear(deg_w0_p1);
 
 2539   mpz_clear(deg_d0_p1);
 
 2542   mpz_clear(sing_int_half);
 
 2543   mpz_clear(sing_int);
 
 2690  r->wvhdl[0] = (
int*) 
omAlloc(nv*
sizeof(
int));
 
 2692    r->wvhdl[0][
i] = (*va)[
i];
 
 2696  r->block0 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2697  r->block1 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2741  r->wvhdl[0] = (
int*) 
omAlloc(nv*
sizeof(
int));
 
 2742  r->wvhdl[1] = (
int*) 
omAlloc(nv*
sizeof(
int));
 
 2746    r->wvhdl[0][
i] = (*vb)[
i];
 
 2747    r->wvhdl[1][
i] = (*va)[
i];
 
 2752  r->block0 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2753  r->block1 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2800  r->wvhdl[0] = (
int*) 
omAlloc(nv*nv*
sizeof(
int));
 
 2804  for(
i=0; 
i<nv*nv; 
i++)
 
 2805    r->wvhdl[0][
i] = (*va)[
i];
 
 2809  r->block0 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2810  r->block1 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2852  r->wvhdl[0] = (
int*) 
omAlloc(nv*
sizeof(
int));
 
 2853  r->wvhdl[1] = (
int*) 
omAlloc(nvs*
sizeof(
int));
 
 2856  for(
i=0; 
i<nvs; 
i++)
 
 2858    r->wvhdl[1][
i] = (*va)[
i];
 
 2862    r->wvhdl[0][
i] = (*vb)[
i];
 
 2866  r->block0 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2867  r->block1 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2911  r->block0 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2912  r->block1 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2948  res->wvhdl[0] = (
int*) 
omAlloc(nv*
sizeof(
int));
 
 2949  for(
int i=0; 
i<nv; 
i++)
 
 2950    res->wvhdl[0][
i] = (*va)[
i];
 
 2955  res->block0 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2956  res->block1 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 2961  res->block1[0] = nv;
 
 2966  res->block1[1] = nv;
 
 3002  r->block0 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 3003  r->block1 = (
int *)
omAlloc0(nb * 
sizeof(
int *));
 
 3083  poly 
p,lm,factor1,factor2;
 
 3104        lm = 
pCopy(Gomega->m[
j]);
 
 3151  int nwalk=0, endwalks=0, nnwinC=1;
 
 3153  ideal Gomega, 
M, F, Gomega1, Gomega2, M1,
F1,
result,ssG;
 
 3154  ring newRing, oldRing, TargetRing;
 
 3158  intvec* pert_target_vector;
 
 3163#ifndef  BUCHBERGER_ALG 
 3169  for(
i=nV-1; 
i>0; 
i--)
 
 3171    (*last_omega)[
i] = 1;
 
 3173  (*last_omega)[0] = 10000;
 
 3178  if(tp_deg > 1 && tp_deg <= nV)
 
 3195    pert_target_vector = target_weight;
 
 3202    target_weight = 
Mivlp(nV);
 
 3216    xtnw=xtnw+clock()-to;
 
 3220    MivString(curr_weight, target_weight, next_weight);
 
 3239    if(
MivComp(next_weight, ivNull) == 1)
 
 3247    if(
MivComp(next_weight, target_weight) == 1)
 
 3250    for(
i=nV-1; 
i>=0; 
i--)
 
 3252      (*extra_curr_weight)[
i] = (*curr_weight)[
i];
 
 3255    for(
i=nV-1; 
i>=0; 
i--)
 
 3257      (*curr_weight)[
i] = (*next_weight)[
i];
 
 3266    xtif=xtif+clock()-to;
 
 3280#ifndef  BUCHBERGER_ALG 
 3281    if(isNolVector(curr_weight) == 0)
 
 3308#ifdef  BUCHBERGER_ALG 
 3315    xtstd=xtstd+clock()-to;
 
 3328    xtlift=xtlift+clock()-to;
 
 3344    xtred=xtred+clock()-to;
 
 3377      Print(
"\n// takes %d steps and calls the recursion of level %d:",
 
 3426  delete target_weight;
 
 3447       && (
G->m[
i]->next->next!=
NULL) 
 
 3448       && (
G->m[
i]->next->next->next!=
NULL) 
 
 3449       && (
G->m[
i]->next->next->next->next!=
NULL)  )
 
 3484       && (
G->m[
i]->next->next!=
NULL)) 
 
 3519  for (
i=nH-1;
i>=0; 
i--)
 
 3540  for(
i=nG-1; 
i>=0; 
i--)
 
 3608  int  mtmp, 
m=(*iva)[0];
 
 3629  mpz_set_si(ndeg, Trandegreebound(
G)+1);
 
 3635  mpz_init_set_si(maxdeg, Trandegreebound(
G));
 
 3638  mpz_pow_ui(ztmp, maxdeg, 2);
 
 3639  mpz_mul_ui(ztmp, ztmp, 2);
 
 3640  mpz_mul_ui(maxdeg, maxdeg, nV+1);
 
 3641  mpz_add(ndeg, ztmp, maxdeg);
 
 3642  mpz_mul_ui(ndeg, ndeg, 
m);
 
 3650#ifdef INVEPS_SMALL_IN_TRAN 
 3651  if(mpz_cmp_ui(ndeg, nV)>0 && nV > 3)
 
 3653    mpz_cdiv_q_ui(ndeg, ndeg, nV);
 
 3659  mpz_init_set(deg_tmp, ndeg);
 
 3661  VAR mpz_t *ivres=( mpz_t *) 
omAlloc(nV*
sizeof(mpz_t));
 
 3662  mpz_init_set_ui(ivres[nV-1],1);
 
 3664  for(
i=nV-2; 
i>=0; 
i--)
 
 3666    mpz_init_set(ivres[
i], deg_tmp);
 
 3667    mpz_mul(deg_tmp, deg_tmp, ndeg);
 
 3670  VAR mpz_t *ivtmp=(mpz_t *)
omAlloc(nV*
sizeof(mpz_t));
 
 3676  mpz_init_set_ui(sing_int,  2147483647);
 
 3685      if( (*ivMat)[
i*nV+
j] >= 0 )
 
 3687        mpz_mul_ui(ivres[
i], ivres[
i], (*ivMat)[
i*nV+
j]);
 
 3691        mpz_mul_ui(ivres[
i], ivres[
i], -(*ivMat)[
i*nV+
j]);
 
 3692        mpz_neg(ivres[
i], ivres[
i]);
 
 3694      mpz_add(ivtmp[
j], ivtmp[
j], ivres[
i]);
 
 3702    (*repr_vector)[
i] = mpz_get_si(ivtmp[
i]);
 
 3703    if(mpz_cmp(ivtmp[
i], sing_int)>=0)
 
 3710        PrintS(
"\n// ** OVERFLOW in \"Repr.Vector\": ");
 
 3711        mpz_out_str( stdout, 10, ivtmp[
i]);
 
 3712        PrintS(
" is greater than 2147483647 (max. integer representation)");
 
 3713        Print(
"\n//  So vector[%d] := %d is wrong!!\n",
i+1,(*repr_vector)[
i]);
 
 3719    ivString(repr_vector, 
"repvector");
 
 3720    Print(
"\n// %d element(s) of it are overflow!!", ntrue);
 
 3729  mpz_clear(sing_int);
 
 3739static intvec* TranPertVector_lp(ideal 
G)
 
 3753  mpz_set_si(ndeg, Trandegreebound(
G)+1);
 
 3759  mpz_init_set_si(maxdeg, Trandegreebound(
G));
 
 3762  mpz_pow_ui(ztmp, maxdeg, 2);
 
 3763  mpz_mul_ui(ztmp, ztmp, 2);
 
 3764  mpz_mul_ui(maxdeg, maxdeg, nV+1);
 
 3765  mpz_add(ndeg, ztmp, maxdeg);
 
 3774#ifdef INVEPS_SMALL_IN_TRAN 
 3775 if(mpz_cmp_ui(ndeg, nV)>0 && nV > 3)
 
 3776    mpz_cdiv_q_ui(ndeg, ndeg, nV);
 
 3783  mpz_init_set(deg_tmp, ndeg);
 
 3785  VAR mpz_t *ivres=(mpz_t *)
omAlloc(nV*
sizeof(mpz_t));
 
 3786  mpz_init_set_ui(ivres[nV-1], 1);
 
 3788  for(
i=nV-2; 
i>=0; 
i--)
 
 3790    mpz_init_set(ivres[
i], deg_tmp);
 
 3791    mpz_mul(deg_tmp, deg_tmp, ndeg);
 
 3795  mpz_init_set_ui(sing_int,  2147483647);
 
 3801    (*repr_vector)[
i] = mpz_get_si(ivres[
i]);
 
 3803    if(mpz_cmp(ivres[
i], sing_int)>=0)
 
 3809        PrintS(
"\n// ** OVERFLOW in \"Repr.Vector\": ");
 
 3810        mpz_out_str( stdout, 10, ivres[
i]);
 
 3811        PrintS(
" is greater than 2147483647 (max. integer representation)");
 
 3812        Print(
"\n//  So vector[%d] := %d is wrong!!\n",
i+1,(*repr_vector)[
i]);
 
 3818    ivString(repr_vector, 
"repvector");
 
 3819    Print(
"\n// %d element(s) of it are overflow!!", ntrue);
 
 3827  mpz_clear(sing_int);
 
 3844  int degtmp, maxdeg = 0;
 
 3855  mpz_init_set_si(ztmp, maxdeg);
 
 3856  mpz_t *ivres=(mpz_t *)
omAlloc(nV*
sizeof(mpz_t));
 
 3857  mpz_init_set_ui(ivres[nV-1], 1); 
 
 3859  for(
i=nV-2; 
i>=0; 
i--)
 
 3861    mpz_init_set(ivres[
i], ztmp); 
 
 3862    mpz_mul_ui(ztmp, ztmp, maxdeg); 
 
 3865  mpz_t *ivtmp=(mpz_t*)
omAlloc(nV*
sizeof(mpz_t));
 
 3873      if((*
M)[
i*nV+
j] < 0)
 
 3875        mpz_mul_ui(ztmp, ivres[
i], -(*
M)[
i*nV+
j]);
 
 3876        mpz_neg(ztmp, ztmp);
 
 3879        mpz_mul_ui(ztmp, ivres[
i], (*
M)[
i*nV+
j]);
 
 3881      mpz_add(ivtmp[
j], ivtmp[
j], ztmp);
 
 3885  mpz_init_set_ui(sing_int,  2147483647);
 
 3891    (*repvector)[
i] = mpz_get_si(ivtmp[
i]);
 
 3892    if(mpz_cmp(ivtmp[
i], sing_int)>0)
 
 3898        PrintS(
"\n// ** OVERFLOW in \"Repr.Matrix\": ");
 
 3899        mpz_out_str( stdout, 10, ivtmp[
i]);
 
 3900        PrintS(
" is greater than 2147483647 (max. integer representation)");
 
 3901        Print(
"\n//  So vector[%d] := %d is wrong!!\n",
i+1,(*repvector)[
i]);
 
 3908    Print(
"\n// %d element(s) of it are overflow!!", ntrue);
 
 3914  mpz_clear(sing_int);
 
 3934                        intvec* orig_target_weight, 
int tp_deg, 
int npwinc)
 
 3942  clock_t tinput = clock();
 
 3946  int nwalk=0, endwalks=0, nnwinC=1;
 
 3948  ideal Gomega, 
M, F, Gomega1, Gomega2, M1,
F1,
result,ssG;
 
 3949  ring newRing, oldRing, TargetRing;
 
 3956#ifndef  BUCHBERGER_ALG 
 3962  for(
i=nV-1; 
i>0; 
i--)
 
 3963    (*last_omega)[
i] = 1;
 
 3964  (*last_omega)[0] = 10000;
 
 3969  if(tp_deg > 1 && tp_deg <= nV)
 
 4041    xtif=xtif+clock()-to;
 
 4044#ifndef  BUCHBERGER_ALG 
 4045    if(isNolVector(curr_weight) == 0)
 
 4072#ifdef  BUCHBERGER_ALG 
 4079    xtstd=xtstd+clock()-to;
 
 4092    xtlift=xtlift+clock()-to;
 
 4108    xtred=xtred+clock()-to;
 
 4124    xtnw=xtnw+clock()-to;
 
 4127    MivString(curr_weight, target_weight, next_weight);
 
 4145    if(
MivComp(next_weight, ivNull) == 1)
 
 4152    if(
MivComp(next_weight, target_weight) == 1)
 
 4163        tproc=tproc+clock()-tinput;
 
 4169        G = 
Rec_LastGB(
G,curr_weight, orig_target_weight, tp_deg+1,nnwinC);
 
 4176    for(
i=nV-1; 
i>=0; 
i--)
 
 4178      (*curr_weight)[
i] = (*next_weight)[
i];
 
 4204      tproc=tproc+clock()-tinput;
 
 4206      F1 = 
Rec_LastGB(
F1,curr_weight, orig_target_weight, tp_deg+1,nnwinC);
 
 4208    delete target_weight;
 
 4245      xtextra=xtextra+clock()-to;
 
 4287  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
 
 4289  clock_t tostd, tproc;
 
 4293  int nwalk=0, endwalks=0;
 
 4295  ideal Gomega, 
M, F, Gomega1, Gomega2, M1, 
F1, 
G;
 
 4298  ring newRing, oldRing;
 
 4316  Print(
"\n// Computation of the first std took = %.2f sec",
 
 4317        ((
double) tostd)/1000000);
 
 4333    xtif=xtif+clock()-to;
 
 4363    xtstd=xtstd+clock()-to;
 
 4376    xtlift=xtlift+clock()-to;
 
 4391    xtred=xtred+clock()-to;
 
 4405    xtnw=xtnw+clock()-to;
 
 4408    MivString(curr_weight, target_weight, next_weight);
 
 4418      goto  TEST_OVERFLOW_OI;
 
 4437    if(
MivComp(next_weight, ivNull) == 1)
 
 4444    if(
MivComp(next_weight, target_weight) == 1)
 
 4446      if(
MivSame(target_weight, exivlp)==1)
 
 4451        tproc = clock()-xftinput;
 
 4463    for(
i=nV-1; 
i>=0; 
i--)
 
 4466      (*curr_weight)[
i] = (*next_weight)[
i];
 
 4482  TimeStringFractal(xftinput, tostd, xtif, xtstd, xtextra,xtlift, xtred,xtnw);
 
 4517       int weight_rad, 
int pert_deg)
 
 4520         target_weight != 
NULL && 
G->m[0] != 
NULL);
 
 4531    (*curr_weight)[
i] = (*orig_M)[
i];
 
 4534  int k=0,weight_norm;
 
 4540  ideal G_test, G_test1, G_test2;
 
 4548      while(weight_norm == 0)
 
 4552          (*next_weight2)[
i] = rand() % 60000 - 30000;
 
 4553          weight_norm = weight_norm + (*next_weight2)[
i]*(*next_weight2)[
i];
 
 4555        weight_norm = 1 + 
static_cast<int>(
sqrt(
double(weight_norm)));
 
 4559        if((*next_weight2)[
i] < 0)
 
 4561          (*next_weight2)[
i] = 1 + (*curr_weight)[
i] + weight_rad*(*next_weight2)[
i]/weight_norm;
 
 4565          (*next_weight2)[
i] = (*curr_weight)[
i] + weight_rad*(*next_weight2)[
i]/weight_norm;
 
 4575        found_random_weight = 
TRUE;
 
 4587    delete curr_weight1;
 
 4605    if(found_random_weight == 
TRUE)
 
 4614            (*result)[
i] = (*next_weight2)[
i];
 
 4621            (*result)[
i] = (*next_weight1)[
i];
 
 4631            (*result)[
i] = (*next_weight2)[
i];
 
 4638            (*result)[
i] = (*next_weight)[
i];
 
 4650          (*result)[
i] = (*next_weight1)[
i];
 
 4657          (*result)[
i] = (*next_weight)[
i];
 
 4665    if(found_random_weight == 
TRUE)
 
 4671          (*result)[
i] = (*next_weight2)[
i];
 
 4678          (*result)[
i] = (*next_weight)[
i];
 
 4686        (*result)[
i] = (*next_weight)[
i];
 
 4692  delete next_weight2;
 
 4695  if(found_random_weight == 
TRUE)
 
 4702    delete next_weight1;
 
 4709    return next_weight1;
 
 4720                          int tp_deg, 
int npwinc)
 
 4726  int nwalk=0, endwalks=0, nnwinC=1, nlast = 0;
 
 4727  ideal Gomega, 
M, F, Gomega1, Gomega2, M1,
F1,
result,ssG;
 
 4728  ring newRing, oldRing, TargetRing;
 
 4731#ifndef BUCHBERGER_ALG 
 4735  for(
i=nV-1; 
i>0; 
i--)
 
 4737    (*last_omega)[
i] = 1;
 
 4739  (*last_omega)[0] = 10000;
 
 4746  if(tp_deg > 1 && tp_deg <= nV)
 
 4807    xtif = xtif + clock()-to;
 
 4810#ifndef  BUCHBERGER_ALG 
 4811    if(isNolVector(curr_weight) == 0)
 
 4839#ifdef  BUCHBERGER_ALG 
 4846    xtstd = xtstd + clock() - to;
 
 4860    xtlift = xtlift + clock() -to;
 
 4878    xtred = xtred + clock() -to;
 
 4896    xtnw = xtnw + clock() - to;
 
 4900    MivString(curr_weight, target_weight, next_weight);
 
 4914    if(
MivComp(next_weight, ivNull) == 1)
 
 4921    if(
MivComp(next_weight, target_weight) == 1)
 
 4929        G = 
REC_GB_Mwalk(
G,curr_weight, orig_target_weight, tp_deg+1,nnwinC);
 
 4936    for(
i=nV-1; 
i>=0; 
i--)
 
 4938      (*curr_weight)[
i] = (*next_weight)[
i];
 
 4970    delete target_weight;
 
 5018#ifndef BUCHBERGER_ALG 
 5034  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
 
 5037  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
 
 5045  ideal Gomega, 
M, F, Gomega1, Gomega2, M1, 
F1, 
G;
 
 5047  ring newRing, oldRing;
 
 5050#ifndef BUCHBERGER_ALG 
 5054  for(
i=nV-1; 
i>=0; 
i--)
 
 5055    (*tmp_weight)[
i] = (*curr_weight)[
i];
 
 5059  for(
i=nV-1; 
i>0; 
i--)
 
 5060    (*last_omega)[
i] = 1;
 
 5061  (*last_omega)[0] = 10000;
 
 5087    tif = tif + clock()-to;
 
 5098#ifdef CHECK_IDEAL_MWALK 
 5099        Print(
"\n// **** Groebnerwalk took %d steps and ", nwalk);
 
 5100        PrintS(
"\n// **** call the rec. Pert. Walk to compute a red GB of:");
 
 5104      if(
MivSame(exivlp, target_weight)==1)
 
 5109        Print(
"\n//  time for the last std(Gw)  = %.2f sec",
 
 5110        ((
double) (clock()-tim)/1000000));
 
 5125      xtlift = xtlift + clock() - to;
 
 5149#ifndef  BUCHBERGER_ALG 
 5150      if(isNolVector(curr_weight) == 0)
 
 5176#ifdef  BUCHBERGER_ALG 
 5183      tstd = tstd + clock() - to;
 
 5199      tlift = tlift + clock() - to;
 
 5219      tred = tred + clock() - to;
 
 5223      xtred = xtred + clock() - to;
 
 5238    tnw = tnw + clock() - to;
 
 5241    MivString(curr_weight, target_weight, next_weight);
 
 5248      PrintS(
"\n// ** The computed vector does NOT stay in Cone!!\n");
 
 5266    if(
MivComp(next_weight, ivNull) == 1)
 
 5272    if(
MivComp(next_weight, target_weight) == 1)
 
 5276    for(
i=nV-1; 
i>=0; 
i--)
 
 5278      (*tmp_weight)[
i] = (*curr_weight)[
i];
 
 5279      (*curr_weight)[
i] = (*next_weight)[
i];
 
 5291  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, 
nstep);
 
 5303            ring baseRing, 
int reduction, 
int printout)
 
 5316  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
 
 5317  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
 
 5323  int nV = baseRing->N;
 
 5325  ideal Gomega, 
M, F, FF, Gomega1, Gomega2, M1;
 
 5327  ring XXRing = baseRing;
 
 5342    (*curr_weight)[
i] = (*orig_M)[
i];
 
 5343    (*target_weight)[
i] = (*target_M)[
i];
 
 5345#ifndef BUCHBERGER_ALG 
 5349  for(
i=nV-1; 
i>0; 
i--)
 
 5351    (*last_omega)[
i] = 1;
 
 5353  (*last_omega)[0] = 10000;
 
 5356#ifdef CHECK_IDEAL_MWALK 
 5363  if(target_M->
length() == nV)
 
 5372  if(orig_M->
length() == nV)
 
 5376    newRing=
VMrRefine(target_weight, curr_weight);
 
 5408    tif = tif + clock()-to;
 
 5411#ifdef CHECK_IDEAL_MWALK 
 5414      idString(Gomega,
"//** Mwalk: Gomega");
 
 5423      PrintS(
"middle of Cone");
 
 5431#ifndef  BUCHBERGER_ALG 
 5432    if(isNolVector(curr_weight) == 0)
 
 5444      if(orig_M->
length() == nV)
 
 5448        newRing=
VMrRefine(target_weight, curr_weight);
 
 5457     if(target_M->
length() == nV)
 
 5461       newRing=
VMrRefine(target_weight, curr_weight);
 
 5480#ifndef  BUCHBERGER_ALG 
 5487    tstd = tstd + clock() - to;
 
 5490#ifdef CHECK_IDEAL_MWALK 
 5509    tlift = tlift + clock() - to;
 
 5511#ifdef CHECK_IDEAL_MWALK 
 5525#ifdef CHECK_IDEAL_MWALK 
 5552    tnw = tnw + clock() - to;
 
 5557      MivString(curr_weight, target_weight, next_weight);
 
 5562      if(
MivComp(curr_weight,next_weight)==1)
 
 5567    if(
MivComp(target_weight,curr_weight) == 1)
 
 5572    for(
i=nV-1; 
i>=0; 
i--)
 
 5575      (*curr_weight)[
i] = (*next_weight)[
i];
 
 5586#ifndef BUCHBERGER_ALG 
 5590  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, 
nstep);
 
 5596    Print(
"\n//** Mwalk: Groebner Walk took %d steps.\n", 
nstep);
 
 5616  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
 
 5617  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
 
 5633  if(pert_deg > nV || pert_deg < 1)
 
 5635    WerrorS(
"Invalid perturbation degree.\n");
 
 5639  ideal Gomega, 
M, F,FF, Gomega1, Gomega2, M1;
 
 5652    (*curr_weight)[
i] = (*orig_M)[
i];
 
 5653    (*target_weight)[
i] = (*target_M)[
i];
 
 5656#ifndef BUCHBERGER_ALG 
 5660  for(
i=nV-1; 
i>0; 
i--)
 
 5662    (*last_omega)[
i] = 1;
 
 5664  (*last_omega)[0] = 10000;
 
 5668  if(target_M->
length() == nV)
 
 5676  if(orig_M->
length() == nV)
 
 5679    newRing=
VMrRefine(target_weight, curr_weight);
 
 5701  tif = tif + clock()-to; 
 
 5708#ifdef CHECK_IDEAL_MWALK 
 5711      idString(Gomega,
"//** Mrwalk: Gomega");
 
 5725#ifndef  BUCHBERGER_ALG 
 5726    if(isNolVector(curr_weight) == 0)
 
 5737      if(orig_M->
length() == nV)
 
 5740        newRing=
VMrRefine(target_weight, curr_weight);
 
 5749     if(target_M->
length() == nV)
 
 5752       newRing=
VMrRefine(target_weight, curr_weight);
 
 5766#ifndef BUCHBERGER_ALG 
 5773    tstd = tstd + clock() - to;
 
 5776#ifdef CHECK_IDEAL_MWALK 
 5795    tlift = tlift + clock() - to;
 
 5797#ifdef CHECK_IDEAL_MWALK 
 5811    tstd = tstd + clock() - to;
 
 5814#ifdef CHECK_IDEAL_MWALK 
 5841    tnw = tnw + clock() - to;
 
 5849    tif = tif + clock()-to; 
 
 5859      if(target_M->
length() == nV)
 
 5873      tnw = tnw + clock() - to;
 
 5881      tif = tif + clock()-to; 
 
 5887    if(
MivComp(next_weight, ivNull) == 1 || 
MivComp(target_weight,curr_weight) == 1)
 
 5895      if(
MivComp(curr_weight,next_weight)==1)
 
 5903      MivString(curr_weight, target_weight, next_weight);
 
 5907    for(
i=nV-1; 
i>=0; 
i--)
 
 5909      (*curr_weight)[
i] = (*next_weight)[
i];
 
 5918#ifndef BUCHBERGER_ALG 
 5923    Print(
"\n//** Mrwalk: Groebner Walk took %d steps.\n", 
nstep);
 
 5926  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, 
nstep);
 
 5960  clock_t  tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
 
 5962  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
 
 5968  int i, ntwC=1, ntestw=1,  nV = 
currRing->N;
 
 5971  if(op_deg < 1 || tp_deg < 1 || op_deg > nV || tp_deg > nV)
 
 5973    WerrorS(
"Invalid perturbation degree.\n");
 
 5978  ideal Gomega, 
M, F, FF, 
G, Gomega1, Gomega2, M1,
F1,Eresult,ssG;
 
 5979  ring newRing, oldRing, TargetRing;
 
 5983  intvec* orig_target = target_weight;
 
 5984  intvec* pert_target_vector = target_weight;
 
 5987#ifndef BUCHBERGER_ALG 
 5994  for(
i=nV-1; 
i>0; 
i--)
 
 5995    (*last_omega)[
i] = 1;
 
 5996  (*last_omega)[0] = 10000;
 
 6003  if(
MivComp(curr_weight, iv_dp) == 1) 
 
 6037  if(op_deg != 1) 
delete iv_M_dp;
 
 6042  if(tp_deg > 1 && tp_deg <= nV)
 
 6054    if(
MivSame(target_weight, exivlp) == 1)
 
 6065    pert_target_vector = target_weight;
 
 6071    Print(
"\n//** Mpwalk: Perturbation Walk of degree (%d,%d):",op_deg,tp_deg);
 
 6073    ivString(curr_weight, 
"//** Mpwalk: new current weight");
 
 6074    ivString(target_weight, 
"//** Mpwalk: new target weight");
 
 6087    tif = tif + clock()-to;
 
 6089#ifdef CHECK_IDEAL_MWALK 
 6092      idString(Gomega,
"//** Mpwalk: Gomega");
 
 6108    if(endwalks == 
TRUE)
 
 6119#ifndef  BUCHBERGER_ALG 
 6120    if(isNolVector(curr_weight) == 0)
 
 6148        PrintS(
"\n// compute a rGB of Gw:\n");
 
 6150#ifndef  BUCHBERGER_ALG 
 6160#ifdef  BUCHBERGER_ALG 
 6167    if(endwalks == 
TRUE)
 
 6170      xtstd = xtstd+clock()-to;
 
 6176        Print(
"\n// time for the last std(Gw)  = %.2f sec\n",
 
 6177            ((
double) clock())/1000000 -((
double)tim) /1000000);
 
 6185      tstd=tstd+clock()-to;
 
 6188#ifdef CHECK_IDEAL_MWALK 
 6206    if(endwalks == 
FALSE)
 
 6207      tlift = tlift+clock()-to;
 
 6211#ifdef CHECK_IDEAL_MWALK 
 6233        PrintS(
"\n //** Mpwalk: reduce the Groebner basis.\n");
 
 6240      if(endwalks == 
FALSE)
 
 6241        tred = tred+clock()-to;
 
 6247    if(endwalks == 
TRUE)
 
 6262      MivString(curr_weight, target_weight, next_weight);
 
 6275    if(
MivComp(next_weight, ivNull) == 1){
 
 6281    if(
MivComp(next_weight, target_weight) == 1)
 
 6284    for(
i=nV-1; 
i>=0; 
i--)
 
 6285      (*curr_weight)[
i] = (*next_weight)[
i];
 
 6293    if(
MivSame(orig_target, exivlp) == 1) {
 
 6317    if( ntestw != 1 || ntwC == 0)
 
 6319      if(ntestw != 1 && printout >2)
 
 6321        ivString(pert_target_vector, 
"tau");
 
 6322        PrintS(
"\n// ** perturbed target vector doesn't stay in cone!!");
 
 6331      if(nP == 0 || tp_deg == 1 || 
MivSame(orig_target, exivlp) != 1){
 
 6340        eF1 = 
LastGB(
F2, curr_weight, tp_deg-1);
 
 6363    delete target_weight;
 
 6372  TimeStringFractal(tinput, tostd, tif+xtif, tstd+xtstd,0, tlift+xtlift, tred+xtred,
 
 6380    Print(
"\n//** Mpwalk: Perturbation Walk took %d steps.\n", 
nstep);
 
 6389              int op_deg, 
int tp_deg, 
int nP, 
int reduction, 
int printout)
 
 6401  clock_t  tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
 
 6403  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
 
 6409  int i, ntwC=1, ntestw=1, nV = 
currRing->N; 
 
 6419  if(op_deg < 1 || tp_deg < 1 || op_deg > nV || tp_deg > nV)
 
 6421    WerrorS(
"Invalid perturbation degree.\n");
 
 6427  ideal Gomega, 
M, F, FF, 
G, Gomega1, Gomega2, M1,
F1,Eresult,ssG;
 
 6428  ring newRing, oldRing, TargetRing;
 
 6437    (*curr_weight)[
i] = (*orig_M)[
i];
 
 6438    (*target_weight)[
i] = (*target_M)[
i];
 
 6440  intvec* orig_target = target_weight;
 
 6441  intvec* pert_target_vector = target_weight;
 
 6444#ifndef BUCHBERGER_ALG 
 6451  for(
i=nV-1; 
i>0; 
i--)
 
 6452    (*last_omega)[
i] = 1;
 
 6453  (*last_omega)[0] = 10000;
 
 6458  if(orig_M->
length() == nV)
 
 6460    if(
MivComp(curr_weight, iv_dp) == 1) 
 
 6516  if(op_deg != 1) 
delete iv_M_dp;
 
 6521  if(target_M->
length() == nV)
 
 6523    if(tp_deg > 1 && tp_deg <= nV)
 
 6532      if(
MivSame(target_weight, exivlp) == 1)
 
 6543      pert_target_vector = target_weight;
 
 6550    if(tp_deg > 1 && tp_deg <= nV)
 
 6560    Print(
"\n//** Mprwalk: Random Perturbation Walk of degree (%d,%d):",op_deg,tp_deg);
 
 6561    ivString(curr_weight, 
"//** Mprwalk: new current weight");
 
 6562    ivString(target_weight, 
"//** Mprwalk: new target weight");
 
 6570  tif = tif + clock()-to; 
 
 6576#ifdef CHECK_IDEAL_MWALK 
 6579      idString(Gomega,
"//** Mprwalk: Gomega");
 
 6596    if(endwalks == 
TRUE)
 
 6607#ifndef  BUCHBERGER_ALG 
 6608    if(isNolVector(curr_weight) == 0)
 
 6616    if(target_M->
length() == nV)
 
 6633    if(endwalks == 
TRUE)
 
 6642        PrintS(
"\n// compute a rGB of Gw:\n");
 
 6644#ifndef  BUCHBERGER_ALG 
 6654#ifdef  BUCHBERGER_ALG 
 6660#ifdef CHECK_IDEAL_MWALK 
 6667    if(endwalks == 
TRUE)
 
 6669      xtstd = xtstd+clock()-to;
 
 6671      Print(
"\n// time for the last std(Gw)  = %.2f sec\n",
 
 6672            ((
double) clock())/1000000 -((
double)tim) /1000000);
 
 6676      tstd=tstd+clock()-to;
 
 6690    if(endwalks == 
FALSE)
 
 6691      tlift = tlift+clock()-to;
 
 6695#ifdef CHECK_IDEAL_MWALK 
 6717        PrintS(
"\n //** Mprwalk: reduce the Groebner basis.\n");
 
 6724      if(endwalks == 
FALSE)
 
 6725        tred = tred+clock()-to;
 
 6732    if(endwalks == 
TRUE)
 
 6741    tnw = tnw + clock() - to;
 
 6750    tif = tif + clock()-to; 
 
 6758        PrintS(
"\n Mpwalk: there is a polynomial in Gomega with at least 3 monomials.\n");
 
 6762      if(target_M->
length() == nV)
 
 6775      tnw = tnw + clock() - to;
 
 6783      tif = tif + clock()-to; 
 
 6791      MivString(curr_weight, target_weight, next_weight);
 
 6803    if(
MivComp(next_weight, ivNull) == 1){
 
 6809    if(
MivComp(next_weight, target_weight) == 1)
 
 6812    for(
i=nV-1; 
i>=0; 
i--)
 
 6813      (*curr_weight)[
i] = (*next_weight)[
i];
 
 6821    if(target_M->
length() == nV)
 
 6823      if(
MivSame(orig_target, exivlp) == 1)
 
 6846    if(ntestw != 1 || ntwC == 0)
 
 6848      if(ntestw != 1 && printout > 2)
 
 6851        ivString(pert_target_vector, 
"tau");
 
 6853        PrintS(
"\n// **Mprwalk: perturbed target vector doesn't stay in cone.");
 
 6862      if(nP == 0 || tp_deg == 1 || 
MivSame(orig_target, exivlp) != 1 || target_M->
length() != nV)
 
 6866          PrintS(
"\n// ** Mprwalk: Call \"std\" to compute a Groebner basis.\n");
 
 6875          PrintS(
"\n// **Mprwalk: Call \"LastGB\" to compute a Groebner basis.\n");
 
 6879        eF1 = 
LastGB(
F2, curr_weight, tp_deg-1);
 
 6904    delete target_weight;
 
 6913  TimeStringFractal(tinput, tostd, tif+xtif, tstd+xtstd,0, tlift+xtlift, tred+xtred,
 
 6922    Print(
"\n//** Mprwalk: Perturbation Walk took %d steps.\n", 
nstep);
 
 6939    (*ivM)[
i*nV + 
j] = 1;
 
 6957    Print(
"\n\n// Entering the %d-th recursion:", nlev);
 
 6960  ring new_ring, testring;
 
 6962  ideal Gomega, Gomega1, Gomega2, FF, F, Gresult, Gresult1, G1, Gt;
 
 6965#ifndef BUCHBERGER_ALG 
 6974  for(
i = nV -1; 
i>=0; 
i--)
 
 6976    (*omtmp)[
i] = (*ivtarget)[
i];
 
 6982  for(
i=nV-1; 
i>0; 
i--)
 
 6983    (*last_omega)[
i] = 1;
 
 6984  (*last_omega)[0] = 10000;
 
 6987  for(
i=0; 
i<nV; 
i++) {
 
 6989      (*omega)[
i] =  (*Xsigma)[
i];
 
 6991      (*omega)[
i] = (*Xsigma)[(nV*(nlev-1))+
i];
 
 6993    (*omega2)[
i] = (*Xtau)[(nlev-1)*nV+
i];
 
 6996   if(nlev == 1)  
Xcall = 1;
 
 7003#ifdef FIRST_STEP_FRACTAL 
 7006    if((nlev == 1 && 
Xcall == 0) || (nlev == 2 && 
Xngleich == 1))
 
 7016    NEXT_VECTOR_FRACTAL:
 
 7023    xtnw=xtnw+clock()-to;
 
 7029      if (
MivComp(next_vect, omega2) == 1)
 
 7035          Print(
"\n//** rec_fractal_call: Perturb the both vectors with degree %d.",nlev);
 
 7042        if(ivtarget->
length() == nV)
 
 7061        if(ivtarget->
length() == nV)
 
 7080        for(
i=nV-1; 
i>=0; 
i--) {
 
 7081          (*omega2)[
i] = (*Xtau)[nV+
i];
 
 7082          (*omega)[
i] = (*Xsigma)[nV+
i];
 
 7093        xtnw=xtnw+clock()-to;
 
 7100        MivString(omega, omega2, next_vect);
 
 7110      if(ivtarget->
length() == nV)
 
 7127      Gt = 
NULL; 
return(Gt);
 
 7131        Print(
"\n//** rec_fractal_call: Applying Buchberger's algorithm in ring r = %s;",
 
 7140      xtextra=xtextra+clock()-to;
 
 7148        Print(
"\n//** rec_fractal_call: Overflow. (4) Leaving the %d-th recursion with %d steps.\n",
 
 7168      if(ivtarget->
length() == nV)
 
 7193          Print(
"\n//** rec_fractal_call: Correct cone. (5) Leaving the %d-th recursion with %d steps.\n",
 
 7198          idString(Gt,
"//** rec_fractal_call: Gt");
 
 7206          PrintS(
"\n//** rec_fractal_call: Wrong cone. Tau doesn't stay in the correct cone.\n");
 
 7209#ifndef  MSTDCC_FRACTAL 
 7211        if(ivtarget->
length() == nV)
 
 7221      Gt = 
NULL; 
return(Gt);
 
 7228            PrintS(
"\n//** rec_fractal_call: Updated vectors are equal to the old vectors.\n");
 
 7231          goto FRACTAL_MSTDCC;
 
 7237        for(
i=nV-1; 
i>=0; 
i--)
 
 7238          (*omega2)[
i] = (*Xtau)[(nlev-1)*nV+
i];
 
 7243        goto NEXT_VECTOR_FRACTAL;
 
 7249          Print(
"\n//** rec_fractal_call: Wrong cone. Applying Buchberger's algorithm in ring = %s.\n",
 
 7257        xtextra=xtextra+clock()-to;
 
 7262        if(ivtarget->
length() == nV)
 
 7286        if(ivtarget->
length() == nV)
 
 7305          Print(
"\n//** rec_fractal_call: Vectors updated. (6) Leaving the %d-th recursion with %d steps.\n",
 
 7317    for(
i=nV-1; 
i>=0; 
i--) {
 
 7319      (*omega)[
i] = (*next_vect)[
i];
 
 7328    xtif=xtif+clock()-to;
 
 7330#ifdef CHECK_IDEAL_MWALK 
 7333      idString(Gomega,
"//** rec_fractal_call: Gomega");
 
 7347        goto NEXT_VECTOR_FRACTAL;
 
 7351#ifndef  BUCHBERGER_ALG 
 7352    if(isNolVector(omega) == 0)
 
 7358    if(ivtarget->
length() == nV)
 
 7381        PrintS(
"\n//** rec_fractal_call: Maximal recursion depth.\n");
 
 7386#ifdef  BUCHBERGER_ALG 
 7393      xtstd=xtstd+clock()-to;
 
 7402#ifdef CHECK_IDEAL_MWALK 
 7405      idString(Gresult,
"//** rec_fractal_call: M");
 
 7420    xtlift=xtlift+clock()-to;
 
 7422#ifdef CHECK_IDEAL_MWALK 
 7425      idString(F,
"//** rec_fractal_call: F");
 
 7454                int weight_rad, 
int reduction, 
int printout)
 
 7460  ring new_ring, testring;
 
 7462  ideal Gomega, Gomega1, Gomega2, F, FF, Gresult, Gresult1, G1, Gt;
 
 7467#ifndef BUCHBERGER_ALG 
 7479  for(
i = nV -1; 
i>=0; 
i--)
 
 7481    (*omtmp)[
i] = (*ivtarget)[
i];
 
 7485  for(
i=nV-1; 
i>0; 
i--)
 
 7486    (*last_omega)[
i] = 1;
 
 7487  (*last_omega)[0] = 10000;
 
 7490  for(
i=0; 
i<nV; 
i++) {
 
 7492      (*omega)[
i] =  (*Xsigma)[
i];
 
 7494      (*omega)[
i] = (*Xsigma)[(nV*(nlev-1))+
i];
 
 7496    (*omega2)[
i] = (*Xtau)[(nlev-1)*nV+
i];
 
 7499   if(nlev == 1)  
Xcall = 1;
 
 7506#ifdef FIRST_STEP_FRACTAL 
 7511    if((nlev == 1 && 
Xcall == 0) || (nlev == 2 && 
Xngleich == 1))
 
 7521    NEXT_VECTOR_FRACTAL:
 
 7528    xtnw=xtnw+clock()-to;
 
 7534        PrintS(
"\n**// rec_r_fractal_call: there is a polynomial in Gomega with at least 3 monomials.\n");
 
 7543      xtnw=xtnw+clock()-to;
 
 7553        xtnw=xtnw+clock()-to;
 
 7561      if (
MivComp(next_vect, omega2) == 1)
 
 7567          Print(
"\n//** rec_r_fractal_call: Perturb both vectors with degree %d.",nlev);
 
 7572        if(ivtarget->
length() == nV)
 
 7591        if(ivtarget->
length() == nV)
 
 7607        if(ivtarget->
length() > nV)
 
 7615        for(
i=nV-1; 
i>=0; 
i--)
 
 7617          (*omega2)[
i] = (*Xtau)[nV+
i];
 
 7618          (*omega)[
i] = (*Xsigma)[nV+
i];
 
 7630        xtnw=xtnw+clock()-to;
 
 7642          xtnw=xtnw+clock()-to;
 
 7653        xtnw=xtnw+clock()-to;
 
 7661        MivString(omega, omega2, next_vect);
 
 7672      if(ivtarget->
length() == nV)
 
 7698        Print(
"\n//** rec_r_fractal_call: applying Buchberger's algorithm in ring r = %s;",
 
 7707      xtextra=xtextra+clock()-to;
 
 7715        Print(
"\n//** rec_r_fractal_call: (1) Leaving the %d-th recursion with %d steps.\n",
 
 7734      if(ivtarget->
length() == nV)
 
 7759          Print(
"\n//** rec_r_fractal_call: (2) Leaving the %d-th recursion with %d steps.\n",
 
 7769          Print(
"\n//** rec_r_fractal_call: target weight doesn't stay in the correct cone.\n");
 
 7772#ifndef  MSTDCC_FRACTAL 
 7780        if(ivtarget->
length() == nV)
 
 7790      Gt = 
NULL; 
return(Gt);
 
 7797          goto FRACTAL_MSTDCC;
 
 7809        for(
i=nV-1; 
i>=0; 
i--)
 
 7810          (*omega2)[
i] = (*Xtau)[(nlev-1)*nV+
i];
 
 7816        goto NEXT_VECTOR_FRACTAL;
 
 7822          Print(
"\n//** rec_r_fractal_call: apply Buchberger's algorithm in ring = %s.\n",
 
 7830        xtextra=xtextra+clock()-to;
 
 7835        if(ivtarget->
length() == nV)
 
 7859        if(ivtarget->
length() == nV)
 
 7878          Print(
"\n//** rec_r_fractal_call: (3) Leaving the %d-th recursion with %d steps.\n",
 
 7890    for(
i=nV-1; 
i>=0; 
i--)
 
 7892      (*altomega)[
i] = (*omega)[
i];
 
 7893      (*omega)[
i] = (*next_vect)[
i];
 
 7902    xtif=xtif+clock()-to;
 
 7906#ifdef CHECK_IDEAL_MWALK 
 7909      idString(Gomega,
"//** rec_r_fractal_call: Gomega");
 
 7923        goto NEXT_VECTOR_FRACTAL;
 
 7927#ifndef  BUCHBERGER_ALG 
 7928    if(isNolVector(omega) == 0)
 
 7933    if(ivtarget->
length() == nV)
 
 7957#ifdef  BUCHBERGER_ALG 
 7964      xtstd=xtstd+clock()-to;
 
 7973#ifdef CHECK_IDEAL_MWALK 
 7976      idString(Gresult,
"//** rec_r_fractal_call: M");
 
 7991    xtlift=xtlift+clock()-to;
 
 7993#ifdef CHECK_IDEAL_MWALK 
 7996      idString(F,
"//** rec_r_fractal_call: F");
 
 8049  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
 
 8069#ifdef FIRST_STEP_FRACTAL 
 8074    && (Gw->m[
i]->next!=
NULL) 
 
 8075    && (Gw->m[
i]->next->next!=
NULL)) 
 
 8079      if(ivstart->
length() == nV)
 
 8081        if(
MivSame(ivstart, iv_dp) != 1)
 
 8106  if(ivtarget->
length() == nV)
 
 8146  if(ivtarget->
length() == nV)
 
 8169  xftostd=xftostd+clock()-to;
 
 8190  TimeStringFractal(xftinput, xftostd, xtif, xtstd, xtextra,
 
 8191                    xtlift, xtred, xtnw);
 
 8196  Print(
"\n// the numbers of Overflow_Error (%d)", 
nnflow);
 
 8213              int weight_rad, 
int reduction, 
int printout)
 
 8236  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
 
 8256#ifdef FIRST_STEP_FRACTAL 
 8261    && (Gw->m[
i]->next!=
NULL) 
 
 8262    && (Gw->m[
i]->next->next!=
NULL)) 
 
 8266      if(ivstart->
length() == nV)
 
 8268        if(
MivSame(ivstart, iv_dp) != 1)
 
 8293  if(ivtarget->
length() == nV)
 
 8333  if(ivtarget->
length() == nV)
 
 8356  xftostd=xftostd+clock()-to;
 
 8377  TimeStringFractal(xftinput, xftostd, xtif, xtstd, xtextra,
 
 8378                    xtlift, xtred, xtnw);
 
 8383  Print(
"\n// the numbers of Overflow_Error (%d)", 
nnflow);
 
 8399  clock_t mtim = clock();
 
 8407  clock_t tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0, textra=0;
 
 8408  clock_t tinput = clock();
 
 8410  int nsteppert=0, 
i, nV = 
currRing->N, nwalk=0, npert_tmp=0;
 
 8411  int *npert=(
int*)
omAlloc(2*nV*
sizeof(
int));
 
 8412  ideal Gomega, 
M,F,  G1, Gomega1, Gomega2, M1, 
F1;
 
 8414  ring newRing, oldRing, lpRing;
 
 8422  int nGB, endwalks = 0,  nwalkpert=0;
 
 8425#ifndef BUCHBERGER_ALG 
 8430  for(
i=nV-1; 
i>0; 
i--)
 
 8431    (*last_omega)[
i] = 1;
 
 8432  (*last_omega)[0] = 10000;
 
 8436  for(
i=nV-1; 
i>=0; 
i--)
 
 8437    (*target_weight)[
i] = (*target_tmp)[
i];
 
 8446  if(
MivComp(curr_weight, iv_dp) == 1) 
 
 8462#ifdef REPRESENTATION_OF_SIGMA 
 8468    if(
MivComp(curr_weight, iv_dp) == 1)
 
 8469      MDp = MatrixOrderdp(nV); 
 
 8473    curr_weight = RepresentationMatrix_Dp(
G, MDp);
 
 8490    tostd=tostd+clock()-to;
 
 8493    goto COMPUTE_NEW_VECTOR;
 
 8512#ifndef  BUCHBERGER_ALG 
 8513    if(isNolVector(curr_weight) == 0)
 
 8534#ifdef  BUCHBERGER_ALG 
 8541    tstd=tstd+clock()-to;
 
 8557    tlift=tlift+clock()-to;
 
 8574    tred=tred+clock()-to;
 
 8592    MivString(curr_weight, target_weight, next_weight);
 
 8604    OMEGA_OVERFLOW_TRAN_NEW:
 
 8616      if(
MivSame(target_tmp, iv_lp) == 1)
 
 8634      if(nP == 0 || 
MivSame(target_tmp, iv_lp) == 0){
 
 8643        G = 
LastGB(G1, curr_weight, nV-1); 
 
 8651      npert[endwalks]=nwalk-npert_tmp;
 
 8660    if(
MivComp(next_weight, target_weight) == 1 ||
 
 8661       MivComp(next_weight, curr_weight) == 1 )
 
 8667      npert[endwalks]=nwalk-npert_tmp;
 
 8673      if(endwalks == 1 && 
MivComp(next_weight, curr_weight) == 1){
 
 8680      if(
MivSame(target_tmp, iv_lp) == 1)
 
 8727        if(
p->next != 
NULL &&
 
 8728           p->next->next != 
NULL &&
 
 8729           p->next->next->next != 
NULL)
 
 8734            (*vector_tmp)[
i] = (*target_weight)[
i];
 
 8736          delete target_weight;
 
 8739          if(
MivComp(vector_tmp, target_weight)==1)
 
 8744            goto OMEGA_OVERFLOW_TRAN_NEW;
 
 8751            goto OMEGA_OVERFLOW_TRAN_NEW;
 
 8761      if(plength3 == 
FALSE)
 
 8786      goto COMPUTE_NEW_VECTOR;
 
 8790    for(
i=nV-1; 
i>=0; 
i--)
 
 8791      (*curr_weight)[
i] = (*next_weight)[
i];
 
 8826ideal TranMrImprovwalk(ideal 
G,
intvec* curr_weight,
intvec* target_tmp, 
int nP, 
int weight_rad, 
int pert_deg)
 
 8829  clock_t mtim = clock();
 
 8837  VAR clock_t tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0, textra=0;
 
 8838  VAR clock_t tinput = clock();
 
 8840  VAR int nsteppert=0, 
i, nV = 
currRing->N, nwalk=0, npert_tmp=0;
 
 8841  VAR int *npert=(
int*)
omAlloc(2*nV*
sizeof(
int));
 
 8842  INST_VAR ideal Gomega, 
M,F,  G1, Gomega1, Gomega2, M1, 
F1;
 
 8844  VAR ring newRing, oldRing, lpRing;
 
 8852  VAR int weight_norm, nGB, endwalks = 0,  nwalkpert=0,  npertstep=0;
 
 8855#ifndef BUCHBERGER_ALG 
 8860  for(
i=nV-1; 
i>0; 
i--)
 
 8862    (*last_omega)[
i] = 1;
 
 8864  (*last_omega)[0] = 10000;
 
 8868  for(
i=nV-1; 
i>=0; 
i--)
 
 8870    (*target_weight)[
i] = (*target_tmp)[
i];
 
 8879  if(
MivComp(curr_weight, iv_dp) == 1)
 
 8902#ifdef REPRESENTATION_OF_SIGMA 
 8908    if(
MivComp(curr_weight, iv_dp) == 1)
 
 8910      MDp = MatrixOrderdp(nV); 
 
 8916    curr_weight = RepresentationMatrix_Dp(
G, MDp);
 
 8937    tostd=tostd+clock()-to;
 
 8940    goto COMPUTE_NEW_VECTOR;
 
 8959#ifndef  BUCHBERGER_ALG 
 8960    if(isNolVector(curr_weight) == 0)
 
 8988#ifdef  BUCHBERGER_ALG 
 8995    tstd=tstd+clock()-to;
 
 9010    tlift=tlift+clock()-to;
 
 9027    tred=tred+clock()-to;
 
 9121    MivString(curr_weight, target_weight, next_weight);
 
 9133    OMEGA_OVERFLOW_TRAN_NEW:
 
 9140#ifdef CHECK_IDEAL_MWALK 
 9145      if(
MivSame(target_tmp, iv_lp) == 1)
 
 9174      if(nP == 0 || 
MivSame(target_tmp, iv_lp) == 0)
 
 9185        G = 
LastGB(G1, curr_weight, nV-1); 
 
 9193      npert[endwalks]=nwalk-npert_tmp;
 
 9202    if(
MivComp(next_weight, target_weight) == 1 || 
MivComp(next_weight, curr_weight) == 1 )
 
 9208      npert[endwalks]=nwalk-npert_tmp;
 
 9214      if(endwalks == 1 && 
MivComp(next_weight, curr_weight) == 1)
 
 9222      if(
MivSame(target_tmp, iv_lp) == 1)
 
 9278        if(
p->next != 
NULL &&
 
 9279           p->next->next != 
NULL &&
 
 9280           p->next->next->next != 
NULL)
 
 9286            (*vector_tmp)[
i] = (*target_weight)[
i];
 
 9288          delete target_weight;
 
 9291          if(
MivComp(vector_tmp, target_weight)==1)
 
 9296            goto OMEGA_OVERFLOW_TRAN_NEW;
 
 9303            goto OMEGA_OVERFLOW_TRAN_NEW;
 
 9313      if(plength3 == 
FALSE)
 
 9339      goto COMPUTE_NEW_VECTOR;
 
 9343    for(
i=nV-1; 
i>=0; 
i--)
 
 9345      (*curr_weight)[
i] = (*next_weight)[
i];
 
 9357  VAR delete next_weight;
 
 9362  Print(
"\n// Computation took %d steps and %.2f sec", nwalk, ((
double) (clock()-mtim)/1000000));
 
 9364  TimeStringFractal(tinput, tostd, tif, tstd, textra, tlift, tred, tnw);
 
 9383  clock_t tinput=clock();
 
 9388  if(tp_deg < 1 || tp_deg > nV)
 
 9390    WerrorS(
"Invalid perturbation degree.\n");
 
 9394  int nwalk=0, endwalks=0, ntestwinC=1;
 
 9395  int tp_deg_tmp = tp_deg;
 
 9396  ideal Gomega, 
M, F, 
G, M1, 
F1, Gomega1, Gomega2, G1;
 
 9397  ring newRing, oldRing, TargetRing;
 
 9430      target_weight = 
Mivlp(nV);
 
 9440  if(tp_deg != tp_deg_tmp)
 
 9450#ifndef  BUCHBERGER_ALG 
 9455  for(
i=nV-1; 
i>0; 
i--)
 
 9457    (*last_omega)[
i] = 1;
 
 9459  (*last_omega)[0] = 10000;
 
 9479    xtif=xtif+clock()-to;
 
 9482#ifndef  BUCHBERGER_ALG 
 9483    if(isNolVector(curr_weight) == 0)
 
 9516#ifdef  BUCHBERGER_ALG 
 9523    xtstd=xtstd+clock()-to;
 
 9539    xtlift=xtlift+clock()-to;
 
 9556    xtred=xtred+clock()-to;
 
 9571    xtnw=xtnw+clock()-to;
 
 9574    MivString(curr_weight, target_weight, next_weight);
 
 9583        tproc = tproc+clock()-tinput;
 
 9596    if(
MivComp(next_weight, ivNull) == 1)
 
 9602    if(
MivComp(next_weight, target_weight) == 1)
 
 9606    for(
i=nV-1; 
i>=0; 
i--)
 
 9609      (*curr_weight)[
i] = (*next_weight)[
i];
 
 9638      xtextra=xtextra+clock()-to;
 
 9648      tproc = tproc+clock()-tinput;
 
 9661  delete target_weight;
 
 9682  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
 
 9684  clock_t tostd, tproc;
 
 9689  int nwalk=0, endwalks=0;
 
 9690  int op_tmp = op_deg;
 
 9691  ideal Gomega, 
M, F, 
G, Gomega1, Gomega2, M1, 
F1;
 
 9692  ring newRing, oldRing;
 
 9699#ifndef  BUCHBERGER_ALG 
 9702  intvec* cw_tmp = curr_weight;
 
 9706  for(
i=nV-1; 
i>0; 
i--)
 
 9708    (*last_omega)[
i] = 1;
 
 9710  (*last_omega)[0] = 10000;
 
 9724      if(
MivComp(curr_weight, iv_dp) == 1)
 
 9727        if(op_tmp == op_deg)
 
 9739      if(op_tmp == op_deg)
 
 9763      curr_weight =  cw_tmp;
 
 9795    xtif=xtif+clock()-to;
 
 9800      for(
i=nV-1; 
i>=0; 
i--)
 
 9801        (*curr_weight)[
i] = (*extra_curr_weight)[
i];
 
 9802      delete extra_curr_weight;
 
 9808#ifndef  BUCHBERGER_ALG 
 9809    if(isNolVector(curr_weight) == 0)
 
 9837#ifdef  BUCHBERGER_ALG 
 9844    xtstd=xtstd+clock()-to;
 
 9858    xtlift=xtlift+clock()-to;
 
 9877    xtred=xtred+clock()-to;
 
 9892    xtnw=xtnw+clock()-to;
 
 9895    MivString(curr_weight, target_weight, next_weight);
 
 9918    if(
MivComp(next_weight, ivNull) == 1)
 
 9925    if(
MivComp(next_weight, target_weight) == 1)
 
 9927      if(tp_deg == 1 || 
MivSame(target_weight, exivlp) == 0)
 
 9934        tproc = clock()-xftinput;
 
 9947    for(
i=nV-1; 
i>=0; 
i--)
 
 9950      (*curr_weight)[
i] = (*next_weight)[
i];
 
const CanonicalForm CFMap CFMap & N
 
poly singclap_pdivide(poly f, poly g, const ring r)
 
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
 
void(* initEcart)(TObject *L)
 
int(* posInT)(const TSet T, const int tl, LObject &h)
 
Coefficient rings, fields and other domains suitable for Singular polynomials.
 
void reduction(LList *sPolyList, CListOld *critPairs, LList *gPrev, RList *rules, LTagList *lTag, RTagList *rTag, ideal gbPrev, PList *rejectedGBList, int plus)
 
const Variable & v
< [in] a sqrfree bivariate poly
 
static int max(int a, int b)
 
void WerrorS(const char *s)
 
intvec * hFirstSeries(ideal A, intvec *module_w, ideal Q, intvec *wdegree)
 
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = M...
 
#define idDelete(H)
delete an ideal
 
static ideal idVec2Ideal(poly vec)
 
static BOOLEAN length(leftv result, leftv arg)
 
intvec * ivCopy(const intvec *o)
 
KINLINE TObject ** initR()
 
KINLINE unsigned long * initsevT()
 
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
 
int posInT0(const TSet, const int length, LObject &)
 
void initS(ideal F, ideal Q, kStrategy strat)
 
void initEcartNormal(TObject *h)
 
void updateS(BOOLEAN toT, kStrategy strat)
 
void initBuchMoraCrit(kStrategy strat)
 
void completeReduce(kStrategy strat, BOOLEAN withT)
 
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
 
gmp_float sqrt(const gmp_float &a)
 
#define omFreeSize(addr, size)
 
#define SI_SAVE_OPT(A, B)
 
#define TEST_OPT_INTSTRATEGY
 
#define SI_RESTORE_OPT(A, B)
 
static int pLength(poly a)
 
static void p_Setm(poly p, const ring r)
 
void rChangeCurrRing(ring r)
 
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
 
Compatibility layer for legacy polynomial operations (over currRing)
 
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
 
#define pIsConstant(p)
like above, except that Comp must be 0
 
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
 
#define pGetExp(p, i)
Exponent.
 
#define pEqualPolys(p1, p2)
 
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
 
#define pCopy(p)
return a copy of the poly
 
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
 
void PrintS(const char *s)
 
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
 
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
 
void rDelete(ring r)
unconditionally deletes fields in r
 
static int rBlocks(const ring r)
 
static char const ** rParameter(const ring r)
(r->cf->parameter)
 
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
 
ideal idInit(int idsize, int rank)
initialise an ideal / module
 
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
 
void id_Normalize(ideal I, const ring r)
normialize all polys in id
 
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
 
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
 
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
 
int F1(int a1, int &r1)
F1.
 
void F2(int a2, int &r2)
F2.
 
int M3ivSame(intvec *temp, intvec *u, intvec *v)
 
static ideal REC_GB_Mwalk(ideal G, intvec *curr_weight, intvec *orig_target_weight, int tp_deg, int npwinc)
 
EXTERN_VAR BOOLEAN pSetm_error
 
static void ivString(intvec *iv, const char *ch)
 
intvec * MivWeightOrderdp(intvec *ivstart)
 
static ideal kInterRedCC(ideal F, ideal Q)
 
static int MivAbsMaxArg(intvec *vec)
 
intvec * MMatrixone(int nV)
 
static ideal idHeadCC(ideal h)
 
static ideal MstdhomCC(ideal G)
 
static ring VMrRefine(intvec *va, intvec *vb)
 
static ideal rec_r_fractal_call(ideal G, int nlev, intvec *ivtarget, int weight_rad, int reduction, int printout)
 
static void cancel(mpz_t zaehler, mpz_t nenner)
 
static intvec * MExpPol(poly f)
 
ideal TranMImprovwalk(ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
 
static int lengthpoly(ideal G)
 
static long Mlcm(long &i1, long &i2)
 
static int MivComp(intvec *iva, intvec *ivb)
 
static int MwalkWeightDegree(poly p, intvec *weight_vector)
 
intvec * MivMatrixOrderdp(int nV)
 
ideal Mfwalk(ideal G, intvec *ivstart, intvec *ivtarget, int reduction, int printout)
 
static intvec * MivSub(intvec *a, intvec *b)
 
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
 
ideal MwalkAlt(ideal Go, intvec *curr_weight, intvec *target_weight)
 
static ideal MidMult(ideal A, ideal B)
 
static long gcd(const long a, const long b)
 
intvec * MivWeightOrderlp(intvec *ivstart)
 
static ideal middleOfCone(ideal G, ideal Gomega)
 
ideal Mprwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int op_deg, int tp_deg, int nP, int reduction, int printout)
 
intvec * MivMatrixOrder(intvec *iv)
 
static int MLmWeightedDegree(const poly p, intvec *weight)
 
static ideal rec_fractal_call(ideal G, int nlev, intvec *ivtarget, int reduction, int printout)
 
void Set_Error(BOOLEAN f)
 
static ideal Mpwalk_MAltwalk1(ideal Go, intvec *curr_weight, int tp_deg)
 
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
 
static ring VMrDefault(intvec *va)
 
static int maxlengthpoly(ideal G)
 
static int * initS_2_R(int maxnr)
 
static int isNegNolVector(intvec *hilb)
 
static void DefRingParlp(void)
 
static long MivDotProduct(intvec *a, intvec *b)
 
ideal MAltwalk2(ideal Go, intvec *curr_weight, intvec *target_weight)
 
static void MLmWeightedDegree_gmp(mpz_t result, const poly p, intvec *weight)
 
static int islengthpoly2(ideal G)
 
static intvec * MWalkRandomNextWeight(ideal G, intvec *orig_M, intvec *target_weight, int weight_rad, int pert_deg)
 
static unsigned long * initsevS(int maxnr)
 
ideal MAltwalk1(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight)
 
ideal Mrwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int pert_deg, int reduction, int printout)
 
static ring VMatrRefine(intvec *va, intvec *vb)
 
intvec * MivMatrixOrderRefine(intvec *iv, intvec *iw)
 
ideal Mfrwalk(ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad, int reduction, int printout)
 
ideal Mwalk(ideal Go, intvec *orig_M, intvec *target_M, ring baseRing, int reduction, int printout)
 
VAR BOOLEAN Overflow_Error
 
static poly MpolyInitialForm(poly g, intvec *curr_weight)
 
ideal Mpwalk(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP, int reduction, int printout)
 
static intvec * NewVectorlp(ideal I)
 
int MivSame(intvec *u, intvec *v)
 
ideal MwalkInitialForm(ideal G, intvec *ivw)
 
static ideal LastGB(ideal G, intvec *curr_weight, int tp_deg)
 
intvec * MivMatrixOrderlp(int nV)
 
static void idString(ideal L, const char *st)
 
static intset initec(int maxnr)
 
static int MivAbsMax(intvec *vec)
 
intvec * Mfpertvector(ideal G, intvec *ivtarget)
 
static ring VMatrDefault(intvec *va)
 
intvec * MPertVectorslp(ideal G, intvec *ivtarget, int pdeg)
 
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
 
static void VMrDefaultlp(void)
 
static void DefRingPar(intvec *va)
 
static ideal MstdCC(ideal G)
 
static intvec * MwalkNextWeightCC(intvec *curr_weight, intvec *target_weight, ideal G)
 
static int test_w_in_ConeCC(ideal G, intvec *iv)
 
static int test_G_GB_walk(ideal H0, ideal H1)
 
static ideal Rec_LastGB(ideal G, intvec *curr_weight, intvec *orig_target_weight, int tp_deg, int npwinc)