Changeset fc1971 in git


Ignore:
Timestamp:
Sep 22, 2009, 11:40:10 AM (15 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
6e05dc2a25c4f0ad4762efc3fed10c763d86d7f1
Parents:
e4dfa998b64bccbdf36f705de5490011b3ef0590
Message:
Fixed traversal of SLA via boolean "maybe"-flag


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    re4dfa99 rfc1971  
    22Compute the Groebner fan of an ideal
    33$Author: monerjan $
    4 $Date: 2009-09-18 11:54:36 $
    5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.85 2009-09-18 11:54:36 monerjan Exp $
    6 $Id: gfan.cc,v 1.85 2009-09-18 11:54:36 monerjan Exp $
     4$Date: 2009-09-22 09:40:10 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.86 2009-09-22 09:40:10 monerjan Exp $
     6$Id: gfan.cc,v 1.86 2009-09-22 09:40:10 monerjan Exp $
    77*/
    88
     
    5353#endif
    5454
     55#ifdef p800
     56#include "../../cddlib/include/setoper.h"
     57#include "../../cddlib/include/cdd.h"
     58#include "../../cddlib/include/cddmp.h"
     59#endif
     60
    5561#ifndef gfan_DEBUG
    5662#define gfan_DEBUG
     63#ifndef gfan_DEBUGLEVEL
     64#define gfan_DEBUGLEVEL 1
     65#endif
    5766#endif
    5867
     
    275284                        cout << "=======================" << endl;
    276285                        cout << "Facet normal = (";
    277                         for(int ii=0;ii<pVariables;ii++)
     286                        fNormal->show(1,1);
     287                        cout << ")"<<endl;
     288                        /*for(int ii=0;ii<pVariables;ii++)
    278289                        {
    279290                                cout << (*fNormal)[ii] << ",";
     
    282293                                cout << ")" << endl;
    283294                        else
    284                                 cout << ")*" << endl;   //This case should never happen in SLA!
     295                                cout << ")*" << endl;*/ //This case should never happen in SLA!
    285296                        cout << "-----------------------" << endl;
    286297                        cout << "Codim2 facets:" << endl;
     
    289300                                f2Normal = codim2Act->getFacetNormal();
    290301                                cout << "(";
    291                                 for(int jj=0;jj<pVariables;jj++)
    292                                 {
    293                                         cout << (*f2Normal)[jj] << ",";
    294                                 }
     302                                f2Normal->show(1,0);
     303//                              for(int jj=0;jj<pVariables;jj++)
     304//                              {
     305//                                      cout << (*f2Normal)[jj] << ",";
     306//                              }
    295307                                cout << ")" << endl;
    296308                                codim2Act = codim2Act->next;
     
    668680                        else
    669681                        {
    670                                 cout << "Redundant rows: ";
    671                                 set_fwrite(stdout, ddredrows);          //otherwise print the redundant rows
     682//                              cout << "Redundant rows: ";
     683//                              set_fwrite(stdout, ddredrows);          //otherwise print the redundant rows
    672684                        }//if dd_Error
    673685#endif
     
    811823                /** \brief Compute the (codim-2)-facets of a given cone
    812824                * This method is used during noRevS
     825                * Additionally we check whether the codim2-facet normal is strictly positive. Otherwise
     826                * the facet is marked as non-flippable.
    813827                */
    814828                void getCodim2Normals(gcone const &gc)
     
    973987                                }//while
    974988#ifdef gfan_DEBUG
    975                                 cout << "Initial Form=";                               
    976                                 pWrite(initialFormElement[ii]);
    977                                 cout << "---" << endl;
     989//                              cout << "Initial Form=";                               
     990//                              pWrite(initialFormElement[ii]);
     991//                              cout << "---" << endl;
    978992#endif
    979993                                /*Now initialFormElement must be added to (ideal)initialForm */
     
    10701084                        construction of the differences
    10711085                        */
    1072                         intPointMatrix = dd_CreateMatrix(iPMatrixRows+10,this->numVars+1);
     1086                        intPointMatrix = dd_CreateMatrix(iPMatrixRows+3,this->numVars+1); //iPMatrixRows+10;
    10731087                        intPointMatrix->numbtype=dd_Integer;    //NOTE: DO NOT REMOVE OR CHANGE TO dd_Rational
    10741088                       
     
    14091423                        //dd_set_si(M->rowvec[0],1);dd_set_si(M->rowvec[1],1);dd_set_si(M->rowvec[2],1);
    14101424                                                                       
     1425                        /*NOTE: Leave the following line commented out!
     1426                        * Otherwise it will cause interior points that are not strictly positive on some examples
     1427                        *
     1428                        */
    14111429                        //dd_MatrixCanonicalize(&M, &ddlinset, &ddredrows, &ddnewpos, &err);
    14121430                        //if (err!=dd_NoError){cout << "Error during dd_MatrixCanonicalize" << endl;}
     
    18301848                        We always choose the first facet from fListPtr as facet to be flipped
    18311849                        */                     
    1832                         while(SearchListAct!=NULL)// && counter<limit)
     1850                        while((SearchListAct!=NULL) )
    18331851                        {//NOTE See to it that the cone is only changed after ALL facets have been flipped!                             
    18341852                                fAct = SearchListAct;
     
    20552073                        /** Flag to indicate a facet that should be added to SLA*/
    20562074                        bool doNotAdd=FALSE;
     2075                        /** \brief  Flag to mark a facet that might be added
     2076                        * The following case may occur:
     2077                        * A facet fAct is found to be parallel but not equal to the current facet slAct from SLA.
     2078                        * This does however not mean that there does not exist a facet behind the current slAct that is actually equal
     2079                        * to fAct. In this case we set the boolean flag maybe to TRUE. If we encounter an equality lateron, it is reset to
     2080                        * FALSE and the according slAct is deleted.
     2081                        * If slAct->next==NULL AND maybe==TRUE we know, that fAct must be added
     2082                        */
     2083                        volatile bool maybe=FALSE;
    20572084                        /**A facet was removed, lengthOfSearchlist-- thus we must not rely on
    20582085                        * if(notParallelCtr==lengthOfSearchList) but rather
     
    20762103                       
    20772104                        while(fAct!=NULL)
    2078                         {                               
     2105                        {                                              
    20792106                                if(fAct->isFlippable==TRUE)
    20802107                                {
     2108                                        maybe=FALSE;
    20812109                                        doNotAdd=TRUE;
    20822110                                        fNormal=fAct->getFacetNormal();
     
    21462174                                                {
    21472175                                                        notParallelCtr++;
    2148                                                         slAct = slAct->next;
     2176//                                                      slAct = slAct->next;
    21492177                                                }
    21502178                                                else    //fN and slN are parallel
    21512179                                                {
     2180                                                        //We check whether the codim-2-facets coincide
    21522181                                                        codim2Act = fAct->codim2Ptr;
    21532182                                                        ctr=0;
     
    21722201                                                                slNormal->show(1,0);
    21732202                                                                cout << ") from SLA:" << endl;
    2174                                                                 fAct->fDebugPrint();
    2175                                                                 slAct->fDebugPrint();
     2203                                                                fAct->fDebugPrint();
     2204                                                                slAct->fDebugPrint();
    21762205#endif
    21772206                                                                removalOccured=TRUE;
    21782207                                                                slAct->isFlippable=FALSE;
    2179                                                                 doNotAdd=TRUE;                                                         
     2208                                                                doNotAdd=TRUE;
     2209                                                                maybe=FALSE;                                                           
    21802210                                                                if(slAct==slHead)       //We want to delete the first element of SearchList
    21812211                                                                {
     
    22112241                                                                //update lengthOfSearchList                                     
    22122242                                                                lengthOfSearchList--;
    2213                                                                 slAct = slAct->next;
     2243                                                                //slAct = slAct->next; //not needed, since facets are equal
    22142244                                                                //delete deleteMarker;
    22152245                                                                deleteMarker=NULL;
     
    22202250                                                                //is no other facet later in SLA that might be equal.
    22212251                                                        {
    2222 //                                                              if(slAct->next==NULL)
    2223 //                                                              {
    2224                                                                         doNotAdd=FALSE;
    2225                                                                         slAct = slAct->next;
    2226                                                                         break;
    2227 //                                                              }
    2228 //                                                              else
    2229 //                                                                      slAct=slAct->next;
     2252                                                                maybe=TRUE;
     2253//                                                                      if(slAct->next==NULL && maybe==TRUE)
     2254//                                                                      {
     2255//                                                                      doNotAdd=FALSE;
     2256//                                                                      slAct = slAct->next;
     2257//                                                                      break;
     2258//                                                                      }
     2259//                                                                      else
     2260//                                                                      slAct=slAct->next;
    22302261                                                        }
    22312262                                                        //slAct = slAct->next;
    22322263                                                        //delete deleteMarker;                                                 
    22332264                                                }//if(!isParallel(fNormal, slNormal))
     2265                                                if( (slAct->next==NULL) && (maybe==TRUE) )
     2266                                                {
     2267                                                        doNotAdd=FALSE;
     2268                                                        break;
     2269                                                }
     2270                                                slAct = slAct->next;
    22342271                                                /* NOTE The following lines must not be here but rather called inside the if-block above.
    22352272                                                Otherwise results get crappy. Unfortunately there are two slAct=slAct->next calls now,
Note: See TracChangeset for help on using the changeset viewer.