Changeset ec6c52 in git
- Timestamp:
- Mar 15, 2010, 6:44:29 PM (13 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- ce41a2e25be4abf8c322bc11839ec929ea281509
- Parents:
- 51c652b54b758c047bef364cc0980f73faeb876e
- Location:
- kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
r51c652 rec6c52 118 118 } 119 119 120 /** \brief Constructor for facets of codim >= 2120 /** \brief Constructor for facets of codim == 2 121 121 * Note that as of now the code of the constructors is only for facets and codim2-faces. One 122 122 * could easily change that by renaming numCodim2Facets to numCodimNminusOneFacets or similar … … 128 128 this->UCN=0; 129 129 this->codim2Ptr=NULL; 130 if(n >1)130 if(n==2) 131 131 { 132 132 this->codim=n; … … 261 261 262 262 /** Equality check for facets based on unique interior points*/ 263 inline bool gcone::areEqual2(facet* f, facet *g)263 static bool areEqual2(facet* f, facet *g) 264 264 { 265 265 #ifdef gfanp … … 269 269 #endif 270 270 bool res = TRUE; 271 // const intvec *fNormal;272 // const intvec *gNormal;273 // fNormal = f->getRef2FacetNormal();274 // gNormal = g->getRef2FacetNormal();275 // intvec *fNRef=const_cast<intvec*>(fNormal);276 // intvec *gNRef=const_cast<intvec*>(gNormal);277 /*if(isParallel(fNRef,*gNRef))278 {279 const intvec *fIntP = f->getRef2InteriorPoint();280 const intvec *gIntP = g->getRef2InteriorPoint();281 for(int ii=0;ii<this->numVars;ii++)282 {283 if( (*fIntP)[ii] != (*gIntP)[ii] )284 {285 res=FALSE;286 break;287 }288 }289 }290 else291 res=FALSE;*/292 271 const intvec *fIntP = f->getRef2InteriorPoint(); 293 272 const intvec *gIntP = g->getRef2InteriorPoint(); 294 for(int ii=0;ii< this->numVars;ii++)273 for(int ii=0;ii<pVariables;ii++) 295 274 { 296 275 if( (*fIntP)[ii] != (*gIntP)[ii] ) … … 316 295 * int foo=((intvec*)f2Normal)->compare((intvec*)s2Normal) resulting in much higher memory usage 317 296 */ 318 inline bool gcone::areEqual(facet *f, facet *s)297 static bool areEqual(facet *f, facet *s) 319 298 { 320 299 #ifdef gfanp … … 706 685 if(codim==2) 707 686 f2=this->facetPtr->codim2Ptr; 708 /*switch(codim)709 {710 case 1:711 f = this->facetPtr;712 break;713 case 2:714 f2 = this->facetPtr->codim2Ptr;715 break;716 }*/717 687 while(f!=NULL) 718 688 { … … 744 714 745 715 /** For debugging purposes only */ 746 inline volatile void gcone::showSLA(facet &f)716 static volatile void showSLA(facet &f) 747 717 { 748 718 facet *fAct; … … 783 753 } 784 754 785 inline void gcone::idDebugPrint(const ideal &I)755 static void idDebugPrint(const ideal &I) 786 756 { 787 757 int numElts=IDELEMS(I); … … 796 766 } 797 767 798 inline void gcone::invPrint(const ideal &I)768 static void invPrint(const ideal &I) 799 769 { 800 770 // int numElts=IDELEMS(I); … … 808 778 } 809 779 810 inline bool gcone::isMonomial(const ideal &I)780 static bool isMonomial(const ideal &I) 811 781 { 812 782 bool res = TRUE; … … 869 839 * an interior point of the cone. 870 840 */ 871 inlinevoid gcone::getConeNormals(const ideal &I, bool compIntPoint)841 void gcone::getConeNormals(const ideal &I, bool compIntPoint) 872 842 { 873 843 #ifdef gfanp … … 1247 1217 * the facet is marked as non-flippable. 1248 1218 */ 1249 inlinevoid gcone::getCodim2Normals(const gcone &gc)1219 void gcone::getCodim2Normals(const gcone &gc) 1250 1220 { 1251 1221 #ifdef gfanp … … 1520 1490 { 1521 1491 intvec *ivOne = new intvec(this->numVars); 1492 int maxNegEntry=0; 1522 1493 for(int ii=0;ii<this->numVars;ii++) 1523 (*ivOne)[ii]=1; 1524 while( !iv64isStrictlyPositive(ivIntPointOfCone) ) 1525 { 1526 intvec *tmp = ivIntPointOfCone; 1527 for(int jj=0;jj<this->numVars;jj++) 1528 (*ivOne)[jj] = (*ivOne)[jj] << 1; //times 2 1529 ivIntPointOfCone = ivAdd(ivIntPointOfCone,ivOne); 1530 delete tmp; 1494 { 1495 // (*ivOne)[ii]=1; 1496 if ((*ivIntPointOfCone)[ii]<maxNegEntry) maxNegEntry=(*ivIntPointOfCone)[ii]; 1531 1497 } 1498 maxNegEntry *= -1; 1499 maxNegEntry++;//To be on the safe side 1500 for(int ii=0;ii<this->numVars;ii++) 1501 (*ivOne)[ii]=maxNegEntry; 1502 intvec *tmp=ivIntPointOfCone; 1503 ivIntPointOfCone=ivAdd(ivIntPointOfCone,ivOne); 1504 delete(tmp); 1505 // while( !iv64isStrictlyPositive(ivIntPointOfCone) ) 1506 // { 1507 // intvec *tmp = ivIntPointOfCone; 1508 // for(int jj=0;jj<this->numVars;jj++) 1509 // (*ivOne)[jj] = (*ivOne)[jj] << 1; //times 2 1510 // ivIntPointOfCone = ivAdd(ivIntPointOfCone,ivOne); 1511 // delete tmp; 1512 // } 1532 1513 delete ivOne; 1533 1514 int ggT=(*ivIntPointOfCone)[0]; … … 2462 2443 /** \brief Compute the negative of a given intvec 2463 2444 */ 2464 inline intvec *gcone::ivNeg(const intvec *iv)2445 static intvec* ivNeg(const intvec *iv) 2465 2446 { //Hm, switching to intvec const intvec does no longer work 2466 2447 intvec *res;// = new intvec(iv->length()); … … 2474 2455 * 2475 2456 */ 2476 inline int gcone::dotProduct(const intvec &iva, const intvec &ivb)2457 static int dotProduct(const intvec &iva, const intvec &ivb) 2477 2458 { 2478 2459 int res=0; 2479 for (int i=0;i< this->numVars;i++)2460 for (int i=0;i<pVariables;i++) 2480 2461 { 2481 2462 // #ifndef NDEBUG … … 2490 2471 * \f$ \alpha\parallel\beta\Leftrightarrow\langle\alpha,\beta\rangle^2=\langle\alpha,\alpha\rangle\langle\beta,\beta\rangle \f$ 2491 2472 */ 2492 inline bool gcone::isParallel(const intvec &a,const intvec &b)2473 static bool isParallel(const intvec &a,const intvec &b) 2493 2474 { 2494 2475 /*#ifdef gfanp … … 2520 2501 * Any rational point is automatically converted into an integer. 2521 2502 */ 2522 inlinevoid gcone::interiorPoint( dd_MatrixPtr &M, intvec &iv) //no const &M here since we want to remove redundant rows2503 void gcone::interiorPoint( dd_MatrixPtr &M, intvec &iv) //no const &M here since we want to remove redundant rows 2523 2504 { 2524 2505 dd_LPPtr lp,lpInt; … … 2635 2616 *NOTE no longer used nor maintained. MM Mar 9, 2010 2636 2617 */ 2637 inlinevoid gcone::interiorPoint2()2618 void gcone::interiorPoint2() 2638 2619 {//idPrint(this->gcBasis); 2639 2620 #ifdef gfan_DEBUG … … 2888 2869 /** \brief Check for equality of two intvecs 2889 2870 */ 2890 inline bool gcone::ivAreEqual(const intvec &a, const intvec &b)2871 static bool ivAreEqual(const intvec &a, const intvec &b) 2891 2872 { 2892 2873 bool res=TRUE; 2893 for(int ii=0;ii< this->numVars;ii++)2874 for(int ii=0;ii<pVariables;ii++) 2894 2875 { 2895 2876 if(a[ii]!=b[ii]) … … 3328 3309 * \param dd_MatrixPtr,intvec 3329 3310 */ 3330 inlinevoid gcone::makeInt(const dd_MatrixPtr &M, const int line, intvec &n)3311 void gcone::makeInt(const dd_MatrixPtr &M, const int line, intvec &n) 3331 3312 { 3332 3313 // mpz_t denom[this->numVars]; … … 3398 3379 * Actually we now also normalize the facet normals. 3399 3380 */ 3400 inlinevoid gcone::normalize()3381 void gcone::normalize() 3401 3382 { 3402 3383 // int *ggT = new int; … … 3796 3777 * gc->gcBasis 3797 3778 */ 3798 inlinevoid gcone::replaceDouble_ringorder_a_ByASingleOne()3779 void gcone::replaceDouble_ringorder_a_ByASingleOne() 3799 3780 { 3800 3781 ring srcRing=currRing; … … 3904 3885 * Each section starts with its name in CAPITALS 3905 3886 */ 3906 inlinevoid gcone::writeConeToFile(const gcone &gc, bool usingIntPoints)3887 void gcone::writeConeToFile(const gcone &gc, bool usingIntPoints) 3907 3888 { 3908 3889 int UCN=gc.UCN; … … 4003 3984 * ||1 => flip2 4004 3985 */ 4005 inlinevoid gcone::readConeFromFile(int UCN, gcone *gc)3986 void gcone::readConeFromFile(int UCN, gcone *gc) 4006 3987 { 4007 3988 //int UCN=gc.UCN; … … 4228 4209 /** \brief Sort the rays of a facet lexicographically 4229 4210 */ 4230 void gcone::sortRays(gcone *gc)4231 {4232 facet *fAct;4233 fAct = this->facetPtr->codim2Ptr;4211 // void gcone::sortRays(gcone *gc) 4212 // { 4213 // facet *fAct; 4214 // fAct = this->facetPtr->codim2Ptr; 4234 4215 // while(fAct->next!=NULL) 4235 4216 // { 4236 4217 // if(fAct->fNormal->compare(fAct->fNormal->next)==-1 4237 4218 // } 4238 }4219 // } 4239 4220 4240 4221 /** \brief Gather the output … … 4390 4371 lists gfan(ideal inputIdeal, int h) 4391 4372 { 4392 lists lResList; //this is the object we return 4393 4373 lists lResList; //this is the object we return 4374 4394 4375 if(rHasGlobalOrdering(currRing)) 4395 4376 { … … 4436 4417 // idShow(gcAct->gcBasis); 4437 4418 #endif 4438 if( gcAct->isMonomial(gcAct->gcBasis))4419 if(isMonomial(gcAct->gcBasis)) 4439 4420 {//FIXME 4440 4421 WerrorS("Monomial input - terminating"); -
kernel/gfan.h
r51c652 rec6c52 53 53 /** \brief The codim of the facet 54 54 */ 55 int codim;55 short codim; 56 56 57 57 /** \brief The Groebner basis on the other side of a shared facet … … 78 78 ring flipRing; //the ring on the other side of the facet 79 79 intvec **fRays; 80 80 81 81 /** The default constructor. */ 82 82 facet(); … … 125 125 }; 126 126 127 127 128 /** 128 129 *\brief Implements the cone structure … … 216 217 inline int getPredUCN(); 217 218 volatile void showFacets(short codim=1); 218 inlinevolatile void showSLA(facet &f);219 inlinevoid idDebugPrint(const ideal &I);220 inlinevoid invPrint(const ideal &I);221 inlinebool isMonomial(const ideal &I);222 inlineintvec *ivNeg(const intvec *iv);219 // volatile void showSLA(facet &f); 220 // void idDebugPrint(const ideal &I); 221 // void invPrint(const ideal &I); 222 // bool isMonomial(const ideal &I); 223 // intvec *ivNeg(const intvec *iv); 223 224 // inline int dotProduct(intvec &iva, intvec &ivb); 224 inline int dotProduct(const intvec &iva, const intvec &ivb); 225 inline bool isParallel(const intvec &a, const intvec &b); 226 // inline int dotProduct(const intvec* a, const intvec *b); 227 // inline bool isParallel(const intvec* a, const intvec* b); 228 inline bool ivAreEqual(const intvec &a, const intvec &b); 229 inline bool areEqual( facet *f, facet *g); 230 inline bool areEqual2(facet* f, facet *g); 225 // inline int dotProduct(const intvec &iva, const intvec &ivb); 226 // inline bool isParallel(const intvec &a, const intvec &b); 227 void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE); 231 228 // inline int intgcd(const int &a, const int &b); 232 inlinevoid writeConeToFile(const gcone &gc, bool usingIntPoints=FALSE);233 inlinevoid readConeFromFile(int gcNum, gcone *gc);234 in line intvec f2M(gcone *gc, facet *f, int n=1);235 inline void sortRays(gcone *gc);229 void writeConeToFile(const gcone &gc, bool usingIntPoints=FALSE); 230 void readConeFromFile(int gcNum, gcone *gc); 231 intvec f2M(gcone *gc, facet *f, int n=1); 232 // inline void sortRays(gcone *gc); 236 233 //The real stuff 237 inline void getConeNormals(const ideal &I, bool compIntPoint=FALSE); 238 inline void getCodim2Normals(const gcone &gc); 239 inline void getExtremalRays(const gcone &gc); 240 inline void flip(ideal gb, facet *f); 241 inline void flip2(const ideal gb, facet *f); 242 inline void computeInv(const ideal &gb, ideal &inv, const intvec &f);// poly restOfDiv(poly const &f, ideal const &I); removed with r12286 234 void getConeNormals(const ideal &I, bool compIntPoint=FALSE); 235 void getCodim2Normals(const gcone &gc); 236 void getExtremalRays(const gcone &gc); 237 void flip(ideal gb, facet *f); 238 void flip2(const ideal gb, facet *f); 239 void computeInv(const ideal &gb, ideal &inv, const intvec &f); 240 //poly restOfDiv(poly const &f, ideal const &I); removed with r12286 243 241 inline ideal ffG(const ideal &H, const ideal &G); 244 242 inline void getGB(ideal const &inputIdeal); 245 inlinevoid interiorPoint( dd_MatrixPtr &M, intvec &iv);246 inlinevoid interiorPoint2(); //removed Feb 8th, 2010, new method Feb 19th, 2010247 inlinevoid preprocessInequalities(dd_MatrixPtr &M);243 void interiorPoint( dd_MatrixPtr &M, intvec &iv); 244 void interiorPoint2(); //removed Feb 8th, 2010, new method Feb 19th, 2010 245 void preprocessInequalities(dd_MatrixPtr &M); 248 246 ring rCopyAndAddWeight(const ring &r, intvec *ivw); 249 247 ring rCopyAndAddWeight2(const ring &, const intvec *, const intvec *); … … 251 249 // void reverseSearch(gcone *gcAct); //NOTE both removed from r12286 252 250 // bool isSearchFacet(gcone &gcTmp, facet *testfacet); 253 void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE);254 inlinevoid makeInt(const dd_MatrixPtr &M, const int line, intvec &n);255 inlinevoid normalize();251 // void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE); 252 void makeInt(const dd_MatrixPtr &M, const int line, intvec &n); 253 void normalize(); 256 254 facet * enqueueNewFacets(facet *f); 257 255 facet * enqueue2(facet *f); 258 256 dd_MatrixPtr facets2Matrix(const gcone &gc); 259 257 /** Compute the lineality space Ax=0 and return it as dd_MatrixPtr dd_LinealitySpace*/ 260 inlinedd_MatrixPtr computeLinealitySpace();258 dd_MatrixPtr computeLinealitySpace(); 261 259 inline bool iv64isStrictlyPositive(const intvec *); 262 260 /** Exchange 2 ordertype_a by just 1 */ 263 inlinevoid replaceDouble_ringorder_a_ByASingleOne();261 void replaceDouble_ringorder_a_ByASingleOne(); 264 262 // static void gcone::idPrint(ideal &I); 265 friend class facet;263 // friend class facet; 266 264 }; 267 265 lists lprepareResult(gcone *gc, const int n); 268 266 static int intgcd(const int &a, const int &b); 267 static int dotProduct(const intvec &iva, const intvec &ivb); 268 static bool isParallel(const intvec &a, const intvec &b); 269 static intvec *ivNeg(const intvec *iv); 270 static void idDebugPrint(const ideal &I); 271 static volatile void showSLA(facet &f); 272 static bool isMonomial(const ideal &I); 273 static bool ivAreEqual(const intvec &a, const intvec &b); 274 static bool areEqual2(facet* f, facet *g); 275 static bool areEqual( facet *f, facet *g); 269 276 // bool iv64isStrictlyPositive(intvec *); 270 277 #endif
Note: See TracChangeset
for help on using the changeset viewer.