Changeset 2b7bb5d in git for kernel/gfan.cc
- Timestamp:
- Apr 1, 2009, 4:07:20 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 7bd7795642f49e279d1fb82377b04df64f84a771
- Parents:
- 798f72186f85eaf9224aef1590336c69ccc6a3f9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
r798f721 r2b7bb5d 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-0 3-31 09:59:14$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.2 5 2009-03-31 09:59:14monerjan Exp $6 $Id: gfan.cc,v 1.2 5 2009-03-31 09:59:14monerjan Exp $4 $Date: 2009-04-01 14:07:20 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.26 2009-04-01 14:07:20 monerjan Exp $ 6 $Id: gfan.cc,v 1.26 2009-04-01 14:07:20 monerjan Exp $ 7 7 */ 8 8 … … 103 103 { 104 104 private: 105 int numFacets; //#of facets of the cone 105 int numFacets; //#of facets of the cone 106 106 107 107 public: … … 116 116 } 117 117 ~gcone(); //destructor 118 118 119 /** Pointer to the first facet */ 119 facet *facetPtr; //Will hold the adress of the first facet 120 facet *facetPtr; //Will hold the adress of the first facet; set by gcone::getConeNormals 120 121 poly gcMarkedTerm; //marked terms of the cone's Groebner basis 121 ideal gcBasis; //GB of the cone 122 int numVars; //#of variables in the ring 123 124 /** Contains the Groebner basis of the cone. Is set by gcone::getGB(ideal I)*/ 125 ideal gcBasis; //GB of the cone, set by gcone::getGB(); 122 126 gcone *next; //Pointer to *previous* cone in search tree 127 123 128 /** \brief Compute the normals of the cone 124 129 * … … 127 132 * Other methods for redundancy checkings might be implemented later. See Anders' diss p.44. 128 133 * Note that in order to use cddlib a 0-th column has to be added to the matrix since cddlib expects 129 * each row to represent an inequality of type const+x1+...+xn <= 0 134 * each row to represent an inequality of type const+x1+...+xn <= 0. While computing the normals we come across 135 * the set \f$ \partial\mathcal{G} \f$ which we might store for later use. C.f p71 of journal 130 136 * As a result of this procedure the pointer facetPtr points to the first facet of the cone. 131 137 */ … … 287 293 }//method getConeNormals(ideal I) 288 294 295 bool isParallel(int v[], intvec iv) 296 { 297 } 298 289 299 /** \brief Compute the Groebner Basis on the other side of a shared facet 290 300 * … … 293 303 * suffices. A term \f$ x^\gamma \f$ of \f$ g \f$ is in \f$ in_\omega(g) \f$ iff \f$ \gamma - leadexp(g)\f$ 294 304 * is parallel to \f$ leadexp(g) \f$ 295 * Checking for parallelity is done by computing the rank of the matrix consisting of the vectors in question. 296 * Another possibility would be to compute an interior point of the facet and taking all terms having the same 297 * weight with respect to this interior point. 305 * Checking for parallelity is done by brute force dividing of components. 306 * Other possibilitiesincludes computing the rank of the matrix consisting of the vectors in question and 307 * computing an interior point of the facet and taking all terms having the same weight with respect 308 * to this interior point. 298 309 *\param ideal, facet 310 * Input: a marked,reduced Groebner basis and a facet 299 311 */ 300 void flip(ideal I, facet *f) //Compute "the other side" 301 { 312 void flip(ideal gb, facet *f) //Compute "the other side" 313 { 314 intvec fNormal; //facet normal, check for parallelity 315 /* EXTREMELY EXPERIMENTAL CODE AHEAD*/ 302 316 /*1st step: Compute the initial ideal*/ 303 map mapping; 304 idhdl h; 305 ideal image; 306 mapping=IDMAP(h); 307 image=idInit(1,1); 308 image=maGetPreimage(currRing,mapping,image); 309 } 317 poly initialForm[IDELEMS(gb)]; //array of #polys in GB to store initial form 318 poly aktpoly; 319 int check[this->numVars]; //array to store the difference of LE and v 320 for (int ii=0;ii<IDELEMS(gb);ii++) 321 { 322 aktpoly = (poly)gb->m[ii]; 323 int *v=(int *)omAlloc((this->numVars+1)*sizeof(int)); 324 int *leadExpV=(int *)omAlloc((this->numVars+1)*sizeof(int)); 325 pGetExpV(aktpoly,leadExpV); //find the leading exponent in leadExpV[1],...,leadExpV[n], use pNext(p) 326 initialForm[ii]=pHead(aktpoly); 327 while(pNext(aktpoly)!=NULL) /*loop trough terms and check for parallelity*/ 328 { 329 aktpoly=pNext(aktpoly); //next term 330 pGetExpV(aktpoly,v); 331 for (int i=0;i<pVariables;i++) 332 { 333 check[i] = v[i]-leadExpV[i]; 334 } 335 if (isParallel(*check,fNormal)) //pass *check when 336 { 337 //initialForm[ii] += pHead(aktpoly); //This should add the respective term to 338 } 339 } 340 341 } 342 }//void flip(ideal gb, facet *f) 310 343 311 344 /** \brief Compute a Groebner Basis 312 345 * 313 * Computes the Groebner basis and stores the result in this->gcBasis346 * Computes the Groebner basis and stores the result in gcone::gcBasis 314 347 *\param ideal 315 348 *\return void … … 381 414 gcone *gcAct; 382 415 gcAct = gcRoot; 416 gcAct->numVars=pVariables; 383 417 gcAct->getGB(inputIdeal); 384 418 gcAct->getConeNormals(gcAct->gcBasis); //hopefully compute the normals
Note: See TracChangeset
for help on using the changeset viewer.