Changeset eaa679 in git
- Timestamp:
- May 7, 2009, 11:55:48 AM (14 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- f4a2f423453c2ac5708a5092a552d99d9ae6dc42
- Parents:
- f16a76d72e29ae88bdd1b8cd60bff79fb200f3cd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
rf16a76d reaa679 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-05-0 6 09:54:23$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.4 6 2009-05-06 09:54:23monerjan Exp $6 $Id: gfan.cc,v 1.4 6 2009-05-06 09:54:23monerjan Exp $4 $Date: 2009-05-07 09:55:48 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.47 2009-05-07 09:55:48 monerjan Exp $ 6 $Id: gfan.cc,v 1.47 2009-05-07 09:55:48 monerjan Exp $ 7 7 */ 8 8 … … 14 14 #include "kutil.h" 15 15 #include "intvec.h" 16 #include "int64vec.h"17 16 #include "polys.h" 18 17 #include "ideals.h" … … 443 442 }//for (int jj = 1; jj <ddcols; jj++) 444 443 /*Quick'n'dirty hack for flippability*/ 445 bool isFlippable=FALSE; 446 //NOTE BUG HERE 447 /* The flippability check is wrong! 448 (1,-4) will pass, but (-1,7) will not. 449 REWRITE THIS 450 */ 451 /*for (int jj = 0; jj<this->numVars; jj++) 452 { 453 intvec *ivCanonical = new intvec(this->numVars); 454 (*ivCanonical)[jj]=1; 455 if (dotProduct(load,ivCanonical)>=0) 456 { 457 isFlippable=FALSE; 458 } 459 else 460 { 461 isFlippable=TRUE; 462 } 463 delete ivCanonical; 464 }//for (int jj = 0; jj<this->numVars; jj++) 465 */ 444 bool isFlippable=FALSE; 466 445 for (int jj = 0; jj<load->length(); jj++) 467 446 { … … 483 462 { /*Now load should be full and we can call setFacetNormal*/ 484 463 fAct->setFacetNormal(load); 485 fAct->next = new facet(); 486 //fAct->printNormal(); 464 fAct->next = new facet(); 487 465 fAct=fAct->next; //this should definitely not be called in the above while-loop :D 488 466 }//if (isFlippable==FALSE) … … 584 562 /*Now initialFormElement must be added to (ideal)initialForm */ 585 563 initialForm->m[ii]=initialFormElement[ii]; 586 }//for 587 //f->setFlipGB(initialForm); //FIXME PROBABLY WRONG TO STORE HERE SINCE INA!=flibGB 564 }//for 588 565 #ifdef gfan_DEBUG 589 566 cout << "Initial ideal is: " << endl; … … 592 569 cout << "===" << endl; 593 570 #endif 594 delete check;571 //delete check; 595 572 596 573 /*2nd step: lift initial ideal to a GB of the neighbouring cone using minus alpha as weight*/ … … 601 578 ring srcRing=currRing; 602 579 603 ring tmpRing=rCopyAndAddWeight(srcRing,fNormal); 580 //intvec *negfNormal = new intvec(this->numVars); 581 //negfNormal=ivNeg(fNormal); 582 ring tmpRing=rCopyAndAddWeight(srcRing,ivNeg(fNormal)); 604 583 rChangeCurrRing(tmpRing); 605 584 … … 612 591 idShow(ina); cout << endl; 613 592 #endif 614 ideal H; //NOTE WTF? rCopyAndAddWeight does not seem to be compatible with kStd... => wrong result!593 ideal H; 615 594 H=kStd(ina,NULL,isHomog,NULL); //we know it is homogeneous 616 595 idSkipZeroes(H); … … 921 900 { 922 901 }//GGW 902 903 intvec *ivNeg(intvec const &iv) 904 { 905 intvec *res = new intvec(this->numVars); 906 for(int ii=0;ii<this->numVars;ii++) 907 { 908 res[ii] = -(int)iv[ii]; 909 } 910 return res; 911 } 923 912 924 913 … … 1191 1180 }//while(fAct.facetPtr->next!=NULL) 1192 1181 delete alpha_i,alpha_j,sigma; 1182 1193 1183 /*If testfacet was minimal then fMin should still point there */ 1194 1184 //NOTE BUG: Comment in and -> out of memory error … … 1198 1188 1199 1189 intvec *test = new intvec(this->numVars); 1200 test=testfacet.getFacetNormal(); 1201 1202 if (isParallel(alpha_min,test))*/ 1203 if (fMin==gcTmp.facetPtr) 1204 { 1190 test=testfacet.getFacetNormal();*/ 1191 //if(fMin->getFacetNormal()==ivNeg(testfacet.getFacetNormal())) 1192 //if (isParallel(fMin->getFacetNormal(),testfacet.getFacetNormal())) 1193 fMin->printNormal(); 1194 testfacet.printNormal(); //NOTE THIS IS EMPTY, so prolly cause of bug above 1195 if (fMin==gcTmp.facetPtr) 1196 //if(areEqual(fMin->getFacetNormal(),ivNeg(testfacet.getFacetNormal()))) 1197 { 1198 cout << "Parallel" << endl; 1205 1199 rChangeCurrRing(actRing); 1200 //delete alpha_min, test; 1206 1201 return TRUE; 1207 1202 } 1208 1203 else 1209 1204 { 1205 cout << "Not parallel" << endl; 1210 1206 rChangeCurrRing(actRing); 1207 //delete alpha_min, test; 1211 1208 return FALSE; 1212 1209 } 1213 1210 }//bool isSearchFacet 1211 1212 bool areEqual(intvec const &a, intvec const &b) 1213 { 1214 bool res=TRUE; 1215 for(int ii=0;ii<this->numVars;ii++) 1216 { 1217 if(a[ii]!=b[ii]) 1218 { 1219 res=FALSE; 1220 break; 1221 } 1222 } 1223 return res; 1224 } 1214 1225 1215 1226 void reverseSearch(gcone *gcAct) //no const possible here since we call gcAct->flip … … 1223 1234 gcAct->flip(gcAct->gcBasis,gcAct->facetPtr); 1224 1235 gcone *gcTmp = new gcone(*gcAct); 1225 idShow(gcTmp->gcBasis);1236 //idShow(gcTmp->gcBasis); 1226 1237 gcTmp->getConeNormals(gcTmp->gcBasis, TRUE); 1227 1238 #ifdef gfan_DEBUG … … 1308 1319 idShow(gcAct->gcBasis); 1309 1320 gcAct->getConeNormals(gcAct->gcBasis); //hopefully compute the normals 1310 gcAct->flip(gcAct->gcBasis,gcAct->facetPtr);1321 //gcAct->flip(gcAct->gcBasis,gcAct->facetPtr); 1311 1322 /*Now it is time to compute the search facets, respectively start the reverse search. 1312 1323 But since we are in the root all facets should be search facets. IS THIS TRUE? … … 1324 1335 fAct = fAct->next; 1325 1336 }*/ 1326 //gcAct->reverseSearch(gcAct); 1337 gcAct->reverseSearch(gcAct); 1338 1327 1339 /*As of now extra.cc expects gfan to return type ideal. Probably this will change in near future. 1328 1340 The return type will then be of type LIST_CMD
Note: See TracChangeset
for help on using the changeset viewer.