Changeset 5684df in git
- Timestamp:
- May 4, 2009, 5:14:38 PM (14 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- b2a6e3e0d28bf571be753914eaccf9f5c629080f
- Parents:
- e2efbe929b401e118eadf323f44b5bd894b457b0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
re2efbe9 r5684df 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-0 4-30 09:32:01$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.4 3 2009-04-30 09:32:01monerjan Exp $6 $Id: gfan.cc,v 1.4 3 2009-04-30 09:32:01monerjan Exp $4 $Date: 2009-05-04 15:14:38 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.44 2009-05-04 15:14:38 monerjan Exp $ 6 $Id: gfan.cc,v 1.44 2009-05-04 15:14:38 monerjan Exp $ 7 7 */ 8 8 … … 210 210 211 211 /** \brief Default destructor */ 212 ~gcone() ;//destructor212 ~gcone(){;} //destructor 213 213 214 214 /** Pointer to the first facet */ … … 403 403 }//for (int jj = 1; jj <ddcols; jj++) 404 404 /*Quick'n'dirty hack for flippability*/ 405 bool isFlippable; 405 bool isFlippable; 406 //NOTE BUG HERE 407 /* The flippability check is wrong! 408 (1,-4) will pass, but (-1,7) will not. 409 REWRITE THIS 410 */ 406 411 for (int jj = 0; jj<this->numVars; jj++) 407 412 { … … 514 519 cout << endl; 515 520 #endif 516 if (isParallel(check,fNormal)) //pass *check when 521 //TODO why not *check, *fNormal???? 522 if (isParallel(*check,*fNormal)) //pass *check when 517 523 { 518 524 cout << "Parallel vector found, adding to initialFormElement" << endl; … … 1022 1028 /** 1023 1029 * Determines whether a given facet of a cone is the search facet of a neighbouring cone 1024 * 1030 * This is done in the following way: 1031 * We loop through all facets of the cone and find the "smallest" facet, i.e. the unique facet 1032 * that is first crossed during the generic walk. 1033 * We then check whether the fNormal of this facet is parallel to the fNormal of our testfacet. 1034 * If this is the case, then our facet is indeed a search facet and TRUE is retuned. 1025 1035 */ 1026 bool isSearchFacet(gcone &tmpcone, facet *testfacet)1027 { 1036 bool isSearchFacet(gcone &tmpcone, facet &testfacet) 1037 { 1028 1038 ring actRing=currRing; 1029 1030 facet *fMin=new facet(); //Pointer to the "minimal" facet 1039 facet *facetPtr=(facet*)tmpcone.facetPtr; 1040 facet *fMin=new facet(*facetPtr); //Pointer to the "minimal" facet 1041 //facet *fMin = new facet(tmpcone.facetPtr); 1042 //fMin=tmpcone.facetPtr; //Initialise to first facet of tmpcone 1031 1043 facet *fAct; 1032 fMin = testfacet; 1044 //fMin = testfacet; 1045 //fMin->next=testfacet->next; 1033 1046 fAct = fMin; 1034 1047 1035 rChangeCurrRing(this->rootRing); 1048 cout << endl<< fMin->next << endl; 1049 cout << tmpcone.facetPtr->next << endl; 1050 tmpcone.facetPtr->printNormal(); 1051 fAct=tmpcone.facetPtr->next; 1052 fAct->printNormal(); 1053 /*fMin->printNormal(); 1054 fMin->next->printNormal();*/ 1055 1056 rChangeCurrRing(this->rootRing); //because we compare the monomials in the rootring 1036 1057 poly p=NULL; 1037 1058 poly q=NULL; … … 1040 1061 intvec *sigma = new intvec(this->numVars); 1041 1062 sigma=tmpcone.getIntPoint(); 1063 cout << "pling" << endl; 1042 1064 int *u=(int *)omAlloc((this->numVars+1)*sizeof(int)); 1043 1065 int *v=(int *)omAlloc((this->numVars+1)*sizeof(int)); 1044 1066 int weight1,weight2; 1045 while( tmpcone.facetPtr->next!=NULL)1067 while(fAct->next!=NULL) //ersetzen durch fAct 1046 1068 { 1047 1069 /* Get alpha_i and alpha_{i+1} */ 1048 1070 p_weight=fMin->getFacetNormal(); 1049 1071 q_weight=fMin->next->getFacetNormal(); 1050 1072 p_weight->show(); 1073 q_weight->show(); 1051 1074 /*Compute the dot product of sigma and alpha_{i,j}*/ 1052 1075 weight1=dotProduct(sigma,p_weight); 1053 1076 weight2=dotProduct(sigma,q_weight); 1054 1077 cout << "weight1=" << weight1 << " " << "weight2=" << weight2 << endl; 1055 1078 /*Adjust alpha_i and alpha_i+1 accordingly*/ 1056 1079 for(int ii=1;ii<=this->numVars;ii++) … … 1061 1084 v[ii]=weight2*(*q_weight)[ii]; 1062 1085 } 1086 cout << "PLONK" << endl; 1063 1087 1064 1088 /*Now p_weight and q_weight need to be compared as exponent vectors*/ 1065 1089 pSetExpV(p,u); 1066 1090 pSetExpV(q,v); 1091 cout << "AARGH" << endl; 1067 1092 /*We want to check whether x^p < x^q 1068 1093 => want to check for return value 1 */ … … 1076 1101 fAct=fAct->next; 1077 1102 } 1103 fAct=fAct->next; 1078 1104 }//while(tmpcone.facetPtr->next!=NULL) 1079 rChangeCurrRing(actRing); 1105 1106 /*If testfacet was minimal then fMin should still point there */ 1107 //if (isParallel(fMin->getFacetNormal,testfacet.getFacetNormal)) 1108 if (fMin==tmpcone.facetPtr) 1109 { 1110 rChangeCurrRing(actRing); 1111 return TRUE; 1112 } 1113 else 1114 { 1115 rChangeCurrRing(actRing); 1116 return FALSE; 1117 } 1080 1118 }//bool isSearchFacet 1081 1119 1082 void reverseSearch(gcone gcAct) //no const possible here since we call gcAct->flip1120 void reverseSearch(gcone *gcAct) //no const possible here since we call gcAct->flip 1083 1121 { 1084 1122 facet *fAct=new facet(); 1085 fAct = gcAct.facetPtr; 1086 1087 while(fAct->next!=NULL) 1088 { 1089 gcAct.flip(gcAct.gcBasis,gcAct.facetPtr); 1090 gcone *gcTmp = new gcone(gcAct); 1123 fAct = gcAct->facetPtr; 1124 1125 while(fAct->next!=NULL) //NOTE NOT SURE WHETHER THIS IS RIGHT! Do I reach EVERY facet or only all but the last? 1126 { 1127 cout << "==========================================================================================="<< endl; 1128 gcAct->flip(gcAct->gcBasis,gcAct->facetPtr); 1129 gcone *gcTmp = new gcone(*gcAct); 1091 1130 idShow(gcTmp->gcBasis); 1092 1131 gcTmp->getConeNormals(gcTmp->gcBasis, TRUE); 1132 #ifdef gfan_DEBUG 1133 facet *f = new facet(); 1134 f=gcTmp->facetPtr; 1135 while(f->next!=NULL) 1136 { 1137 f->printNormal(); 1138 f=f->next; 1139 } 1140 #endif 1093 1141 gcTmp->showIntPoint(); 1094 1142 /*recursive part goes gere*/ 1095 if (isSearchFacet(gcTmp,gcAct.facetPtr)) 1096 { 1097 gcAct.next=gcTmp; 1098 reverseSearch(*gcTmp); 1143 if (isSearchFacet(*gcTmp,(facet&)gcAct->facetPtr)) 1144 { 1145 gcAct->next=gcTmp; 1146 cout << "PING"<< endl; 1147 reverseSearch(gcTmp); 1099 1148 } 1100 1149 else … … 1113 1162 int numvar = pVariables; 1114 1163 1115 1164 #ifdef gfan_DEBUG 1116 1165 cout << "Now in subroutine gfan" << endl; 1117 1166 #endif 1118 1167 ring inputRing=currRing; // The ring the user entered 1119 1168 ring rootRing; // The ring associated to the target ordering … … 1179 1228 fAct = fAct->next; 1180 1229 }*/ 1181 gcAct->reverseSearch( *gcAct);1230 gcAct->reverseSearch(gcAct); 1182 1231 /*As of now extra.cc expects gfan to return type ideal. Probably this will change in near future. 1183 1232 The return type will then be of type LIST_CMD
Note: See TracChangeset
for help on using the changeset viewer.