Changeset 86f23e in git


Ignore:
Timestamp:
Apr 30, 2009, 11:32:01 AM (15 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
fca87ac65d9188c296070cf81e3cdbe571886b62
Parents:
d7fe2a25f82c1fea9eea86260f9312234f364449
Message:
populated method revereSearch
new method isSearchFacet; calling with references does not work as expected though
rev will not compile


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    rd7fe2a2 r86f23e  
    22Compute the Groebner fan of an ideal
    33$Author: monerjan $
    4 $Date: 2009-04-29 07:22:48 $
    5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.42 2009-04-29 07:22:48 monerjan Exp $
    6 $Id: gfan.cc,v 1.42 2009-04-29 07:22:48 monerjan Exp $
     4$Date: 2009-04-30 09:32:01 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.43 2009-04-30 09:32:01 monerjan Exp $
     6$Id: gfan.cc,v 1.43 2009-04-30 09:32:01 monerjan Exp $
    77*/
    88
     
    228228                }
    229229               
    230                 void getIntPoint()
     230                /** \brief Return the interior point */
     231                intvec *getIntPoint()
     232                {
     233                        return this->ivIntPt;
     234                }
     235               
     236                void showIntPoint()
    231237                {
    232238                        ivIntPt->show();
     
    10141020                }//rCopyAndChange
    10151021               
    1016                 void reverseSearch()
    1017                 {
     1022                /**
     1023                * Determines whether a given facet of a cone is the search facet of a neighbouring cone
     1024                *
     1025                */
     1026                bool isSearchFacet(gcone &tmpcone, facet *testfacet)
     1027                {                       
     1028                        ring actRing=currRing;
     1029                       
     1030                        facet *fMin=new facet();        //Pointer to the "minimal" facet
     1031                        facet *fAct;
     1032                        fMin = testfacet;
     1033                        fAct = fMin;
     1034                       
     1035                        rChangeCurrRing(this->rootRing);
     1036                        poly p=NULL;
     1037                        poly q=NULL;
     1038                        intvec *p_weight = new intvec(this->numVars);                   
     1039                        intvec *q_weight = new intvec(this->numVars);
     1040                        intvec *sigma = new intvec(this->numVars);
     1041                        sigma=tmpcone.getIntPoint();
     1042                        int *u=(int *)omAlloc((this->numVars+1)*sizeof(int));
     1043                        int *v=(int *)omAlloc((this->numVars+1)*sizeof(int));
     1044                        int weight1,weight2;
     1045                        while(tmpcone.facetPtr->next!=NULL)
     1046                        {
     1047                                /* Get alpha_i and alpha_{i+1} */
     1048                                p_weight=fMin->getFacetNormal();
     1049                                q_weight=fMin->next->getFacetNormal();
     1050                               
     1051                                /*Compute the dot product of sigma and alpha_{i,j}*/
     1052                                weight1=dotProduct(sigma,p_weight);
     1053                                weight2=dotProduct(sigma,q_weight);
     1054                               
     1055                                /*Adjust alpha_i and alpha_i+1 accordingly*/
     1056                                for(int ii=1;ii<=this->numVars;ii++)
     1057                                {
     1058                                        /*p_weight[ii]=weight1*(*p_weight)[ii];
     1059                                        q_weight[ii]=weight2*(*q_weight)[ii];*/
     1060                                        u[ii]=weight1*(*p_weight)[ii];
     1061                                        v[ii]=weight2*(*q_weight)[ii];
     1062                                }
     1063                               
     1064                                /*Now p_weight and q_weight need to be compared as exponent vectors*/
     1065                                pSetExpV(p,u);
     1066                                pSetExpV(q,v);
     1067                                /*We want to check whether x^p < x^q
     1068                                => want to check for return value 1 */
     1069                                if (pLmCmp(p,q)==1)     //i.e. x^q is smaller
     1070                                {
     1071                                        fMin=fMin->next;
     1072                                        fAct=fMin;
     1073                                }
     1074                                else
     1075                                {
     1076                                        fAct=fAct->next;
     1077                                }
     1078                        }//while(tmpcone.facetPtr->next!=NULL)
     1079                        rChangeCurrRing(actRing);
     1080                }//bool isSearchFacet
     1081               
     1082                void reverseSearch(gcone gcAct) //no const possible here since we call gcAct->flip
     1083                {
     1084                        facet *fAct=new facet();
     1085                        fAct = gcAct.facetPtr;                 
     1086                       
     1087                        while(fAct->next!=NULL)
     1088                        {
     1089                                gcAct.flip(gcAct.gcBasis,gcAct.facetPtr);
     1090                                gcone *gcTmp = new gcone(gcAct);
     1091                                idShow(gcTmp->gcBasis);
     1092                                gcTmp->getConeNormals(gcTmp->gcBasis, TRUE);
     1093                                gcTmp->showIntPoint();
     1094                                /*recursive part goes gere*/
     1095                                if (isSearchFacet(gcTmp,gcAct.facetPtr))
     1096                                {
     1097                                        gcAct.next=gcTmp;
     1098                                        reverseSearch(*gcTmp);
     1099                                }
     1100                                else
     1101                                {
     1102                                        delete gcTmp;
     1103                                        /*NOTE remove fAct from linked list. It's no longer needed*/
     1104                                }
     1105                                /*recursion ends*/
     1106                                fAct = fAct->next;             
     1107                        }//while(fAct->next!=NULL)
    10181108                }//reverseSearch
    10191109};//class gcone
     
    10781168        NOTE: Check for flippability is not very sophisticated
    10791169        */
    1080         facet *fAct=new facet();
     1170        /*facet *fAct=new facet();
    10811171        fAct=gcAct->facetPtr;
    10821172        while(fAct->next!=NULL)
     
    10881178                gcTmp->getIntPoint();
    10891179                fAct = fAct->next;             
    1090         }
    1091        
     1180        }*/
     1181        gcAct->reverseSearch(*gcAct);
    10921182        /*As of now extra.cc expects gfan to return type ideal. Probably this will change in near future.
    10931183        The return type will then be of type LIST_CMD
Note: See TracChangeset for help on using the changeset viewer.