Changeset ec6c52 in git


Ignore:
Timestamp:
Mar 15, 2010, 6:44:29 PM (13 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
ce41a2e25be4abf8c322bc11839ec929ea281509
Parents:
51c652b54b758c047bef364cc0980f73faeb876e
Message:
Moved some methods from classes to static functions
Changed the way the interior point is made >0


git-svn-id: file:///usr/local/Singular/svn/trunk@12646 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    r51c652 rec6c52  
    118118}
    119119               
    120 /** \brief Constructor for facets of codim >= 2
     120/** \brief Constructor for facets of codim == 2
    121121* Note that as of now the code of the constructors is only for facets and codim2-faces. One
    122122* could easily change that by renaming numCodim2Facets to numCodimNminusOneFacets or similar
     
    128128        this->UCN=0;
    129129        this->codim2Ptr=NULL;
    130         if(n>1)
     130        if(n==2)
    131131        {
    132132                this->codim=n;
     
    261261
    262262/** Equality check for facets based on unique interior points*/
    263 inline bool gcone::areEqual2(facet* f, facet *g)
     263static bool areEqual2(facet* f, facet *g)
    264264{
    265265#ifdef gfanp
     
    269269#endif
    270270        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         else
    291                 res=FALSE;*/
    292271        const intvec *fIntP = f->getRef2InteriorPoint();
    293272        const intvec *gIntP = g->getRef2InteriorPoint();
    294         for(int ii=0;ii<this->numVars;ii++)
     273        for(int ii=0;ii<pVariables;ii++)
    295274        {
    296275                if( (*fIntP)[ii] != (*gIntP)[ii] )
     
    316295* int foo=((intvec*)f2Normal)->compare((intvec*)s2Normal) resulting in much higher memory usage
    317296*/
    318 inline bool gcone::areEqual(facet *f, facet *s)
     297static bool areEqual(facet *f, facet *s)
    319298{
    320299#ifdef gfanp
     
    706685        if(codim==2)
    707686                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         }*/     
    717687        while(f!=NULL)
    718688        {
     
    744714               
    745715/** For debugging purposes only */
    746 inline volatile void gcone::showSLA(facet &f)
     716static volatile void showSLA(facet &f)
    747717{
    748718        facet *fAct;
     
    783753}
    784754               
    785 inline void gcone::idDebugPrint(const ideal &I)
     755static void idDebugPrint(const ideal &I)
    786756{
    787757        int numElts=IDELEMS(I);
     
    796766}
    797767
    798 inline void gcone::invPrint(const ideal &I)
     768static void invPrint(const ideal &I)
    799769{
    800770//      int numElts=IDELEMS(I);
     
    808778}
    809779
    810 inline bool gcone::isMonomial(const ideal &I)
     780static bool isMonomial(const ideal &I)
    811781{
    812782        bool res = TRUE;
     
    869839 * an interior point of the cone.
    870840                 */
    871 inline void gcone::getConeNormals(const ideal &I, bool compIntPoint)
     841void gcone::getConeNormals(const ideal &I, bool compIntPoint)
    872842{
    873843#ifdef gfanp
     
    12471217 * the facet is marked as non-flippable.
    12481218 */
    1249 inline void gcone::getCodim2Normals(const gcone &gc)
     1219void gcone::getCodim2Normals(const gcone &gc)
    12501220{
    12511221#ifdef gfanp
     
    15201490        {
    15211491                intvec *ivOne = new intvec(this->numVars);
     1492                int maxNegEntry=0;
    15221493                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];
    15311497                }
     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//              }
    15321513                delete ivOne;
    15331514                int ggT=(*ivIntPointOfCone)[0];
     
    24622443/** \brief Compute the negative of a given intvec
    24632444        */             
    2464 inline intvec *gcone::ivNeg(const intvec *iv)
     2445static intvec* ivNeg(const intvec *iv)
    24652446{       //Hm, switching to intvec const intvec does no longer work
    24662447        intvec *res;// = new intvec(iv->length());
     
    24742455*
    24752456*/
    2476 inline int gcone::dotProduct(const intvec &iva, const intvec &ivb)                             
     2457static int dotProduct(const intvec &iva, const intvec &ivb)                             
    24772458{                       
    24782459        int res=0;     
    2479         for (int i=0;i<this->numVars;i++)
     2460        for (int i=0;i<pVariables;i++)
    24802461        {
    24812462// #ifndef NDEBUG
     
    24902471 * \f$ \alpha\parallel\beta\Leftrightarrow\langle\alpha,\beta\rangle^2=\langle\alpha,\alpha\rangle\langle\beta,\beta\rangle \f$
    24912472 */
    2492 inline bool gcone::isParallel(const intvec &a,const intvec &b)
     2473static bool isParallel(const intvec &a,const intvec &b)
    24932474{       
    24942475/*#ifdef gfanp 
     
    25202501 * Any rational point is automatically converted into an integer.
    25212502 */
    2522 inline void gcone::interiorPoint( dd_MatrixPtr &M, intvec &iv) //no const &M here since we want to remove redundant rows
     2503void gcone::interiorPoint( dd_MatrixPtr &M, intvec &iv) //no const &M here since we want to remove redundant rows
    25232504{
    25242505        dd_LPPtr lp,lpInt;
     
    26352616*NOTE no longer used nor maintained. MM Mar 9, 2010
    26362617*/
    2637 inline void gcone::interiorPoint2()
     2618void gcone::interiorPoint2()
    26382619{//idPrint(this->gcBasis);
    26392620#ifdef gfan_DEBUG
     
    28882869/** \brief Check for equality of two intvecs
    28892870 */
    2890 inline bool gcone::ivAreEqual(const intvec &a, const intvec &b)
     2871static bool ivAreEqual(const intvec &a, const intvec &b)
    28912872{
    28922873        bool res=TRUE;
    2893         for(int ii=0;ii<this->numVars;ii++)
     2874        for(int ii=0;ii<pVariables;ii++)
    28942875        {
    28952876                if(a[ii]!=b[ii])
     
    33283309 * \param dd_MatrixPtr,intvec
    33293310 */
    3330 inline void gcone::makeInt(const dd_MatrixPtr &M, const int line, intvec &n)
     3311void gcone::makeInt(const dd_MatrixPtr &M, const int line, intvec &n)
    33313312{                       
    33323313//      mpz_t denom[this->numVars];
     
    33983379 * Actually we now also normalize the facet normals.
    33993380 */
    3400 inline void gcone::normalize()
     3381void gcone::normalize()
    34013382{
    34023383//      int *ggT = new int;
     
    37963777* gc->gcBasis
    37973778*/
    3798 inline void gcone::replaceDouble_ringorder_a_ByASingleOne()
     3779void gcone::replaceDouble_ringorder_a_ByASingleOne()
    37993780{
    38003781        ring srcRing=currRing;
     
    39043885 * Each section starts with its name in CAPITALS
    39053886 */
    3906 inline void gcone::writeConeToFile(const gcone &gc, bool usingIntPoints)
     3887void gcone::writeConeToFile(const gcone &gc, bool usingIntPoints)
    39073888{
    39083889        int UCN=gc.UCN;
     
    40033984* ||1 => flip2
    40043985*/
    4005 inline void gcone::readConeFromFile(int UCN, gcone *gc)
     3986void gcone::readConeFromFile(int UCN, gcone *gc)
    40063987{
    40073988        //int UCN=gc.UCN;
     
    42284209/** \brief Sort the rays of a facet lexicographically
    42294210*/
    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;
    42344215//      while(fAct->next!=NULL)
    42354216//      {
    42364217//              if(fAct->fNormal->compare(fAct->fNormal->next)==-1
    42374218//      }
    4238 }
     4219// }
    42394220
    42404221/** \brief Gather the output
     
    43904371lists gfan(ideal inputIdeal, int h)
    43914372{
    4392         lists lResList; //this is the object we return
    4393        
     4373        lists lResList; //this is the object we return 
     4374
    43944375        if(rHasGlobalOrdering(currRing))
    43954376        {       
     
    44364417        //              idShow(gcAct->gcBasis);
    44374418        #endif
    4438                         if(gcAct->isMonomial(gcAct->gcBasis))
     4419                        if(isMonomial(gcAct->gcBasis))
    44394420                        {//FIXME
    44404421                                WerrorS("Monomial input - terminating");
  • kernel/gfan.h

    r51c652 rec6c52  
    5353                /** \brief The codim of the facet
    5454                 */
    55                 int codim;
     55                short codim;
    5656               
    5757                /** \brief The Groebner basis on the other side of a shared facet
     
    7878                ring flipRing;          //the ring on the other side of the facet
    7979                intvec **fRays;
    80                                        
     80                               
    8181                /** The default constructor. */
    8282                facet();
     
    125125};
    126126
     127               
    127128/**
    128129 *\brief Implements the cone structure
     
    216217                inline int getPredUCN();               
    217218                volatile void showFacets(short codim=1);
    218                 inline volatile void showSLA(facet &f);
    219                 inline void idDebugPrint(const ideal &I);
    220                 inline void invPrint(const ideal &I);
    221                 inline bool isMonomial(const ideal &I);
    222                 inline intvec *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);
    223224//              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);
    231228//              inline int intgcd(const int &a, const int &b);
    232                 inline void writeConeToFile(const gcone &gc, bool usingIntPoints=FALSE);
    233                 inline void readConeFromFile(int gcNum, gcone *gc);
    234                 inline 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);
    236233                //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
    243241                inline ideal ffG(const ideal &H, const ideal &G);
    244242                inline void getGB(ideal const &inputIdeal);             
    245                 inline void interiorPoint( dd_MatrixPtr &M, intvec &iv);
    246                 inline void interiorPoint2(); //removed Feb 8th, 2010, new method Feb 19th, 2010
    247                 inline void 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);
    248246                ring rCopyAndAddWeight(const ring &r, intvec *ivw);
    249247                ring rCopyAndAddWeight2(const ring &, const intvec *, const intvec *);
     
    251249//              void reverseSearch(gcone *gcAct); //NOTE both removed from r12286
    252250//              bool isSearchFacet(gcone &gcTmp, facet *testfacet);
    253                 void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE);
    254                 inline void makeInt(const dd_MatrixPtr &M, const int line, intvec &n);
    255                 inline void normalize();
     251//              void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE);
     252                void makeInt(const dd_MatrixPtr &M, const int line, intvec &n);
     253                void normalize();
    256254                facet * enqueueNewFacets(facet *f);
    257255                facet * enqueue2(facet *f);
    258256                dd_MatrixPtr facets2Matrix(const gcone &gc);
    259257                /** Compute the lineality space Ax=0 and return it as dd_MatrixPtr dd_LinealitySpace*/
    260                 inline dd_MatrixPtr computeLinealitySpace();
     258                dd_MatrixPtr computeLinealitySpace();
    261259                inline bool iv64isStrictlyPositive(const intvec *);
    262260                /** Exchange 2 ordertype_a by just 1 */
    263                 inline void replaceDouble_ringorder_a_ByASingleOne();
     261                void replaceDouble_ringorder_a_ByASingleOne();
    264262//              static void gcone::idPrint(ideal &I);           
    265                 friend class facet;     
     263//              friend class facet;     
    266264};
    267265lists lprepareResult(gcone *gc, const int n);
    268266static int intgcd(const int &a, const int &b);
     267static int dotProduct(const intvec &iva, const intvec &ivb);
     268static bool isParallel(const intvec &a, const intvec &b);
     269static intvec *ivNeg(const intvec *iv);
     270static void idDebugPrint(const ideal &I);
     271static volatile void showSLA(facet &f);
     272static bool isMonomial(const ideal &I);
     273static bool ivAreEqual(const intvec &a, const intvec &b);
     274static bool areEqual2(facet* f, facet *g);
     275static bool areEqual( facet *f,  facet *g);
    269276// bool iv64isStrictlyPositive(intvec *);
    270277#endif
Note: See TracChangeset for help on using the changeset viewer.