Changeset 20c1a3 in git
- Timestamp:
- Jun 3, 2015, 5:16:50 PM (8 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 269fc4d27717409c0438dbf31005bd82968fc09d633196803bc6aac699d9f7df3d38f77b6222ea7d
- Parents:
- 2c2d2e89ad6e29cc2a1d2903129b937241868370
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/walk.cc
r2c2d2e8 r20c1a3 806 806 for(i=nG-1; i>=0; i--) 807 807 { 808 mi = MpolyInitialForm(G->m[i], iv); 809 gi = G->m[i]; 810 808 mi = pHead(MpolyInitialForm(G->m[i], iv)); 809 //Print("\n **// test_w_in_ConeCC: lm(initial)= %s \n",pString(mi)); 810 gi = pHead(G->m[i]); 811 //Print("\n **// test_w_in_ConeCC: lm(ideal)= %s \n",pString(gi)); 811 812 if(mi == NULL) 812 813 { … … 1646 1647 (* result)[i] = mpz_get_si(pert_vector[i]); 1647 1648 } 1648 1649 /* 1649 1650 j = 0; 1650 for(i=0; i<n V; i++)1651 for(i=0; i<niv; i++) 1651 1652 { 1652 1653 (* result1)[i] = mpz_get_si(pert_vector[i]); … … 1658 1659 } 1659 1660 } 1660 if(j > n V- 1)1661 if(j > niv - 1) 1661 1662 { 1662 1663 // Print("\n// MfPertwalk: geaenderter vector gleich Null! \n"); … … 1664 1665 goto CHECK_OVERFLOW; 1665 1666 } 1666 1667 /* 1667 1668 // check that the perturbed weight vector lies in the Groebner cone 1669 Print("\n========================================\n//** MfPertvector: test in Cone.\n"); 1668 1670 if(test_w_in_ConeCC(G,result1) != 0) 1669 1671 { … … 1681 1683 // Print("\n// Mfpertwalk: geaenderter vector liegt nicht in Groebnerkegel! \n"); 1682 1684 } 1683 1685 Print("\n ========================================\n");*/ 1684 1686 CHECK_OVERFLOW: 1685 1687 … … 5043 5045 Set_Error(FALSE); 5044 5046 Overflow_Error = FALSE; 5045 BOOLEAN endwalks = FALSE;5047 //BOOLEAN endwalks = FALSE; 5046 5048 #ifdef TIME_TEST 5047 5049 clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0; … … 5057 5059 ring newRing; 5058 5060 ring XXRing = baseRing; 5061 ring targetRing; 5059 5062 intvec* ivNull = new intvec(nV); 5060 5063 intvec* curr_weight = new intvec(nV); … … 5065 5068 for(i=0; i<nV; i++) 5066 5069 { 5067 (*tmp_weight)[i] = (* target_M)[i];5070 (*tmp_weight)[i] = (*orig_M)[i]; 5068 5071 } 5069 5072 */ … … 5090 5093 } 5091 5094 //#endif 5095 5096 if(target_M->length() == nV) 5097 { 5098 // define the target ring 5099 targetRing = VMrDefault(target_weight); 5100 } 5101 else 5102 { 5103 targetRing = VMatrDefault(target_M); 5104 } 5105 if(orig_M->length() == nV) 5106 { 5107 // define a new ring with ordering "(a(curr_weight),lp) 5108 newRing = VMrDefault(curr_weight); 5109 } 5110 else 5111 { 5112 newRing = VMatrDefault(orig_M); 5113 } 5114 rChangeCurrRing(newRing); 5115 5092 5116 #ifdef TIME_TEST 5093 5117 to = clock(); 5094 5118 #endif 5095 if(orig_M->length() == nV) 5096 { 5097 // define a new ring with ordering "(a(curr_weight),lp) 5098 newRing = VMrDefault(curr_weight); 5099 } 5100 else 5101 { 5102 newRing = VMatrDefault(orig_M); 5103 } 5104 rChangeCurrRing(newRing); 5119 5105 5120 ideal G = MstdCC(idrMoveR(Go,baseRing,currRing)); 5106 //ideal G = idrMoveR(Go,baseRing,currRing); 5107 baseRing = currRing; 5121 5108 5122 #ifdef TIME_TEST 5109 5123 tostd = clock()-to; 5110 5124 #endif 5111 5125 5126 baseRing = currRing; 5112 5127 nwalk = 0; 5128 5113 5129 while(1) 5114 5130 { 5115 5131 nwalk ++; 5116 5132 nstep ++; 5133 5117 5134 #ifdef TIME_TEST 5118 5135 to = clock(); 5119 5136 #endif 5120 //#ifdef CHECK_IDEAL_MWALK5121 if(printout > 2)5122 {5123 idString(G,"//** Mwalk: G");5124 }5125 //#endif5126 // test whether target cone is reached5127 if(reduction !=0 && test_w_in_ConeCC(G,target_weight) == 1)5128 {5129 endwalks = TRUE;5130 }5131 5137 // compute an initial form ideal of <G> w.r.t. "curr_vector" 5132 5138 Gomega = MwalkInitialForm(G, curr_weight); 5133 5139 #ifdef TIME_TEST 5134 //time for computing initial form ideal5135 5140 tif = tif + clock()-to; 5136 5141 #endif 5142 5137 5143 //#ifdef CHECK_IDEAL_MWALK 5138 5144 if(printout > 1) … … 5141 5147 } 5142 5148 //#endif 5149 5143 5150 if(reduction == 0) 5144 5151 { 5145 //PrintS("\n//** Mwalk: test middle of cone!\n");5146 5152 FF = middleOfCone(G,Gomega); 5147 //PrintS("\n//** Mwalk: Test F!\n");5148 5153 if( FF != NULL) 5149 5154 { … … 5151 5156 G = idCopy(FF); 5152 5157 idDelete(&FF); 5153 //PrintS("\n//** Mwalk: FF nicht NULL! Compue next vector.\n");5154 5158 goto NEXT_VECTOR; 5155 5159 } 5156 5160 } 5161 5157 5162 #ifndef BUCHBERGER_ALG 5158 5163 if(isNolVector(curr_weight) == 0) … … 5165 5170 } 5166 5171 #endif 5172 5167 5173 if(nwalk == 1) 5168 5174 { … … 5181 5187 if(target_M->length() == nV) 5182 5188 { 5183 //define a new ring with ordering "(a(curr_weight), Wp(target_weight))"5184 newRing = VMr Refine(curr_weight,target_weight);5189 //define a new ring with ordering "(a(curr_weight),lp)" 5190 newRing = VMrDefault(curr_weight); 5185 5191 } 5186 5192 else … … 5225 5231 // where Gomega is a reduced Groebner basis w.r.t. the current ring 5226 5232 F = MLifttwoIdeal(Gomega2, M1, G); 5233 5227 5234 #ifdef TIME_TEST 5228 5235 tlift = tlift + clock() - to; … … 5236 5243 idDelete(&Gomega2); 5237 5244 idDelete(&M1); 5245 5238 5246 rChangeCurrRing(newRing); // change the ring to newRing 5239 5247 G = idrMoveR(F,baseRing,currRing); 5240 5248 idDelete(&F); 5249 idSkipZeroes(G); 5250 5251 //#ifdef CHECK_IDEAL_MWALK 5252 if(printout > 2) 5253 { 5254 idString(G, "//** Mwalk: G"); 5255 } 5256 //#endif 5257 5258 rChangeCurrRing(targetRing); 5259 G = idrMoveR(G,newRing,currRing); 5260 // test whether target cone is reached 5261 if(reduction !=0 && test_w_in_ConeCC(G,curr_weight) == 1) 5262 { 5263 baseRing = currRing; 5264 break; 5265 //endwalks = TRUE; 5266 } 5267 5268 rChangeCurrRing(newRing); 5269 G = idrMoveR(G,targetRing,currRing); 5241 5270 baseRing = currRing; 5271 5272 /* 5242 5273 #ifdef TIME_TEST 5243 5274 to = clock(); … … 5247 5278 tstd = tstd + clock() - to; 5248 5279 #endif 5249 idSkipZeroes(G); 5250 //#ifdef CHECK_IDEAL_MWALK 5251 if(printout > 2) 5252 { 5253 idString(G, "//** Mwalk: G"); 5254 } 5255 //#endif 5280 */ 5281 5282 5256 5283 #ifdef TIME_TEST 5257 5284 to = clock(); … … 5268 5295 } 5269 5296 //#endif 5270 if(MivComp(target_weight,curr_weight) == 1 || endwalks == TRUE) 5271 { 5272 5297 if(MivComp(target_weight,curr_weight) == 1)// || endwalks == TRUE) 5298 {/* 5273 5299 //#ifdef CHECK_IDEAL_MWALK 5274 5300 if(printout > 0) … … 5328 5354 to = clock(); 5329 5355 #endif 5330 / *PrintS("\n //**Mwalk: Interreduce");5356 //PrintS("\n //**Mwalk: Interreduce"); 5331 5357 //interreduce the Groebner basis <G> w.r.t. currRing 5332 G = kInterRedCC(G,NULL);*/5358 //G = kInterRedCC(G,NULL); 5333 5359 #ifdef TIME_TEST 5334 5360 tred = tred + clock() - to; 5335 5361 #endif 5336 5362 idSkipZeroes(G); 5337 delete next_weight; 5363 delete next_weight; */ 5338 5364 break; 5339 5365 } … … 5348 5374 rChangeCurrRing(XXRing); 5349 5375 ideal result = idrMoveR(G,baseRing,currRing); 5376 idDelete(&Go); 5350 5377 idDelete(&G); 5351 5378 //delete tmp_weight; … … 5376 5403 Set_Error(FALSE); 5377 5404 Overflow_Error = FALSE; 5378 BOOLEAN endwalks = FALSE;5405 //BOOLEAN endwalks = FALSE; 5379 5406 #ifdef TIME_TEST 5380 5407 clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0; … … 5389 5416 ideal Gomega, M, F,FF, Gomega1, Gomega2, M1; 5390 5417 ring newRing; 5418 ring targetRing; 5391 5419 ring baseRing = currRing; 5392 5420 ring XXRing = currRing; … … 5422 5450 to = clock(); 5423 5451 #endif 5452 5453 if(target_M->length() == nV) 5454 { 5455 // define the target ring 5456 targetRing = VMrDefault(target_weight); 5457 } 5458 else 5459 { 5460 targetRing = VMatrDefault(target_M); 5461 } 5424 5462 if(orig_M->length() == nV) 5425 5463 { … … 5445 5483 to = clock(); 5446 5484 #endif 5447 //#ifdef CHECK_IDEAL_MWALK 5448 if(printout > 2) 5449 { 5450 idString(G,"//** Mrwalk: G"); 5451 } 5452 //#endif 5485 5453 5486 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5454 5487 //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise … … 5464 5497 //#endif 5465 5498 // test whether target cone is reached 5466 if(test_w_in_ConeCC(G,target_weight) == 1)5499 /* if(test_w_in_ConeCC(G,target_weight) == 1) 5467 5500 { 5468 5501 endwalks = TRUE; 5469 } 5502 }*/ 5470 5503 if(reduction == 0) 5471 5504 { 5472 //PrintS("\n//** Mrwalk: test middle of cone!\n");5505 5473 5506 FF = middleOfCone(G,Gomega); 5474 //PrintS("\n//** Mrwalk: Test F!\n");5507 5475 5508 if(FF != NULL) 5476 5509 { … … 5478 5511 G = idCopy(FF); 5479 5512 idDelete(&FF); 5480 //PrintS("\n//** Mrwalk: FF nicht NULL! Compue next vector.\n");5513 5481 5514 goto NEXT_VECTOR; 5482 5515 } … … 5507 5540 if(target_M->length() == nV) 5508 5541 { 5509 newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))" 5542 newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp) 5543 //newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))" 5510 5544 } 5511 5545 else … … 5575 5609 } 5576 5610 //#endif 5611 5612 rChangeCurrRing(targetRing); 5613 G = idrMoveR(G,newRing,currRing); 5614 // test whether target cone is reached 5615 if(reduction !=0 && test_w_in_ConeCC(G,curr_weight) == 1) 5616 { 5617 baseRing = currRing; 5618 break; 5619 } 5620 5621 rChangeCurrRing(newRing); 5622 G = idrMoveR(G,targetRing,currRing); 5623 baseRing = currRing; 5624 5625 5577 5626 NEXT_VECTOR: 5578 5627 #ifdef TIME_TEST … … 5596 5645 } 5597 5646 //#endif 5598 if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1 || endwalks == TRUE)5599 { 5647 if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || endwalks == TRUE) 5648 {/* 5600 5649 //#ifdef CHECK_IDEAL_MWALK 5601 5650 if(printout > 0) … … 5655 5704 to = clock(); 5656 5705 #endif 5657 / *PrintS("\n //**Mrwalk: Interreduce");5706 //PrintS("\n //**Mrwalk: Interreduce"); 5658 5707 //interreduce the Groebner basis <G> w.r.t. currRing 5659 G = kInterRedCC(G,NULL);*/5708 //G = kInterRedCC(G,NULL); 5660 5709 #ifdef TIME_TEST 5661 5710 tred = tred + clock() - to; 5662 5711 #endif 5663 5712 idSkipZeroes(G); 5664 delete next_weight; 5713 delete next_weight;*/ 5665 5714 break; 5666 5715 } … … 6724 6773 { 6725 6774 Overflow_Error = FALSE; 6726 //Print("\n\n// Entering the %d-th recursion:", nlev); 6727 6775 if(printout >0) 6776 { 6777 Print("\n\n// Entering the %d-th recursion:", nlev); 6778 } 6728 6779 int i, nV = currRing->N; 6729 6780 ring new_ring, testring; … … 6793 6844 // We only perturb the current target vector at the recursion level 1 6794 6845 if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3 6795 if (MivComp(next_vect, omega2) != 1)6846 if (MivComp(next_vect, omega2) == 1) 6796 6847 { 6797 6848 // to dispense with taking initial (and lifting/interreducing … … 6848 6899 to=clock(); 6849 6900 6850 / * to avoid the value of Overflow_Error that occur in Mfpertvector*/6901 // to avoid the value of Overflow_Error that occur in Mfpertvector 6851 6902 Overflow_Error = FALSE; 6852 6853 6903 next_vect = MkInterRedNextWeight(omega,omega2,G); 6854 6904 xtnw=xtnw+clock()-to; … … 6862 6912 //#endif 6863 6913 6864 /* check whether the the computed vector is in the correct cone */ 6865 /* If no, the reduced GB of an omega-homogeneous ideal will be 6866 computed by Buchberger algorithm and stop this recursion step*/ 6867 //if(test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6 6868 if(Overflow_Error == TRUE) 6914 // check whether the the computed vector is in the correct cone. 6915 // If no, compute the reduced Groebner basis of an omega-homogeneous 6916 // ideal with Buchberger's algorithm and stop this recursion step 6917 if(Overflow_Error == TRUE || test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6 6869 6918 { 6870 6919 delete next_vect; … … 6886 6935 if(printout > 0) 6887 6936 { 6888 Print("\n//** rec_fractal_call: Overflow.Applying Buchberger's algorithm in ring r = %s;",6937 Print("\n//** rec_fractal_call: Applying Buchberger's algorithm in ring r = %s;", 6889 6938 rString(currRing)); 6890 6939 } … … 6905 6954 6906 6955 nnflow ++; 6907 6908 6956 Overflow_Error = FALSE; 6909 6957 return (G1); 6910 } //end overflow-check6958 } 6911 6959 6912 6960 … … 6951 6999 if(printout > 0) 6952 7000 { 6953 Print("\n//** rec_fractal_call: Wrong cone. Tau 'doesn't stay in the correct cone.\n");7001 Print("\n//** rec_fractal_call: Wrong cone. Tau doesn't stay in the correct cone.\n"); 6954 7002 } 6955 /* 7003 6956 7004 #ifndef MSTDCC_FRACTAL 6957 7005 intvec* Xtautmp; … … 6990 7038 goto NEXT_VECTOR_FRACTAL; 6991 7039 #endif 6992 */ 7040 6993 7041 FRACTAL_MSTDCC: 6994 7042 if(printout > 0) … … 7063 7111 7064 7112 to=clock(); 7065 / * Take the initial form of <G> w.r.t. omega */7113 // Take the initial form of <G> w.r.t. omega 7066 7114 Gomega = MwalkInitialForm(G, omega); 7067 7115 xtif=xtif+clock()-to; … … 7073 7121 if(reduction == 0) 7074 7122 { 7075 / *Check whether the intermediate weight vector lies in the interior of the cone.7076 * If so, only perform reductions. Otherwise apply Buchberger's algorithm. */7123 // Check whether the intermediate weight vector lies in the interior of the cone. 7124 // If so, only perform reductions. Otherwise apply Buchberger's algorithm. 7077 7125 FF = middleOfCone(G,Gomega); 7078 7126 if( FF != NULL) … … 7081 7129 G = idCopy(FF); 7082 7130 idDelete(&FF); 7083 / * Compue next vector. */7131 // Compue next vector. 7084 7132 goto NEXT_VECTOR_FRACTAL; 7085 7133 } … … 7158 7206 G = idrMoveR(F,oRing,currRing); 7159 7207 to=clock(); 7160 / * Interreduce G */7161 // G = kInterRedCC(F1, NULL);7208 // Interreduce G 7209 // G = kInterRedCC(F1, NULL); 7162 7210 xtred=xtred+clock()-to; 7163 7211 //idDelete(&F1); … … 7239 7287 if(polylength > 0 && G->m[0] != NULL) 7240 7288 { 7241 /* 7242 there is a polynomial in Gomega with at least 3 monomials, 7243 low-dimensional facet of the cone 7244 */ 7289 7290 PrintS("\n**// rec_r_fractal_call: there is a polynomial in Gomega with at least 3 monomials, low-dimensional facet of the cone.\n"); 7291 7245 7292 delete next_vect; 7246 7293 next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,nlev); … … 7324 7371 if(G->m[0] != NULL && polylength > 0) 7325 7372 { 7326 /* 7327 there is a polynomial in Gomega with at least 3 monomials, 7328 low-dimensional facet of the cone 7329 */ 7373 7374 PrintS("//** rec_r_fractal_call: there is a polynomial in Gomega with at least 3 monomials, low-dimensional facet of the cone"); 7375 7330 7376 delete next_vect; 7331 7377 next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,nlev); … … 7349 7395 computed by Buchberger algorithm and stop this recursion step*/ 7350 7396 //if(test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6 7351 if(Overflow_Error == TRUE )7397 if(Overflow_Error == TRUE || test_w_in_ConeCC(G,next_vect) != 1) 7352 7398 { 7353 7399 delete next_vect;
Note: See TracChangeset
for help on using the changeset viewer.