Changeset 64b6c6 in git


Ignore:
Timestamp:
Sep 13, 2010, 2:46:28 PM (14 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
ce35eb186c60fc2922d2d106228a4d3a2cb87a5b
Parents:
c292b2f02aae398d9441027fcf6031ee977365e1
Message:
Resolved conflict


git-svn-id: file:///usr/local/Singular/svn/trunk@13181 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    rc292b2 r64b6c6  
    6262
    6363#ifdef p800
    64 #include <../cddlib/include/setoper.h>
    65 #include <../cddlib/include/cdd.h>
    66 #include <../cddlib/include/cddmp.h>
     64#include <../../cddlib/include/setoper.h>
     65#include <../../cddlib/include/cdd.h>
     66#include <../../cddlib/include/cddmp.h>
    6767#endif
    6868
     
    30363036{       
    30373037        facet *SearchListRoot = new facet(); //The list containing ALL facets we come across
    3038 //      vector<facet> stlRoot;
    30393038        facet *SearchListAct;
    30403039        SearchListAct = NULL;
    3041         //SearchListAct = SearchListRoot;
    3042                        
     3040        //SearchListAct = SearchListRoot;                       
    30433041        gcone *gcAct;
    30443042        gcAct = &gcRoot;
     
    30483046        gcNext = &gcRoot;
    30493047        gcone *gcHead;
    3050         gcHead = &gcRoot;
    3051                        
     3048        gcHead = &gcRoot;                       
    30523049        facet *fAct;
    3053         fAct = gcAct->facetPtr;                 
    3054                        
     3050        fAct = gcAct->facetPtr;                         
    30553051        ring rAct;
    30563052        rAct = currRing;
    3057                                                
    3058         int UCNcounter=gcAct->getUCN();
    3059        
     3053        int UCNcounter=gcAct->getUCN();
    30603054#ifdef gfan_DEBUG
    30613055        printf("NoRevs\n");
     
    30683062                dd_LinealitySpace = gcAct->computeLinealitySpace();
    30693063        /*End of lineality space computation*/         
    3070 //      gcAct->getCodim2Normals(*gcAct);
     3064        //gcAct->getCodim2Normals(*gcAct);
    30713065        if(fAct->codim2Ptr==NULL)
    3072                 gcAct->getExtremalRays(*gcAct);
    3073                                
    3074         //Compute unique representation of Facets and rays, i.e. primitive vectors
    3075 //      gcAct->normalize();
    3076                        
     3066                gcAct->getExtremalRays(*gcAct);         
    30773067        /* Make a copy of the facet list of first cone
    30783068           Since the operations getCodim2Normals and normalize affect the facets
     
    30903080                        if( ii==0 || (ii>0 && SearchListAct==NULL) ) //1st facet may be non-flippable
    30913081                        {
    3092                                 if(SearchListRoot!=NULL)
    3093                                         delete(SearchListRoot);
     3082                                if(SearchListRoot!=NULL) delete(SearchListRoot);
    30943083                                SearchListRoot = fAct->shallowCopy(*fAct);
    30953084                                SearchListAct = SearchListRoot; //SearchListRoot is already 'new'ed at beginning of method!
     
    31193108                        SearchListAct->isFlippable=TRUE;
    31203109                        //Copy int point as well
    3121                         int64vec *ivIntPt;// = new int64vec(this->numVars);
     3110                        int64vec *ivIntPt;
    31223111                        ivIntPt = fAct->getInteriorPoint();
    31233112                        SearchListAct->setInteriorPoint(ivIntPt);
     
    31313120                        SearchListAct->codim2Ptr = new facet(2);
    31323121                        sl2Root = SearchListAct->codim2Ptr;
    3133                         sl2Act = sl2Root;
    3134                                         //while(codim2Act!=NULL)
     3122                        sl2Act = sl2Root;                       
    31353123                        for(int jj=0;jj<fAct->numCodim2Facets;jj++)
    31363124//                      for(int jj=0;jj<fAct->numRays-1;jj++)
     
    31763164                if(SearchListAct->next!=NULL){
    31773165#endif
    3178 //              if(SearchListAct->next!=NULL)
    3179 //              {
    31803166                        SearchListAct->next->prev = SearchListAct;                                     
    31813167                }
     
    32023188                        //NOTE rCopy needed?
    32033189                        ring rTmp=rCopy(fAct->flipRing);
    3204 //                      ring rTmp=fAct->flipRing; //segfaults
    32053190                        rComplete(rTmp);
    32063191                        rChangeCurrRing(rTmp);
     
    32153200                        */
    32163201                        idDelete((ideal *)&fAct->flipGB);
    3217                         rDelete(fAct->flipRing);
    3218                        
    3219                         gcTmp->getConeNormals(gcTmp->gcBasis/*, FALSE*/);       //TODO FALSE is default, so should not be needed here
     3202                        rDelete(fAct->flipRing);                       
     3203                        gcTmp->getConeNormals(gcTmp->gcBasis/*, FALSE*/);
    32203204//                      gcTmp->getCodim2Normals(*gcTmp);
    32213205                        gcTmp->getExtremalRays(*gcTmp);
     
    32333217                        /*add facets to SLA here*/
    32343218#ifdef SHALLOW
    3235 //                      printf("fActUCN before enq2: %i\n",fAct->getUCN());
    3236                         facet *tmp; tmp=gcTmp->enqueue2(SearchListRoot);
    3237 //                      printf("\nheadUCN=%i\n",tmp->getUCN());
    3238 //                      printf("fActUCN after enq2: %i\n",fAct->getUCN());                     
     3219  #ifdef gfan_DEBUG
     3220                        printf("fActUCN before enq2: %i\n",fAct->getUCN());
     3221  #endif
     3222                        facet *tmp;
     3223                        tmp=gcTmp->enqueue2(SearchListRoot);
     3224  #ifdef gfan_DEBUG
     3225                        printf("\nheadUCN=%i\n",tmp->getUCN());
     3226                        printf("fActUCN after enq2: %i\n",fAct->getUCN());
     3227  #endif
    32393228                        SearchListRoot=tmp;
    3240 //                      SearchListRoot=gcTmp->enqueue2/*NewFacets*/(SearchListRoot);
    3241 #else
     3229                        //SearchListRoot=gcTmp->enqueue2/*NewFacets*/(SearchListRoot);
     3230#else 
    32423231                        SearchListRoot=gcTmp->enqueueNewFacets(SearchListRoot);
    3243 #endif
     3232#endif //ifdef SHALLOW
    32443233                        gcTmp->writeConeToFile(*gcTmp);
    32453234                        if(gfanHeuristic==1)
    32463235                        {
    3247 //                              gcTmp->writeConeToFile(*gcTmp);
    32483236                                idDelete((ideal*)&gcTmp->gcBasis);//Whonder why?
    32493237                                rDelete(gcTmp->baseRing);
     
    33503338void gcone::makeInt(const dd_MatrixPtr &M, const int line, int64vec &n)
    33513339{                       
    3352 //      mpz_t denom[this->numVars];
    33533340        mpz_t *denom = new mpz_t[this->numVars];
    33543341        for(int ii=0;ii<this->numVars;ii++)
     
    33903377        mpq_set_num(qkgV,kgV);
    33913378                       
    3392 //                      mpq_canonicalize(qkgV);
     3379//      mpq_canonicalize(qkgV);
    33933380//      int ggT=1;
    33943381        for (int ii=0;ii<(M->colsize)-1;ii++)
     
    34013388        for(int ii=0;ii<this->numVars;ii++)
    34023389                ggT=int64gcd(ggT,n[ii]);       
    3403         //Normalization
     3390        //Normalisation
    34043391        if(ggT>1)
    34053392        {
     
    35143501         * If slAct->next==NULL AND maybe==TRUE we know, that fAct must be added
    35153502         */
    3516 //      volatile bool maybe=FALSE;
     3503
    35173504        /**A facet was removed, lengthOfSearchlist-- thus we must not rely on
    35183505         * if(notParallelCtr==lengthOfSearchList) but rather
     
    35203507         */
    35213508        volatile bool removalOccured=FALSE;
    3522 //      int ctr=0;      //encountered equalities in SLA
    3523 //      int notParallelCtr=0;
    3524 //      gcone::lengthOfSearchList=1;
    35253509        while(slEnd->next!=NULL)
    35263510        {
    35273511                slEnd=slEnd->next;
    3528 //              gcone::lengthOfSearchList++;
    35293512        }
    35303513        /*1st step: compare facetNormals*/                     
     
    35363519                        fNormal=fAct->getFacetNormal();                 
    35373520                        slAct = slHead;
    3538                         //notParallelCtr=0;
    35393521                        /*If slAct==NULL and fAct!=NULL
    35403522                        we just copy all remaining facets into SLA*/
     
    36893671}//addC2N
    36903672
    3691 /** Try using shallow copies*/
     3673/** Enqueuing using shallow copies*/
    36923674facet * gcone::enqueue2(facet *f)
    36933675{
     
    37093691        facet *codim2Act;
    37103692        codim2Act = this->facetPtr->codim2Ptr;
    3711 //      facet *sl2Act;
    3712 //      sl2Act = f->codim2Ptr;
    37133693        volatile bool removalOccured=FALSE;
    37143694        while(slEnd->next!=NULL)
     
    37443724                                        fCopy = fCopy->next;
    37453725                                }
    3746                                 break; 
     3726                                break;  //WTF?
    37473727                        }
    37483728                        /*Comparison starts here*/
     
    37673747                                                }
    37683748                                                fDeleteMarker->shallowDelete();
    3769 //                                              delete fDeleteMarker;//NOTE this messes up fAct in noRevS!
     3749                                                //delete fDeleteMarker;//NOTE this messes up fAct in noRevS!
    37703750//                                              printf("headUCN@enq=%i\n",slHead->getUCN());
    37713751                                        }
     
    37753755                                                slEnd->next = NULL;
    37763756                                                fDeleteMarker->shallowDelete();
    3777 //                                              delete(fDeleteMarker);
     3757                                                delete(fDeleteMarker);
    37783758                                        }                                                               
    37793759                                        else
     
    37823762                                                slAct->next->prev = slAct->prev;
    37833763                                                fDeleteMarker->shallowDelete();
    3784 //                                              delete(fDeleteMarker);
     3764                                                delete(fDeleteMarker);
    37853765                                        }
    37863766                                        removalOccured=TRUE;
     
    37893769printf("Removing (");fAct->fNormal->show(1,1);printf(") from list\n");
    37903770#endif
    3791                                         /*fDeleteMarker->shallowDelete();*///Sets everything to NULL
    3792 //                                      delete(fDeleteMarker);
    37933771                                        break;//leave the while loop, since we found fAct=slAct thus delete slAct and do not add fAct
    37943772                                }
     
    38553833        replacementRing->order[2]=ringorder_C;
    38563834
    3857         int64vec *ivw = this->getIntPoint(TRUE);
     3835        int64vec *ivw = this->getIntPoint(TRUE);//returns a reference
    38583836//      assert(this->ivIntPt); 
    38593837        int length=ivw->length();       
     
    38643842                if((*ivw)[jj]>=INT_MAX) WarnS("A[jj] exceeds INT_MAX in gcone::replaceDouble_ringorder_a_ByASingleOne!\n");
    38653843        }       
    3866 //      delete ivw;
     3844        //delete ivw; //Not needed if this->getIntPoint(TRUE)
    38673845        replacementRing->wvhdl[0]=(int *)A;
    38683846        replacementRing->block1[0]=length;
     
    38733851        rDelete(this->baseRing);
    38743852        this->baseRing=rCopy(replacementRing);
    3875         this->gcBasis=idCopy(temporaryGroebnerBasis);
    3876         //FIXME idDelete & rDelete!!! DONE!
     3853        this->gcBasis=idCopy(temporaryGroebnerBasis);   
    38773854        /*And back to where we came from*/
    38783855        rChangeCurrRing(srcRing);
     
    39723949        filename.append(UCNstr);
    39733950        filename.append(suffix);
    3974        
    3975        
     3951               
    39763952//      int thisPID = getpid();
    39773953//      ss << thisPID;
     
    40163992                        for (int ii=0;ii<iv->length();ii++)
    40173993                        {
    4018                                 if (ii<iv->length()-1)
    4019                                 {
    4020                                         gcOutputFile << (*iv)[ii] << ",";
    4021                                 }
    4022                                 else
    4023                                 {
    4024                                         gcOutputFile << (*iv)[ii] << " ";
    4025                                 }
     3994//                              if (ii<iv->length()-1)
     3995//                                      gcOutputFile << (*iv)[ii] << ",";
     3996//                              else
     3997//                                      gcOutputFile << (*iv)[ii] << " ";
     3998                                gcOutputFile << (*iv)[ii];
     3999                                (ii<iv->length()-1) ? gcOutputFile << "," : gcOutputFile << " ";
    40264000                        }
    4027 //                      delete iv;
     4001                        //delete iv;
    40284002                        while(f2Act!=NULL)
    40294003                        {
    40304004                                const int64vec *iv2;
    4031                                 iv2=f2Act->getRef2FacetNormal();//->getFacetNormal();   
     4005                                iv2=f2Act->getRef2FacetNormal();
    40324006                                for(int jj=0;jj<iv2->length();jj++)
    40334007                                {
    4034                                         if (jj<iv2->length()-1)
    4035                                         {
    4036                                                 gcOutputFile << (*iv2)[jj] << ",";
    4037                                         }
    4038                                         else
    4039                                         {
    4040                                                 gcOutputFile << (*iv2)[jj] << " ";
    4041                                         }
     4008//                                      if (jj<iv2->length()-1)
     4009//                                              gcOutputFile << (*iv2)[jj] << ",";
     4010//                                      else
     4011//                                              gcOutputFile << (*iv2)[jj] << " ";
     4012                                        gcOutputFile << (*iv2)[jj];
     4013                                        (jj<iv2->length()-1) ? gcOutputFile << "," : gcOutputFile << " ";
    40424014                                }
    4043 //                              delete iv2;
    40444015                                f2Act = f2Act->next;
    40454016                        }
     
    40654036        string UCNstr = ss.str();
    40664037        int gcBasisLength=0;
    4067         size_t found;                   //used for find_first_(not)_of
     4038        size_t found;   //used for find_first_(not)_of
    40684039
    40694040        string prefix="/tmp/Singular/cone";
     
    44114382                }
    44124383                fAct = fAct->next;
    4413 //              delete fNormal;
    44144384        }       
    44154385        return *res;
     
    44744444                        gcAct = gcRoot;
    44754445                        gcone::numVars=pVariables;
    4476 //                      gcAct->numVars=pVariables;//NOTE is now static
     4446                        //gcAct->numVars=pVariables;//NOTE is now static
    44774447                        gcAct->getGB(inputIdeal);
    44784448                        /*Check whether input is homogeneous
     
    45004470                                dd_free_global_constants();
    45014471                                //This is filthy
    4502                                 goto pointOfNoReturn;
    4503                                 //return lResList;
     4472                                goto pointOfNoReturn;                           
    45044473                        }                       
    45054474                        gcAct->getConeNormals(gcAct->gcBasis);
     
    45304499                //Simply return an empty list
    45314500                WerrorS("Ring has non-global ordering.\nThis function requires your current ring to be endowed with a global ordering.\n Now terminating!");
    4532                 gcone *gcRoot=new gcone();
    4533                 gcone *gcPtr = gcRoot;
    4534                 for(int ii=0;ii<10000;ii++)
    4535                 {
    4536                         gcPtr->setBaseRing(currRing);
    4537                         facet *fPtr=gcPtr->facetPtr=new facet();
    4538                         for(int jj=0;jj<5;jj++)
    4539                         {
    4540                                 int64vec *iv=new int64vec(pVariables);
    4541                                 fPtr->setFacetNormal(iv);                               
    4542                                 delete(iv);
    4543                                 fPtr->next=new facet();
    4544                                 fPtr=fPtr->next;
    4545                         }
    4546                         gcPtr->next=new gcone();
    4547                         gcPtr->next->prev=gcPtr;
    4548                         gcPtr=gcPtr->next;                     
    4549                 }
    4550                 gcPtr=gcRoot;
    4551                 while(gcPtr!=NULL)
    4552                 {
    4553                         gcPtr=gcPtr->next;
    4554 //                      delete(gcPtr->prev);
    4555                 }
     4501//              gcone *gcRoot=new gcone();
     4502//              gcone *gcPtr = gcRoot;
     4503//              for(int ii=0;ii<10000;ii++)
     4504//              {
     4505//                      gcPtr->setBaseRing(currRing);
     4506//                      facet *fPtr=gcPtr->facetPtr=new facet();
     4507//                      for(int jj=0;jj<5;jj++)
     4508//                      {
     4509//                              int64vec *iv=new int64vec(pVariables);
     4510//                              fPtr->setFacetNormal(iv);                               
     4511//                              delete(iv);
     4512//                              fPtr->next=new facet();
     4513//                              fPtr=fPtr->next;
     4514//                      }
     4515//                      gcPtr->next=new gcone();
     4516//                      gcPtr->next->prev=gcPtr;
     4517//                      gcPtr=gcPtr->next;                     
     4518//              }
     4519//              gcPtr=gcRoot;
     4520//              while(gcPtr!=NULL)
     4521//              {
     4522//                      gcPtr=gcPtr->next;
     4523// //                   delete(gcPtr->prev);
     4524//              }
    45564525                goto pointOfNoReturn;
    45574526        }
     
    45594528#ifdef gfanp
    45604529        cout << endl << "t_getConeNormals:" << gcone::time_getConeNormals << endl;
    4561 //      cout << "t_getCodim2Normals:" << gcone::time_getCodim2Normals << endl;
    4562 //      cout << "  t_ddMC:" << gcone::t_ddMC << endl;
    4563 //      cout << "  t_mI:" << gcone::t_mI << endl;
    4564 //      cout << "  t_iP:" << gcone::t_iP << endl;
     4530        /*cout << "t_getCodim2Normals:" << gcone::time_getCodim2Normals << endl;
     4531        cout << "  t_ddMC:" << gcone::t_ddMC << endl;
     4532        cout << "  t_mI:" << gcone::t_mI << endl;
     4533        cout << "  t_iP:" << gcone::t_iP << endl;*/
    45654534        cout << "t_getExtremalRays:" << gcone::t_getExtremalRays << endl;
    45664535        cout << "  t_ddPolyh:" << gcone::t_ddPolyh << endl;
Note: See TracChangeset for help on using the changeset viewer.