Changeset c8e7d30 in git
- Timestamp:
- Apr 28, 2009, 6:18:37 PM (15 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- ab0cafebc7997832ae2068f0c3e9590fc2a07835
- Parents:
- f9db282b5b2b723efd96054f374040ec3a02452c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
rf9db28 rc8e7d30 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-04-2 7 14:39:52$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.4 0 2009-04-27 14:39:52monerjan Exp $6 $Id: gfan.cc,v 1.4 0 2009-04-27 14:39:52monerjan Exp $4 $Date: 2009-04-28 16:18:37 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.41 2009-04-28 16:18:37 monerjan Exp $ 6 $Id: gfan.cc,v 1.41 2009-04-28 16:18:37 monerjan Exp $ 7 7 */ 8 8 … … 88 88 89 89 /** Stores the facet normal \param intvec*/ 90 void setFacetNormal(intvec *iv){ 90 void setFacetNormal(intvec *iv) 91 { 91 92 this->fNormal = ivCopy(iv); 92 93 //return; … … 146 147 ring rootRing; //good to know this -> generic walk 147 148 ideal inputIdeal; //the original 149 ring baseRing; //the basering of the cone 148 150 /* TODO in order to save memory use pointers to rootRing and inputIdeal instead */ 151 intvec *ivIntPt; //an interior point of the cone 152 149 153 public: 150 154 /** \brief Default constructor. … … 156 160 this->next=NULL; 157 161 this->facetPtr=NULL; 162 this->baseRing=currRing; 158 163 } 159 164 … … 169 174 this->rootRing=r; 170 175 this->inputIdeal=I; 176 this->baseRing=currRing; 171 177 } 172 178 173 179 /** \brief Copy constructor 174 180 * 175 * Copies one cone, forgets about everything but the facetNormal 181 * Copies one cone, sets this->gcBasis to the flipped GB and reverses the 182 * direction of the according facet normal 176 183 */ 177 gcone( gcone& gc)184 gcone(const gcone& gc) 178 185 { 179 186 this->next=NULL; 180 facet *f=this->facetPtr; 181 f->fNormal=gc.facetPtr->getFacetNormal(); 182 this->gcBasis=gc.facetPtr->getFlipGB(); 183 184 /*Reverse direction of the facet normal*/ 185 intvec *foo=f->getFacetNormal(); 187 this->numVars=gc.numVars; 188 facet *fAct= new facet(); 189 this->facetPtr=fAct; 190 191 intvec *ivtmp = new intvec(this->numVars); 192 ivtmp = gc.facetPtr->getFacetNormal(); 193 ivtmp->show(); 194 195 ideal gb; 196 gb=gc.facetPtr->getFlipGB(); 197 this->gcBasis=gb;//gc.facetPtr->getFlipGB(); //this cone's GB is the flipped GB 198 idShow(this->gcBasis); 199 200 /*Reverse direction of the facet normal to make it an inner normal*/ 186 201 for (int ii=0; ii<this->numVars;ii++) 187 202 { 188 (*foo)[ii]=-(*foo)[ii]; 189 //(*f).(*fNormal)[ii]=-( (*f).(*fNormal)[ii]); 190 } 191 f->setFacetNormal(foo); 203 (*ivtmp)[ii]=-(*ivtmp)[ii]; 204 } 205 //ivtmp->show(); cout << endl; 206 fAct->setFacetNormal(ivtmp); 207 //fAct->printNormal();cout << endl; 208 //ivtmp->show();cout << endl; 192 209 } 193 210 … … 204 221 ideal gcBasis; //GB of the cone, set by gcone::getGB(); 205 222 gcone *next; //Pointer to *previous* cone in search tree 223 224 /** \brief Set the interior point of a cone */ 225 void setIntPoint(intvec *iv) 226 { 227 this->ivIntPt=ivCopy(iv); 228 } 229 230 void getIntPoint() 231 { 232 ivIntPt->show(); 233 } 206 234 207 235 /** \brief Compute the normals of the cone … … 214 242 * the set \f$ \partial\mathcal{G} \f$ which we might store for later use. C.f p71 of journal 215 243 * As a result of this procedure the pointer facetPtr points to the first facet of the cone. 244 * 245 * Optionally, if the parameter bool compIntPoint is set to TRUE the method will also compute 246 * an interior point of the cone. 216 247 */ 217 void getConeNormals(ideal const &I )248 void getConeNormals(ideal const &I, bool compIntPoint=FALSE) 218 249 { 219 250 #ifdef gfan_DEBUG … … 403 434 */ 404 435 436 if (compIntPoint==TRUE) 437 { 438 intvec *iv = new intvec(this->numVars); 439 interiorPoint(ddineq, *iv); 440 this->setIntPoint(iv); //stores the interior point in gcone::ivIntPt 441 delete iv; 442 } 443 405 444 //Clean up but don't delete the return value! (Whatever it will turn out to be) 445 406 446 dd_FreeMatrix(ddineq); 407 447 set_free(ddredrows); … … 717 757 cout << "Flipped GB is: " << endl; 718 758 f->printFlipGB(); 719 #endif 720 759 #endif 721 760 }//void flip(ideal gb, facet *f) 722 761 … … 750 789 //cout << "TICK 3" << endl; 751 790 poly step1,step2,step3; 752 cout << "dividing "; pWrite(pHead(p));cout << "by ";pWrite(pHead(I->m[ii-1])); cout << endl;791 //cout << "dividing "; pWrite(pHead(p));cout << "by ";pWrite(pHead(I->m[ii-1])); cout << endl; 753 792 step1 = pDivideM(pHead(p),pHead(I->m[ii-1])); 754 cout << "LT(p)/LT(f_i)="; pWrite(step1); cout << endl;793 //cout << "LT(p)/LT(f_i)="; pWrite(step1); cout << endl; 755 794 //cout << "TICK 3.1" << endl; 756 795 step2 = ppMult_qq(step1, I->m[ii-1]); … … 776 815 pSetm(r); 777 816 pSort(r); 778 cout << "r="; pWrite(r); cout << endl;817 //cout << "r="; pWrite(r); cout << endl; 779 818 //cout << "TICK 6" << endl; 780 819 if (pLength(p)!=1) … … 787 826 } 788 827 //cout << "TICK 7" << endl; 789 cout << "p="; pWrite(p);828 //cout << "p="; pWrite(p); 790 829 }//if (divOccured==FALSE) 791 830 }//while (p!=0) … … 1030 1069 idShow(gcAct->gcBasis); 1031 1070 gcAct->getConeNormals(gcAct->gcBasis); //hopefully compute the normals 1032 gcAct->flip(gcAct->gcBasis,gcAct->facetPtr);1071 //gcAct->flip(gcAct->gcBasis,gcAct->facetPtr); 1033 1072 /*Now it is time to compute the search facets, respectively start the reverse search. 1034 1073 But since we are in the root all facets should be search facets. IS THIS TRUE? 1035 1074 NOTE: Check for flippability is not very sophisticated 1036 1075 */ 1076 facet *fAct=new facet(); 1077 fAct=gcAct->facetPtr; 1078 while(fAct->next!=NULL) 1079 { 1080 gcAct->flip(gcAct->gcBasis,gcAct->facetPtr); 1081 gcone *gcTmp = new gcone(*gcAct); 1082 idShow(gcTmp->gcBasis); 1083 gcTmp->getConeNormals(gcTmp->gcBasis, TRUE); 1084 gcTmp->getIntPoint(); 1085 fAct = fAct->next; 1086 } 1037 1087 1038 1088 /*As of now extra.cc expects gfan to return type ideal. Probably this will change in near future. … … 1044 1094 */ 1045 1095 rChangeCurrRing(inputRing); 1046 res=gcAct->gcBasis; 1096 //res=gcAct->gcBasis; 1097 res=gcRoot->gcBasis; 1047 1098 //cout << fRoot << endl; 1048 1099 return res;
Note: See TracChangeset
for help on using the changeset viewer.