Changeset 5ece85 in git


Ignore:
Timestamp:
Jan 29, 2010, 10:51:19 AM (13 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
20d4b60dbf3e6336262bc0f3909917d6f602bbe6
Parents:
be6689fe956f0a8b1125b510d5502af93d70d021
Message:
int facet::numRays serves the same as numCodim2Facets
Crude idea of sorting rays lexicographically


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    rbe6689f r5ece85  
    3232#include <time.h>
    3333#include <sys/time.h>
     34#include <stdlib.h>
    3435//#include <gmpxx.h>
    35 #include <vector>
     36// #include <vector>
     37
    3638
    3739/*DO NOT REMOVE THIS*/
     
    9395        this->codim=1;          //default for (codim-1)-facets
    9496        this->numCodim2Facets=0;
     97        this->numRays=0;
    9598        this->flipGB=NULL;
    9699        this->isIncoming=FALSE;
     
    116119        }//NOTE Handle exception here!                 
    117120        this->numCodim2Facets=0;
     121        this->numRays=0;
    118122        this->flipGB=NULL;
    119123        this->isIncoming=FALSE;
     
    503507 * This is mainly for debugging purposes. Usually called from within gdb
    504508 */
    505 inline void gcone::showFacets(const short codim)
    506 {
    507         facet *f;
    508         switch(codim)
     509volatile void gcone::showFacets(const short codim)
     510{
     511        facet *f=this->facetPtr;
     512        facet *f2=NULL;
     513        if(codim==2)
     514                f2=this->facetPtr->codim2Ptr;
     515        /*switch(codim)
    509516        {
    510517                case 1:
     
    512519                        break;
    513520                case 2:
    514                         f = this->facetPtr->codim2Ptr;
     521                        f2 = this->facetPtr->codim2Ptr;
    515522                        break;
    516         }       
     523        }*/     
    517524        while(f!=NULL)
    518525        {
     
    526533                        cout << ") ";
    527534                delete iv;
     535                if(codim==2)
     536                {
     537                        f2=f->codim2Ptr;
     538                        while(f2!=NULL)
     539                        {
     540                                cout << "[";
     541                                f2->getFacetNormal()->show(1,0);
     542                                cout << "]";
     543                                f2 = f2->next;
     544                        }
     545                        cout << endl;
     546                }
    528547                f=f->next;
    529548        }
     
    11821201        dd_MatrixPtr P;
    11831202        P=dd_CopyGenerators(ddPolyh);
    1184         dd_FreePolyhedra(ddPolyh);
     1203        dd_FreePolyhedra(ddPolyh);     
    11851204        //Loop through the rows of P and check whether fNormal*row[i]=0 => row[i] belongs to fNormal
    11861205        int rows=P->rowsize;
     
    12091228                                }
    12101229                                codim2Act->setFacetNormal(rowvec);
    1211                                 //Check flippability                           
     1230                                fAct->numRays++;                       
    12121231                        }
    12131232                        delete(rowvec);
    1214                 }               
     1233                }
     1234                //Now (if we have at least 3 variables) do a bubblesort on the rays
     1235                /*if(this->numVars>2)
     1236                {
     1237                        facet *A[fAct->numRays-1];
     1238                        facet *f2Act=fAct->codim2Ptr;
     1239                        for(unsigned ii=0;ii<fAct->numRays;ii++)
     1240                        {
     1241                                A[ii]=f2Act;
     1242                                f2Act=f2Act->next;
     1243                        }
     1244                        bool exchanged=FALSE;
     1245                        unsigned n=fAct->numRays-1;
     1246                        do
     1247                        {
     1248                                exchanged=FALSE;//n=fAct->numRays-1;                           
     1249                                for(unsigned ii=0;ii<=n-1;ii++)
     1250                                {                                       
     1251                                        if((A[ii]->fNormal)->compare((A[ii+1]->fNormal))==1)
     1252                                        {
     1253                                                //Swap rays
     1254                                                cout << "Swapping ";
     1255                                                A[ii]->fNormal->show(1,0); cout << " with "; A[ii+1]->fNormal->show(1,0); cout << endl;
     1256                                                A[ii]->next=A[ii+1]->next;
     1257                                                if(ii>0)
     1258                                                        A[ii-1]->next=A[ii+1];
     1259                                                A[ii+1]->next=A[ii];
     1260                                                if(ii==0)
     1261                                                        fAct->codim2Ptr=A[ii+1];
     1262                                                //end swap
     1263                                                facet *tmp=A[ii];//swap in list
     1264                                                A[ii+1]=A[ii];
     1265                                                A[ii]=tmp;
     1266//                                              tmp=NULL;                       
     1267                                        }                                       
     1268                                }
     1269                                n--;                   
     1270                        }while(exchanged==TRUE && n>=0);
     1271                }*///if pVariables>2
    12151272                delete fNormal;         
    12161273                fAct = fAct->next;
     
    12181275        //Now all extremal rays should be set w.r.t their respective fNormal
    12191276        //TODO Not sufficient -> vol2 II/125&127
     1277        //NOTE Sufficient according to cddlibs doc. These ARE rays
    12201278        fAct=gc.facetPtr;
    12211279        while(fAct!=NULL)
     
    12501308                fAct = fAct->next;
    12511309        }
     1310       
     1311       
    12521312#ifdef gfanp
    12531313        gettimeofday(&end, 0);
     
    16481708                        }
    16491709                        if (isParallel(*check,fNormal)) //pass *check when
     1710//                      if(fNormal.compare(check)==0)
    16501711                        {
    16511712                                //Found a parallel vector. Add it
     
    22902351                                        //while(codim2Act!=NULL)
    22912352                        for(int jj=0;jj<fAct->numCodim2Facets;jj++)
     2353//                      for(int jj=0;jj<fAct->numRays-1;jj++)
    22922354                        {
    22932355                                intvec *f2Normal;
     
    31473209        return rCopy(this->baseRing);
    31483210}
     3211/** \brief Sort the rays of a facet lexicographically
     3212*/
     3213void gcone::sortRays(gcone *gc)
     3214{
     3215        facet *fAct;
     3216        fAct = this->facetPtr->codim2Ptr;
     3217//      while(fAct->next!=NULL)
     3218//      {
     3219//              if(fAct->fNormal->compare(fAct->fNormal->next)==-1
     3220//      }
     3221}
     3222
    31493223/** \brief Gather the output
    31503224* List of lists
  • kernel/gfan.h

    rbe6689f r5ece85  
    7676                int numCodim2Facets;    //#of (codim-2)-facets of this facet. Set in getCodim2Normals()
    7777                ring flipRing;          //the ring on the other side of the facet
    78                                        
     78                unsigned numRays;       //Number of spanning rays of the cone                   
    7979                /** The default constructor. */
    8080                facet();
     
    195195                inline int getUCN();
    196196                inline int getPredUCN();               
    197                 inline void showFacets(short codim=1);
     197                volatile void showFacets(short codim=1);
    198198                inline volatile void showSLA(facet &f);
    199199                inline void idDebugPrint(const ideal &I);
     
    209209                inline void readConeFromFile(int gcNum, gcone *gc);
    210210                inline intvec f2M(gcone *gc, facet *f, int n=1);
    211                
     211                inline void sortRays(gcone *gc);
    212212                //The real stuff
    213213                inline void getConeNormals(const ideal &I, bool compIntPoint=FALSE);
Note: See TracChangeset for help on using the changeset viewer.