Changeset 8e682d in git
- Timestamp:
- Dec 3, 2014, 5:18:10 PM (9 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 8af63a71de0015f0413204e1a7a8620a8d37cc7a
- Parents:
- 41c9e458d3df4f560848651c9fc0710d72f703dc
- Location:
- Singular
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/grwalk.lib
r41c9e4 r8e682d 346 346 } 347 347 348 proc fwalk(ideal Go, int reduction, list #)348 proc fwalk(ideal Go, int reduction, int printout, list #) 349 349 "SYNTAX: fwalk(ideal i,int reductioin); 350 350 fwalk(ideal i, int reduction intvec v, intvec w); … … 372 372 373 373 ideal G = fetch(xR, Go); 374 G = system("Mfwalk", G, curr_weight, target_weight, reduction );374 G = system("Mfwalk", G, curr_weight, target_weight, reduction, printout); 375 375 376 376 setring xR; … … 388 388 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 389 389 int reduction = 1; 390 fwalk(I,reduction); 390 int printout = 1; 391 fwalk(I,reduction,printout); 391 392 } 392 393 -
Singular/LIB/rwalk.lib
r41c9e4 r8e682d 10 10 rwalk(ideal,int,int[,intvec,intvec]); standard basis of ideal via Random Walk algorithm 11 11 rwalk(ideal,int[,intvec,intvec]); standard basis of ideal via Random Perturbation Walk algorithm 12 fr walk(ideal,int[,intvec,intvec]); standard basis of ideal via Random Fractal Walk algorithm12 frandwalk(ideal,int[,intvec,intvec]); standard basis of ideal via Random Fractal Walk algorithm 13 13 "; 14 14 … … 270 270 * Fractal Walk with random element * 271 271 ************************************/ 272 proc frandwalk(ideal Go, int radius, list #)273 "SYNTAX: frwalk(ideal i, int radius );274 frwalk(ideal i, int radius, int vec v, intvec w);272 proc frandwalk(ideal Go, int radius, int reduction, int printout, list #) 273 "SYNTAX: frwalk(ideal i, int radius, int reduction, int printout); 274 frwalk(ideal i, int radius, int reduction, int printout, intvec v, intvec w); 275 275 TYPE: ideal 276 276 PURPOSE: compute the standard basis of the ideal, calculated via … … 306 306 ideal G = fetch(xR, Go); 307 307 int pert_deg = 2; 308 G = system("Mfrwalk", G, curr_weight, target_weight, radius); 308 309 G = system("Mfrwalk", G, curr_weight, target_weight, radius, reduction, printout); 309 310 310 311 setring xR; … … 322 323 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 323 324 int reduction = 0; 324 frandwalk(I,2,0 );325 } 325 frandwalk(I,2,0,1); 326 } -
Singular/extra.cc
r41c9e4 r8e682d 1936 1936 if (strcmp(sys_cmd, "Mfwalk") == 0) 1937 1937 { 1938 const short t[]={ 4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};1938 const short t[]={5,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD}; 1939 1939 if (!iiCheckTypes(h,t,1)) return TRUE; 1940 1940 if (((intvec*) h->next->Data())->length() != currRing->N && … … 1943 1943 Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n", 1944 1944 currRing->N); 1945 return TRUE;1946 }1947 ideal arg1 = (ideal) h->Data();1948 intvec* arg2 = (intvec*) h->next->Data();1949 intvec* arg3 = (intvec*) h->next->next->Data();1950 int arg4 = (int)(long) h->next->next->next->Data();1951 ideal result = (ideal) Mfwalk(arg1, arg2, arg3, arg4);1952 res->rtyp = IDEAL_CMD;1953 res->data = result;1954 return FALSE;1955 }1956 else1957 #endif1958 /*==================== Mfrwalk =================*/1959 #ifdef HAVE_WALK1960 if (strcmp(sys_cmd, "Mfrwalk") == 0)1961 {1962 const short t[]={5,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD};1963 if (!iiCheckTypes(h,t,1)) return TRUE;1964 if (((intvec*) h->next->Data())->length() != currRing->N &&1965 ((intvec*) h->next->next->Data())->length() != currRing->N)1966 {1967 Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);1968 1945 return TRUE; 1969 1946 } … … 1973 1950 int arg4 = (int)(long) h->next->next->next->Data(); 1974 1951 int arg5 = (int)(long) h->next->next->next->next->Data(); 1975 ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4, arg5); 1952 ideal result = (ideal) Mfwalk(arg1, arg2, arg3, arg4, arg5); 1953 res->rtyp = IDEAL_CMD; 1954 res->data = result; 1955 return FALSE; 1956 } 1957 else 1958 #endif 1959 /*==================== Mfrwalk =================*/ 1960 #ifdef HAVE_WALK 1961 if (strcmp(sys_cmd, "Mfrwalk") == 0) 1962 { 1963 const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD}; 1964 if (!iiCheckTypes(h,t,1)) return TRUE; 1965 /* 1966 if (((intvec*) h->next->Data())->length() != currRing->N && 1967 ((intvec*) h->next->next->Data())->length() != currRing->N) 1968 { 1969 Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N); 1970 return TRUE; 1971 } 1972 */ 1973 if((((intvec*) h->next->Data())->length() != currRing->N && 1974 ((intvec*) h->next->next->Data())->length() != currRing->N ) && 1975 (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) && 1976 ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) )) 1977 { 1978 Werror("system(\"Mfrwalk\" ...) intvecs not of length %d or %d\n", 1979 currRing->N,(currRing->N)*(currRing->N)); 1980 return TRUE; 1981 } 1982 1983 ideal arg1 = (ideal) h->Data(); 1984 intvec* arg2 = (intvec*) h->next->Data(); 1985 intvec* arg3 = (intvec*) h->next->next->Data(); 1986 int arg4 = (int)(long) h->next->next->next->Data(); 1987 int arg5 = (int)(long) h->next->next->next->next->Data(); 1988 int arg6 = (int)(long) h->next->next->next->next->next->Data(); 1989 ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4, arg5, arg6); 1976 1990 res->rtyp = IDEAL_CMD; 1977 1991 res->data = result; -
Singular/walk.cc
r41c9e4 r8e682d 985 985 } 986 986 987 /***************************************************************************** 988 * create a weight matrix order as intvec of an extra weight vector (a(iv), lp)*989 ****************************************************************************** /987 /********************************************************************************* 988 * create a weight matrix order as intvec of an extra weight vector (a(iv),M(iw)) * 989 **********************************************************************************/ 990 990 intvec* MivMatrixOrderRefine(intvec* iv, intvec* iw) 991 991 { 992 assume( iv->length() == iw->length());993 int i, nR = iv->length();992 assume((iv->length())*(iv->length()) == iw->length()); 993 int i,j, nR = iv->length(); 994 994 995 995 intvec* ivm = new intvec(nR*nR); … … 998 998 { 999 999 (*ivm)[i] = (*iv)[i]; 1000 (*ivm)[i+nR] = (*iw)[i]; 1001 } 1002 for(i=2; i<nR; i++) 1003 { 1004 (*ivm)[i*nR+i-2] = 1; 1000 } 1001 for(i=1; i<nR; i++) 1002 { 1003 for(j=0; j<nR; j++) 1004 { 1005 (*ivm)[j+i*nR] = (*iw)[j+i*nR]; 1006 } 1005 1007 } 1006 1008 return ivm; … … 2454 2456 //rChangeCurrRing(r); 2455 2457 } 2456 2458 //unused 2459 #if 0 2457 2460 static ring VMrDefault1(intvec* va) 2458 2461 { … … 2525 2528 return r; 2526 2529 } 2527 2530 #endif 2528 2531 /**************************************************************** 2529 2532 * define and execute a new ring with ordering (a(va),Wp(vb),C) * … … 4314 4317 intvec* Xivlp; 4315 4318 4316 #if 04317 /********************************4318 * compute a next weight vector *4319 ********************************/4320 static intvec* MWalkRandomNextWeight(ideal G, intvec* curr_weight, intvec* target_weight, int weight_rad, int pert_deg)4321 {4322 int i, weight_norm;4323 int nV = currRing->N;4324 intvec* next_weight2;4325 intvec* next_weight22 = new intvec(nV);4326 intvec* next_weight = MwalkNextWeightCC(curr_weight,target_weight, G);4327 if(MivComp(next_weight, target_weight) == 1)4328 {4329 return(next_weight);4330 }4331 else4332 {4333 //compute a perturbed next weight vector "next_weight1"4334 intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G, MivMatrixOrder(curr_weight), pert_deg), target_weight, G);4335 //Print("\n // size of next_weight1 = %d", sizeof((*next_weight1)));4336 4337 //compute a random next weight vector "next_weight2"4338 while(1)4339 {4340 weight_norm = 0;4341 while(weight_norm == 0)4342 {4343 for(i=0; i<nV; i++)4344 {4345 //Print("\n// next_weight[%d] = %d", i, (*next_weight)[i]);4346 (*next_weight22)[i] = rand() % 60000 - 30000;4347 weight_norm = weight_norm + (*next_weight22)[i]*(*next_weight22)[i];4348 }4349 weight_norm = 1 + floor(sqrt(weight_norm));4350 }4351 4352 for(i=nV-1; i>=0; i--)4353 {4354 if((*next_weight22)[i] < 0)4355 {4356 (*next_weight22)[i] = 1 + (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);4357 }4358 else4359 {4360 (*next_weight22)[i] = (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);4361 }4362 //Print("\n// next_weight22[%d] = %d", i, (*next_weight22)[i]);4363 }4364 4365 if(test_w_in_ConeCC(G, next_weight22) == 1)4366 {4367 //Print("\n//MWalkRandomNextWeight: next_weight2 im Kegel\n");4368 next_weight2 = MkInterRedNextWeight(next_weight22, target_weight, G);4369 delete next_weight22;4370 break;4371 }4372 }4373 intvec* result = new intvec(nV);4374 ideal G_test = MwalkInitialForm(G, next_weight);4375 ideal G_test1 = MwalkInitialForm(G, next_weight1);4376 ideal G_test2 = MwalkInitialForm(G, next_weight2);4377 4378 // compare next_weights4379 if(IDELEMS(G_test1) < IDELEMS(G_test))4380 {4381 if(IDELEMS(G_test2) <= IDELEMS(G_test1)) // |G_test2| <= |G_test1| < |G_test|4382 {4383 for(i=0; i<nV; i++)4384 {4385 (*result)[i] = (*next_weight2)[i];4386 }4387 }4388 else // |G_test1| < |G_test|, |G_test1| < |G_test2|4389 {4390 for(i=0; i<nV; i++)4391 {4392 (*result)[i] = (*next_weight1)[i];4393 }4394 }4395 }4396 else4397 {4398 if(IDELEMS(G_test2) <= IDELEMS(G_test)) // |G_test2| <= |G_test| <= |G_test1|4399 {4400 for(i=0; i<nV; i++)4401 {4402 (*result)[i] = (*next_weight2)[i];4403 }4404 }4405 else // |G_test| <= |G_test1|, |G_test| < |G_test2|4406 {4407 for(i=0; i<nV; i++)4408 {4409 (*result)[i] = (*next_weight)[i];4410 }4411 }4412 }4413 delete next_weight;4414 delete next_weight1;4415 idDelete(&G_test);4416 idDelete(&G_test1);4417 idDelete(&G_test2);4418 if(test_w_in_ConeCC(G, result) == 1)4419 {4420 delete next_weight2;4421 return result;4422 }4423 else4424 {4425 delete result;4426 return next_weight2;4427 }4428 }4429 }4430 #endif4431 4319 4432 4320 /******************************** … … 4443 4331 4444 4332 //compute a perturbed next weight vector "next_weight1" 4445 //intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G,MivMatrixOrderRefine(curr_weight,target_weight),pert_deg),target_weight,G);4446 4333 intvec* next_weight1 =MkInterRedNextWeight(curr_weight,target_weight,G); 4447 4334 //compute a random next weight vector "next_weight2" … … 5111 4998 ring baseRing, int reduction, int printout) 5112 4999 { 5113 BITSET save1 = si_opt_1; // save current options 5000 // save current options 5001 BITSET save1 = si_opt_1; 5114 5002 if(reduction == 0) 5115 5003 { 5116 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5117 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5004 // no reduced Groebner basis 5005 si_opt_1 &= (~Sy_bit(OPT_REDSB)); 5006 // not tail reductions 5007 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); 5118 5008 } 5119 5009 Set_Error(FALSE); … … 5166 5056 to = clock(); 5167 5057 #endif 5168 if(orig_M->length() == nV) 5169 { 5170 newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp) 5171 } 5172 else 5173 { 5174 newRing = VMatrDefault(orig_M); 5175 } 5058 if(orig_M->length() == nV) 5059 { 5060 // define a new ring with ordering "(a(curr_weight),lp) 5061 newRing = VMrDefault(curr_weight); 5062 } 5063 else 5064 { 5065 newRing = VMatrDefault(orig_M); 5066 } 5176 5067 rChangeCurrRing(newRing); 5177 5068 ideal G = MstdCC(idrMoveR(Go,baseRing,currRing)); … … 5195 5086 } 5196 5087 //#endif 5197 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5088 // compute an initial form ideal of <G> w.r.t. "curr_vector" 5089 Gomega = MwalkInitialForm(G, curr_weight); 5198 5090 #ifdef TIME_TEST 5199 tif = tif + clock()-to; //time for computing initial form ideal 5091 //time for computing initial form ideal 5092 tif = tif + clock()-to; 5200 5093 #endif 5201 5094 //#ifdef CHECK_IDEAL_MWALK … … 5219 5112 if(orig_M->length() == nV) 5220 5113 { 5221 newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp) 5114 // define a new ring with ordering "(a(curr_weight),lp) 5115 newRing = VMrDefault(curr_weight); 5222 5116 } 5223 5117 else … … 5230 5124 if(target_M->length() == nV) 5231 5125 { 5232 newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))" 5126 //define a new ring with ordering "(a(curr_weight),Wp(target_weight))" 5127 newRing = VMrRefine(curr_weight,target_weight); 5233 5128 } 5234 5129 else 5235 5130 { 5131 //define a new ring with matrix ordering 5236 5132 newRing = VMatrRefine(target_M,curr_weight); 5237 5133 } … … 5269 5165 to = clock(); 5270 5166 #endif 5271 // 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 5167 // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), 5168 // where Gomega is a reduced Groebner basis w.r.t. the current ring 5272 5169 F = MLifttwoIdeal(Gomega2, M1, G); 5273 5170 #ifdef TIME_TEST … … 5289 5186 to = clock(); 5290 5187 #endif 5291 //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL); 5188 5292 5189 #ifdef TIME_TEST 5293 5190 tstd = tstd + clock() - to; … … 5313 5210 } 5314 5211 //#endif 5315 if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 5316 { 5317 #ifdef CHECK_IDEAL_MWALK 5318 PrintS("\n//** Mwalk: entering last cone.\n"); 5319 #endif 5212 if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1 || test_w_in_ConeCC(G, target_weight) == 1) 5213 { 5214 //#ifdef CHECK_IDEAL_MWALK 5215 if(printout > 0) 5216 { 5217 PrintS("\n//** Mwalk: entering last cone.\n"); 5218 } 5219 //#endif 5320 5220 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5321 5221 if(target_M->length() == nV) … … 5366 5266 to = clock(); 5367 5267 #endif 5368 // if(si_opt_1 == (Sy_bit(OPT_REDSB))){ 5369 G = kInterRedCC(G,NULL); //interreduce the Groebner basis <G> w.r.t. currRing 5370 // } 5268 //interreduce the Groebner basis <G> w.r.t. currRing 5269 G = kInterRedCC(G,NULL); 5371 5270 #ifdef TIME_TEST 5372 5271 tred = tred + clock() - to; … … 5386 5285 ideal result = idrMoveR(G,baseRing,currRing); 5387 5286 idDelete(&G); 5388 /*#ifdef CHECK_IDEAL_MWALK5389 pDelete(&p);5390 #endif*/5391 5287 delete tmp_weight; 5392 5288 delete ivNull; … … 5404 5300 } 5405 5301 5406 // 07.11.20125407 5302 // THE RANDOM WALK ALGORITHM 5408 5303 ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg, … … 6651 6546 * Perturb the start weight vector at the top level, i.e. nlev = 1 * 6652 6547 ***********************************************************************/ 6653 static ideal rec_fractal_call(ideal G, int nlev, intvec* omtmp)6548 static ideal rec_fractal_call(ideal G, int nlev, intvec* ivtarget, int printout) 6654 6549 { 6655 6550 Overflow_Error = FALSE; … … 6668 6563 intvec* next_vect; 6669 6564 intvec* omega2 = new intvec(nV); 6565 intvec* omtmp = new intvec(nV); 6670 6566 intvec* altomega = new intvec(nV); 6671 6567 6568 for(i = nV -1; i>0; i--) 6569 { 6570 (*omtmp)[i] = (*ivtarget)[i]; 6571 } 6672 6572 //BOOLEAN isnewtarget = FALSE; 6673 6573 … … 6710 6610 NEXT_VECTOR_FRACTAL: 6711 6611 to=clock(); 6712 / * determine the next border */6612 // determine the next border 6713 6613 next_vect = MkInterRedNextWeight(omega,omega2,G); 6714 6614 xtnw=xtnw+clock()-to; 6715 #ifdef PRINT_VECTORS 6716 MivString(omega, omega2, next_vect); 6717 #endif 6615 6718 6616 oRing = currRing; 6719 6617 6720 / * We only perturb the current target vector at the recursion level 1 */6618 // We only perturb the current target vector at the recursion level 1 6721 6619 if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3 6722 6620 if (MivComp(next_vect, omega2) == 1) 6723 6621 { 6724 /* to dispense with taking initial (and lifting/interreducing 6725 after the call of recursion */ 6726 //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev); 6727 //idElements(G, "G"); 6622 // to dispense with taking initial (and lifting/interreducing 6623 // after the call of recursion 6624 if(printout > 0) 6625 { 6626 Print("\n//** rec_fractal_call: Perturb the both vectors with degree %d.",nlev); 6627 //idElements(G, "G"); 6628 } 6728 6629 6729 6630 Xngleich = 1; 6730 6631 nlev +=1; 6731 6632 6732 if (rParameter(currRing) != NULL) 6733 DefRingPar(omtmp); 6633 if(ivtarget->length() == nV) 6634 { 6635 if (rParameter(currRing) != NULL) 6636 DefRingPar(omtmp); 6637 else 6638 rChangeCurrRing(VMrDefault(omtmp)); 6639 } 6734 6640 else 6735 rChangeCurrRing(VMrDefault1(omtmp)); 6736 6641 { 6642 rChangeCurrRing(VMatrDefault(ivtarget)); 6643 } 6737 6644 testring = currRing; 6738 6645 Gt = idrMoveR(G, oRing,currRing); 6739 6646 6740 /* perturb the original target vector w.r.t. the current GB */ 6741 delete Xtau; 6742 Xtau = NewVectorlp(Gt); 6647 // perturb the original target vector w.r.t. the current GB 6648 if(ivtarget->length() == nV) 6649 { 6650 delete Xtau; 6651 Xtau = NewVectorlp(Gt); 6652 } 6653 else 6654 { 6655 delete Xtau; 6656 Xtau = Mfpertvector(Gt,ivtarget); 6657 } 6743 6658 6744 6659 rChangeCurrRing(oRing); 6745 6660 G = idrMoveR(Gt, testring,currRing); 6746 6661 6747 / * perturb the current vector w.r.t. the current GB */6662 // perturb the current vector w.r.t. the current GB 6748 6663 Mwlp = MivWeightOrderlp(omega); 6749 6664 Xsigma = Mfpertvector(G, Mwlp); … … 6763 6678 next_vect = MkInterRedNextWeight(omega,omega2,G); 6764 6679 xtnw=xtnw+clock()-to; 6765 6766 #ifdef PRINT_VECTORS 6680 } 6681 //#ifdef PRINT_VECTORS 6682 if(printout > 0) 6683 { 6767 6684 MivString(omega, omega2, next_vect); 6768 #endif 6769 } 6770 6685 } 6686 //#endif 6771 6687 6772 6688 /* check whether the the computed vector is in the correct cone */ … … 6777 6693 { 6778 6694 delete next_vect; 6779 if (rParameter(currRing) != NULL) 6780 { 6781 DefRingPar(omtmp); 6695 if(ivtarget->length() == nV) 6696 { 6697 if (rParameter(currRing) != NULL) 6698 DefRingPar(omtmp); 6699 else 6700 rChangeCurrRing(VMrDefault(omtmp)); 6782 6701 } 6783 6702 else 6784 6703 { 6785 rChangeCurrRing(VM rDefault1(omtmp));6704 rChangeCurrRing(VMatrDefault(ivtarget)); 6786 6705 } 6787 6706 #ifdef TEST_OVERFLOW … … 6789 6708 Gt = NULL; return(Gt); 6790 6709 #endif 6791 6792 //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing)); 6710 if(printout > 0) 6711 { 6712 Print("\n//** rec_fractal_call: applying Buchberger's algorithm in ring r = %s;", 6713 rString(currRing)); 6714 } 6793 6715 to=clock(); 6794 6716 Gt = idrMoveR(G, oRing,currRing); … … 6799 6721 delete omega2; 6800 6722 delete altomega; 6801 6802 //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks); 6803 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6723 if(printout > 0) 6724 { 6725 Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n", 6726 nlev, nwalks); 6727 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6728 } 6729 6804 6730 nnflow ++; 6805 6731 … … 6818 6744 if (MivComp(next_vect, XivNull) == 1) 6819 6745 { 6820 if (rParameter(currRing) != NULL) 6821 DefRingPar(omtmp); 6746 if(ivtarget->length() == nV) 6747 { 6748 if (rParameter(currRing) != NULL) 6749 DefRingPar(omtmp); 6750 else 6751 rChangeCurrRing(VMrDefault(omtmp)); 6752 } 6822 6753 else 6823 rChangeCurrRing(VMrDefault1(omtmp)); 6754 { 6755 rChangeCurrRing(VMatrDefault(ivtarget)); 6756 } 6824 6757 6825 6758 testring = currRing; … … 6830 6763 delete next_vect; 6831 6764 delete altomega; 6832 //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks); 6833 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6834 6765 if(printout > 0) 6766 { 6767 Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n", 6768 nlev, nwalks); 6769 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6770 } 6835 6771 return (Gt); 6836 6772 } … … 6843 6779 //07.08.03 6844 6780 //ivString(Xtau, "old Xtau"); 6845 intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp)); 6781 intvec* Xtautmp; 6782 if(ivtarget->length() == nV) 6783 { 6784 Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp)); 6785 } 6786 else 6787 { 6788 Xtautmp = Mfpertvector(Gt, ivtarget); 6789 } 6846 6790 #ifdef TEST_OVERFLOW 6847 6791 if(Overflow_Error == TRUE) … … 6871 6815 6872 6816 FRACTAL_MSTDCC: 6873 //Print("\n// apply BB-Alg in ring = %s;", rString(currRing)); 6817 if(printout > 0) 6818 { 6819 Print("\n//** rec_fractal_call: apply Buchberger's algorithm in ring = %s.\n", 6820 rString(currRing)); 6821 } 6874 6822 to=clock(); 6875 6823 G = MstdCC(Gt); … … 6879 6827 6880 6828 // update the original target vector w.r.t. the current GB 6881 if(MivSame(Xivinput, Xivlp) == 1) 6882 if (rParameter(currRing) != NULL) 6883 DefRingParlp(); 6829 if(ivtarget->length() == nV) 6830 { 6831 if(MivSame(Xivinput, Xivlp) == 1) 6832 if (rParameter(currRing) != NULL) 6833 DefRingParlp(); 6834 else 6835 VMrDefaultlp(); 6884 6836 else 6885 VMrDefaultlp(); 6837 if (rParameter(currRing) != NULL) 6838 DefRingPar(Xivinput); 6839 else 6840 rChangeCurrRing(VMrDefault(Xivinput)); 6841 } 6886 6842 else 6887 if (rParameter(currRing) != NULL) 6888 DefRingPar(Xivinput); 6889 else 6890 rChangeCurrRing(VMrDefault1(Xivinput)); 6891 6843 { 6844 rChangeCurrRing(VMatrRefine(ivtarget,Xivinput)); 6845 } 6892 6846 testring = currRing; 6893 6847 Gt = idrMoveR(G, oRing,currRing); … … 6902 6856 delete next_vect; 6903 6857 delete altomega; 6904 /* 6905 Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks); 6906 Print(" ** Overflow_Error? (%d)", Overflow_Error); 6907 */ 6858 if(printout > 0) 6859 { 6860 Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n", 6861 nlev, nwalks); 6862 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6863 } 6908 6864 if(Overflow_Error == TRUE) 6909 6865 nnflow ++; … … 6924 6880 Gomega = MwalkInitialForm(G, omega); 6925 6881 xtif=xtif+clock()-to; 6926 6882 if(printout > 1) 6883 { 6884 idString(Gomega,"//** rec_fractal_call: Gomega"); 6885 } 6927 6886 #ifndef BUCHBERGER_ALG 6928 6887 if(isNolVector(omega) == 0) … … 6931 6890 hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing); 6932 6891 #endif // BUCHBERGER_ALG 6933 6934 if (rParameter(currRing) != NULL) 6935 DefRingPar(omega); 6892 if(ivtarget->length() == nV) 6893 { 6894 if (rParameter(currRing) != NULL) 6895 DefRingPar(omega); 6896 else 6897 rChangeCurrRing(VMrDefault(omega)); 6898 } 6936 6899 else 6937 rChangeCurrRing(VMrDefault1(omega)); 6938 6900 { 6901 rChangeCurrRing(VMatrRefine(ivtarget,omega)); 6902 } 6939 6903 Gomega1 = idrMoveR(Gomega, oRing,currRing); 6940 6904 6941 / * Maximal recursion depth, to compute a red. GB */6942 / * Fractal walk with the alternative recursion */6943 / * alternative recursion */6905 // Maximal recursion depth, to compute a red. GB 6906 // Fractal walk with the alternative recursion 6907 // alternative recursion 6944 6908 // if(nlev == nV || lengthpoly(Gomega1) == 0) 6945 6909 if(nlev == Xnlev || lengthpoly(Gomega1) == 0) 6946 6910 //if(nlev == nV) // blind recursion 6947 6911 { 6948 /*6949 if(Xnlev != nV)6950 {6951 Print("\n// ** Xnlev = %d", Xnlev);6952 ivString(Xtau, "Xtau");6953 }6954 */6955 6912 to=clock(); 6956 6913 #ifdef BUCHBERGER_ALG … … 6962 6919 xtstd=xtstd+clock()-to; 6963 6920 } 6964 else { 6921 else 6922 { 6965 6923 rChangeCurrRing(oRing); 6966 6924 Gomega1 = idrMoveR(Gomega1, oRing,currRing); 6967 Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega); 6968 } 6969 6970 //convert a Groebner basis from a ring to another ring, 6925 Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout); 6926 } 6927 if(printout > 2) 6928 { 6929 idString(Gresult,"//** rec_fractal_call: M"); 6930 } 6931 //convert a Groebner basis from a ring to another ring 6971 6932 new_ring = currRing; 6972 6933 … … 6976 6937 6977 6938 to=clock(); 6978 / * Lifting process */6939 // Lifting process 6979 6940 F = MLifttwoIdeal(Gomega2, Gresult1, G); 6980 6941 xtlift=xtlift+clock()-to; 6942 if(printout > 2) 6943 { 6944 idString(F,"//** rec_fractal_call: F"); 6945 } 6981 6946 idDelete(&Gresult1); 6982 6947 idDelete(&Gomega2); … … 6997 6962 * Perturb the start weight vector at the top level with random element * 6998 6963 ************************************************************************/ 6999 static ideal rec_r_fractal_call(ideal G, int nlev, intvec* omtmp, int weight_rad) 6964 static ideal rec_r_fractal_call(ideal G, int nlev, intvec* ivtarget, 6965 int weight_rad, int printout) 7000 6966 { 7001 6967 Overflow_Error = FALSE; 7002 6968 //Print("\n\n// Entering the %d-th recursion:", nlev); 7003 6969 7004 int i, nV = currRing->N;6970 int i, polylength, nV = currRing->N; 7005 6971 ring new_ring, testring; 7006 6972 //ring extoRing; … … 7014 6980 intvec* next_vect; 7015 6981 intvec* omega2 = new intvec(nV); 6982 intvec* omtmp = new intvec(nV); 7016 6983 intvec* altomega = new intvec(nV); 7017 6984 7018 6985 //BOOLEAN isnewtarget = FALSE; 7019 6986 6987 for(i = nV -1; i>0; i--) 6988 { 6989 (*omtmp)[i] = (*ivtarget)[i]; 6990 } 7020 6991 // to avoid (1,0,...,0) as the target vector (Hans) 7021 6992 intvec* last_omega = new intvec(nV); … … 7057 7028 to=clock(); 7058 7029 /* determine the next border */ 7059 next_vect = MWalkRandomNextWeight(G, omega,omega2, weight_rad, 1+nlev); 7060 if(isNolVector(next_vect)) 7061 { 7062 next_vect = MkInterRedNextWeight(omega,omega2,G); 7030 next_vect = MkInterRedNextWeight(omega,omega2,G); 7031 if(polylength > 0) 7032 { 7033 //there is a polynomial in Gomega with at least 3 monomials, 7034 //low-dimensional facet of the cone 7035 delete next_vect; 7036 next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev); 7037 if(isNolVector(next_vect)) 7038 { 7039 delete next_vect; 7040 next_vect = MkInterRedNextWeight(omega,omega2,G); 7041 } 7063 7042 } 7064 7043 xtnw=xtnw+clock()-to; 7065 #ifdef PRINT_VECTORS 7066 MivString(omega, omega2, next_vect); 7067 #endif 7044 7068 7045 oRing = currRing; 7069 7046 7070 / * We only perturb the current target vector at the recursion level 1 */7047 // We only perturb the current target vector at the recursion level 1 7071 7048 if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3 7072 7049 if (MivComp(next_vect, omega2) == 1) 7073 7050 { 7074 /* to dispense with taking initial (and lifting/interreducing 7075 after the call of recursion */ 7076 //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev); 7077 //idElements(G, "G"); 7078 7051 // to dispense with taking initials and lifting/interreducing 7052 // after the call of recursion. 7053 if(printout > 0) 7054 { 7055 Print("\n//** rec_r_fractal_call: Perturb the both vectors with degree %d.",nlev); 7056 //idElements(G, "G"); 7057 } 7079 7058 Xngleich = 1; 7080 7059 nlev +=1; 7081 7082 if (rParameter(currRing) != NULL) 7083 DefRingPar(omtmp); 7060 if(ivtarget->length() == nV) 7061 { 7062 if (rParameter(currRing) != NULL) 7063 DefRingPar(omtmp); 7064 else 7065 rChangeCurrRing(VMrDefault(omtmp)); 7066 } 7084 7067 else 7085 rChangeCurrRing(VMrDefault1(omtmp)); 7086 7068 { 7069 rChangeCurrRing(VMatrDefault(ivtarget)); 7070 } 7087 7071 testring = currRing; 7088 7072 Gt = idrMoveR(G, oRing,currRing); 7089 7073 7090 /* perturb the original target vector w.r.t. the current GB */ 7091 delete Xtau; 7092 Xtau = NewVectorlp(Gt); 7074 // perturb the original target vector w.r.t. the current GB 7075 if(ivtarget->length() == nV) 7076 { 7077 delete Xtau; 7078 Xtau = NewVectorlp(Gt); 7079 } 7080 else 7081 { 7082 delete Xtau; 7083 Xtau = Mfpertvector(Gt,ivtarget); 7084 } 7093 7085 7094 7086 rChangeCurrRing(oRing); 7095 G = idrMoveR(Gt, 7096 7097 / * perturb the current vector w.r.t. the current GB */7087 G = idrMoveR(Gt,testring,currRing); 7088 7089 // perturb the current vector w.r.t. the current GB 7098 7090 Mwlp = MivWeightOrderlp(omega); 7091 if(ivtarget->length() > nV) 7092 { 7093 delete Mwlp; 7094 Mwlp = MivMatrixOrderRefine(omega,ivtarget); 7095 } 7099 7096 Xsigma = Mfpertvector(G, Mwlp); 7100 7097 delete Mwlp; … … 7112 7109 7113 7110 next_vect = MkInterRedNextWeight(omega,omega2,G); 7111 if(polylength > 0) 7112 { 7113 //there is a polynomial in Gomega with at least 3 monomials, 7114 //low-dimensional facet of the cone 7115 delete next_vect; 7116 next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev); 7117 if(isNolVector(next_vect)) 7118 { 7119 delete next_vect; 7120 next_vect = MkInterRedNextWeight(omega,omega2,G); 7121 } 7122 } 7114 7123 xtnw=xtnw+clock()-to; 7115 7116 #ifdef PRINT_VECTORS 7124 } 7125 //#ifdef PRINT_VECTORS 7126 if(printout > 0) 7127 { 7117 7128 MivString(omega, omega2, next_vect); 7118 #endif 7119 } 7120 7121 7122 /* check whether the the computed vector is in the correct cone */ 7123 /* If no, the reduced GB of an omega-homogeneous ideal will be 7129 } 7130 //#endif 7131 7132 /* check whether the the computed vector is in the correct cone 7133 If no, the reduced GB of an omega-homogeneous ideal will be 7124 7134 computed by Buchberger algorithm and stop this recursion step*/ 7125 7135 //if(test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6 … … 7127 7137 { 7128 7138 delete next_vect; 7129 if (rParameter(currRing) != NULL) 7130 { 7131 DefRingPar(omtmp); 7139 if(ivtarget->length() == nV) 7140 { 7141 if (rParameter(currRing) != NULL) 7142 { 7143 DefRingPar(omtmp); 7144 } 7145 else 7146 { 7147 rChangeCurrRing(VMrDefault(omtmp)); 7148 } 7132 7149 } 7133 7150 else 7134 7151 { 7135 rChangeCurrRing(VM rDefault1(omtmp));7152 rChangeCurrRing(VMatrDefault(ivtarget)); 7136 7153 } 7137 7154 #ifdef TEST_OVERFLOW 7138 7155 Gt = idrMoveR(G, oRing,currRing); 7139 Gt = NULL; return(Gt); 7140 #endif 7141 7142 //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing)); 7156 Gt = NULL; 7157 return(Gt); 7158 #endif 7159 if(printout > 0) 7160 { 7161 Print("\n//** rec_r_fractal_call: applying Buchberger's algorithm in ring r = %s;", 7162 rString(currRing)); 7163 } 7143 7164 to=clock(); 7144 7165 Gt = idrMoveR(G, oRing,currRing); … … 7149 7170 delete omega2; 7150 7171 delete altomega; 7151 7152 //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks); 7153 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 7172 if(printout > 0) 7173 { 7174 Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n", 7175 nlev, nwalks); 7176 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 7177 } 7154 7178 nnflow ++; 7155 7156 7179 Overflow_Error = FALSE; 7157 7180 return (G1); 7158 7181 } 7159 7160 7161 /* If the perturbed target vector stays in the correct cone, 7162 return the current GB, 7163 otherwise, return the computed GB by the Buchberger-algorithm. 7164 Then we update the perturbed target vectors w.r.t. this GB. */ 7165 7166 /* the computed vector is equal to the origin vector, since 7167 t is not defined */ 7182 /* 7183 If the perturbed target vector stays in the correct cone, 7184 return the current Groebner basis. 7185 Otherwise, return the Groebner basis computed with Buchberger's 7186 algorithm. 7187 Then we update the perturbed target vectors w.r.t. this GB. 7188 */ 7168 7189 if (MivComp(next_vect, XivNull) == 1) 7169 7190 { 7170 if (rParameter(currRing) != NULL) 7171 DefRingPar(omtmp); 7191 // The computed vector is equal to the origin vector, 7192 // because t is not defined 7193 if(ivtarget->length() == nV) 7194 { 7195 if (rParameter(currRing) != NULL) 7196 DefRingPar(omtmp); 7197 else 7198 rChangeCurrRing(VMrDefault(omtmp)); 7199 } 7172 7200 else 7173 rChangeCurrRing(VMrDefault1(omtmp)); 7174 7201 { 7202 rChangeCurrRing(VMatrDefault(ivtarget)); 7203 } 7175 7204 testring = currRing; 7176 7205 Gt = idrMoveR(G, oRing,currRing); 7177 7206 7178 if(test_w_in_ConeCC(Gt, omega2) == 1) { 7207 if(test_w_in_ConeCC(Gt, omega2) == 1) 7208 { 7179 7209 delete omega2; 7180 7210 delete next_vect; 7181 7211 delete altomega; 7182 //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks); 7183 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 7184 7212 if(printout > 0) 7213 { 7214 Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n", 7215 nlev, nwalks); 7216 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 7217 } 7185 7218 return (Gt); 7186 7219 } 7187 7220 else 7188 { 7189 //ivString(omega2, "tau'"); 7190 //Print("\n// tau' doesn't stay in the correct cone!!"); 7191 7221 { 7222 if(printout > 0) 7223 { 7224 Print("\n//** rec_r_fractal_call: target weight doesn't stay in the correct cone.\n"); 7225 } 7192 7226 #ifndef MSTDCC_FRACTAL 7193 //07.08.037194 7227 //ivString(Xtau, "old Xtau"); 7195 intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp)); 7228 intvec* Xtautmp; 7229 if(ivtarget->length() == nV) 7230 { 7231 Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp)); 7232 } 7233 else 7234 { 7235 Xtautmp = Mfpertvector(Gt, ivtarget); 7236 } 7196 7237 #ifdef TEST_OVERFLOW 7197 7238 if(Overflow_Error == TRUE) … … 7221 7262 7222 7263 FRACTAL_MSTDCC: 7223 //Print("\n// apply BB-Alg in ring = %s;", rString(currRing)); 7264 if(printout > 0) 7265 { 7266 Print("\n//** rec_r_fractal_call: apply Buchberge's algorithm in ring = %s.\n", 7267 rString(currRing)); 7268 } 7224 7269 to=clock(); 7225 7270 G = MstdCC(Gt); … … 7229 7274 7230 7275 // update the original target vector w.r.t. the current GB 7231 if(MivSame(Xivinput, Xivlp) == 1) 7232 if (rParameter(currRing) != NULL) 7233 DefRingParlp(); 7276 if(ivtarget->length() == nV) 7277 { 7278 if(MivSame(Xivinput, Xivlp) == 1) 7279 if (rParameter(currRing) != NULL) 7280 DefRingParlp(); 7281 else 7282 VMrDefaultlp(); 7234 7283 else 7235 VMrDefaultlp(); 7284 if (rParameter(currRing) != NULL) 7285 DefRingPar(Xivinput); 7286 else 7287 rChangeCurrRing(VMrDefault(Xivinput)); 7288 } 7236 7289 else 7237 if (rParameter(currRing) != NULL) 7238 DefRingPar(Xivinput); 7239 else 7240 rChangeCurrRing(VMrDefault1(Xivinput)); 7241 7290 { 7291 rChangeCurrRing(VMatrRefine(ivtarget,Xivinput)); 7292 } 7242 7293 testring = currRing; 7243 7294 Gt = idrMoveR(G, oRing,currRing); … … 7252 7303 delete next_vect; 7253 7304 delete altomega; 7254 /* 7255 Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks); 7256 Print(" ** Overflow_Error? (%d)", Overflow_Error); 7257 */ 7305 if(printout > 0) 7306 { 7307 Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n", 7308 nlev,nwalks); 7309 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 7310 } 7258 7311 if(Overflow_Error == TRUE) 7259 7312 nnflow ++; … … 7271 7324 7272 7325 to=clock(); 7273 / * Take the initial form of <G> w.r.t. omega */7326 // Take the initial form of <G> w.r.t. omega 7274 7327 Gomega = MwalkInitialForm(G, omega); 7275 7328 xtif=xtif+clock()-to; 7276 7329 //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise 7330 polylength = lengthpoly(Gomega); 7331 if(printout > 1) 7332 { 7333 idString(Gomega,"//** rec_r_fractal_call: Gomega"); 7334 } 7277 7335 #ifndef BUCHBERGER_ALG 7278 7336 if(isNolVector(omega) == 0) … … 7280 7338 else 7281 7339 hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing); 7282 #endif // BUCHBERGER_ALG 7283 7284 if (rParameter(currRing) != NULL) 7285 DefRingPar(omega); 7340 #endif 7341 if(ivtarget->length() == nV) 7342 { 7343 if (rParameter(currRing) != NULL) 7344 DefRingPar(omega); 7345 else 7346 rChangeCurrRing(VMrDefault(omega)); 7347 } 7286 7348 else 7287 rChangeCurrRing(VMrDefault1(omega)); 7288 7349 { 7350 rChangeCurrRing(VMatrRefine(ivtarget,omega)); 7351 } 7289 7352 Gomega1 = idrMoveR(Gomega, oRing,currRing); 7290 7353 7291 /* Maximal recursion depth, to compute a red. GB */ 7292 /* Fractal walk with the alternative recursion */ 7293 /* alternative recursion */ 7294 // if(nlev == nV || lengthpoly(Gomega1) == 0) 7354 // Maximal recursion depth, to compute a red. GB 7355 // Fractal walk with the alternative recursion 7356 // alternative recursion 7295 7357 if(nlev == Xnlev || lengthpoly(Gomega1) == 0) 7296 //if(nlev == nV) // blind recursion 7297 { 7298 /* 7299 if(Xnlev != nV) 7300 { 7301 Print("\n// ** Xnlev = %d", Xnlev); 7302 ivString(Xtau, "Xtau"); 7303 } 7304 */ 7358 { 7305 7359 to=clock(); 7306 7360 #ifdef BUCHBERGER_ALG … … 7309 7363 Gresult =kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,omega); 7310 7364 delete hilb_func; 7311 #endif // BUCHBERGER_ALG7365 #endif 7312 7366 xtstd=xtstd+clock()-to; 7313 7367 } 7314 else { 7368 else 7369 { 7315 7370 rChangeCurrRing(oRing); 7316 7371 Gomega1 = idrMoveR(Gomega1, oRing,currRing); 7317 Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega); 7318 } 7319 7320 //convert a Groebner basis from a ring to another ring, 7372 Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout); 7373 } 7374 if(printout > 2) 7375 { 7376 idString(Gresult,"//** rec_r_fractal_call: M"); 7377 } 7378 //convert a Groebner basis from a ring to another ring 7321 7379 new_ring = currRing; 7322 7380 … … 7326 7384 7327 7385 to=clock(); 7328 / * Lifting process */7386 // Lifting process 7329 7387 F = MLifttwoIdeal(Gomega2, Gresult1, G); 7330 7388 xtlift=xtlift+clock()-to; 7389 7390 if(printout > 2) 7391 { 7392 idString(F,"//** rec_r_fractal_call: F"); 7393 } 7394 7331 7395 idDelete(&Gresult1); 7332 7396 idDelete(&Gomega2); … … 7337 7401 7338 7402 to=clock(); 7339 / * Interreduce G */7403 // Interreduce G 7340 7404 G = kInterRedCC(F1, NULL); 7341 7405 xtred=xtred+clock()-to; … … 7343 7407 } 7344 7408 } 7345 7346 7347 7409 7348 7410 … … 7351 7413 * * 7352 7414 * The main procedur Mfwalk calls the recursive Subroutine * 7353 * rec_fractal_call to compute the wanted Gr ï¿œbner basis.*7354 * At the main procedur we compute the reduced Gr ï¿œbner basis w.r.t. a "fast"*7415 * rec_fractal_call to compute the wanted Groebner basis. * 7416 * At the main procedur we compute the reduced Groebner basis w.r.t. a "fast" * 7355 7417 * order, e.g. "dp" and a sequence of weight vectors which are row vectors * 7356 7418 * of a matrix. This matrix defines the given monomial order, e.g. "lp" * 7357 7419 *******************************************************************************/ 7358 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, int reduction) 7420 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, 7421 int reduction, int printout) 7359 7422 { 7360 7423 BITSET save1 = si_opt_1; // save current options … … 7363 7426 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 7364 7427 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 7365 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));7366 7428 } 7367 7429 Set_Error(FALSE); … … 7399 7461 intvec* iv_dp = MivUnit(nV); // define (1,1,...,1) 7400 7462 intvec* Mdp; 7401 7402 if(MivSame(ivstart, iv_dp) != 1) 7403 Mdp = MivWeightOrderdp(ivstart); 7463 if(ivstart->length() == nV) 7464 { 7465 if(MivSame(ivstart, iv_dp) != 1) 7466 Mdp = MivWeightOrderdp(ivstart); 7467 else 7468 Mdp = MivMatrixOrderdp(nV); 7469 } 7404 7470 else 7405 Mdp = MivMatrixOrderdp(nV); 7471 { 7472 Mdp = ivstart; 7473 } 7406 7474 7407 7475 Xsigma = Mfpertvector(I, Mdp); … … 7420 7488 Xivlp = Mivlp(nV); 7421 7489 7422 if(MivComp(ivtarget, Xivlp) != 1) 7423 { 7424 if (rParameter(currRing) != NULL) 7425 DefRingPar(ivtarget); 7490 if(ivtarget->length() == nV) 7491 { 7492 if(MivComp(ivtarget, Xivlp) != 1) 7493 { 7494 if (rParameter(currRing) != NULL) 7495 DefRingPar(ivtarget); 7496 else 7497 rChangeCurrRing(VMrDefault(ivtarget)); 7498 7499 I1 = idrMoveR(I, oldRing,currRing); 7500 Mlp = MivWeightOrderlp(ivtarget); 7501 Xtau = Mfpertvector(I1, Mlp); 7502 } 7426 7503 else 7427 rChangeCurrRing(VMrDefault1(ivtarget)); 7428 7429 I1 = idrMoveR(I, oldRing,currRing); 7430 Mlp = MivWeightOrderlp(ivtarget); 7431 Xtau = Mfpertvector(I1, Mlp); 7504 { 7505 if (rParameter(currRing) != NULL) 7506 DefRingParlp(); 7507 else 7508 VMrDefaultlp(); 7509 7510 I1 = idrMoveR(I, oldRing,currRing); 7511 Mlp = MivMatrixOrderlp(nV); 7512 Xtau = Mfpertvector(I1, Mlp); 7513 } 7432 7514 } 7433 7515 else 7434 7516 { 7435 if (rParameter(currRing) != NULL) 7436 DefRingParlp(); 7437 else 7438 VMrDefaultlp(); 7439 7440 I1 = idrMoveR(I, oldRing,currRing); 7441 Mlp = MivMatrixOrderlp(nV); 7517 rChangeCurrRing(VMatrDefault(ivtarget)); 7518 I1 = idrMoveR(I,oldRing,currRing); 7519 Mlp = ivtarget; 7442 7520 Xtau = Mfpertvector(I1, Mlp); 7443 7521 } … … 7450 7528 id_Delete(&I, oldRing); 7451 7529 ring tRing = currRing; 7452 7453 if (rParameter(currRing) != NULL) 7454 DefRingPar(ivstart); 7530 if(ivtarget->length() == nV) 7531 { 7532 if (rParameter(currRing) != NULL) 7533 DefRingPar(ivstart); 7534 else 7535 rChangeCurrRing(VMrDefault(ivstart)); 7536 } 7455 7537 else 7456 rChangeCurrRing(VMrDefault1(ivstart)); 7538 { 7539 rChangeCurrRing(VMatrDefault(ivstart)); 7540 } 7457 7541 7458 7542 I = idrMoveR(I1,tRing,currRing); … … 7465 7549 ring helpRing = currRing; 7466 7550 7467 J = rec_fractal_call(J, 1, ivtarget);7551 J = rec_fractal_call(J,1,ivtarget,printout); 7468 7552 7469 7553 rChangeCurrRing(oldRing); … … 7495 7579 * The main procedur Mfwalk calls the recursive Subroutine * 7496 7580 * rec_r_fractal_call to compute the wanted Groebner basis. * 7497 * At the main procedur we compute the reduced Groebner basis w.r.t. a "fast"*7581 * At the main procedure we compute the reduced Groebner basis w.r.t. a "fast" * 7498 7582 * order, e.g. "dp" and a sequence of weight vectors which are row vectors * 7499 7583 * of a matrix. This matrix defines the given monomial order, e.g. "lp" * 7500 7584 *******************************************************************************/ 7501 7585 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, 7502 int weight_rad, int reduction )7586 int weight_rad, int reduction, int printout) 7503 7587 { 7504 7588 BITSET save1 = si_opt_1; // save current options … … 7542 7626 intvec* iv_dp = MivUnit(nV); // define (1,1,...,1) 7543 7627 intvec* Mdp; 7544 7545 if(MivSame(ivstart, iv_dp) != 1) 7546 Mdp = MivWeightOrderdp(ivstart); 7628 if(ivstart->length() == nV) 7629 { 7630 if(MivSame(ivstart, iv_dp) != 1) 7631 Mdp = MivWeightOrderdp(ivstart); 7632 else 7633 Mdp = MivMatrixOrderdp(nV); 7634 } 7547 7635 else 7548 Mdp = MivMatrixOrderdp(nV); 7636 { 7637 Mdp = ivstart; 7638 } 7549 7639 7550 7640 Xsigma = Mfpertvector(I, Mdp); … … 7563 7653 Xivlp = Mivlp(nV); 7564 7654 7565 if(MivComp(ivtarget, Xivlp) != 1) 7566 { 7567 if (rParameter(currRing) != NULL) 7568 DefRingPar(ivtarget); 7655 if(ivtarget->length() == nV) 7656 { 7657 if(MivComp(ivtarget, Xivlp) != 1) 7658 { 7659 if (rParameter(currRing) != NULL) 7660 DefRingPar(ivtarget); 7661 else 7662 rChangeCurrRing(VMrDefault(ivtarget)); 7663 7664 I1 = idrMoveR(I, oldRing,currRing); 7665 Mlp = MivWeightOrderlp(ivtarget); 7666 Xtau = Mfpertvector(I1, Mlp); 7667 } 7569 7668 else 7570 rChangeCurrRing(VMrDefault1(ivtarget)); 7571 7572 I1 = idrMoveR(I, oldRing,currRing); 7573 Mlp = MivWeightOrderlp(ivtarget); 7574 Xtau = Mfpertvector(I1, Mlp); 7669 { 7670 if (rParameter(currRing) != NULL) 7671 DefRingParlp(); 7672 else 7673 VMrDefaultlp(); 7674 7675 I1 = idrMoveR(I, oldRing,currRing); 7676 Mlp = MivMatrixOrderlp(nV); 7677 Xtau = Mfpertvector(I1, Mlp); 7678 } 7575 7679 } 7576 7680 else 7577 7681 { 7578 if (rParameter(currRing) != NULL) 7579 DefRingParlp(); 7580 else 7581 VMrDefaultlp(); 7582 7583 I1 = idrMoveR(I, oldRing,currRing); 7584 Mlp = MivMatrixOrderlp(nV); 7682 rChangeCurrRing(VMatrDefault(ivtarget)); 7683 I1 = idrMoveR(I,oldRing,currRing); 7684 Mlp = ivtarget; 7585 7685 Xtau = Mfpertvector(I1, Mlp); 7586 7686 } … … 7593 7693 id_Delete(&I, oldRing); 7594 7694 ring tRing = currRing; 7595 7596 if (rParameter(currRing) != NULL) 7597 DefRingPar(ivstart); 7695 if(ivtarget->length() == nV) 7696 { 7697 if (rParameter(currRing) != NULL) 7698 DefRingPar(ivstart); 7699 else 7700 rChangeCurrRing(VMrDefault(ivstart)); 7701 } 7598 7702 else 7599 rChangeCurrRing(VMrDefault1(ivstart)); 7703 { 7704 rChangeCurrRing(VMatrDefault(ivstart)); 7705 } 7600 7706 7601 7707 I = idrMoveR(I1,tRing,currRing); … … 7608 7714 ring helpRing = currRing; 7609 7715 7610 J = rec_r_fractal_call(J, 1, ivtarget,weight_rad);7716 J = rec_r_fractal_call(J,1,ivtarget,weight_rad,printout); 7611 7717 7612 7718 rChangeCurrRing(oldRing); -
Singular/walk.h
r41c9e4 r8e682d 68 68 69 69 /* The fractal walk algorithm */ 70 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, int reduction );70 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, int reduction, int printout); 71 71 72 72 /* The fractal walk algorithm with random element */ 73 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, int weight_rad, int reduction );73 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, int weight_rad, int reduction, int printout); 74 74 75 75 /* Implement Tran's idea */
Note: See TracChangeset
for help on using the changeset viewer.