* THE PERTURBATION WALK ALGORITHM WITH RANDOM ELEMENT * *******************************************************/
| 6387 | * THE PERTURBATION WALK ALGORITHM WITH RANDOM ELEMENT * |
| 6388 | *******************************************************/ |
| 6389 | ideal Mprwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, |
| 6390 | int op_deg, int tp_deg, int nP, int reduction, int printout) |
| 6391 | { |
| 6392 | BITSET save1 = si_opt_1; // save current options |
| 6393 | if(reduction == 0) |
| 6394 | { |
| 6395 | si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis |
| 6396 | si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions |
| 6397 | } |
| 6398 | Set_Error(FALSE); |
| 6399 | Overflow_Error = FALSE; |
| 6400 | //Print("// pSetm_Error = (%d)", ErrorCheck()); |
| 6401 | #ifdef TIME_TEST |
| 6402 | clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0; |
| 6403 | xtextra=0; |
| 6404 | xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; |
| 6405 | tinput = clock(); |
| 6406 | |
| 6407 | clock_t tim; |
| 6408 | #endif |
| 6409 | nstep = 0; |
| 6410 | int i, ntwC=1, ntestw=1, nV = currRing->N; //polylength |
| 6411 | |
| 6412 | //check that weight radius is valid |
| 6413 | if(weight_rad < 0) |
| 6414 | { |
| 6415 | WerrorS("Invalid radius.\n"); |
| 6416 | return NULL; |
| 6417 | } |
| 6418 | |
| 6419 | //check that perturbation degree is valid |
| 6420 | if(op_deg < 1 || tp_deg < 1 || op_deg > nV || tp_deg > nV) |
| 6421 | { |
| 6422 | WerrorS("Invalid perturbation degree.\n"); |
| 6423 | return NULL; |
| 6424 | } |
| 6425 | |
| 6426 | BOOLEAN endwalks = FALSE; |
| 6427 | |
| 6428 | ideal Gomega, M, F, FF, G, Gomega1, Gomega2, M1,F1,Eresult,ssG; |
| 6429 | ring newRing, oldRing, TargetRing; |
| 6430 | intvec* iv_M; |
| 6431 | intvec* iv_M_dp; |
| 6432 | intvec* iv_M_lp; |
| 6433 | intvec* exivlp = Mivlp(nV); |
| 6434 | intvec* curr_weight = new intvec(nV); |
| 6435 | intvec* target_weight = new intvec(nV); |
| 6436 | for(i=0; i<nV; i++) |
| 6437 | { |
| 6438 | (*curr_weight)[i] = (*orig_M)[i]; |
| 6439 | (*target_weight)[i] = (*target_M)[i]; |
| 6440 | } |
| 6441 | intvec* orig_target = target_weight; |
| 6442 | intvec* pert_target_vector = target_weight; |
| 6443 | intvec* ivNull = new intvec(nV); |
| 6444 | intvec* iv_dp = MivUnit(nV);// define (1,1,...,1) |
| 6445 | #ifndef BUCHBERGER_ALG |
| 6446 | intvec* hilb_func; |
no test coverage detected