6401 clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
6403 xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
6409 int i, ntwC=1, ntestw=1, nV =
currRing->N;
6419 if(op_deg < 1 || tp_deg < 1 || op_deg > nV || tp_deg > nV)
6421 WerrorS(
"Invalid perturbation degree.\n");
6427 ideal Gomega,
M, F, FF,
G, Gomega1, Gomega2, M1,F1,Eresult,ssG;
6428 ring newRing, oldRing, TargetRing;
6437 (*curr_weight)[
i] = (*orig_M)[
i];
6438 (*target_weight)[
i] = (*target_M)[
i];
6440 intvec* orig_target = target_weight;
6441 intvec* pert_target_vector = target_weight;
6444#ifndef BUCHBERGER_ALG
6451 for(
i=nV-1;
i>0;
i--)
6452 (*last_omega)[
i] = 1;
6453 (*last_omega)[0] = 10000;
6458 if(orig_M->
length() == nV)
6460 if(
MivComp(curr_weight, iv_dp) == 1)
6516 if(op_deg != 1)
delete iv_M_dp;
6521 if(target_M->
length() == nV)
6523 if(tp_deg > 1 && tp_deg <= nV)
6532 if(
MivSame(target_weight, exivlp) == 1)
6543 pert_target_vector = target_weight;
6550 if(tp_deg > 1 && tp_deg <= nV)
6560 Print(
"\n//** Mprwalk: Random Perturbation Walk of degree (%d,%d):",op_deg,tp_deg);
6561 ivString(curr_weight,
"//** Mprwalk: new current weight");
6562 ivString(target_weight,
"//** Mprwalk: new target weight");
6570 tif = tif + clock()-to;
6576#ifdef CHECK_IDEAL_MWALK
6579 idString(Gomega,
"//** Mprwalk: Gomega");
6596 if(endwalks ==
TRUE)
6607#ifndef BUCHBERGER_ALG
6608 if(isNolVector(curr_weight) == 0)
6616 if(target_M->
length() == nV)
6633 if(endwalks ==
TRUE)
6642 PrintS(
"\n// compute a rGB of Gw:\n");
6644#ifndef BUCHBERGER_ALG
6654#ifdef BUCHBERGER_ALG
6660#ifdef CHECK_IDEAL_MWALK
6667 if(endwalks ==
TRUE)
6669 xtstd = xtstd+clock()-to;
6671 Print(
"\n// time for the last std(Gw) = %.2f sec\n",
6672 ((
double) clock())/1000000 -((
double)tim) /1000000);
6676 tstd=tstd+clock()-to;
6690 if(endwalks ==
FALSE)
6691 tlift = tlift+clock()-to;
6695#ifdef CHECK_IDEAL_MWALK
6717 PrintS(
"\n //** Mprwalk: reduce the Groebner basis.\n");
6724 if(endwalks ==
FALSE)
6725 tred = tred+clock()-to;
6732 if(endwalks ==
TRUE)
6741 tnw = tnw + clock() - to;
6750 tif = tif + clock()-to;
6758 PrintS(
"\n Mpwalk: there is a polynomial in Gomega with at least 3 monomials.\n");
6762 if(target_M->
length() == nV)
6775 tnw = tnw + clock() - to;
6783 tif = tif + clock()-to;
6791 MivString(curr_weight, target_weight, next_weight);
6803 if(
MivComp(next_weight, ivNull) == 1){
6809 if(
MivComp(next_weight, target_weight) == 1)
6812 for(
i=nV-1;
i>=0;
i--)
6813 (*curr_weight)[
i] = (*next_weight)[
i];
6821 if(target_M->
length() == nV)
6823 if(
MivSame(orig_target, exivlp) == 1)
6846 if(ntestw != 1 || ntwC == 0)
6848 if(ntestw != 1 && printout > 2)
6851 ivString(pert_target_vector,
"tau");
6853 PrintS(
"\n// **Mprwalk: perturbed target vector doesn't stay in cone.");
6862 if(nP == 0 || tp_deg == 1 ||
MivSame(orig_target, exivlp) != 1 || target_M->
length() != nV)
6866 PrintS(
"\n// ** Mprwalk: Call \"std\" to compute a Groebner basis.\n");
6875 PrintS(
"\n// **Mprwalk: Call \"LastGB\" to compute a Groebner basis.\n");
6879 eF1 =
LastGB(F2, curr_weight, tp_deg-1);
6904 delete target_weight;
6913 TimeStringFractal(tinput, tostd, tif+xtif, tstd+xtstd,0, tlift+xtlift, tred+xtred,
6922 Print(
"\n//** Mprwalk: Perturbation Walk took %d steps.\n",
nstep);
static int lengthpoly(ideal G)
static ideal middleOfCone(ideal G, ideal Gomega)
static intvec * MWalkRandomNextWeight(ideal G, intvec *orig_M, intvec *target_weight, int weight_rad, int pert_deg)
intvec * MivMatrixOrderRefine(intvec *iv, intvec *iw)
static ideal LastGB(ideal G, intvec *curr_weight, int tp_deg)
static void idString(ideal L, const char *st)