Functions
walk.h File Reference
#include <kernel/structs.h>

Go to the source code of this file.

Functions

ideal MwalkInitialForm (ideal G, intvec *curr_weight)
 
intvecMwalkNextWeight (intvec *curr_weight, intvec *target_weight, ideal G)
 
int MivSame (intvec *u, intvec *v)
 
int M3ivSame (intvec *next_weight, intvec *u, intvec *v)
 
intvecMivdp (int nR)
 
intvecMivlp (int nR)
 
intvecMivMatrixOrder (intvec *iv)
 
intvecMivMatrixOrderdp (int iv)
 
intvecMPertVectors (ideal G, intvec *ivtarget, int pdeg)
 
intvecMPertVectorslp (ideal G, intvec *ivtarget, int pdeg)
 
intvecMivMatrixOrderlp (int nV)
 
intvecMfpertvector (ideal G, intvec *iv)
 
intvecMivUnit (int nV)
 
intvecMivWeightOrderlp (intvec *ivstart)
 
intvecMivWeightOrderdp (intvec *ivstart)
 
ideal MidLift (ideal Gomega, ideal M)
 
ideal MLiftLmalG (ideal L, ideal G)
 
ideal MLiftLmalGNew (ideal Gomega, ideal M, ideal G)
 
ideal MLiftLmalGMin (ideal L, ideal G)
 
intvecMkInterRedNextWeight (intvec *iva, intvec *ivb, ideal G)
 
intvecMPertNextWeight (intvec *iva, ideal G, int deg)
 
intvecMivperttarget (ideal G, int ndeg)
 
intvecMSimpleIV (intvec *iv)
 
ideal Mwalk (ideal Go, intvec *orig_M, intvec *target_M, ring baseRing)
 
ideal Mrwalk (ideal Go, intvec *curr_weight, intvec *target_weight, int weight_rad, int pert_deg, ring baseRing)
 
ideal Mpwalk (ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP)
 
ideal Mprwalk (ideal Go, intvec *curr_weight, intvec *target_weight, int weight_rad, int op_deg, int tp_deg, ring baseRing)
 
ideal Mfwalk (ideal G, intvec *ivstart, intvec *ivtarget)
 
ideal Mfrwalk (ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad)
 
intvecTranMPertVectorslp (ideal G)
 
ideal TranMImprovwalk (ideal Go, intvec *curr_weight, intvec *target_weight, int nP)
 
ideal MAltwalk1 (ideal G, int op, int tp, intvec *curr_weight, intvec *target_weight)
 
ideal MAltwalk2 (ideal G, intvec *curr_weight, intvec *target_weight)
 

Function Documentation

int M3ivSame ( intvec next_weight,
intvec u,
intvec v 
)

Definition at line 889 of file walk.cc.

890 {
891  assume(temp->length() == u->length() && u->length() == v->length());
892 
893  if((MivSame(temp, u)) == 1)
894  {
895  return 0;
896  }
897  if((MivSame(temp, v)) == 1)
898  {
899  return 1;
900  }
901  return 2;
902 }
int length() const
Definition: intvec.h:85
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
#define assume(x)
Definition: mod2.h:405
ideal MAltwalk1 ( ideal  G,
int  op,
int  tp,
intvec curr_weight,
intvec target_weight 
)

Definition at line 8444 of file walk.cc.

