Changeset eaa679 in git


Ignore:
Timestamp:
May 7, 2009, 11:55:48 AM (15 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
f4a2f423453c2ac5708a5092a552d99d9ae6dc42
Parents:
f16a76d72e29ae88bdd1b8cd60bff79fb200f3cd
Message:
Some cleanup
Fixed yesterday's bug that was caused by omitting to reverse the facet normal
method ivNeg to reverse intvecs
Traced down bug in isSearchFacet. Namely testfacet seems to be strangely empty;
additionally it seems the "mininmal" facet is not yet found correctly


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    rf16a76d reaa679  
    22Compute the Groebner fan of an ideal
    33$Author: monerjan $
    4 $Date: 2009-05-06 09:54:23 $
    5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.46 2009-05-06 09:54:23 monerjan Exp $
    6 $Id: gfan.cc,v 1.46 2009-05-06 09:54:23 monerjan Exp $
     4$Date: 2009-05-07 09:55:48 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.47 2009-05-07 09:55:48 monerjan Exp $
     6$Id: gfan.cc,v 1.47 2009-05-07 09:55:48 monerjan Exp $
    77*/
    88
     
    1414#include "kutil.h"
    1515#include "intvec.h"
    16 #include "int64vec.h"
    1716#include "polys.h"
    1817#include "ideals.h"
     
    443442                                }//for (int jj = 1; jj <ddcols; jj++)
    444443                                /*Quick'n'dirty hack for flippability*/
    445                                 bool isFlippable=FALSE;
    446                                 //NOTE BUG HERE
    447                                 /* The flippability check is wrong!
    448                                 (1,-4) will pass, but (-1,7) will not.
    449                                 REWRITE THIS
    450                                 */                     
    451                                 /*for (int jj = 0; jj<this->numVars; jj++)
    452                                 {                                       
    453                                         intvec *ivCanonical = new intvec(this->numVars);
    454                                         (*ivCanonical)[jj]=1;                                   
    455                                         if (dotProduct(load,ivCanonical)>=0)
    456                                         {
    457                                                 isFlippable=FALSE;                                             
    458                                         }
    459                                         else
    460                                         {
    461                                                 isFlippable=TRUE;
    462                                         }                                       
    463                                         delete ivCanonical;
    464                                 }//for (int jj = 0; jj<this->numVars; jj++)
    465                                 */     
     444                                bool isFlippable=FALSE;                         
    466445                                for (int jj = 0; jj<load->length(); jj++)
    467446                                {
     
    483462                                {       /*Now load should be full and we can call setFacetNormal*/
    484463                                        fAct->setFacetNormal(load);
    485                                         fAct->next = new facet();
    486                                         //fAct->printNormal();
     464                                        fAct->next = new facet();                                       
    487465                                        fAct=fAct->next;        //this should definitely not be called in the above while-loop :D
    488466                                }//if (isFlippable==FALSE)
     
    584562                                /*Now initialFormElement must be added to (ideal)initialForm */
    585563                                initialForm->m[ii]=initialFormElement[ii];
    586                         }//for
    587                         //f->setFlipGB(initialForm);    //FIXME PROBABLY WRONG TO STORE HERE SINCE INA!=flibGB                 
     564                        }//for                 
    588565#ifdef gfan_DEBUG
    589566                        cout << "Initial ideal is: " << endl;
     
    592569                        cout << "===" << endl;
    593570#endif
    594                         delete check;
     571                        //delete check;
    595572                       
    596573                        /*2nd step: lift initial ideal to a GB of the neighbouring cone using minus alpha as weight*/
     
    601578                        ring srcRing=currRing;
    602579
    603                         ring tmpRing=rCopyAndAddWeight(srcRing,fNormal);
     580                        //intvec *negfNormal = new intvec(this->numVars);
     581                        //negfNormal=ivNeg(fNormal);
     582                        ring tmpRing=rCopyAndAddWeight(srcRing,ivNeg(fNormal));
    604583                        rChangeCurrRing(tmpRing);
    605584                       
     
    612591                        idShow(ina); cout << endl;
    613592#endif
    614                         ideal H;  //NOTE WTF? rCopyAndAddWeight does not seem to be compatible with kStd... => wrong result!
     593                        ideal H;
    615594                        H=kStd(ina,NULL,isHomog,NULL);  //we know it is homogeneous
    616595                        idSkipZeroes(H);
     
    921900                {
    922901                }//GGW
     902               
     903                intvec *ivNeg(intvec const &iv)
     904                {
     905                        intvec *res = new intvec(this->numVars);
     906                        for(int ii=0;ii<this->numVars;ii++)
     907                        {
     908                                res[ii] = -(int)iv[ii];
     909                        }
     910                        return res;
     911                }
    923912
    924913
     
    11911180                        }//while(fAct.facetPtr->next!=NULL)
    11921181                        delete alpha_i,alpha_j,sigma;
     1182                       
    11931183                        /*If testfacet was minimal then fMin should still point there */
    11941184                        //NOTE BUG: Comment in and -> out of memory error
     
    11981188                       
    11991189                        intvec *test = new intvec(this->numVars);
    1200                         test=testfacet.getFacetNormal();                       
    1201                        
    1202                         if (isParallel(alpha_min,test))*/
    1203                         if (fMin==gcTmp.facetPtr)
    1204                         {
     1190                        test=testfacet.getFacetNormal();*/
     1191                        //if(fMin->getFacetNormal()==ivNeg(testfacet.getFacetNormal()))
     1192                        //if (isParallel(fMin->getFacetNormal(),testfacet.getFacetNormal()))
     1193                        fMin->printNormal();
     1194                        testfacet.printNormal();  //NOTE THIS IS EMPTY, so prolly cause of bug above
     1195                        if (fMin==gcTmp.facetPtr)                       
     1196                        //if(areEqual(fMin->getFacetNormal(),ivNeg(testfacet.getFacetNormal())))
     1197                        {                               
     1198                                cout << "Parallel" << endl;
    12051199                                rChangeCurrRing(actRing);
     1200                                //delete alpha_min, test;
    12061201                                return TRUE;
    12071202                        }
    12081203                        else
    12091204                        {
     1205                                cout << "Not parallel" << endl;
    12101206                                rChangeCurrRing(actRing);
     1207                                //delete alpha_min, test;
    12111208                                return FALSE;
    12121209                        }
    12131210                }//bool isSearchFacet
     1211               
     1212                bool areEqual(intvec const &a, intvec const &b)
     1213                {
     1214                        bool res=TRUE;
     1215                        for(int ii=0;ii<this->numVars;ii++)
     1216                        {
     1217                                if(a[ii]!=b[ii])
     1218                                {
     1219                                        res=FALSE;
     1220                                        break;
     1221                                }
     1222                        }
     1223                        return res;
     1224                }
    12141225               
    12151226                void reverseSearch(gcone *gcAct) //no const possible here since we call gcAct->flip
     
    12231234                                gcAct->flip(gcAct->gcBasis,gcAct->facetPtr);
    12241235                                gcone *gcTmp = new gcone(*gcAct);
    1225                                 idShow(gcTmp->gcBasis);
     1236                                //idShow(gcTmp->gcBasis);
    12261237                                gcTmp->getConeNormals(gcTmp->gcBasis, TRUE);
    12271238#ifdef gfan_DEBUG
     
    13081319        idShow(gcAct->gcBasis);
    13091320        gcAct->getConeNormals(gcAct->gcBasis);  //hopefully compute the normals
    1310         gcAct->flip(gcAct->gcBasis,gcAct->facetPtr);   
     1321        //gcAct->flip(gcAct->gcBasis,gcAct->facetPtr); 
    13111322        /*Now it is time to compute the search facets, respectively start the reverse search.
    13121323        But since we are in the root all facets should be search facets. IS THIS TRUE?
     
    13241335                fAct = fAct->next;             
    13251336        }*/
    1326         //gcAct->reverseSearch(gcAct);
     1337        gcAct->reverseSearch(gcAct);
     1338       
    13271339        /*As of now extra.cc expects gfan to return type ideal. Probably this will change in near future.
    13281340        The return type will then be of type LIST_CMD
Note: See TracChangeset for help on using the changeset viewer.