/ Implementation of the perturbation walk algorithm */ / If the perturbed target weight vector or an intermediate weight vector doesn't stay in the correct Groebner cone, we have only a reduced Groebner basis for the given ideal with respect to a monomial order which differs to the given order. Then we have to compute the wanted reduced Groebner basis for it. For this, we can
| 5946 | */ |
| 5947 | // if nP = 0 use kStd, else call LastGB |
| 5948 | ideal Mpwalk(ideal Go, int op_deg, int tp_deg,intvec* curr_weight, |
| 5949 | intvec* target_weight, int nP, int reduction, int printout) |
| 5950 | { |
| 5951 | BITSET save1 = si_opt_1; // save current options |
| 5952 | if(reduction == 0) |
| 5953 | { |
| 5954 | si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis |
| 5955 | si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions |
| 5956 | } |
| 5957 | Set_Error(FALSE ); |
| 5958 | Overflow_Error = FALSE; |
| 5959 | //Print("// pSetm_Error = (%d)", ErrorCheck()); |
| 5960 | #ifdef TIME_TEST |
| 5961 | clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0; |
| 5962 | xtextra=0; |
| 5963 | xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; |
| 5964 | tinput = clock(); |
| 5965 | |
| 5966 | clock_t tim; |
| 5967 | #endif |
| 5968 | nstep = 0; |
| 5969 | int i, ntwC=1, ntestw=1, nV = currRing->N; |
| 5970 | |
| 5971 | //check that perturbation degree is valid |
| 5972 | if(op_deg < 1 || tp_deg < 1 || op_deg > nV || tp_deg > nV) |
| 5973 | { |
| 5974 | WerrorS("Invalid perturbation degree.\n"); |
| 5975 | return NULL; |
| 5976 | } |
| 5977 | |
| 5978 | BOOLEAN endwalks = FALSE; |
| 5979 | ideal Gomega, M, F, FF, G, Gomega1, Gomega2, M1,F1,Eresult,ssG; |
| 5980 | ring newRing, oldRing, TargetRing; |
| 5981 | intvec* iv_M_dp; |
| 5982 | intvec* iv_M_lp; |
| 5983 | intvec* exivlp = Mivlp(nV); |
| 5984 | intvec* orig_target = target_weight; |
| 5985 | intvec* pert_target_vector = target_weight; |
| 5986 | intvec* ivNull = new intvec(nV); |
| 5987 | intvec* iv_dp = MivUnit(nV);// define (1,1,...,1) |
| 5988 | #ifndef BUCHBERGER_ALG |
| 5989 | intvec* hilb_func; |
| 5990 | #endif |
| 5991 | intvec* next_weight; |
| 5992 | |
| 5993 | // to avoid (1,0,...,0) as the target vector |
| 5994 | intvec* last_omega = new intvec(nV); |
| 5995 | for(i=nV-1; i>0; i--) |
| 5996 | (*last_omega)[i] = 1; |
| 5997 | (*last_omega)[0] = 10000; |
| 5998 | |
| 5999 | ring XXRing = currRing; |
| 6000 | #ifdef TIME_TEST |
| 6001 | to = clock(); |
| 6002 | #endif |
| 6003 | // perturbs the original vector |
| 6004 | if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp" |
| 6005 | { |
no test coverage detected