Changeset ae5056 in git


Ignore:
Timestamp:
Jun 16, 2009, 10:45:33 AM (15 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
8e5a5b4f1f2f9bf6f4661d12232c26be179b09f3
Parents:
e28cf1ea73e36a7c3768b1ea8eb0e279b22ecede
Message:
Crude fix of ring construction, depending on whether the ring to be copied
has order in {dp,Dp,ds,ls}.
Anyhow the ring construction might do with a rewrite from scratch
Fixed copy constructor; minor various bugfixes


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    re28cf1 rae5056  
    22Compute the Groebner fan of an ideal
    33$Author: monerjan $
    4 $Date: 2009-06-14 10:00:14 $
    5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.60 2009-06-14 10:00:14 monerjan Exp $
    6 $Id: gfan.cc,v 1.60 2009-06-14 10:00:14 monerjan Exp $
     4$Date: 2009-06-16 08:45:33 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.61 2009-06-16 08:45:33 monerjan Exp $
     6$Id: gfan.cc,v 1.61 2009-06-16 08:45:33 monerjan Exp $
    77*/
    88
     
    192192                void setFlipGB(ideal I)
    193193                {
    194                         this->flipGB=I;
     194                        this->flipGB=idCopy(I);
    195195                }
    196196               
     
    374374                        this->next=NULL;
    375375                        this->numVars=gc.numVars;
    376                         this->UCN=(gc.UCN)+1;
     376                        //this->UCN=(gc.UCN)+1;
     377                        this->UCN++;
    377378                        this->facetPtr=NULL;
    378                         this->gcBasis=gc.gcBasis;
    379                         this->baseRing=f.flipRing;
    380                         rChangeCurrRing(this->baseRing);
     379                        this->gcBasis=idCopy(f.flipGB);
     380                        this->inputIdeal=idCopy(this->gcBasis);
     381                        this->baseRing=rCopy0(f.flipRing);
     382                        //rComplete(this->baseRing);
     383                        //rChangeCurrRing(this->baseRing);
    381384                }
    382385               
     
    405408                }
    406409               
     410                /** \brief Print facets
     411                * This is mainly for debugging purposes. Usually called from within gdb
     412                */
    407413                void showFacets(short codim=1)
    408414                {
     
    788794                        compute $G_{-\alpha}(in_v(I))
    789795                        see journal p. 66
     796                        NOTE Check for different rings. Prolly it will not always be necessary to add a weight, if the
     797                        srcRing already has a weighted ordering
    790798                        */
    791799                        ring srcRing=currRing;
     800                        ring tmpRing;
    792801
    793802                        //intvec *negfNormal = new intvec(this->numVars);
    794803                        //negfNormal=ivNeg(fNormal);
    795                         ring tmpRing=rCopyAndAddWeight(srcRing,ivNeg(fNormal));
     804                        if( (srcRing->order[0]==ringorder_dp)
     805                                || (srcRing->order[0]==ringorder_Dp)
     806                                 || (srcRing->order[0]==ringorder_ds)
     807                                 || (srcRing->order[0]==ringorder_ls) )
     808                        {
     809                                tmpRing=rCopyAndAddWeight(srcRing,ivNeg(fNormal));
     810                        }
     811                        else
     812                        {
     813                                tmpRing=rCopy0(srcRing);
     814                                int length=fNormal->length();
     815                                int *A=(int *)omAlloc(length*sizeof(int));
     816                                for(int jj=0;jj<length;jj++)
     817                                {
     818                                        A[jj]=-(*fNormal)[jj];
     819                                }
     820                                tmpRing->wvhdl[0]=(int*)A;
     821                                rComplete(tmpRing);     
     822                        }
    796823                        rChangeCurrRing(tmpRing);
    797824                       
     
    940967                        turn the minimal basis into a reduced one
    941968                        */
    942                         ring dstRing=rCopyAndAddWeight(tmpRing,iv_weight);     
     969                        //ring dstRing=rCopyAndAddWeight(tmpRing,iv_weight);   
    943970                       
    944971//                      int i,j;
     
    9771004                                dstRing->wvhdl[0][ii]=(*iv_weight)[ii];                         
    9781005                        }*/
     1006                        ring dstRing=rCopy0(tmpRing);
     1007                        int length=iv_weight->length();
     1008                        int *A=(int *)omAlloc(length*sizeof(int));
     1009                        for(int jj=0;jj<length;jj++)
     1010                        {
     1011                                A[jj]=(*iv_weight)[jj];
     1012                        }
     1013                        dstRing->wvhdl[0]=(int*)A;
     1014                        rComplete(dstRing);
     1015                        //rSetWeightVec(dstRing,iv_weight);
     1016                        //assume(dstRing!=NULL);
     1017                        //assume(dstRing->OrdSize>0);
     1018                        //assume(dstRing->typ[0].ord_typ==ro_dp);
     1019                        //memcpy(dstRing->typ[0].data.wp.weights,iv_weight,dstRing->N*sizeof(int));             
    9791020                        rChangeCurrRing(dstRing);
     1021                       
    9801022#ifdef gfan_DEBUG
    9811023                        rWrite(dstRing); cout << endl;
     
    9901032                        test|=Sy_bit(OPT_REDSB);
    9911033                        test|=Sy_bit(6);        //OPT_DEBUG                                     
    992                         dstRing_I=kStd(idrCopyR(this->inputIdeal,this->rootRing),NULL,testHomog,NULL);                                 
     1034                        dstRing_I=kStd(idrCopyR(this->inputIdeal,this->baseRing),NULL,testHomog,NULL);                                 
    9931035                        kInterRed(dstRing_I);
    9941036                        idSkipZeroes(dstRing_I);
     
    9971039                       
    9981040                        f->setFlipGB(dstRing_I);//store the flipped GB
    999                         f->flipRing=dstRing;    //store the ring on the other side
     1041                        f->flipRing=rCopy0(dstRing);    //store the ring on the other side
    10001042#ifdef gfan_DEBUG
    10011043                        cout << "Flipped GB is: " << endl;
    10021044                        f->printFlipGB();
    10031045#endif                 
    1004                         //rChangeCurrRing(srcRing);     //return to the ring we started the computation of flipGB in
     1046                        rChangeCurrRing(srcRing);       //return to the ring we started the computation of flipGB in
    10051047                }//void flip(ideal gb, facet *f)
    10061048                               
     
    12231265                                dd_WriteNumber(stdout,lpSol->sol[ii]);
    12241266                        }
     1267                        cout << endl;
    12251268#endif
    12261269                       
     
    12491292                                mpq_clear(product);
    12501293                        }
     1294#ifdef gfan_DEBUG
     1295                        iv.show();
     1296                        cout << endl;
     1297#endif
    12511298                        mpq_clear(qkgV);
    12521299                        mpz_clear(tmp);
     
    15221569                * soon as we compute this facet again. Comparison of facets is done by...
    15231570                */
    1524                 void noRevS(gcone &gc, bool usingIntPoint=FALSE)
     1571                void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE)
    15251572                {       
    15261573                        facet *SearchListRoot = new facet(); //The list containing ALL facets we come across
     
    15281575                        SearchListAct = SearchListRoot;
    15291576                       
     1577                        gcone *gcAct;
     1578                        gcAct = &gcRoot;
     1579                        gcone = *gcPtr;
     1580                        gcPtr = &gcRoot;
     1581                       
    15301582                        facet *fAct;
    1531                         fAct = gc.facetPtr;                     
    1532                        
     1583                        fAct = gcAct->facetPtr;                 
     1584                                               
     1585                        int UCNcounter=gcAct->getUCN();
    15331586#ifdef gfan_DEBUG
    15341587                        cout << "NoRevs" << endl;
    15351588                        cout << "Facets are:" << endl;
    1536                         gc.showFacets();
     1589                        gcAct->showFacets();
    15371590#endif                 
    15381591                       
    1539                         this->getCodim2Normals(gc);
     1592                        gcAct->getCodim2Normals(*gcAct);
    15401593                               
    15411594                        //Compute unique representation of codim-2-facets
    1542                         this->normalize();
     1595                        gcAct->normalize();
    15431596                       
    15441597                        /*Make a copy of the facet list of first cone
     
    15551608                        SearchListAct = SearchListRoot; //Set to beginning of list
    15561609                       
    1557                         fAct = gc.facetPtr;
     1610                        fAct = gcAct->facetPtr;
    15581611                        if(areEqual(fAct->getFacetNormal(),fAct->next->getFacetNormal()))
    15591612                        {
     
    15611614                        }
    15621615                       
    1563                         gc.writeConeToFile(gc);
    1564                        
     1616                        gcAct->writeConeToFile(*gcAct);
     1617                       
     1618                        /*End of initialisation*/
     1619                        fAct = gcAct->facetPtr;
    15651620                        /*2nd step
    15661621                        Choose a facet from fListPtr, flip it and forget the previous cone
     
    15681623                        */
    15691624                        while(SearchListAct->next!=NULL)
    1570                         {
    1571                                 gc.flip(gc.gcBasis,SearchListAct);
    1572                                 gcone *gcTmp = new gcone::gcone(gc,*SearchListAct);
    1573                        
    1574                         //gcTmp->getConeNormals();
     1625                        {//NOTE See to it that the cone is only changed after ALL facets have been flipped!
     1626                                //As of now this is not the case!
     1627                                gcAct->flip(gcAct->gcBasis,SearchListAct);
     1628                                /*ring rTmp=rCopy(SearchListAct->flipRing);
     1629                                //NOTE It is absolutely crucial to go to the new ring before constructing a new cone!
     1630                                rComplete(rTmp);
     1631                                rChangeCurrRing(rTmp);
     1632                                gcone *gcTmp = new gcone::gcone(*gcAct,*SearchListAct);
     1633                                gcAct = gcTmp;
     1634                                gcAct->getConeNormals(gcAct->gcBasis, FALSE);*/
     1635                                //gcAct->getCodim2Normals(*gcAct);                     
     1636                       
    15751637                        //add new facets
    15761638                        //fListPtr = fListPtr->next;
    15771639                                SearchListAct = SearchListAct->next;
    1578                         }
     1640                        }                       
    15791641               
    15801642                        //NOTE Hm, comment in and get a crash for free...
Note: See TracChangeset for help on using the changeset viewer.