Changeset 86f23e in git
- Timestamp:
- Apr 30, 2009, 11:32:01 AM (14 years ago)
- Branches:
- (u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
- Children:
- fca87ac65d9188c296070cf81e3cdbe571886b62
- Parents:
- d7fe2a25f82c1fea9eea86260f9312234f364449
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
rd7fe2a2 r86f23e 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-04- 29 07:22:48$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.4 2 2009-04-29 07:22:48monerjan Exp $6 $Id: gfan.cc,v 1.4 2 2009-04-29 07:22:48monerjan Exp $4 $Date: 2009-04-30 09:32:01 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.43 2009-04-30 09:32:01 monerjan Exp $ 6 $Id: gfan.cc,v 1.43 2009-04-30 09:32:01 monerjan Exp $ 7 7 */ 8 8 … … 228 228 } 229 229 230 void getIntPoint() 230 /** \brief Return the interior point */ 231 intvec *getIntPoint() 232 { 233 return this->ivIntPt; 234 } 235 236 void showIntPoint() 231 237 { 232 238 ivIntPt->show(); … … 1014 1020 }//rCopyAndChange 1015 1021 1016 void reverseSearch() 1017 { 1022 /** 1023 * Determines whether a given facet of a cone is the search facet of a neighbouring cone 1024 * 1025 */ 1026 bool isSearchFacet(gcone &tmpcone, facet *testfacet) 1027 { 1028 ring actRing=currRing; 1029 1030 facet *fMin=new facet(); //Pointer to the "minimal" facet 1031 facet *fAct; 1032 fMin = testfacet; 1033 fAct = fMin; 1034 1035 rChangeCurrRing(this->rootRing); 1036 poly p=NULL; 1037 poly q=NULL; 1038 intvec *p_weight = new intvec(this->numVars); 1039 intvec *q_weight = new intvec(this->numVars); 1040 intvec *sigma = new intvec(this->numVars); 1041 sigma=tmpcone.getIntPoint(); 1042 int *u=(int *)omAlloc((this->numVars+1)*sizeof(int)); 1043 int *v=(int *)omAlloc((this->numVars+1)*sizeof(int)); 1044 int weight1,weight2; 1045 while(tmpcone.facetPtr->next!=NULL) 1046 { 1047 /* Get alpha_i and alpha_{i+1} */ 1048 p_weight=fMin->getFacetNormal(); 1049 q_weight=fMin->next->getFacetNormal(); 1050 1051 /*Compute the dot product of sigma and alpha_{i,j}*/ 1052 weight1=dotProduct(sigma,p_weight); 1053 weight2=dotProduct(sigma,q_weight); 1054 1055 /*Adjust alpha_i and alpha_i+1 accordingly*/ 1056 for(int ii=1;ii<=this->numVars;ii++) 1057 { 1058 /*p_weight[ii]=weight1*(*p_weight)[ii]; 1059 q_weight[ii]=weight2*(*q_weight)[ii];*/ 1060 u[ii]=weight1*(*p_weight)[ii]; 1061 v[ii]=weight2*(*q_weight)[ii]; 1062 } 1063 1064 /*Now p_weight and q_weight need to be compared as exponent vectors*/ 1065 pSetExpV(p,u); 1066 pSetExpV(q,v); 1067 /*We want to check whether x^p < x^q 1068 => want to check for return value 1 */ 1069 if (pLmCmp(p,q)==1) //i.e. x^q is smaller 1070 { 1071 fMin=fMin->next; 1072 fAct=fMin; 1073 } 1074 else 1075 { 1076 fAct=fAct->next; 1077 } 1078 }//while(tmpcone.facetPtr->next!=NULL) 1079 rChangeCurrRing(actRing); 1080 }//bool isSearchFacet 1081 1082 void reverseSearch(gcone gcAct) //no const possible here since we call gcAct->flip 1083 { 1084 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); 1091 idShow(gcTmp->gcBasis); 1092 gcTmp->getConeNormals(gcTmp->gcBasis, TRUE); 1093 gcTmp->showIntPoint(); 1094 /*recursive part goes gere*/ 1095 if (isSearchFacet(gcTmp,gcAct.facetPtr)) 1096 { 1097 gcAct.next=gcTmp; 1098 reverseSearch(*gcTmp); 1099 } 1100 else 1101 { 1102 delete gcTmp; 1103 /*NOTE remove fAct from linked list. It's no longer needed*/ 1104 } 1105 /*recursion ends*/ 1106 fAct = fAct->next; 1107 }//while(fAct->next!=NULL) 1018 1108 }//reverseSearch 1019 1109 };//class gcone … … 1078 1168 NOTE: Check for flippability is not very sophisticated 1079 1169 */ 1080 facet *fAct=new facet();1170 /*facet *fAct=new facet(); 1081 1171 fAct=gcAct->facetPtr; 1082 1172 while(fAct->next!=NULL) … … 1088 1178 gcTmp->getIntPoint(); 1089 1179 fAct = fAct->next; 1090 } 1091 1180 }*/ 1181 gcAct->reverseSearch(*gcAct); 1092 1182 /*As of now extra.cc expects gfan to return type ideal. Probably this will change in near future. 1093 1183 The return type will then be of type LIST_CMD
Note: See TracChangeset
for help on using the changeset viewer.