8446 {
8447  Set_Error(FALSE );
8449 #ifdef TIME_TEST
8450  BOOLEAN nOverflow_Error = FALSE;
8451 #endif
8452  // Print("// pSetm_Error = (%d)", ErrorCheck());
8453 
8454  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
8455  xftinput = clock();
8456  clock_t tostd, tproc;
8457 
8458  nstep = 0;
8459  int i, nV = currRing->N;
8460  int nwalk=0, endwalks=0;
8461  int op_tmp = op_deg;
8462  ideal Gomega, M, F, G, Gomega1, Gomega2, M1, F1;
8463  ring newRing, oldRing;
8464  intvec* next_weight;
8465  intvec* iv_M_dp;
8466  intvec* ivNull = new intvec(nV);
8467  intvec* iv_dp = MivUnit(nV);// define (1,1,...,1)
8468  intvec* exivlp = Mivlp(nV);
8469  //intvec* extra_curr_weight = new intvec(nV);
8470 #ifndef BUCHBERGER_ALG
8471  intvec* hilb_func;
8472 #endif
8473  intvec* cw_tmp = curr_weight;
8474 
8475  // to avoid (1,0,...,0) as the target vector
8476  intvec* last_omega = new intvec(nV);
8477  for(i=nV-1; i>0; i--)
8478  {
8479  (*last_omega)[i] = 1;
8480  }
8481  (*last_omega)[0] = 10000;
8482 
8483  ring XXRing = currRing;
8484 
8485  to=clock();
8486  /* compute a pertubed weight vector of the original weight vector.
8487  The perturbation degree is recursive decrease until that vector
8488  stays inn the correct cone. */
8489  while(1)
8490  {
8491  if(Overflow_Error == FALSE)
8492  {
8493  if(MivComp(curr_weight, iv_dp) == 1)
8494  {
8495  //rOrdStr(currRing) = "dp"
8496  if(op_tmp == op_deg)
8497  {
8498  G = MstdCC(Go);
8499  if(op_deg != 1)
8500  {
8501  iv_M_dp = MivMatrixOrderdp(nV);
8502  }
8503  }
8504  }
8505  }
8506  else
8507  {
8508  if(op_tmp == op_deg)
8509  {
8510  //rOrdStr(currRing) = (a(...),lp,C)
8511  if (rParameter(currRing) != NULL)
8512  {
8513  DefRingPar(cw_tmp);
8514  }
8515  else
8516  {
8517  rChangeCurrRing(VMrDefault(cw_tmp)); // Aenderung 16
8518  }
8519  G = idrMoveR(Go, XXRing,currRing);
8520  G = MstdCC(G);
8521  if(op_deg != 1)
8522  iv_M_dp = MivMatrixOrder(cw_tmp);
8523  }
8524  }
8526  if(op_deg != 1)
8527  {
8528  curr_weight = MPertVectors(G, iv_M_dp, op_deg);
8529  }
8530  else
8531  {
8532  curr_weight = cw_tmp;
8533  break;
8534  }
8535  if(Overflow_Error == FALSE)
8536  {
8537  break;
8538  }
8539  Overflow_Error = TRUE;
8540  op_deg --;
8541  }
8542  tostd=clock()-to;
8543 
8544  if(op_tmp != 1 )
8545  delete iv_M_dp;
8546  delete iv_dp;
8547 
8548  if(currRing->order[0] == ringorder_a)
8549  goto NEXT_VECTOR;
8550 
8551  while(1)
8552  {
8553  nwalk ++;
8554  nstep ++;
8555 
8556  to = clock();
8557  // compute an initial form ideal of <G> w.r.t. "curr_vector"
8558  Gomega = MwalkInitialForm(G, curr_weight);
8559  xtif=xtif+clock()-to;
8560 #if 0
8561  if(Overflow_Error == TRUE)
8562  {
8563  for(i=nV-1; i>=0; i--)
8564  (*curr_weight)[i] = (*extra_curr_weight)[i];
8565  delete extra_curr_weight;
8566 
8567  newRing = currRing;
8568  goto MSTD_ALT1;
8569  }
8570 #endif
8571 #ifndef BUCHBERGER_ALG
8572  if(isNolVector(curr_weight) == 0)
8573  {
8574  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
8575  }
8576  else
8577  {
8578  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
8579  }
8580 #endif // BUCHBERGER_ALG
8581 
8582  oldRing = currRing;
8583 
8584  // define a new ring which ordering is "(a(curr_weight),lp)
8585  if (rParameter(currRing) != NULL)
8586  {
8587  DefRingPar(curr_weight);
8588  }
8589  else
8590  {
8591  rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 17
8592  }
8593  newRing = currRing;
8594  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
8595 
8596  to=clock();
8597  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
8598 #ifdef BUCHBERGER_ALG
8599  M = MstdhomCC(Gomega1);
8600 #else
8601  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
8602  delete hilb_func;
8603 #endif // BUCHBERGER_ALG
8604  xtstd=xtstd+clock()-to;
8605 
8606  // change the ring to oldRing
8607  rChangeCurrRing(oldRing);
8608  M1 = idrMoveR(M, newRing,currRing);
8609  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
8610 
8611  to=clock();
8612  // compute a reduced Groebner basis of <G> w.r.t. "newRing" by the lifting process
8613  F = MLifttwoIdeal(Gomega2, M1, G);
8614  xtlift=xtlift+clock()-to;
8615 
8616  idDelete(&M1);
8617  idDelete(&Gomega2);
8618  idDelete(&G);
8619 
8620  // change the ring to newRing
8621  rChangeCurrRing(newRing);
8622  F1 = idrMoveR(F, oldRing,currRing);
8623 
8624  to=clock();
8625  // reduce the Groebner basis <G> w.r.t. new ring
8626  G = kInterRedCC(F1, NULL);
8627  xtred=xtred+clock()-to;
8628  idDelete(&F1);
8629 
8630  if(endwalks == 1)
8631  {
8632  break;
8633  }
8634  NEXT_VECTOR:
8635  to=clock();
8636  // compute a next weight vector
8637  next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
8638  xtnw=xtnw+clock()-to;
8639 #ifdef PRINT_VECTORS
8640  MivString(curr_weight, target_weight, next_weight);
8641 #endif
8642 
8643  if(Overflow_Error == TRUE)
8644  {
8645  newRing = currRing;
8646 
8647  if (rParameter(currRing) != NULL)
8648  {
8649  DefRingPar(target_weight);
8650  }
8651  else
8652  {
8653  rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 18
8654  }
8655  F1 = idrMoveR(G, newRing,currRing);
8656  G = MstdCC(F1);
8657  idDelete(&F1);
8658  newRing = currRing;
8659  break; //for while
8660  }
8661 
8662 
8663  /* G is the wanted Groebner basis if next_weight == curr_weight */
8664  if(MivComp(next_weight, ivNull) == 1)
8665  {
8666  newRing = currRing;
8667  delete next_weight;
8668  break; //for while
8669  }
8670 
8671  if(MivComp(next_weight, target_weight) == 1)
8672  {
8673  if(tp_deg == 1 || MivSame(target_weight, exivlp) == 0)
8674  endwalks = 1;
8675  else
8676  {
8677  // MSTD_ALT1:
8678 #ifdef TIME_TEST
8679  nOverflow_Error = Overflow_Error;
8680 #endif
8681  tproc = clock()-xftinput;
8682 
8683  //Print("\n// main routine takes %d steps and calls \"Mpwalk\" (1,%d):", nwalk, tp_deg);
8684 
8685  // compute the red. GB of <G> w.r.t. the lex order by the "recursive-modified" perturbation walk alg (1,tp_deg)
8686  G = Mpwalk_MAltwalk1(G, curr_weight, tp_deg);
8687  delete next_weight;
8688  break; // for while
8689  }
8690  }
8691 
8692  //NOT Changed, to free memory
8693  for(i=nV-1; i>=0; i--)
8694  {
8695  //(*extra_curr_weight)[i] = (*curr_weight)[i];
8696  (*curr_weight)[i] = (*next_weight)[i];
8697  }
8698  delete next_weight;
8699  }//while
8700 
8701  rChangeCurrRing(XXRing);
8702  ideal result = idrMoveR(G, newRing,currRing);
8703  id_Delete(&G, newRing);
8704 
8705  delete ivNull;
8706  if(op_deg != 1 )
8707  {
8708  delete curr_weight;
8709  }
8710  delete exivlp;
8711 #ifdef TIME_TEST
8712 
8713  Print("\n// \"Main procedure\" took %d steps, %.2f sec. and Overflow_Error(%d)",
8714  nwalk, ((double) tproc)/1000000, nOverflow_Error);
8715 
8716  TimeStringFractal(xftinput, tostd, xtif, xtstd,xtextra, xtlift, xtred, xtnw);
8717 
8718  Print("\n// pSetm_Error = (%d)", ErrorCheck());
8719  Print("\n// Overflow_Error? (%d)", Overflow_Error);
8720  Print("\n// Awalk1 took %d steps.\n", nstep);
8721 #endif
8722  return(result);
8723 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
BOOLEAN ErrorCheck()
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
clock_t xftinput
Definition: walk.cc:99
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
static ideal Mpwalk_MAltwalk1(ideal Go, intvec *curr_weight, int tp_deg)
Definition: walk.cc:7988
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static int isNolVector(intvec *hilb)
Definition: walk.cc:2961
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2809
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
static void MivString(intvec *iva, intvec *ivb, intvec *ivc)
Definition: walk.cc:514
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1300
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
int BOOLEAN
Definition: auxiliary.h:131
clock_t xtextra
Definition: walk.cc:99
return result
Definition: facAbsBiFact.cc:76
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2358
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
ideal MAltwalk2 ( ideal  G,
intvec curr_weight,
intvec target_weight 
)

Definition at line 4075 of file walk.cc.

4076 {
4077  Set_Error(FALSE);
4079  //BOOLEAN nOverflow_Error = FALSE;
4080  //Print("// pSetm_Error = (%d)", ErrorCheck());
4081 
4082  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
4083  xftinput = clock();
4084  clock_t tostd, tproc;
4085 
4086  nstep = 0;
4087  int i, nV = currRing->N;
4088  int nwalk=0, endwalks=0;
4089  // int nhilb = 1;
4090  ideal Gomega, M, F, Gomega1, Gomega2, M1, F1, G;
4091  //ideal G1;
4092  //ring endRing;
4093  ring newRing, oldRing;
4094  intvec* ivNull = new intvec(nV);
4095  intvec* next_weight;
4096 #if 0
4097  intvec* extra_curr_weight = new intvec(nV);
4098 #endif
4099  //intvec* hilb_func;
4100  intvec* exivlp = Mivlp(nV);
4101 
4102  ring XXRing = currRing;
4103 
4104  //Print("\n// ring r_input = %s;", rString(currRing));
4105  to = clock();
4106  /* compute the reduced Groebner basis of the given ideal w.r.t.
4107  a "fast" monomial order, e.g. degree reverse lex. order (dp) */
4108  G = MstdCC(Go);
4109  tostd=clock()-to;
4110 
4111  /*
4112  Print("\n// Computation of the first std took = %.2f sec",
4113  ((double) tostd)/1000000);
4114  */
4115  if(currRing->order[0] == ringorder_a)
4116  {
4117  goto NEXT_VECTOR;
4118  }
4119  while(1)
4120  {
4121  nwalk ++;
4122  nstep ++;
4123  to = clock();
4124  /* compute an initial form ideal of <G> w.r.t. "curr_vector" */
4125  Gomega = MwalkInitialForm(G, curr_weight);
4126  xtif=xtif+clock()-to;
4127 #if 0
4128  if(Overflow_Error == TRUE)
4129  {
4130  for(i=nV-1; i>=0; i--)
4131  (*curr_weight)[i] = (*extra_curr_weight)[i];
4132  delete extra_curr_weight;
4133  goto LAST_GB_ALT2;
4134  }
4135 #endif
4136  oldRing = currRing;
4137 
4138  /* define a new ring that its ordering is "(a(curr_weight),lp) */
4139  if (rParameter(currRing) != NULL)
4140  {
4141  DefRingPar(curr_weight);
4142  }
4143  else
4144  {
4145  rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
4146  }
4147  newRing = currRing;
4148  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
4149  to = clock();
4150  /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */
4151  M = MstdhomCC(Gomega1);
4152  xtstd=xtstd+clock()-to;
4153  /* change the ring to oldRing */
4154  rChangeCurrRing(oldRing);
4155  M1 = idrMoveR(M, newRing,currRing);
4156  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
4157 
4158  to = clock();
4159  /* compute the reduced Groebner basis of <G> w.r.t. "newRing"
4160  by the liftig process */
4161  F = MLifttwoIdeal(Gomega2, M1, G);
4162  xtlift=xtlift+clock()-to;
4163  idDelete(&M1);
4164  idDelete(&Gomega2);
4165  idDelete(&G);
4166 
4167  /* change the ring to newRing */
4168  rChangeCurrRing(newRing);
4169  F1 = idrMoveR(F, oldRing,currRing);
4170 
4171  to = clock();
4172  /* reduce the Groebner basis <G> w.r.t. newRing */
4173  G = kInterRedCC(F1, NULL);
4174  xtred=xtred+clock()-to;
4175  idDelete(&F1);
4176 
4177  if(endwalks == 1)
4178  break;
4179 
4180  NEXT_VECTOR:
4181  to = clock();
4182  /* compute a next weight vector */
4183  next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
4184  xtnw=xtnw+clock()-to;
4185 #ifdef PRINT_VECTORS
4186  MivString(curr_weight, target_weight, next_weight);
4187 #endif
4188 
4189  if(Overflow_Error == TRUE)
4190  {
4191  /*
4192  ivString(next_weight, "omega");
4193  PrintS("\n// ** The weight vector does NOT stay in Cone!!\n");
4194  */
4195 #ifdef TEST_OVERFLOW
4196  goto TEST_OVERFLOW_OI;
4197 #endif
4198 
4199  newRing = currRing;
4200  if (rParameter(currRing) != NULL)
4201  {
4202  DefRingPar(target_weight);
4203  }
4204  else
4205  {
4206  rChangeCurrRing(VMrDefault(target_weight)); // Aenderung
4207  }
4208  F1 = idrMoveR(G, newRing,currRing);
4209  G = MstdCC(F1);
4210  idDelete(&F1);
4211  newRing = currRing;
4212  break;
4213  }
4214 
4215  if(MivComp(next_weight, ivNull) == 1)
4216  {
4217  newRing = currRing;
4218  delete next_weight;
4219  break;
4220  }
4221 
4222  if(MivComp(next_weight, target_weight) == 1)
4223  {
4224  if(MivSame(target_weight, exivlp)==1)
4225  {
4226  // LAST_GB_ALT2:
4227  //nOverflow_Error = Overflow_Error;
4228  tproc = clock()-xftinput;
4229  //Print("\n// takes %d steps and calls the recursion of level 2:", nwalk);
4230  /* call the changed perturbation walk algorithm with degree 2 */
4231  G = Rec_LastGB(G, curr_weight, target_weight, 2,1);
4232  newRing = currRing;
4233  delete next_weight;
4234  break;
4235  }
4236  endwalks = 1;
4237  }
4238 
4239  for(i=nV-1; i>=0; i--)
4240  {
4241  //(*extra_curr_weight)[i] = (*curr_weight)[i];
4242  (*curr_weight)[i] = (*next_weight)[i];
4243  }
4244  delete next_weight;
4245  }
4246 #ifdef TEST_OVERFLOW
4247  TEST_OVERFLOW_OI:
4248 #endif
4249  rChangeCurrRing(XXRing);
4250  G = idrMoveR(G, newRing,currRing);
4251  delete ivNull;
4252  delete exivlp;
4253 
4254 #ifdef TIME_TEST
4255  // Print("\n// \"Main procedure\" took %d steps dnd %.2f sec. Overflow_Error (%d)", nwalk, ((double) tproc)/1000000, nOverflow_Error);
4256 
4257  TimeStringFractal(xftinput, tostd, xtif, xtstd, xtextra,xtlift, xtred,xtnw);
4258 
4259  Print("\n// pSetm_Error = (%d)", ErrorCheck());
4260  //Print("\n// Overflow_Error? (%d)", nOverflow_Error);
4261  Print("\n// Awalk2 took %d steps!!", nstep);
4262 #endif
4263 
4264  return(G);
4265 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
BOOLEAN ErrorCheck()
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
clock_t xftinput
Definition: walk.cc:99
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
static ideal Rec_LastGB(ideal G, intvec *curr_weight, intvec *orig_target_weight, int tp_deg, int npwinc)
Definition: walk.cc:3759
clock_t xtnw
Definition: walk.cc:98
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2809
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
static void MivString(intvec *iva, intvec *ivb, intvec *ivc)
Definition: walk.cc:514
clock_t xtlift
Definition: walk.cc:98
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2358
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
intvec* Mfpertvector ( ideal  G,
intvec iv 
)

Definition at line 1492 of file walk.cc.

1493 {
1494  int i, j, nG = IDELEMS(G);
1495  int nV = currRing->N;
1496  int niv = nV*nV;
1497 
1498 
1499  // Calculate maxA = Max(A2) + Max(A3) + ... + Max(AnV),
1500  // where the Ai are the i-te rows of the matrix 'targer_ord'.
1501  int ntemp, maxAi, maxA=0;
1502  for(i=1; i<nV; i++)
1503  {
1504  maxAi = (*ivtarget)[i*nV];
1505  if(maxAi<0)
1506  {
1507  maxAi = -maxAi;
1508  }
1509  for(j=i*nV+1; j<(i+1)*nV; j++)
1510  {
1511  ntemp = (*ivtarget)[j];
1512  if(ntemp < 0)
1513  {
1514  ntemp = -ntemp;
1515  }
1516  if(ntemp > maxAi)
1517  {
1518  maxAi = ntemp;
1519  }
1520  }
1521  maxA = maxA + maxAi;
1522  }
1523  intvec* ivUnit = Mivdp(nV);
1524 
1525  // Calculate inveps = 1/eps, where 1/eps > deg(p)*maxA for all p in G.
1526  mpz_t tot_deg; mpz_init(tot_deg);
1527  mpz_t maxdeg; mpz_init(maxdeg);
1528  mpz_t inveps; mpz_init(inveps);
1529 
1530 
1531  for(i=nG-1; i>=0; i--)
1532  {
1533  mpz_set_ui(maxdeg, MwalkWeightDegree(G->m[i], ivUnit));
1534  if (mpz_cmp(maxdeg, tot_deg) > 0 )
1535  {
1536  mpz_set(tot_deg, maxdeg);
1537  }
1538  }
1539 
1540  delete ivUnit;
1541  //inveps = (tot_deg * maxA) + 1;
1542  mpz_mul_ui(inveps, tot_deg, maxA);
1543  mpz_add_ui(inveps, inveps, 1);
1544 
1545  // takes "small" inveps
1546 #ifdef INVEPS_SMALL_IN_FRACTAL
1547  if(mpz_cmp_ui(inveps, nV)>0 && nV > 3)
1548  {
1549  mpz_cdiv_q_ui(inveps, inveps, nV);
1550  }
1551  //PrintS("\n// choose the \"small\" inverse epsilon!");
1552 #endif
1553 
1554  // PrintLn(); mpz_out_str(stdout, 10, inveps);
1555 
1556  // Calculate the perturbed target orders:
1557  mpz_t *ivtemp=(mpz_t *)omAlloc(nV*sizeof(mpz_t));
1558  mpz_t *pert_vector=(mpz_t *)omAlloc(niv*sizeof(mpz_t));
1559 
1560  for(i=0; i < nV; i++)
1561  {
1562  mpz_init_set_si(ivtemp[i], (*ivtarget)[i]);
1563  mpz_init_set_si(pert_vector[i], (*ivtarget)[i]);
1564  }
1565 
1566  mpz_t ztmp; mpz_init(ztmp);
1567  // BOOLEAN isneg = FALSE;
1568 
1569  for(i=1; i<nV; i++)
1570  {
1571  for(j=0; j<nV; j++)
1572  {
1573  mpz_mul(ztmp, inveps, ivtemp[j]);
1574  if((*ivtarget)[i*nV+j]<0)
1575  {
1576  mpz_sub_ui(ivtemp[j], ztmp, -(*ivtarget)[i*nV+j]);
1577  }
1578  else
1579  {
1580  mpz_add_ui(ivtemp[j], ztmp,(*ivtarget)[i*nV+j]);
1581  }
1582  }
1583 
1584  for(j=0; j<nV; j++)
1585  {
1586  mpz_init_set(pert_vector[i*nV+j],ivtemp[j]);
1587  }
1588  }
1589 
1590  /* 2147483647 is max. integer representation in SINGULAR */
1591  mpz_t sing_int;
1592  mpz_init_set_ui(sing_int, 2147483647);
1593 
1594  intvec* result = new intvec(niv);
1595  intvec* result1 = new intvec(niv);
1596  BOOLEAN nflow = FALSE;
1597 
1598  // computes gcd
1599  mpz_set(ztmp, pert_vector[0]);
1600  for(i=0; i<niv; i++)
1601  {
1602  mpz_gcd(ztmp, ztmp, pert_vector[i]);
1603  if(mpz_cmp_si(ztmp, 1)==0)
1604  {
1605  break;
1606  }
1607  }
1608 
1609  for(i=0; i<niv; i++)
1610  {
1611  mpz_divexact(pert_vector[i], pert_vector[i], ztmp);
1612  (* result)[i] = mpz_get_si(pert_vector[i]);
1613  }
1614 
1615  j = 0;
1616  for(i=0; i<nV; i++)
1617  {
1618  (* result1)[i] = mpz_get_si(pert_vector[i]);
1619  (* result1)[i] = 0.1*(* result1)[i];
1620  (* result1)[i] = floor((* result1)[i] + 0.5);
1621  if((* result1)[i] == 0)
1622  {
1623  j++;
1624  }
1625  }
1626  if(j > nV - 1)
1627  {
1628  // Print("\n// MfPertwalk: geaenderter vector gleich Null! \n");
1629  delete result1;
1630  goto CHECK_OVERFLOW;
1631  }
1632 
1633 // check that the perturbed weight vector lies in the Groebner cone
1634  if(test_w_in_ConeCC(G,result1) != 0)
1635  {
1636  // Print("\n// MfPertwalk: geaenderter vector liegt in Groebnerkegel! \n");
1637  delete result;
1638  result = result1;
1639  for(i=0; i<nV; i++)
1640  {
1641  mpz_set_si(pert_vector[i], (*result1)[i]);
1642  }
1643  }
1644  else
1645  {
1646  delete result1;
1647  // Print("\n// Mfpertwalk: geaenderter vector liegt nicht in Groebnerkegel! \n");
1648  }
1649 
1650  CHECK_OVERFLOW:
1651 
1652  for(i=0; i<niv; i++)
1653  {
1654  if(mpz_cmp(pert_vector[i], sing_int)>0)
1655  {
1656  if(nflow == FALSE)
1657  {
1658  Xnlev = i / nV;
1659  nflow = TRUE;
1660  Overflow_Error = TRUE;
1661  Print("\n// Xlev = %d and the %d-th element is", Xnlev, i+1);
1662  PrintS("\n// ** OVERFLOW in \"Mfpertvector\": ");
1663  mpz_out_str( stdout, 10, pert_vector[i]);
1664  PrintS(" is greater than 2147483647 (max. integer representation)");
1665  Print("\n// So vector[%d] := %d is wrong!!", i+1, (*result)[i]);
1666  }
1667  }
1668  }
1669  if(Overflow_Error == TRUE)
1670  {
1671  ivString(result, "new_vector");
1672  }
1673  omFree(pert_vector);
1674  omFree(ivtemp);
1675  mpz_clear(ztmp);
1676  mpz_clear(tot_deg);
1677  mpz_clear(maxdeg);
1678  mpz_clear(inveps);
1679  mpz_clear(sing_int);
1680 
1682  for(j=0; j<IDELEMS(G); j++)
1683  {
1684  poly p=G->m[j];
1685  while(p!=NULL)
1686  {
1687  p_Setm(p,currRing); pIter(p);
1688  }
1689  }
1690  return result;
1691 }
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
int Xnlev
Definition: walk.cc:1491
static TreeM * G
Definition: janet.cc:38
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
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...
Definition: ring.cc:3371
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:19
intvec * Mivdp(int nR)
Definition: walk.cc:980
#define NULL
Definition: omList.c:10
static int MwalkWeightDegree(poly p, intvec *weight_vector)
Definition: walk.cc:645
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static void ivString(intvec *iv, const char *ch)
Definition: walk.cc:500
int BOOLEAN
Definition: auxiliary.h:131
return result
Definition: facAbsBiFact.cc:76
ideal Mfrwalk ( ideal  G,
intvec ivstart,
intvec ivtarget,
int  weight_rad 
)

Definition at line 6938 of file walk.cc.

6939 {
6940  Set_Error(FALSE);
6942  //Print("// pSetm_Error = (%d)", ErrorCheck());
6943  //Print("\n// ring ro = %s;", rString(currRing));
6944 
6945  nnflow = 0;
6946  Xngleich = 0;
6947  Xcall = 0;
6948  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
6949  xftinput = clock();
6950 
6951  ring oldRing = currRing;
6952  int i, nV = currRing->N;
6953  XivNull = new intvec(nV);
6954  Xivinput = ivtarget;
6955  ngleich = 0;
6956  to=clock();
6957  ideal I = MstdCC(G);
6958  G = NULL;
6959  xftostd=clock()-to;
6960  Xsigma = ivstart;
6961 
6962  Xnlev=nV;
6963 
6964 #ifdef FIRST_STEP_FRACTAL
6965  ideal Gw = MwalkInitialForm(I, ivstart);
6966  for(i=IDELEMS(Gw)-1; i>=0; i--)
6967  {
6968  if((Gw->m[i]!=NULL) // len >=0
6969  && (Gw->m[i]->next!=NULL) // len >=1
6970  && (Gw->m[i]->next->next!=NULL)) // len >=2
6971  {
6972  intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
6973  intvec* Mdp;
6974 
6975  if(MivSame(ivstart, iv_dp) != 1)
6976  Mdp = MivWeightOrderdp(ivstart);
6977  else
6978  Mdp = MivMatrixOrderdp(nV);
6979 
6980  Xsigma = Mfpertvector(I, Mdp);
6982 
6983  delete Mdp;
6984  delete iv_dp;
6985  break;
6986  }
6987  }
6988  idDelete(&Gw);
6989 #endif
6990 
6991  ideal I1;
6992  intvec* Mlp;
6993  Xivlp = Mivlp(nV);
6994 
6995  if(MivComp(ivtarget, Xivlp) != 1)
6996  {
6997  if (rParameter(currRing) != NULL)
6998  DefRingPar(ivtarget);
6999  else
7000  rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
7001 
7002  I1 = idrMoveR(I, oldRing,currRing);
7003  Mlp = MivWeightOrderlp(ivtarget);
7004  Xtau = Mfpertvector(I1, Mlp);
7005  }
7006  else
7007  {
7008  if (rParameter(currRing) != NULL)
7009  DefRingParlp();
7010  else
7011  VMrDefaultlp();
7012 
7013  I1 = idrMoveR(I, oldRing,currRing);
7014  Mlp = MivMatrixOrderlp(nV);
7015  Xtau = Mfpertvector(I1, Mlp);
7016  }
7017  delete Mlp;
7019 
7020  //ivString(Xsigma, "Xsigma");
7021  //ivString(Xtau, "Xtau");
7022 
7023  id_Delete(&I, oldRing);
7024  ring tRing = currRing;
7025 
7026  if (rParameter(currRing) != NULL)
7027  DefRingPar(ivstart);
7028  else
7029  rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
7030 
7031  I = idrMoveR(I1,tRing,currRing);
7032  to=clock();
7033  ideal J = MstdCC(I);
7034  idDelete(&I);
7035  xftostd=xftostd+clock()-to;
7036 
7037  ideal resF;
7038  ring helpRing = currRing;
7039 //ideal G, int nlev, intvec* omtmp, int weight_rad)
7040  J = rec_r_fractal_call(J, 1, ivtarget,weight_rad);
7041 
7042  rChangeCurrRing(oldRing);
7043  resF = idrMoveR(J, helpRing,currRing);
7044  idSkipZeroes(resF);
7045 
7046  delete Xivlp;
7047  delete Xsigma;
7048  delete Xtau;
7049  delete XivNull;
7050 
7051 #ifdef TIME_TEST
7052  TimeStringFractal(xftinput, xftostd, xtif, xtstd, xtextra,
7053  xtlift, xtred, xtnw);
7054 
7055 
7056  Print("\n// pSetm_Error = (%d)", ErrorCheck());
7057  Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
7058  Print("\n// the numbers of Overflow_Error (%d)", nnflow);
7059 #endif
7060 
7061  return(resF);
7062 }
BOOLEAN ErrorCheck()
#define Print
Definition: emacs.cc:83
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1492
intvec * Xivlp
Definition: walk.cc:4285
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
intvec * Xivinput
Definition: walk.cc:4284
int nnflow
Definition: walk.cc:6103
static ring VMrDefault1(intvec *va)
Definition: walk.cc:2428
int ngleich
Definition: walk.cc:4280
int Xngleich
Definition: walk.cc:6105
#define FALSE
Definition: auxiliary.h:140
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
clock_t xtred
Definition: walk.cc:98
intvec * Xsigma
Definition: walk.cc:4281
int Xnlev
Definition: walk.cc:1491
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1436
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
intvec * Xtau
Definition: walk.cc:4282
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2746
int Xcall
Definition: walk.cc:6104
clock_t xftostd
Definition: walk.cc:99
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
clock_t xftinput
Definition: walk.cc:99
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2879
static ideal MstdCC(ideal G)
Definition: walk.cc:907
static ideal rec_r_fractal_call(ideal G, int nlev, intvec *omtmp, int weight_rad)
Definition: walk.cc:6456
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2809
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
intvec * XivNull
Definition: walk.cc:6088
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
intvec * Mivlp(int nR)
Definition: walk.cc:995
clock_t xtif
Definition: walk.cc:98
ideal Mfwalk ( ideal  G,
intvec ivstart,
intvec ivtarget 
)

Definition at line 6812 of file walk.cc.

6813 {
6814  Set_Error(FALSE);
6816  //Print("// pSetm_Error = (%d)", ErrorCheck());
6817  //Print("\n// ring ro = %s;", rString(currRing));
6818 
6819  nnflow = 0;
6820  Xngleich = 0;
6821  Xcall = 0;
6822  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
6823  xftinput = clock();
6824 
6825  ring oldRing = currRing;
6826  int i, nV = currRing->N;
6827  XivNull = new intvec(nV);
6828  Xivinput = ivtarget;
6829  ngleich = 0;
6830  to=clock();
6831  ideal I = MstdCC(G);
6832  G = NULL;
6833  xftostd=clock()-to;
6834  Xsigma = ivstart;
6835 
6836  Xnlev=nV;
6837 
6838 #ifdef FIRST_STEP_FRACTAL
6839  ideal Gw = MwalkInitialForm(I, ivstart);
6840  for(i=IDELEMS(Gw)-1; i>=0; i--)
6841  {
6842  if((Gw->m[i]!=NULL) // len >=0
6843  && (Gw->m[i]->next!=NULL) // len >=1
6844  && (Gw->m[i]->next->next!=NULL)) // len >=2
6845  {
6846  intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
6847  intvec* Mdp;
6848 
6849  if(MivSame(ivstart, iv_dp) != 1)
6850  Mdp = MivWeightOrderdp(ivstart);
6851  else
6852  Mdp = MivMatrixOrderdp(nV);
6853 
6854  Xsigma = Mfpertvector(I, Mdp);
6856 
6857  delete Mdp;
6858  delete iv_dp;
6859  break;
6860  }
6861  }
6862  idDelete(&Gw);
6863 #endif
6864 
6865  ideal I1;
6866  intvec* Mlp;
6867  Xivlp = Mivlp(nV);
6868 
6869  if(MivComp(ivtarget, Xivlp) != 1)
6870  {
6871  if (rParameter(currRing) != NULL)
6872  DefRingPar(ivtarget);
6873  else
6874  rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
6875 
6876  I1 = idrMoveR(I, oldRing,currRing);
6877  Mlp = MivWeightOrderlp(ivtarget);
6878  Xtau = Mfpertvector(I1, Mlp);
6879  }
6880  else
6881  {
6882  if (rParameter(currRing) != NULL)
6883  DefRingParlp();
6884  else
6885  VMrDefaultlp();
6886 
6887  I1 = idrMoveR(I, oldRing,currRing);
6888  Mlp = MivMatrixOrderlp(nV);
6889  Xtau = Mfpertvector(I1, Mlp);
6890  }
6891  delete Mlp;
6893 
6894  //ivString(Xsigma, "Xsigma");
6895  //ivString(Xtau, "Xtau");
6896 
6897  id_Delete(&I, oldRing);
6898  ring tRing = currRing;
6899 
6900  if (rParameter(currRing) != NULL)
6901  DefRingPar(ivstart);
6902  else
6903  rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
6904 
6905  I = idrMoveR(I1,tRing,currRing);
6906  to=clock();
6907  ideal J = MstdCC(I);
6908  idDelete(&I);
6909  xftostd=xftostd+clock()-to;
6910 
6911  ideal resF;
6912  ring helpRing = currRing;
6913 
6914  J = rec_fractal_call(J, 1, ivtarget);
6915 
6916  rChangeCurrRing(oldRing);
6917  resF = idrMoveR(J, helpRing,currRing);
6918  idSkipZeroes(resF);
6919 
6920  delete Xivlp;
6921  delete Xsigma;
6922  delete Xtau;
6923  delete XivNull;
6924 
6925 #ifdef TIME_TEST
6926  TimeStringFractal(xftinput, xftostd, xtif, xtstd, xtextra,
6927  xtlift, xtred, xtnw);
6928 
6929 
6930  Print("\n// pSetm_Error = (%d)", ErrorCheck());
6931  Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
6932  Print("\n// the numbers of Overflow_Error (%d)", nnflow);
6933 #endif
6934 
6935  return(resF);
6936 }
BOOLEAN ErrorCheck()
#define Print
Definition: emacs.cc:83
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1492
intvec * Xivlp
Definition: walk.cc:4285
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
intvec * Xivinput
Definition: walk.cc:4284
int nnflow
Definition: walk.cc:6103
static ring VMrDefault1(intvec *va)
Definition: walk.cc:2428
int ngleich
Definition: walk.cc:4280
int Xngleich
Definition: walk.cc:6105
#define FALSE
Definition: auxiliary.h:140
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
clock_t xtred
Definition: walk.cc:98
intvec * Xsigma
Definition: walk.cc:4281
int Xnlev
Definition: walk.cc:1491
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1436
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
intvec * Xtau
Definition: walk.cc:4282
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2746
int Xcall
Definition: walk.cc:6104
clock_t xftostd
Definition: walk.cc:99
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
clock_t xftinput
Definition: walk.cc:99
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2879
static ideal MstdCC(ideal G)
Definition: walk.cc:907
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2809
static ideal rec_fractal_call(ideal G, int nlev, intvec *omtmp)
Definition: walk.cc:6110
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
intvec * XivNull
Definition: walk.cc:6088
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
intvec * Mivlp(int nR)
Definition: walk.cc:995
clock_t xtif
Definition: walk.cc:98
ideal MidLift ( ideal  Gomega,
ideal  M 
)
intvec* Mivdp ( int  nR)

Definition at line 980 of file walk.cc.

981 {
982  int i;
983  intvec* ivm = new intvec(nR);
984 
985  for(i=nR-1; i>=0; i--)
986  {
987  (*ivm)[i] = 1;
988  }
989  return ivm;
990 }
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* Mivlp ( int  nR)

Definition at line 995 of file walk.cc.

996 {
997  intvec* ivm = new intvec(nR);
998  (*ivm)[0] = 1;
999 
1000  return ivm;
1001 }
Definition: intvec.h:16
intvec* MivMatrixOrder ( intvec iv)

Definition at line 938 of file walk.cc.

939 {
940  int i, nR = iv->length();
941 
942  intvec* ivm = new intvec(nR*nR);
943 
944  for(i=0; i<nR; i++)
945  {
946  (*ivm)[i] = (*iv)[i];
947  }
948  for(i=1; i<nR; i++)
949  {
950  (*ivm)[i*nR+i-1] = 1;
951  }
952  return ivm;
953 }
int length() const
Definition: intvec.h:85
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MivMatrixOrderdp ( int  iv)

Definition at line 1397 of file walk.cc.

1398 {
1399  int i;
1400  intvec* ivM = new intvec(nV*nV);
1401 
1402  for(i=0; i<nV; i++)
1403  {
1404  (*ivM)[i] = 1;
1405  }
1406  for(i=1; i<nV; i++)
1407  {
1408  (*ivM)[(i+1)*nV - i] = -1;
1409  }
1410  return(ivM);
1411 }
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MivMatrixOrderlp ( int  nV)

Definition at line 1381 of file walk.cc.

1382 {
1383  int i;
1384  intvec* ivM = new intvec(nV*nV);
1385 
1386  for(i=0; i<nV; i++)
1387  {
1388  (*ivM)[i*nV + i] = 1;
1389  }
1390  return(ivM);
1391 }
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* Mivperttarget ( ideal  G,
int  ndeg 
)
int MivSame ( intvec u,
intvec v 
)

Definition at line 868 of file walk.cc.

869 {
870  assume(u->length() == v->length());
871 
872  int i, niv = u->length();
873 
874  for (i=0; i<niv; i++)
875  {
876  if ((*u)[i] != (*v)[i])
877  {
878  return 0;
879  }
880  }
881  return 1;
882 }
int length() const
Definition: intvec.h:85
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
intvec* MivUnit ( int  nV)

Definition at line 1476 of file walk.cc.

1477 {
1478  int i;
1479  intvec* ivM = new intvec(nV);
1480  for(i=nV-1; i>=0; i--)
1481  {
1482  (*ivM)[i] = 1;
1483  }
1484  return(ivM);
1485 }
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MivWeightOrderdp ( intvec ivstart)

Definition at line 1436 of file walk.cc.

1437 {
1438  int i;
1439  int nV = ivstart->length();
1440  intvec* ivM = new intvec(nV*nV);
1441 
1442  for(i=0; i<nV; i++)
1443  {
1444  (*ivM)[i] = (*ivstart)[i];
1445  }
1446  for(i=0; i<nV; i++)
1447  {
1448  (*ivM)[nV+i] = 1;
1449  }
1450  for(i=2; i<nV; i++)
1451  {
1452  (*ivM)[(i+1)*nV - i] = -1;
1453  }
1454  return(ivM);
1455 }
int length() const
Definition: intvec.h:85
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MivWeightOrderlp ( intvec ivstart)

Definition at line 1416 of file walk.cc.

1417 {
1418  int i;
1419  int nV = ivstart->length();
1420  intvec* ivM = new intvec(nV*nV);
1421 
1422  for(i=0; i<nV; i++)
1423  {
1424  (*ivM)[i] = (*ivstart)[i];
1425  }
1426  for(i=1; i<nV; i++)
1427  {
1428  (*ivM)[i*nV + i-1] = 1;
1429  }
1430  return(ivM);
1431 }
int length() const
Definition: intvec.h:85
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MkInterRedNextWeight ( intvec iva,
intvec ivb,
ideal  G 
)

Definition at line 2248 of file walk.cc.

2249 {
2250  intvec* tmp = new intvec(iva->length());
2251  intvec* result;
2252 
2253  if(G == NULL)
2254  {
2255  return tmp;
2256  }
2257  if(MivComp(iva, ivb) == 1)
2258  {
2259  return tmp;
2260  }
2261  result = MwalkNextWeightCC(iva, ivb, G);
2262 
2263  if(MivComp(result, iva) == 1)
2264  {
2265  delete result;
2266  return tmp;
2267  }
2268 
2269  delete tmp;
2270  return result;
2271 }
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
int length() const
Definition: intvec.h:85
static TreeM * G
Definition: janet.cc:38
Definition: intvec.h:16
static intvec * MwalkNextWeightCC(intvec *curr_weight, intvec *target_weight, ideal G)
Definition: walk.cc:1865
#define NULL
Definition: omList.c:10
return result
Definition: facAbsBiFact.cc:76
ideal MLiftLmalG ( ideal  L,
ideal  G 
)
ideal MLiftLmalGMin ( ideal  L,
ideal  G 
)
ideal MLiftLmalGNew ( ideal  Gomega,
ideal  M,
ideal  G 
)
intvec* MPertNextWeight ( intvec iva,
ideal  G,
int  deg 
)
intvec* MPertVectors ( ideal  G,
intvec ivtarget,
int  pdeg 
)

Definition at line 1061 of file walk.cc.

1062 {
1063  // ivtarget is a matrix order of a degree reverse lex. order
1064  int nV = currRing->N;
1065  //assume(pdeg <= nV && pdeg >= 0);
1066 
1067  int i, j, nG = IDELEMS(G);
1068  intvec* v_null = new intvec(nV);
1069 
1070 
1071  // Check that the perturbed degree is valid
1072  if(pdeg > nV || pdeg <= 0)
1073  {
1074  WerrorS("//** The perturbed degree is wrong!!");
1075  return v_null;
1076  }
1077  delete v_null;
1078 
1079  if(pdeg == 1)
1080  {
1081  return ivtarget;
1082  }
1083  mpz_t *pert_vector = (mpz_t*)omAlloc(nV*sizeof(mpz_t));
1084  //mpz_t *pert_vector1 = (mpz_t*)omAlloc(nV*sizeof(mpz_t));
1085 
1086  for(i=0; i<nV; i++)
1087  {
1088  mpz_init_set_si(pert_vector[i], (*ivtarget)[i]);
1089  // mpz_init_set_si(pert_vector1[i], (*ivtarget)[i]);
1090  }
1091  // Calculate max1 = Max(A2)+Max(A3)+...+Max(Apdeg),
1092  // where the Ai are the i-te rows of the matrix target_ord.
1093  int ntemp, maxAi, maxA=0;
1094  for(i=1; i<pdeg; i++)
1095  {
1096  maxAi = (*ivtarget)[i*nV];
1097  if(maxAi<0)
1098  {
1099  maxAi = -maxAi;
1100  }
1101  for(j=i*nV+1; j<(i+1)*nV; j++)
1102  {
1103  ntemp = (*ivtarget)[j];
1104  if(ntemp < 0)
1105  {
1106  ntemp = -ntemp;
1107  }
1108  if(ntemp > maxAi)
1109  {
1110  maxAi = ntemp;
1111  }
1112  }
1113  maxA += maxAi;
1114  }
1115 
1116  // Calculate inveps = 1/eps, where 1/eps > totaldeg(p)*max1 for all p in G.
1117 
1118  intvec* ivUnit = Mivdp(nV);
1119 
1120  mpz_t tot_deg; mpz_init(tot_deg);
1121  mpz_t maxdeg; mpz_init(maxdeg);
1122  mpz_t inveps; mpz_init(inveps);
1123 
1124 
1125  for(i=nG-1; i>=0; i--)
1126  {
1127  mpz_set_ui(maxdeg, MwalkWeightDegree(G->m[i], ivUnit));
1128  if (mpz_cmp(maxdeg, tot_deg) > 0 )
1129  {
1130  mpz_set(tot_deg, maxdeg);
1131  }
1132  }
1133 
1134  delete ivUnit;
1135  mpz_mul_ui(inveps, tot_deg, maxA);
1136  mpz_add_ui(inveps, inveps, 1);
1137 
1138 
1139  // takes "small" inveps
1140 #ifdef INVEPS_SMALL_IN_MPERTVECTOR
1141  if(mpz_cmp_ui(inveps, pdeg)>0 && pdeg > 3)
1142  {
1143  // Print("\n// choose the\"small\" inverse epsilon := %d / %d = ", mpz_get_si(inveps), pdeg);
1144  mpz_fdiv_q_ui(inveps, inveps, pdeg);
1145  // mpz_out_str(stdout, 10, inveps);
1146  }
1147 #else
1148  // PrintS("\n// the \"big\" inverse epsilon: ");
1149  mpz_out_str(stdout, 10, inveps);
1150 #endif
1151 
1152  // pert(A1) = inveps^(pdeg-1)*A1 + inveps^(pdeg-2)*A2+...+A_pdeg,
1153  // pert_vector := A1
1154  for( i=1; i < pdeg; i++ )
1155  {
1156  for(j=0; j<nV; j++)
1157  {
1158  mpz_mul(pert_vector[j], pert_vector[j], inveps);
1159  if((*ivtarget)[i*nV+j]<0)
1160  {
1161  mpz_sub_ui(pert_vector[j], pert_vector[j],-(*ivtarget)[i*nV+j]);
1162  }
1163  else
1164  {
1165  mpz_add_ui(pert_vector[j], pert_vector[j],(*ivtarget)[i*nV+j]);
1166  }
1167  }
1168  }
1169  mpz_t ztemp;
1170  mpz_init(ztemp);
1171  mpz_set(ztemp, pert_vector[0]);
1172  for(i=1; i<nV; i++)
1173  {
1174  mpz_gcd(ztemp, ztemp, pert_vector[i]);
1175  if(mpz_cmp_si(ztemp, 1) == 0)
1176  {
1177  break;
1178  }
1179  }
1180  if(mpz_cmp_si(ztemp, 1) != 0)
1181  {
1182  for(i=0; i<nV; i++)
1183  {
1184  mpz_divexact(pert_vector[i], pert_vector[i], ztemp);
1185  }
1186  }
1187 
1188  intvec *pert_vector1= new intvec(nV);
1189  j = 0;
1190  for(i=0; i<nV; i++)
1191  {
1192  (* pert_vector1)[i] = mpz_get_si(pert_vector[i]);
1193  (* pert_vector1)[i] = 0.1*(* pert_vector1)[i];
1194  (* pert_vector1)[i] = floor((* pert_vector1)[i] + 0.5);
1195  if((* pert_vector1)[i] == 0)
1196  {
1197  j++;
1198  }
1199  }
1200  if(j > nV - 1)
1201  {
1202  // Print("\n// MPertVectors: geaenderter vector gleich Null! \n");
1203  delete pert_vector1;
1204  goto CHECK_OVERFLOW;
1205  }
1206 
1207 // check that the perturbed weight vector lies in the Groebner cone
1208  if(test_w_in_ConeCC(G,pert_vector1) != 0)
1209  {
1210  // Print("\n// MPertVectors: geaenderter vector liegt in Groebnerkegel! \n");
1211  for(i=0; i<nV; i++)
1212  {
1213  mpz_set_si(pert_vector[i], (*pert_vector1)[i]);
1214  }
1215  }
1216  else
1217  {
1218  //Print("\n// MpertVectors: geaenderter vector liegt nicht in Groebnerkegel! \n");
1219  }
1220  delete pert_vector1;
1221 
1222  CHECK_OVERFLOW:
1223  intvec* result = new intvec(nV);
1224 
1225  /* 2147483647 is max. integer representation in SINGULAR */
1226  mpz_t sing_int;
1227  mpz_init_set_ui(sing_int, 2147483647);
1228 
1229  int ntrue=0;
1230  for(i=0; i<nV; i++)
1231  {
1232  (*result)[i] = mpz_get_si(pert_vector[i]);
1233  if(mpz_cmp(pert_vector[i], sing_int)>=0)
1234  {
1235  ntrue++;
1236  if(Overflow_Error == FALSE)
1237  {
1238  Overflow_Error = TRUE;
1239  PrintS("\n// ** OVERFLOW in \"MPertvectors\": ");
1240  mpz_out_str( stdout, 10, pert_vector[i]);
1241  PrintS(" is greater than 2147483647 (max. integer representation)");
1242  Print("\n// So vector[%d] := %d is wrong!!", i+1, (*result)[i]);
1243  }
1244  }
1245  }
1246 
1247  if(Overflow_Error == TRUE)
1248  {
1249  ivString(result, "pert_vector");
1250  Print("\n// %d element(s) of it is overflow!!", ntrue);
1251  }
1252 
1253  mpz_clear(ztemp);
1254  mpz_clear(sing_int);
1255  omFree(pert_vector);
1256  //omFree(pert_vector1);
1257  mpz_clear(tot_deg);
1258  mpz_clear(maxdeg);
1259  mpz_clear(inveps);
1260 
1262  for(j=0; j<IDELEMS(G); j++)
1263  {
1264  poly p=G->m[j];
1265  while(p!=NULL)
1266  {
1267  p_Setm(p,currRing); pIter(p);
1268  }
1269  }
1270  return result;
1271 }
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
static TreeM * G
Definition: janet.cc:38
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
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...
Definition: ring.cc:3371
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:19
intvec * Mivdp(int nR)
Definition: walk.cc:980
#define NULL
Definition: omList.c:10
static int MwalkWeightDegree(poly p, intvec *weight_vector)
Definition: walk.cc:645
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static void ivString(intvec *iv, const char *ch)
Definition: walk.cc:500
return result
Definition: facAbsBiFact.cc:76
intvec* MPertVectorslp ( ideal  G,
intvec ivtarget,
int  pdeg 
)

Definition at line 1279 of file walk.cc.

1280 {
1281  // ivtarget is a matrix order of the lex. order
1282  int nV = currRing->N;
1283  //assume(pdeg <= nV && pdeg >= 0);
1284 
1285  int i, j, nG = IDELEMS(G);
1286  intvec* pert_vector = new intvec(nV);
1287 
1288  //Checking that the perturbated degree is valid
1289  if(pdeg > nV || pdeg <= 0)
1290  {
1291  WerrorS("//** The perturbed degree is wrong!!");
1292  return pert_vector;
1293  }
1294  for(i=0; i<nV; i++)
1295  {
1296  (*pert_vector)[i]=(*ivtarget)[i];
1297  }
1298  if(pdeg == 1)
1299  {
1300  return pert_vector;
1301  }
1302  // Calculate max1 = Max(A2)+Max(A3)+...+Max(Apdeg),
1303  // where the Ai are the i-te rows of the matrix target_ord.
1304  int ntemp, maxAi, maxA=0;
1305  for(i=1; i<pdeg; i++)
1306  {
1307  maxAi = (*ivtarget)[i*nV];
1308  for(j=i*nV+1; j<(i+1)*nV; j++)
1309  {
1310  ntemp = (*ivtarget)[j];
1311  if(ntemp > maxAi)
1312  {
1313  maxAi = ntemp;
1314  }
1315  }
1316  maxA += maxAi;
1317  }
1318 
1319  // Calculate inveps := 1/eps, where 1/eps > deg(p)*max1 for all p in G.
1320  int inveps, tot_deg = 0, maxdeg;
1321 
1322  intvec* ivUnit = Mivdp(nV);//19.02
1323  for(i=nG-1; i>=0; i--)
1324  {
1325  // maxdeg = pTotaldegree(G->m[i], currRing); //it's wrong for ex1,2,rose
1326  maxdeg = MwalkWeightDegree(G->m[i], ivUnit);
1327  if (maxdeg > tot_deg )
1328  {
1329  tot_deg = maxdeg;
1330  }
1331  }
1332  delete ivUnit;
1333 
1334  inveps = (tot_deg * maxA) + 1;
1335 
1336 #ifdef INVEPS_SMALL_IN_FRACTAL
1337  // Print("\n// choose the\"small\" inverse epsilon := %d / %d = ", inveps, pdeg);
1338  if(inveps > pdeg && pdeg > 3)
1339  {
1340  inveps = inveps / pdeg;
1341  }
1342  // Print(" %d", inveps);
1343 #else
1344  PrintS("\n// the \"big\" inverse epsilon %d", inveps);
1345 #endif
1346 
1347  // Pert(A1) = inveps^(pdeg-1)*A1 + inveps^(pdeg-2)*A2+...+A_pdeg
1348  for ( i=1; i < pdeg; i++ )
1349  {
1350  for(j=0; j<nV; j++)
1351  {
1352  (*pert_vector)[j] = inveps*((*pert_vector)[j]) + (*ivtarget)[i*nV+j];
1353  }
1354  }
1355 
1356  int temp = (*pert_vector)[0];
1357  for(i=1; i<nV; i++)
1358  {
1359  temp = gcd(temp, (*pert_vector)[i]);
1360  if(temp == 1)
1361  {
1362  break;
1363  }
1364  }
1365  if(temp != 1)
1366  {
1367  for(i=0; i<nV; i++)
1368  {
1369  (*pert_vector)[i] = (*pert_vector)[i] / temp;
1370  }
1371  }
1372 
1373  intvec* result = pert_vector;
1374  delete pert_vector;
1375  return result;
1376 }
void WerrorS(const char *s)
Definition: feFopen.cc:23
static TreeM * G
Definition: janet.cc:38
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:19
intvec * Mivdp(int nR)
Definition: walk.cc:980
static long gcd(const long a, const long b)
Definition: walk.cc:541
static int MwalkWeightDegree(poly p, intvec *weight_vector)
Definition: walk.cc:645
return result
Definition: facAbsBiFact.cc:76
ideal Mprwalk ( ideal  Go,
intvec curr_weight,
intvec target_weight,
int  weight_rad,
int  op_deg,
int  tp_deg,
ring  baseRing 
)

Definition at line 8244 of file walk.cc.

8245 {
8246  BITSET save1 = si_opt_1; // save current options
8247  si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
8248  Set_Error(FALSE);
8250 #ifdef TIME_TEST
8251  clock_t tinput=0, tostd=0, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
8252  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
8253  tinput = clock();
8254  clock_t tim;
8255 #endif
8256  int i,nwalk,nV = baseRing->N;
8257 
8258  ideal G, Gomega, M, F, Gomega1, Gomega2, M1;
8259  ring newRing;
8260  ring XXRing = baseRing;
8261  intvec* exivlp = Mivlp(nV);
8262  intvec* orig_target = target_weight;
8263  intvec* pert_target_vector = target_weight;
8264  intvec* ivNull = new intvec(nV);
8265  intvec* tmp_weight = new intvec(nV);
8266 #ifdef CHECK_IDEAL_MWALK
8267  poly p;
8268 #endif
8269  for(i=0; i<nV; i++)
8270  {
8271  (*tmp_weight)[i] = (*curr_weight)[i];
8272  }
8273 #ifndef BUCHBERGER_ALG
8274  intvec* hilb_func;
8275  // to avoid (1,0,...,0) as the target vector
8276  intvec* last_omega = new intvec(nV);
8277  for(i=0 i<nV; i++)
8278  {
8279  (*last_omega)[i] = 1;
8280  }
8281  (*last_omega)[0] = 10000;
8282 #endif
8283  baseRing = currRing;
8284  newRing = VMrDefault(curr_weight);
8285  rChangeCurrRing(newRing);
8286  G = idrMoveR(Go,baseRing,currRing);
8287 #ifdef TIME_TEST
8288  to = clock();
8289 #endif
8290  G = kStd(G,NULL,testHomog,NULL,NULL,0,0,NULL);
8291  idSkipZeroes(G);
8292 #ifdef TIME_TEST
8293  tostd = tostd + to - clock();
8294 #endif
8295 #ifdef CHECK_IDEAL_MWALK
8296  idString(G,"G");
8297 #endif
8298  if(op_deg >1)
8299  {
8300  if(MivComp(curr_weight,MivUnit(nV)) == 1) //ring order is "dp"
8301  {
8302  curr_weight = MPertVectors(G, MivMatrixOrderdp(nV), op_deg);
8303  }
8304  else //ring order is not "dp"
8305  {
8306  curr_weight = MPertVectors(G, MivMatrixOrder(curr_weight), op_deg);
8307  }
8308  }
8309  baseRing = currRing;
8310  if(tp_deg > 1 && tp_deg <= nV)
8311  {
8312  pert_target_vector = target_weight;
8313  }
8314 #ifdef CHECK_IDEAL_MWALK
8315  ivString(curr_weight, "new curr_weight");
8316  ivString(target_weight, "new target_weight");
8317 #endif
8318  nwalk = 0;
8319  while(1)
8320  {
8321  nwalk ++;
8322 #ifdef TIME_TEST
8323  to = clock();
8324 #endif
8325  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
8326 #ifdef TIME_TEST
8327  tif = tif + clock()-to; //time for computing initial form ideal
8328 #endif
8329 #ifdef CHECK_IDEAL_MWALK
8330  idString(Gomega,"Gomega");
8331 #endif
8332 #ifndef BUCHBERGER_ALG
8333  if(isNolVector(curr_weight) == 0)
8334  {
8335  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
8336  }
8337  else
8338  {
8339  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
8340  }
8341 #endif
8342  if(nwalk == 1)
8343  {
8344  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
8345  }
8346  else
8347  {
8348  newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
8349  }
8350  rChangeCurrRing(newRing);
8351  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
8352  idDelete(&Gomega);
8353  // compute a Groebner basis of <Gomega> w.r.t. "newRing"
8354 #ifdef TIME_TEST
8355  to = clock();
8356 #endif
8357 #ifndef BUCHBERGER_ALG
8358  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
8359  delete hilb_func;
8360 #else
8361  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
8362 #endif
8363  idSkipZeroes(M);
8364 #ifdef TIME_TEST
8365  tstd = tstd + clock() - to;
8366 #endif
8367 #ifdef CHECK_IDEAL_MWALK
8368  idString(M, "M");
8369 #endif
8370  //change the ring to baseRing
8371  rChangeCurrRing(baseRing);
8372  M1 = idrMoveR(M, newRing,currRing);
8373  idDelete(&M);
8374  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
8375  idDelete(&Gomega1);
8376  to = clock();
8377  // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring
8378  F = MLifttwoIdeal(Gomega2, M1, G);
8379  idSkipZeroes(F);
8380 #ifdef TIME_TEST
8381  tlift = tlift + clock() - to;
8382 #endif
8383 #ifdef CHECK_IDEAL_MWALK
8384  idString(F,"F");
8385 #endif
8386  rChangeCurrRing(newRing); // change the ring to newRing
8387  G = idrMoveR(F,baseRing,currRing);
8388  idDelete(&F);
8389  baseRing = currRing; // set baseRing equal to newRing
8390 #ifdef CHECK_IDEAL_MWALK
8391  idString(G,"G");
8392 #endif
8393 #ifdef TIME_TEST
8394  to = clock();
8395 #endif
8396  intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, op_deg);
8397 #ifdef TIME_TEST
8398  tnw = tnw + clock() - to;
8399 #endif
8400 #ifdef PRINT_VECTORS
8401  MivString(curr_weight, target_weight, next_weight);
8402 #endif
8403  if(Overflow_Error == TRUE)
8404  {
8405  PrintS("\n//**Mprwalk: OVERFLOW: The computed vector does not stay in cone, the result may be wrong.\n");
8406  delete next_weight;
8407  break;
8408  }
8409 
8410  if(test_w_in_ConeCC(G,target_weight) == 1 || MivComp(next_weight, ivNull) == 1)
8411  {
8412  delete next_weight;
8413  break;
8414  }
8415  //update tmp_weight and curr_weight
8416  for(i=nV-1; i>=0; i--)
8417  {
8418  (*tmp_weight)[i] = (*curr_weight)[i];
8419  (*curr_weight)[i] = (*next_weight)[i];
8420  }
8421  delete next_weight;
8422  } //end of while-loop
8423  Print("\n// Mprwalk took %d steps. Ring= %s;\n", nwalk, rString(currRing));
8424  idSkipZeroes(G);
8425  si_opt_1 = save1; //set original options, e. g. option(RedSB)
8426  baseRing = currRing;
8427  rChangeCurrRing(XXRing);
8428  ideal Res = idrMoveR(G,baseRing,currRing);
8429  delete tmp_weight;
8430  delete ivNull;
8431  delete exivlp;
8432 #ifndef BUCHBERGER_ALG
8433  delete last_omega;
8434 #endif
8435 #ifdef TIME_TEST
8436  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
8437 #endif
8438  return(Res);
8439 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
#define OPT_REDSB
Definition: options.h:71
unsigned si_opt_1
Definition: options.c:5
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
char * rString(ring r)
Definition: ring.cc:644
const ideal
Definition: gb_hack.h:42
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
static TreeM * G
Definition: janet.cc:38
#define BITSET
Definition: structs.h:17
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
#define Sy_bit(x)
Definition: options.h:30
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
polyrec * poly
Definition: hilb.h:10
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
void idSkipZeroes(ideal ide)
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static int isNolVector(intvec *hilb)
Definition: walk.cc:2961
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void MivString(intvec *iva, intvec *ivb, intvec *ivc)
Definition: walk.cc:514
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1300
static void ivString(intvec *iv, const char *ch)
Definition: walk.cc:500
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
static ring VMrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2503
intvec * Mivlp(int nR)
Definition: walk.cc:995
static intvec * MWalkRandomNextWeight(ideal G, intvec *curr_weight, intvec *target_weight, int weight_rad, int pert_deg)
Definition: walk.cc:4406
static ring VMrDefault(intvec *va)
Definition: walk.cc:2358
clock_t xtif
Definition: walk.cc:98
ideal Mpwalk ( ideal  Go,
int  op_deg,
int  tp_deg,
intvec curr_weight,
intvec target_weight,
int  nP 
)

Definition at line 5750 of file walk.cc.

5752 {
5753  Set_Error(FALSE );
5755  //Print("// pSetm_Error = (%d)", ErrorCheck());
5756 
5757  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
5758  xtextra=0;
5759  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
5760  tinput = clock();
5761 
5762  clock_t tim;
5763 
5764  nstep = 0;
5765  int i, ntwC=1, ntestw=1, nV = currRing->N;
5766  int endwalks=0;
5767 
5768  ideal Gomega, M, F, G, Gomega1, Gomega2, M1,F1,Eresult,ssG;
5769  ring newRing, oldRing, TargetRing;
5770  intvec* iv_M_dp;
5771  intvec* iv_M_lp;
5772  intvec* exivlp = Mivlp(nV);
5773  intvec* orig_target = target_weight;
5774  intvec* pert_target_vector = target_weight;
5775  intvec* ivNull = new intvec(nV);
5776  intvec* iv_dp = MivUnit(nV);// define (1,1,...,1)
5777 #ifndef BUCHBERGER_ALG
5778  intvec* hilb_func;
5779 #endif
5780  intvec* next_weight;
5781 
5782  // to avoid (1,0,...,0) as the target vector
5783  intvec* last_omega = new intvec(nV);
5784  for(i=nV-1; i>0; i--)
5785  (*last_omega)[i] = 1;
5786  (*last_omega)[0] = 10000;
5787 
5788  ring XXRing = currRing;
5789 
5790 
5791  to = clock();
5792  /* perturbs the original vector */
5793  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp"
5794  {
5795  G = MstdCC(Go);
5796  tostd = clock()-to;
5797  if(op_deg != 1){
5798  iv_M_dp = MivMatrixOrderdp(nV);
5799  //ivString(iv_M_dp, "iv_M_dp");
5800  curr_weight = MPertVectors(G, iv_M_dp, op_deg);
5801  }
5802  }
5803  else
5804  {
5805  //define ring order := (a(curr_weight),lp);
5806  if (rParameter(currRing) != NULL)
5807  DefRingPar(curr_weight);
5808  else
5809  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 1
5810 
5811  G = idrMoveR(Go, XXRing,currRing);
5812  G = MstdCC(G);
5813  tostd = clock()-to;
5814  if(op_deg != 1){
5815  iv_M_dp = MivMatrixOrder(curr_weight);
5816  curr_weight = MPertVectors(G, iv_M_dp, op_deg);
5817  }
5818  }
5819  delete iv_dp;
5820  if(op_deg != 1) delete iv_M_dp;
5821 
5822  ring HelpRing = currRing;
5823 
5824  /* perturbs the target weight vector */
5825  if(tp_deg > 1 && tp_deg <= nV)
5826  {
5827  if (rParameter(currRing) != NULL)
5828  DefRingPar(target_weight);
5829  else
5830  rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 2
5831 
5832  TargetRing = currRing;
5833  ssG = idrMoveR(G,HelpRing,currRing);
5834  if(MivSame(target_weight, exivlp) == 1)
5835  {
5836  iv_M_lp = MivMatrixOrderlp(nV);
5837  //ivString(iv_M_lp, "iv_M_lp");
5838  //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg);
5839  target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
5840  }
5841  else
5842  {
5843  iv_M_lp = MivMatrixOrder(target_weight);
5844  //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg);
5845  target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
5846  }
5847  delete iv_M_lp;
5848  pert_target_vector = target_weight;
5849  rChangeCurrRing(HelpRing);
5850  G = idrMoveR(ssG, TargetRing,currRing);
5851  }
5852  /*
5853  Print("\n// Perturbationwalkalg. vom Gradpaar (%d,%d):",op_deg,tp_deg);
5854  ivString(curr_weight, "new sigma");
5855  ivString(target_weight, "new tau");
5856  */
5857  while(1)
5858  {
5859  nstep ++;
5860  to = clock();
5861  /* compute an initial form ideal of <G> w.r.t. the weight vector
5862  "curr_weight" */
5863  Gomega = MwalkInitialForm(G, curr_weight);
5864 
5865 
5866 #ifdef ENDWALKS
5867  if(endwalks == 1){
5868  Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
5869  idElements(G, "G");
5870  // idElements(Gomega, "Gw");
5871  headidString(G, "G");
5872  //headidString(Gomega, "Gw");
5873  }
5874 #endif
5875 
5876  tif = tif + clock()-to;
5877 
5878 #ifndef BUCHBERGER_ALG
5879  if(isNolVector(curr_weight) == 0)
5880  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
5881  else
5882  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
5883 #endif // BUCHBERGER_ALG
5884 
5885  oldRing = currRing;
5886 
5887  // define a new ring with ordering "(a(curr_weight),lp)
5888  if (rParameter(currRing) != NULL)
5889  DefRingPar(curr_weight);
5890  else
5891  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 3
5892 
5893  newRing = currRing;
5894  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
5895 
5896 #ifdef ENDWALKS
5897  if(endwalks==1)
5898  {
5899  Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
5900  idElements(Gomega1, "Gw");
5901  headidString(Gomega1, "headGw");
5902  PrintS("\n// compute a rGB of Gw:\n");
5903 
5904 #ifndef BUCHBERGER_ALG
5905  ivString(hilb_func, "w");
5906 #endif
5907  }
5908 #endif
5909 
5910  tim = clock();
5911  to = clock();
5912  /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */
5913 #ifdef BUCHBERGER_ALG
5914  M = MstdhomCC(Gomega1);
5915 #else
5916  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
5917  delete hilb_func;
5918 #endif // BUCHBERGER_ALG
5919 
5920  if(endwalks == 1){
5921  xtstd = xtstd+clock()-to;
5922 #ifdef ENDWALKS
5923  Print("\n// time for the last std(Gw) = %.2f sec\n",
5924  ((double) clock())/1000000 -((double)tim) /1000000);
5925 #endif
5926  }
5927  else
5928  tstd=tstd+clock()-to;
5929 
5930  /* change the ring to oldRing */
5931  rChangeCurrRing(oldRing);
5932  M1 = idrMoveR(M, newRing,currRing);
5933  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5934 
5935  //if(endwalks==1) PrintS("\n// Lifting is working:..");
5936 
5937  to=clock();
5938  /* compute a representation of the generators of submod (M)
5939  with respect to those of mod (Gomega).
5940  Gomega is a reduced Groebner basis w.r.t. the current ring */
5941  F = MLifttwoIdeal(Gomega2, M1, G);
5942  if(endwalks != 1)
5943  tlift = tlift+clock()-to;
5944  else
5945  xtlift=clock()-to;
5946 
5947  idDelete(&M1);
5948  idDelete(&Gomega2);
5949  idDelete(&G);
5950 
5951  /* change the ring to newRing */
5952  rChangeCurrRing(newRing);
5953  F1 = idrMoveR(F, oldRing,currRing);
5954 
5955  //if(endwalks==1)PrintS("\n// InterRed is working now:");
5956 
5957  to=clock();
5958  /* reduce the Groebner basis <G> w.r.t. new ring */
5959  G = kInterRedCC(F1, NULL);
5960  if(endwalks != 1)
5961  tred = tred+clock()-to;
5962  else
5963  xtred=clock()-to;
5964 
5965  idDelete(&F1);
5966 
5967  if(endwalks == 1)
5968  break;
5969 
5970  to=clock();
5971  /* compute a next weight vector */
5972  next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
5973  tnw=tnw+clock()-to;
5974 #ifdef PRINT_VECTORS
5975  MivString(curr_weight, target_weight, next_weight);
5976 #endif
5977 
5978  if(Overflow_Error == TRUE)
5979  {
5980  ntwC = 0;
5981  //ntestomega = 1;
5982  //Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
5983  //idElements(G, "G");
5984  delete next_weight;
5985  goto FINISH_160302;
5986  }
5987  if(MivComp(next_weight, ivNull) == 1){
5988  newRing = currRing;
5989  delete next_weight;
5990  //Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
5991  break;
5992  }
5993  if(MivComp(next_weight, target_weight) == 1)
5994  endwalks = 1;
5995 
5996  for(i=nV-1; i>=0; i--)
5997  (*curr_weight)[i] = (*next_weight)[i];
5998 
5999  delete next_weight;
6000  }//while
6001 
6002  if(tp_deg != 1)
6003  {
6004  FINISH_160302:
6005  if(MivSame(orig_target, exivlp) == 1)
6006  if (rParameter(currRing) != NULL)
6007  DefRingParlp();
6008  else
6009  VMrDefaultlp();
6010  else
6011  if (rParameter(currRing) != NULL)
6012  DefRingPar(orig_target);
6013  else
6014  rChangeCurrRing(VMrDefault(orig_target)); //Aenderung
6015 
6016  TargetRing=currRing;
6017  F1 = idrMoveR(G, newRing,currRing);
6018 #ifdef CHECK_IDEAL
6019  headidString(G, "G");
6020 #endif
6021 
6022 
6023  // check whether the pertubed target vector stays in the correct cone
6024  if(ntwC != 0){
6025  ntestw = test_w_in_ConeCC(F1, pert_target_vector);
6026  }
6027 
6028  if( ntestw != 1 || ntwC == 0)
6029  {
6030  /*
6031  if(ntestw != 1){
6032  ivString(pert_target_vector, "tau");
6033  PrintS("\n// ** perturbed target vector doesn't stay in cone!!");
6034  Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
6035  idElements(F1, "G");
6036  }
6037  */
6038  // LastGB is "better" than the kStd subroutine
6039  to=clock();
6040  ideal eF1;
6041  if(nP == 0 || tp_deg == 1 || MivSame(orig_target, exivlp) != 1){
6042  // PrintS("\n// ** calls \"std\" to compute a GB");
6043  eF1 = MstdCC(F1);
6044  idDelete(&F1);
6045  }
6046  else {
6047  // PrintS("\n// ** calls \"LastGB\" to compute a GB");
6048  rChangeCurrRing(newRing);
6049  ideal F2 = idrMoveR(F1, TargetRing,currRing);
6050  eF1 = LastGB(F2, curr_weight, tp_deg-1);
6051  F2=NULL;
6052  }
6053  xtextra=clock()-to;
6054  ring exTargetRing = currRing;
6055 
6056  rChangeCurrRing(XXRing);
6057  Eresult = idrMoveR(eF1, exTargetRing,currRing);
6058  }
6059  else{
6060  rChangeCurrRing(XXRing);
6061  Eresult = idrMoveR(F1, TargetRing,currRing);
6062  }
6063  }
6064  else {
6065  rChangeCurrRing(XXRing);
6066  Eresult = idrMoveR(G, newRing,currRing);
6067  }
6068  delete ivNull;
6069  if(tp_deg != 1)
6070  delete target_weight;
6071 
6072  if(op_deg != 1 )
6073  delete curr_weight;
6074 
6075  delete exivlp;
6076  delete last_omega;
6077 
6078 #ifdef TIME_TEST
6079  TimeStringFractal(tinput, tostd, tif+xtif, tstd+xtstd,0, tlift+xtlift, tred+xtred,
6080  tnw+xtnw);
6081 
6082  Print("\n// pSetm_Error = (%d)", ErrorCheck());
6083  Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep, Overflow_Error);
6084 #endif
6085  return(Eresult);
6086 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
BOOLEAN ErrorCheck()
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
#define FALSE
Definition: auxiliary.h:140
char * rString(ring r)
Definition: ring.cc:644
static ideal LastGB(ideal G, intvec *curr_weight, int tp_deg)
Definition: walk.cc:2984
const ideal
Definition: gb_hack.h:42
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2746
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2879
static int isNolVector(intvec *hilb)
Definition: walk.cc:2961
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2809
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
static void MivString(intvec *iva, intvec *ivb, intvec *ivc)
Definition: walk.cc:514
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1300
static void ivString(intvec *iv, const char *ch)
Definition: walk.cc:500
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2358
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
ideal Mrwalk ( ideal  Go,
intvec curr_weight,
intvec target_weight,
int  weight_rad,
int  pert_deg,
ring  baseRing 
)

Definition at line 5339 of file walk.cc.

5340 {
5341  BITSET save1 = si_opt_1; // save current options
5342  //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
5343  //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
5344  //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
5345  Set_Error(FALSE);
5347 #ifdef TIME_TEST
5348  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
5349  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
5350  tinput = clock();
5351  clock_t tim;
5352 #endif
5353  nstep=0;
5354  int i,nwalk,endwalks = 0;
5355  int nV = baseRing->N;
5356 
5357  ideal Gomega, M, F, Gomega1, Gomega2, M1; //, F1;
5358  ring newRing;
5359  ring XXRing = baseRing;
5360  intvec* ivNull = new intvec(nV);
5361  intvec* curr_weight = new intvec(nV);
5362  intvec* target_weight = new intvec(nV);
5363  intvec* exivlp = Mivlp(nV);
5364  intvec* tmp_weight = new intvec(nV);
5365  for(i=0; i<nV; i++)
5366  {
5367  (*tmp_weight)[i] = (*target_M)[i];
5368  }
5369  for(i=0; i<nV; i++)
5370  {
5371  (*curr_weight)[i] = (*orig_M)[i];
5372  (*target_weight)[i] = (*target_M)[i];
5373  }
5374 #ifndef BUCHBERGER_ALG
5375  intvec* hilb_func;
5376  // to avoid (1,0,...,0) as the target vector
5377  intvec* last_omega = new intvec(nV);
5378  for(i=nV-1; i>0; i--)
5379  {
5380  (*last_omega)[i] = 1;
5381  }
5382  (*last_omega)[0] = 10000;
5383 #endif
5385 #ifdef CHECK_IDEAL_MWALK
5386  idString(Go,"Go");
5387 #endif
5388 #ifdef TIME_TEST
5389  to = clock();
5390 #endif
5391  if(orig_M->length() == nV)
5392  {
5393  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
5394  }
5395  else
5396  {
5397  newRing = VMatrDefault(orig_M);
5398  }
5399  rChangeCurrRing(newRing);
5400  ideal G = MstdCC(idrMoveR(Go,baseRing,currRing));
5401  baseRing = currRing;
5402 #ifdef TIME_TEST
5403  tostd = clock()-to;
5404 #endif
5405 
5406  nwalk = 0;
5407  while(1)
5408  {
5409  nwalk ++;
5410  nstep ++;
5411 #ifdef TIME_TEST
5412  to = clock();
5413 #endif
5414 #ifdef CHECK_IDEAL_MWALK
5415  idString(G,"G");
5416 #endif
5417  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
5418 #ifdef TIME_TEST
5419  tif = tif + clock()-to; //time for computing initial form ideal
5420 #endif
5421 #ifdef CHECK_IDEAL_MWALK
5422  idString(Gomega,"Gomega");
5423 #endif
5424 #ifndef BUCHBERGER_ALG
5425  if(isNolVector(curr_weight) == 0)
5426  {
5427  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
5428  }
5429  else
5430  {
5431  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
5432  }
5433 #endif
5434  if(nwalk == 1)
5435  {
5436  if(orig_M->length() == nV)
5437  {
5438  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
5439  }
5440  else
5441  {
5442  newRing = VMatrDefault(orig_M);
5443  }
5444  }
5445  else
5446  {
5447  if(target_M->length() == nV)
5448  {
5449  newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
5450  }
5451  else
5452  {
5453  newRing = VMatrRefine(target_M,curr_weight);
5454  }
5455  }
5456  rChangeCurrRing(newRing);
5457  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
5458  idDelete(&Gomega);
5459  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
5460 #ifdef TIME_TEST
5461  to = clock();
5462 #endif
5463 #ifndef BUCHBERGER_ALG
5464  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
5465  delete hilb_func;
5466 #else
5467  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
5468 #endif
5469 #ifdef TIME_TEST
5470  tstd = tstd + clock() - to;
5471 #endif
5472  idSkipZeroes(M);
5473 #ifdef CHECK_IDEAL_MWALK
5474  PrintS("\n//** Mwalk: computed M.\n");
5475  idString(M, "M");
5476 #endif
5477  //change the ring to baseRing
5478  rChangeCurrRing(baseRing);
5479  M1 = idrMoveR(M, newRing,currRing);
5480  idDelete(&M);
5481  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5482  idDelete(&Gomega1);
5483 #ifdef TIME_TEST
5484  to = clock();
5485 #endif
5486  // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring
5487  F = MLifttwoIdeal(Gomega2, M1, G);
5488 #ifdef TIME_TEST
5489  tlift = tlift + clock() - to;
5490 #endif
5491 #ifdef CHECK_IDEAL_MWALK
5492  idString(F, "F");
5493 #endif
5494  idDelete(&Gomega2);
5495  idDelete(&M1);
5496  rChangeCurrRing(newRing); // change the ring to newRing
5497  G = idrMoveR(F,baseRing,currRing);
5498  idDelete(&F);
5499  baseRing = currRing;
5500 #ifdef TIME_TEST
5501  to = clock();
5502 #endif
5503  //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);
5504 #ifdef TIME_TEST
5505  tstd = tstd + clock() - to;
5506 #endif
5507  idSkipZeroes(G);
5508 #ifdef CHECK_IDEAL_MWALK
5509  idString(G, "G");
5510 #endif
5511 #ifdef TIME_TEST
5512  to = clock();
5513 #endif
5514  intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg);//next_weight = MwalkNextWeightCC(curr_weight,target_weight,G);
5515 #ifdef TIME_TEST
5516  tnw = tnw + clock() - to;
5517 #endif
5518 #ifdef PRINT_VECTORS
5519  MivString(curr_weight, target_weight, next_weight);
5520 #endif
5521  if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 || MivComp(next_weight,curr_weight) == 1)
5522  {
5523 #ifdef CHECK_IDEAL_MWALK
5524  PrintS("\n//** Mwalk: entering last cone.\n");
5525 #endif
5526  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
5527  if(target_M->length() == nV)
5528  {
5529  newRing = VMrDefault(target_weight); // define a new ring with ordering "(a(curr_weight),lp)
5530  }
5531  else
5532  {
5533  newRing = VMatrDefault(target_M);
5534  }
5535  rChangeCurrRing(newRing);
5536  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
5537  idDelete(&Gomega);
5538 #ifdef CHECK_IDEAL_MWALK
5539  idString(Gomega1, "Gomega");
5540 #endif
5541  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
5542 #ifdef CHECK_IDEAL_MWALK
5543  idString(M,"M");
5544 #endif
5545  rChangeCurrRing(baseRing);
5546  M1 = idrMoveR(M, newRing,currRing);
5547  idDelete(&M);
5548  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5549  idDelete(&Gomega1);
5550  F = MLifttwoIdeal(Gomega2, M1, G);
5551 #ifdef CHECK_IDEAL_MWALK
5552  idString(F,"F");
5553 #endif
5554  idDelete(&Gomega2);
5555  idDelete(&M1);
5556  rChangeCurrRing(newRing); // change the ring to newRing
5557  G = idrMoveR(F,baseRing,currRing);
5558  idDelete(&F);
5559  baseRing = currRing;
5560  si_opt_1 = save1; //set original options, e. g. option(RedSB)
5561  idSkipZeroes(G);
5562 #ifdef TIME_TEST
5563  to = clock();
5564 #endif
5565  // if(si_opt_1 == (Sy_bit(OPT_REDSB)))
5566  // {
5567  //G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set
5568  // }
5569 #ifdef TIME_TEST
5570  tred = tred + clock() - to;
5571 #endif
5572  idSkipZeroes(G);
5573  delete next_weight;
5574  break;
5575 #ifdef CHECK_IDEAL_MWALK
5576  PrintS("\n//** Mwalk: last cone.\n");
5577 #endif
5578  }
5579 #ifdef CHECK_IDEAL_MWALK
5580  PrintS("\n//** Mwalk: update weight vectors.\n");
5581 #endif
5582  for(i=nV-1; i>=0; i--)
5583  {
5584  (*tmp_weight)[i] = (*curr_weight)[i];
5585  (*curr_weight)[i] = (*next_weight)[i];
5586  }
5587  delete next_weight;
5588  }
5589  rChangeCurrRing(XXRing);
5590  ideal result = idrMoveR(G,baseRing,currRing);
5591  idDelete(&G);
5592 /*#ifdef CHECK_IDEAL_MWALK
5593  pDelete(&p);
5594 #endif*/
5595  delete tmp_weight;
5596  delete ivNull;
5597  delete exivlp;
5598 #ifndef BUCHBERGER_ALG
5599  delete last_omega;
5600 #endif
5601 #ifdef TIME_TEST
5602  Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
5603  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
5604  Print("\n//** Mwalk: Ergebnis.\n");
5605  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
5606  //Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
5607 #endif
5608  return(result);
5609 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
unsigned si_opt_1
Definition: options.c:5
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
#define FALSE
Definition: auxiliary.h:140
static ring VMatrDefault(intvec *va)
Definition: walk.cc:2586
const ideal
Definition: gb_hack.h:42
clock_t xtred
Definition: walk.cc:98
static ring VMatrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2664
static TreeM * G
Definition: janet.cc:38
#define BITSET
Definition: structs.h:17
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
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...
Definition: ring.cc:3371
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
void idSkipZeroes(ideal ide)
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static int isNolVector(intvec *hilb)
Definition: walk.cc:2961
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void MivString(intvec *iva, intvec *ivb, intvec *ivc)
Definition: walk.cc:514
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1300
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
static ring VMrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2503
return result
Definition: facAbsBiFact.cc:76
intvec * Mivlp(int nR)
Definition: walk.cc:995
static intvec * MWalkRandomNextWeight(ideal G, intvec *curr_weight, intvec *target_weight, int weight_rad, int pert_deg)
Definition: walk.cc:4406
static ring VMrDefault(intvec *va)
Definition: walk.cc:2358
clock_t xtif
Definition: walk.cc:98
intvec* MSimpleIV ( intvec iv)
ideal Mwalk ( ideal  Go,
intvec orig_M,
intvec target_M,
ring  baseRing 
)

Definition at line 5065 of file walk.cc.

5066 {
5067  BITSET save1 = si_opt_1; // save current options
5068  //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
5069  //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
5070  //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
5071  Set_Error(FALSE);
5073 #ifdef TIME_TEST
5074  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
5075  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
5076  tinput = clock();
5077  clock_t tim;
5078 #endif
5079  nstep=0;
5080  int i,nwalk,endwalks = 0;
5081  int nV = baseRing->N;
5082 
5083  ideal Gomega, M, F, Gomega1, Gomega2, M1; //, F1;
5084  ring newRing;
5085  ring XXRing = baseRing;
5086  intvec* ivNull = new intvec(nV);
5087  intvec* curr_weight = new intvec(nV);
5088  intvec* target_weight = new intvec(nV);
5089  intvec* exivlp = Mivlp(nV);
5090  intvec* tmp_weight = new intvec(nV);
5091  for(i=0; i<nV; i++)
5092  {
5093  (*tmp_weight)[i] = (*target_M)[i];
5094  }
5095  for(i=0; i<nV; i++)
5096  {
5097  (*curr_weight)[i] = (*orig_M)[i];
5098  (*target_weight)[i] = (*target_M)[i];
5099  }
5100 #ifndef BUCHBERGER_ALG
5101  intvec* hilb_func;
5102  // to avoid (1,0,...,0) as the target vector
5103  intvec* last_omega = new intvec(nV);
5104  for(i=nV-1; i>0; i--)
5105  {
5106  (*last_omega)[i] = 1;
5107  }
5108  (*last_omega)[0] = 10000;
5109 #endif
5111 #ifdef CHECK_IDEAL_MWALK
5112  idString(Go,"Go");
5113 #endif
5114 #ifdef TIME_TEST
5115  to = clock();
5116 #endif
5117  if(orig_M->length() == nV)
5118  {
5119  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
5120  }
5121  else
5122  {
5123  newRing = VMatrDefault(orig_M);
5124  }
5125  rChangeCurrRing(newRing);
5126  ideal G = MstdCC(idrMoveR(Go,baseRing,currRing));
5127  baseRing = currRing;
5128 #ifdef TIME_TEST
5129  tostd = clock()-to;
5130 #endif
5131 
5132  nwalk = 0;
5133  while(1)
5134  {
5135  nwalk ++;
5136  nstep ++;
5137 #ifdef TIME_TEST
5138  to = clock();
5139 #endif
5140 #ifdef CHECK_IDEAL_MWALK
5141  idString(G,"G");
5142 #endif
5143  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
5144 #ifdef TIME_TEST
5145  tif = tif + clock()-to; //time for computing initial form ideal
5146 #endif
5147 #ifdef CHECK_IDEAL_MWALK
5148  idString(Gomega,"Gomega");
5149 #endif
5150 #ifndef BUCHBERGER_ALG
5151  if(isNolVector(curr_weight) == 0)
5152  {
5153  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
5154  }
5155  else
5156  {
5157  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
5158  }
5159 #endif
5160  if(nwalk == 1)
5161  {
5162  if(orig_M->length() == nV)
5163  {
5164  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
5165  }
5166  else
5167  {
5168  newRing = VMatrDefault(orig_M);
5169  }
5170  }
5171  else
5172  {
5173  if(target_M->length() == nV)
5174  {
5175  newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
5176  }
5177  else
5178  {
5179  newRing = VMatrRefine(target_M,curr_weight);
5180  }
5181  }
5182  rChangeCurrRing(newRing);
5183  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
5184  idDelete(&Gomega);
5185  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
5186 #ifdef TIME_TEST
5187  to = clock();
5188 #endif
5189 #ifndef BUCHBERGER_ALG
5190  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
5191  delete hilb_func;
5192 #else
5193  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
5194 #endif
5195 #ifdef TIME_TEST
5196  tstd = tstd + clock() - to;
5197 #endif
5198  idSkipZeroes(M);
5199 #ifdef CHECK_IDEAL_MWALK
5200  PrintS("\n//** Mwalk: computed M.\n");
5201  idString(M, "M");
5202 #endif
5203  //change the ring to baseRing
5204  rChangeCurrRing(baseRing);
5205  M1 = idrMoveR(M, newRing,currRing);
5206  idDelete(&M);
5207  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5208  idDelete(&Gomega1);
5209 #ifdef TIME_TEST
5210  to = clock();
5211 #endif
5212  // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring
5213  F = MLifttwoIdeal(Gomega2, M1, G);
5214 #ifdef TIME_TEST
5215  tlift = tlift + clock() - to;
5216 #endif
5217 #ifdef CHECK_IDEAL_MWALK
5218  idString(F, "F");
5219 #endif
5220  idDelete(&Gomega2);
5221  idDelete(&M1);
5222  rChangeCurrRing(newRing); // change the ring to newRing
5223  G = idrMoveR(F,baseRing,currRing);
5224  idDelete(&F);
5225  baseRing = currRing;
5226 #ifdef TIME_TEST
5227  to = clock();
5228 #endif
5229  //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);
5230 #ifdef TIME_TEST
5231  tstd = tstd + clock() - to;
5232 #endif
5233  idSkipZeroes(G);
5234 #ifdef CHECK_IDEAL_MWALK
5235  idString(G, "G");
5236 #endif
5237 #ifdef TIME_TEST
5238  to = clock();
5239 #endif
5240  intvec* next_weight = MwalkNextWeightCC(curr_weight,target_weight,G);
5241 #ifdef TIME_TEST
5242  tnw = tnw + clock() - to;
5243 #endif
5244 #ifdef PRINT_VECTORS
5245  MivString(curr_weight, target_weight, next_weight);
5246 #endif
5247  if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 || MivComp(next_weight,curr_weight) == 1)
5248  {
5249 #ifdef CHECK_IDEAL_MWALK
5250  PrintS("\n//** Mwalk: entering last cone.\n");
5251 #endif
5252  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
5253  if(target_M->length() == nV)
5254  {
5255  newRing = VMrDefault(target_weight); // define a new ring with ordering "(a(curr_weight),lp)
5256  }
5257  else
5258  {
5259  newRing = VMatrDefault(target_M);
5260  }
5261  rChangeCurrRing(newRing);
5262  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
5263  idDelete(&Gomega);
5264 #ifdef CHECK_IDEAL_MWALK
5265  idString(Gomega1, "Gomega");
5266 #endif
5267  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
5268 #ifdef CHECK_IDEAL_MWALK
5269  idString(M,"M");
5270 #endif
5271  rChangeCurrRing(baseRing);
5272  M1 = idrMoveR(M, newRing,currRing);
5273  idDelete(&M);
5274  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5275  idDelete(&Gomega1);
5276  F = MLifttwoIdeal(Gomega2, M1, G);
5277 #ifdef CHECK_IDEAL_MWALK
5278  idString(F,"F");
5279 #endif
5280  idDelete(&Gomega2);
5281  idDelete(&M1);
5282  rChangeCurrRing(newRing); // change the ring to newRing
5283  G = idrMoveR(F,baseRing,currRing);
5284  idDelete(&F);
5285  baseRing = currRing;
5286  si_opt_1 = save1; //set original options, e. g. option(RedSB)
5287  idSkipZeroes(G);
5288 #ifdef TIME_TEST
5289  to = clock();
5290 #endif
5291  // if(si_opt_1 == (Sy_bit(OPT_REDSB)))
5292  // {
5293  G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set
5294  // }
5295 #ifdef TIME_TEST
5296  tred = tred + clock() - to;
5297 #endif
5298  idSkipZeroes(G);
5299  delete next_weight;
5300  break;
5301 #ifdef CHECK_IDEAL_MWALK
5302  PrintS("\n//** Mwalk: last cone.\n");
5303 #endif
5304  }
5305 #ifdef CHECK_IDEAL_MWALK
5306  PrintS("\n//** Mwalk: update weight vectors.\n");
5307 #endif
5308  for(i=nV-1; i>=0; i--)
5309  {
5310  (*tmp_weight)[i] = (*curr_weight)[i];
5311  (*curr_weight)[i] = (*next_weight)[i];
5312  }
5313  delete next_weight;
5314  }
5315  rChangeCurrRing(XXRing);
5316  ideal result = idrMoveR(G,baseRing,currRing);
5317  idDelete(&G);
5318 /*#ifdef CHECK_IDEAL_MWALK
5319  pDelete(&p);
5320 #endif*/
5321  delete tmp_weight;
5322  delete ivNull;
5323  delete exivlp;
5324 #ifndef BUCHBERGER_ALG
5325  delete last_omega;
5326 #endif
5327 #ifdef TIME_TEST
5328  Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
5329  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
5330  Print("\n//** Mwalk: Ergebnis.\n");
5331  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
5332  //Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
5333 #endif
5334  return(result);
5335 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
unsigned si_opt_1
Definition: options.c:5
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
#define FALSE
Definition: auxiliary.h:140
static ring VMatrDefault(intvec *va)
Definition: walk.cc:2586
const ideal
Definition: gb_hack.h:42
clock_t xtred
Definition: walk.cc:98
int length() const
Definition: intvec.h:85
static ring VMatrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2664
static TreeM * G
Definition: janet.cc:38
#define BITSET
Definition: structs.h:17
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
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...
Definition: ring.cc:3371
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
static intvec * MwalkNextWeightCC(intvec *curr_weight, intvec *target_weight, ideal G)
Definition: walk.cc:1865
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
void idSkipZeroes(ideal ide)
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static int isNolVector(intvec *hilb)
Definition: walk.cc:2961
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
static void MivString(intvec *iva, intvec *ivb, intvec *ivc)
Definition: walk.cc:514
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1300
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
static ring VMrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2503
return result
Definition: facAbsBiFact.cc:76
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2358
clock_t xtif
Definition: walk.cc:98
ideal MwalkInitialForm ( ideal  G,
intvec curr_weight 
)

Definition at line 736 of file walk.cc.

737 {
738  BOOLEAN nError = Overflow_Error;
740 
741  int i, nG = IDELEMS(G);
742  ideal Gomega = idInit(nG, 1);
743 
744  for(i=nG-1; i>=0; i--)
745  {
746  Gomega->m[i] = MpolyInitialForm(G->m[i], ivw);
747  }
748  if(Overflow_Error == FALSE)
749  {
750  Overflow_Error = nError;
751  }
752  return Gomega;
753 }
#define FALSE
Definition: auxiliary.h:140
static poly MpolyInitialForm(poly g, intvec *curr_weight)
Definition: walk.cc:699
const ideal
Definition: gb_hack.h:42
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
int BOOLEAN
Definition: auxiliary.h:131
intvec* MwalkNextWeight ( intvec curr_weight,
intvec target_weight,
ideal  G 
)
ideal TranMImprovwalk ( ideal  Go,
intvec curr_weight,
intvec target_weight,
int  nP 
)

Definition at line 7069 of file walk.cc.

7070 {
7071 #ifdef TIME_TEST
7072  clock_t mtim = clock();
7073 #endif
7074  Set_Error(FALSE );
7076  //Print("// pSetm_Error = (%d)", ErrorCheck());
7077  //Print("\n// ring ro = %s;", rString(currRing));
7078 
7079  clock_t tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0, textra=0;
7080 #ifdef TIME_TEST
7081  clock_t tinput = clock();
7082 #endif
7083  int nsteppert=0, i, nV = currRing->N, nwalk=0, npert_tmp=0;
7084  int *npert=(int*)omAlloc(2*nV*sizeof(int));
7085  ideal Gomega, M,F, G1, Gomega1, Gomega2, M1, F1;
7086  //ring endRing;
7087  ring newRing, oldRing, lpRing;
7088  intvec* next_weight;
7089  intvec* ivNull = new intvec(nV); //define (0,...,0)
7090  intvec* iv_dp = MivUnit(nV);// define (1,1,...,1)
7091  intvec* iv_lp = Mivlp(nV); //define (1,0,...,0)
7092  ideal H0;
7093  //ideal H1;
7094  ideal H2, Glp;
7095  int nGB, endwalks = 0, nwalkpert=0, npertstep=0;
7096  intvec* Mlp = MivMatrixOrderlp(nV);
7097  intvec* vector_tmp = new intvec(nV);
7098 #ifndef BUCHBERGER_ALG
7099  intvec* hilb_func;
7100 #endif
7101  /* to avoid (1,0,...,0) as the target vector */
7102  intvec* last_omega = new intvec(nV);
7103  for(i=nV-1; i>0; i--)
7104  (*last_omega)[i] = 1;
7105  (*last_omega)[0] = 10000;
7106 
7107  // intvec* extra_curr_weight = new intvec(nV);
7108  intvec* target_weight = new intvec(nV);
7109  for(i=nV-1; i>=0; i--)
7110  (*target_weight)[i] = (*target_tmp)[i];
7111 
7112  ring XXRing = currRing;
7113  newRing = currRing;
7114 
7115  to=clock();
7116  /* compute a red. GB w.r.t. the help ring */
7117  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) = "dp"
7118  G = MstdCC(G);
7119  else
7120  {
7121  //rOrdStr(currRing) = (a(.c_w..),lp,C)
7122  if (rParameter(currRing) != NULL)
7123  DefRingPar(curr_weight);
7124  else
7125  rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 4
7126  G = idrMoveR(G, XXRing,currRing);
7127  G = MstdCC(G);
7128  }
7129  tostd=clock()-to;
7130 
7131 #ifdef REPRESENTATION_OF_SIGMA
7132  ideal Gw = MwalkInitialForm(G, curr_weight);
7133 
7134  if(islengthpoly2(Gw)==1)
7135  {
7136  intvec* MDp;
7137  if(MivComp(curr_weight, iv_dp) == 1)
7138  MDp = MatrixOrderdp(nV); //MivWeightOrderlp(iv_dp);
7139  else
7140  MDp = MivWeightOrderlp(curr_weight);
7141 
7142  curr_weight = RepresentationMatrix_Dp(G, MDp);
7143 
7144  delete MDp;
7145 
7146  ring exring = currRing;
7147 
7148  if (rParameter(currRing) != NULL)
7149  DefRingPar(curr_weight);
7150  else
7151  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 5
7152  to=clock();
7153  Gw = idrMoveR(G, exring,currRing);
7154  G = MstdCC(Gw);
7155  Gw = NULL;
7156  tostd=tostd+clock()-to;
7157  //ivString(curr_weight,"rep. sigma");
7158  goto COMPUTE_NEW_VECTOR;
7159  }
7160 
7161  idDelete(&Gw);
7162  delete iv_dp;
7163 #endif
7164 
7165 
7166  while(1)
7167  {
7168  to=clock();
7169  /* compute an initial form ideal of <G> w.r.t. "curr_vector" */
7170  Gomega = MwalkInitialForm(G, curr_weight);
7171  tif=tif+clock()-to;
7172 
7173 #ifndef BUCHBERGER_ALG
7174  if(isNolVector(curr_weight) == 0)
7175  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
7176  else
7177  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
7178 #endif // BUCHBERGER_ALG
7179 
7180  oldRing = currRing;
7181 
7182  /* define a new ring that its ordering is "(a(curr_weight),lp) */
7183  if (rParameter(currRing) != NULL)
7184  DefRingPar(curr_weight);
7185  else
7186  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 6
7187 
7188  newRing = currRing;
7189  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
7190 
7191  to=clock();
7192  /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */
7193 #ifdef BUCHBERGER_ALG
7194  M = MstdhomCC(Gomega1);
7195 #else
7196  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
7197  delete hilb_func;
7198 #endif // BUCHBERGER_ALG
7199  tstd=tstd+clock()-to;
7200 
7201  /* change the ring to oldRing */
7202  rChangeCurrRing(oldRing);
7203  M1 = idrMoveR(M, newRing,currRing);
7204  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
7205 
7206  to=clock();
7207  /* compute a representation of the generators of submod (M)
7208  with respect to those of mod (Gomega).
7209  Gomega is a reduced Groebner basis w.r.t. the current ring */
7210  F = MLifttwoIdeal(Gomega2, M1, G);
7211  tlift=tlift+clock()-to;
7212 
7213  idDelete(&M1);
7214  idDelete(&Gomega2);
7215  idDelete(&G);
7216 
7217  /* change the ring to newRing */
7218  rChangeCurrRing(newRing);
7219  F1 = idrMoveR(F, oldRing,currRing);
7220 
7221  to=clock();
7222  /* reduce the Groebner basis <G> w.r.t. new ring */
7223  G = kInterRedCC(F1, NULL);
7224  tred=tred+clock()-to;
7225  idDelete(&F1);
7226 
7227 
7228  COMPUTE_NEW_VECTOR:
7229  newRing = currRing;
7230  nwalk++;
7231  nwalkpert++;
7232  to=clock();
7233  // compute a next weight vector
7234  next_weight = MwalkNextWeightCC(curr_weight,target_weight, G);
7235  tnw=tnw+clock()-to;
7236 #ifdef PRINT_VECTORS
7237  MivString(curr_weight, target_weight, next_weight);
7238 #endif
7239 
7240 
7241  /* check whether the computed intermediate weight vector is in
7242  the correct cone; sometimes it is very big e.g. s7, cyc7.
7243  If it is NOT in the correct cone, then compute directly
7244  a reduced Groebner basis with respect to the lexicographic ordering
7245  for the known Groebner basis that it is computed in the last step.
7246  */
7247  //if(test_w_in_ConeCC(G, next_weight) != 1)
7248  if(Overflow_Error == TRUE)
7249  {
7250  OMEGA_OVERFLOW_TRAN_NEW:
7251  //Print("\n// takes %d steps!", nwalk-1);
7252  //Print("\n//ring lastRing = %s;", rString(currRing));
7253 #ifdef TEST_OVERFLOW
7254  goto BE_FINISH;
7255 #endif
7256 
7257 #ifdef CHECK_IDEAL_MWALK
7258  idElements(G, "G");
7259  //headidString(G, "G");
7260 #endif
7261 
7262  if(MivSame(target_tmp, iv_lp) == 1)
7263  if (rParameter(currRing) != NULL)
7264  DefRingParlp();
7265  else
7266  VMrDefaultlp();
7267  else
7268  if (rParameter(currRing) != NULL)
7269  DefRingPar(target_tmp);
7270  else
7271  rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 8
7272 
7273  lpRing = currRing;
7274  G1 = idrMoveR(G, newRing,currRing);
7275 
7276  to=clock();
7277  /*apply kStd or LastGB to compute a lex. red. Groebner basis of <G>*/
7278  if(nP == 0 || MivSame(target_tmp, iv_lp) == 0){
7279  //Print("\n\n// calls \"std in ring r_%d = %s;", nwalk, rString(currRing));
7280  G = MstdCC(G1);//no result for qnt1
7281  }
7282  else {
7283  rChangeCurrRing(newRing);
7284  G1 = idrMoveR(G1, lpRing,currRing);
7285 
7286  //Print("\n\n// calls \"LastGB\" (%d) to compute a GB", nV-1);
7287  G = LastGB(G1, curr_weight, nV-1); //no result for kats7
7288 
7289  rChangeCurrRing(lpRing);
7290  G = idrMoveR(G, newRing,currRing);
7291  }
7292  textra=clock()-to;
7293  npert[endwalks]=nwalk-npert_tmp;
7294  npert_tmp = nwalk;
7295  endwalks ++;
7296  break;
7297  }
7298 
7299  /* check whether the computed Groebner basis is really a Groebner basis.
7300  If not, we perturb the target vector with the maximal "perturbation"
7301  degree.*/
7302  if(MivComp(next_weight, target_weight) == 1 ||
7303  MivComp(next_weight, curr_weight) == 1 )
7304  {
7305  //Print("\n//ring r_%d = %s;", nwalk, rString(currRing));
7306 
7307 
7308  //compute the number of perturbations and its step
7309  npert[endwalks]=nwalk-npert_tmp;
7310  npert_tmp = nwalk;
7311 
7312  endwalks ++;
7313 
7314  /*it is very important if the walk only uses one step, e.g. Fate, liu*/
7315  if(endwalks == 1 && MivComp(next_weight, curr_weight) == 1){
7316  rChangeCurrRing(XXRing);
7317  G = idrMoveR(G, newRing,currRing);
7318  goto FINISH;
7319  }
7320  H0 = id_Head(G,currRing);
7321 
7322  if(MivSame(target_tmp, iv_lp) == 1)
7323  if (rParameter(currRing) != NULL)
7324  DefRingParlp();
7325  else
7326  VMrDefaultlp();
7327  else
7328  if (rParameter(currRing) != NULL)
7329  DefRingPar(target_tmp);
7330  else
7331  rChangeCurrRing(VMrDefault(target_tmp)); //Aenderung 9
7332 
7333  lpRing = currRing;
7334  Glp = idrMoveR(G, newRing,currRing);
7335  H2 = idrMoveR(H0, newRing,currRing);
7336 
7337  /* Apply Lemma 2.2 in Collart et. al (1997) to check whether
7338  cone(k-1) is equal to cone(k) */
7339  nGB = 1;
7340  for(i=IDELEMS(Glp)-1; i>=0; i--)
7341  {
7342  poly t;
7343  if((t=pSub(pHead(Glp->m[i]), pCopy(H2->m[i]))) != NULL)
7344  {
7345  pDelete(&t);
7346  idDelete(&H2);//5.5.02
7347  nGB = 0; //i.e. Glp is no reduced Groebner basis
7348  break;
7349  }
7350  pDelete(&t);
7351  }
7352 
7353  idDelete(&H2);//5.5.02
7354 
7355  if(nGB == 1)
7356  {
7357  G = Glp;
7358  Glp = NULL;
7359  break;
7360  }
7361 
7362  /* perturb the target weight vector, if the vector target_tmp
7363  stays in many cones */
7364  poly p;
7365  BOOLEAN plength3 = FALSE;
7366  for(i=IDELEMS(Glp)-1; i>=0; i--)
7367  {
7368  p = MpolyInitialForm(Glp->m[i], target_tmp);
7369  if(p->next != NULL &&
7370  p->next->next != NULL &&
7371  p->next->next->next != NULL)
7372  {
7374 
7375  for(i=0; i<nV; i++)
7376  (*vector_tmp)[i] = (*target_weight)[i];
7377 
7378  delete target_weight;
7379  target_weight = MPertVectors(Glp, Mlp, nV);
7380 
7381  if(MivComp(vector_tmp, target_weight)==1)
7382  {
7383  //PrintS("\n// The old and new representaion vector are the same!!");
7384  G = Glp;
7385  newRing = currRing;
7386  goto OMEGA_OVERFLOW_TRAN_NEW;
7387  }
7388 
7389  if(Overflow_Error == TRUE)
7390  {
7391  rChangeCurrRing(newRing);
7392  G = idrMoveR(Glp, lpRing,currRing);
7393  goto OMEGA_OVERFLOW_TRAN_NEW;
7394  }
7395 
7396  plength3 = TRUE;
7397  pDelete(&p);
7398  break;
7399  }
7400  pDelete(&p);
7401  }
7402 
7403  if(plength3 == FALSE)
7404  {
7405  rChangeCurrRing(newRing);
7406  G = idrMoveR(Glp, lpRing,currRing);
7407  goto TRAN_LIFTING;
7408  }
7409 
7410 
7411  npertstep = nwalk;
7412  nwalkpert = 1;
7413  nsteppert ++;
7414 
7415  /*
7416  Print("\n// Subroutine needs (%d) steps.", nwalk);
7417  idElements(Glp, "last G in walk:");
7418  PrintS("\n// ****************************************");
7419  Print("\n// Perturb the original target vector (%d): ", nsteppert);
7420  ivString(target_weight, "new target");
7421  PrintS("\n// ****************************************\n");
7422  */
7423  rChangeCurrRing(newRing);
7424  G = idrMoveR(Glp, lpRing,currRing);
7425 
7426  delete next_weight;
7427 
7428  //Print("\n// ring rNEW = %s;", rString(currRing));
7429  goto COMPUTE_NEW_VECTOR;
7430  }
7431 
7432  TRAN_LIFTING:
7433  for(i=nV-1; i>=0; i--)
7434  (*curr_weight)[i] = (*next_weight)[i];
7435 
7436  delete next_weight;
7437  }//while
7438 #ifdef TEST_OVERFLOW
7439  BE_FINISH:
7440 #endif
7441  rChangeCurrRing(XXRing);
7442  G = idrMoveR(G, lpRing,currRing);
7443 
7444  FINISH:
7445  delete ivNull;
7446  delete next_weight;
7447  delete iv_lp;
7448  omFree(npert);
7449 
7450 #ifdef TIME_TEST
7451  Print("\n// Computation took %d steps and %.2f sec",
7452  nwalk, ((double) (clock()-mtim)/1000000));
7453 
7454  TimeStringFractal(tinput, tostd, tif, tstd, textra, tlift, tred, tnw);
7455 
7456  Print("\n// pSetm_Error = (%d)", ErrorCheck());
7457  Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
7458 #endif
7459 
7460  return(G);
7461 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
BOOLEAN ErrorCheck()
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
static ideal LastGB(ideal G, intvec *curr_weight, int tp_deg)
Definition: walk.cc:2984
static poly MpolyInitialForm(poly g, intvec *curr_weight)
Definition: walk.cc:699
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2746
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
#define pSub(a, b)
Definition: polys.h:258
static int islengthpoly2(ideal G)
Definition: walk.cc:3285
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
static intvec * MwalkNextWeightCC(intvec *curr_weight, intvec *target_weight, ideal G)
Definition: walk.cc:1865
int i
Definition: cfEzgcd.cc:123
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:19
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2879
static int isNolVector(intvec *hilb)
Definition: walk.cc:2961
static ideal MstdCC(ideal G)
Definition: walk.cc:907
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2809
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
ideal id_Head(ideal h, const ring r)
#define pDelete(p_ptr)
Definition: polys.h:157
static void MivString(intvec *iva, intvec *ivb, intvec *ivc)
Definition: walk.cc:514
intvec * MivUnit(int nV)
Definition: walk.cc:1476
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1300
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
int BOOLEAN
Definition: auxiliary.h:131
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2358
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
intvec* TranMPertVectorslp ( ideal  G)