Changeset c8e7d30 in git


Ignore:
Timestamp:
Apr 28, 2009, 6:18:37 PM (15 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
ab0cafebc7997832ae2068f0c3e9590fc2a07835
Parents:
f9db282b5b2b723efd96054f374040ec3a02452c
Message:
fixed copy constructor


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    rf9db28 rc8e7d30  
    22Compute the Groebner fan of an ideal
    33$Author: monerjan $
    4 $Date: 2009-04-27 14:39:52 $
    5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.40 2009-04-27 14:39:52 monerjan Exp $
    6 $Id: gfan.cc,v 1.40 2009-04-27 14:39:52 monerjan Exp $
     4$Date: 2009-04-28 16:18:37 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.41 2009-04-28 16:18:37 monerjan Exp $
     6$Id: gfan.cc,v 1.41 2009-04-28 16:18:37 monerjan Exp $
    77*/
    88
     
    8888               
    8989                /** Stores the facet normal \param intvec*/
    90                 void setFacetNormal(intvec *iv){
     90                void setFacetNormal(intvec *iv)
     91                {
    9192                        this->fNormal = ivCopy(iv);
    9293                        //return;
     
    146147                ring rootRing;          //good to know this -> generic walk
    147148                ideal inputIdeal;       //the original
     149                ring baseRing;          //the basering of the cone             
    148150                /* TODO in order to save memory use pointers to rootRing and inputIdeal instead */
     151                intvec *ivIntPt;        //an interior point of the cone
     152               
    149153        public:
    150154                /** \brief Default constructor.
     
    156160                        this->next=NULL;
    157161                        this->facetPtr=NULL;
     162                        this->baseRing=currRing;
    158163                }
    159164               
     
    169174                        this->rootRing=r;
    170175                        this->inputIdeal=I;
     176                        this->baseRing=currRing;
    171177                }
    172178               
    173179                /** \brief Copy constructor
    174180                *
    175                 * Copies one cone, forgets about everything but the facetNormal
     181                * Copies one cone, sets this->gcBasis to the flipped GB and reverses the
     182                * direction of the according facet normal
    176183                */                     
    177                 gcone(gcone& gc)               
     184                gcone(const gcone& gc)         
    178185                {
    179186                        this->next=NULL;
    180                         facet *f=this->facetPtr;
    181                         f->fNormal=gc.facetPtr->getFacetNormal();
    182                         this->gcBasis=gc.facetPtr->getFlipGB();
    183                        
    184                         /*Reverse direction of the facet normal*/                       
    185                         intvec *foo=f->getFacetNormal();
     187                        this->numVars=gc.numVars;                       
     188                        facet *fAct= new facet();                       
     189                        this->facetPtr=fAct;
     190                       
     191                        intvec *ivtmp = new intvec(this->numVars);                                             
     192                        ivtmp = gc.facetPtr->getFacetNormal();
     193                        ivtmp->show();                 
     194                       
     195                        ideal gb;
     196                        gb=gc.facetPtr->getFlipGB();                   
     197                        this->gcBasis=gb;//gc.facetPtr->getFlipGB();    //this cone's GB is the flipped GB
     198                        idShow(this->gcBasis);
     199                       
     200                        /*Reverse direction of the facet normal to make it an inner normal*/                   
    186201                        for (int ii=0; ii<this->numVars;ii++)
    187202                        {
    188                                 (*foo)[ii]=-(*foo)[ii];
    189                                 //(*f).(*fNormal)[ii]=-( (*f).(*fNormal)[ii]);
    190                         }
    191                         f->setFacetNormal(foo);
     203                                (*ivtmp)[ii]=-(*ivtmp)[ii];                             
     204                        }
     205                        //ivtmp->show(); cout << endl;
     206                        fAct->setFacetNormal(ivtmp);
     207                        //fAct->printNormal();cout << endl;
     208                        //ivtmp->show();cout << endl;
    192209                }
    193210               
     
    204221                ideal gcBasis;          //GB of the cone, set by gcone::getGB();
    205222                gcone *next;            //Pointer to *previous* cone in search tree
     223               
     224                /** \brief Set the interior point of a cone */
     225                void setIntPoint(intvec *iv)
     226                {
     227                        this->ivIntPt=ivCopy(iv);
     228                }
     229               
     230                void getIntPoint()
     231                {
     232                        ivIntPt->show();
     233                }
    206234               
    207235                /** \brief Compute the normals of the cone
     
    214242                * the set \f$ \partial\mathcal{G} \f$ which we might store for later use. C.f p71 of journal
    215243                * As a result of this procedure the pointer facetPtr points to the first facet of the cone.
     244                *
     245                * Optionally, if the parameter bool compIntPoint is set to TRUE the method will also compute
     246                * an interior point of the cone.
    216247                */
    217                 void getConeNormals(ideal const &I)
     248                void getConeNormals(ideal const &I, bool compIntPoint=FALSE)
    218249                {
    219250#ifdef gfan_DEBUG
     
    403434                        */
    404435                       
     436                        if (compIntPoint==TRUE)
     437                        {
     438                                intvec *iv = new intvec(this->numVars);
     439                                interiorPoint(ddineq, *iv);
     440                                this->setIntPoint(iv);  //stores the interior point in gcone::ivIntPt
     441                                delete iv;
     442                        }
     443                       
    405444                        //Clean up but don't delete the return value! (Whatever it will turn out to be)
     445                       
    406446                        dd_FreeMatrix(ddineq);
    407447                        set_free(ddredrows);
     
    717757                        cout << "Flipped GB is: " << endl;
    718758                        f->printFlipGB();
    719 #endif
    720                        
     759#endif                 
    721760                }//void flip(ideal gb, facet *f)
    722761                               
     
    750789                                                //cout << "TICK 3" << endl;
    751790                                                poly step1,step2,step3;
    752                                                 cout << "dividing "; pWrite(pHead(p));cout << "by ";pWrite(pHead(I->m[ii-1])); cout << endl;
     791                                                //cout << "dividing "; pWrite(pHead(p));cout << "by ";pWrite(pHead(I->m[ii-1])); cout << endl;
    753792                                                step1 = pDivideM(pHead(p),pHead(I->m[ii-1]));
    754                                                 cout << "LT(p)/LT(f_i)="; pWrite(step1); cout << endl;
     793                                                //cout << "LT(p)/LT(f_i)="; pWrite(step1); cout << endl;
    755794                                                //cout << "TICK 3.1" << endl;
    756795                                                step2 = ppMult_qq(step1, I->m[ii-1]);
     
    776815                                        pSetm(r);
    777816                                        pSort(r);
    778                                         cout << "r="; pWrite(r); cout << endl;
     817                                        //cout << "r="; pWrite(r); cout << endl;
    779818                                        //cout << "TICK 6" << endl;
    780819                                        if (pLength(p)!=1)
     
    787826                                        }
    788827                                        //cout << "TICK 7" << endl;
    789                                         cout << "p="; pWrite(p);
     828                                        //cout << "p="; pWrite(p);
    790829                                }//if (divOccured==FALSE)
    791830                        }//while (p!=0)
     
    10301069        idShow(gcAct->gcBasis);
    10311070        gcAct->getConeNormals(gcAct->gcBasis);  //hopefully compute the normals
    1032         gcAct->flip(gcAct->gcBasis,gcAct->facetPtr);
     1071        //gcAct->flip(gcAct->gcBasis,gcAct->facetPtr);
    10331072        /*Now it is time to compute the search facets, respectively start the reverse search.
    10341073        But since we are in the root all facets should be search facets. IS THIS TRUE?
    10351074        NOTE: Check for flippability is not very sophisticated
    10361075        */
     1076        facet *fAct=new facet();
     1077        fAct=gcAct->facetPtr;
     1078        while(fAct->next!=NULL)
     1079        {
     1080                gcAct->flip(gcAct->gcBasis,gcAct->facetPtr);
     1081                gcone *gcTmp = new gcone(*gcAct);
     1082                idShow(gcTmp->gcBasis);
     1083                gcTmp->getConeNormals(gcTmp->gcBasis, TRUE);
     1084                gcTmp->getIntPoint();
     1085                fAct = fAct->next;             
     1086        }
    10371087       
    10381088        /*As of now extra.cc expects gfan to return type ideal. Probably this will change in near future.
     
    10441094        */
    10451095        rChangeCurrRing(inputRing);
    1046         res=gcAct->gcBasis;
     1096        //res=gcAct->gcBasis;
     1097        res=gcRoot->gcBasis;
    10471098        //cout << fRoot << endl;
    10481099        return res;
Note: See TracChangeset for help on using the changeset viewer.