Changeset a7f2073 in git


Ignore:
Timestamp:
May 18, 2009, 5:11:53 PM (15 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
3131f355cc7139ed1bca8dd189bd09b02d51dc35
Parents:
4e636006a036122ffe86cbfd6e636134782f6672
Message:
New method showFacets
removed all deletes in order to prevent facets from miraculously dissapearing


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    r4e63600 ra7f2073  
    22Compute the Groebner fan of an ideal
    33$Author: monerjan $
    4 $Date: 2009-05-15 13:54:46 $
    5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.52 2009-05-15 13:54:46 monerjan Exp $
    6 $Id: gfan.cc,v 1.52 2009-05-15 13:54:46 monerjan Exp $
     4$Date: 2009-05-18 15:11:53 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.53 2009-05-18 15:11:53 monerjan Exp $
     6$Id: gfan.cc,v 1.53 2009-05-18 15:11:53 monerjan Exp $
    77*/
    88
     
    8989                bool isIncoming;        //Is the facet incoming or outgoing?
    9090                facet *next;            //Pointer to next facet
    91                
     91                intvec *codim2Normals;
     92                               
    9293                /** The default constructor. Do I need a constructor of type facet(intvec)? */
    9394                facet()                 
     
    293294                       
    294295                        fAct->setFacetNormal(ivtmp);
    295                         delete ivtmp;                                           
     296                        delete ivtmp;
     297                        delete fAct;                                           
    296298                }
    297299               
     
    315317                {
    316318                        ivIntPt->show();
     319                }
     320               
     321                void showFacets()
     322                {
     323                        facet *f = new facet();
     324                        f = this->facetPtr;
     325                        intvec *iv = new intvec(this->numVars);
     326                       
     327                        while (f!=NULL)
     328                        {
     329                                iv = f->getFacetNormal();
     330                                iv->show();
     331                                f=f->next;
     332                        }
     333                        //delete iv;
     334                        //delete f;
    317335                }
    318336               
     
    488506                                        (*ivCanonical)[jj]=1;
    489507                                        cout << "dotProd=" << dotProduct(*load,*ivCanonical) << endl;
    490                                         if (dotProduct(*load,*ivCanonical)<0)                                   
     508                                        if (dotProduct(*load,*ivCanonical)<0)   
     509                                        //if (ivMult(load,ivCanonical)<0)
    491510                                        {
    492511                                                isFlippable=TRUE;
     
    506525                                        fAct=fAct->next;        //this should definitely not be called in the above while-loop :D
    507526                                }//if (isFlippable==FALSE)
    508                                 delete load;
     527                                //delete load;
    509528                        }//for (int kk = 0; kk<ddrows; kk++)
    510529                       
     
    532551                        free(ddnewpos);
    533552                        set_free(ddlinset);
     553                        //NOTE Commented out. Solved the bug that after facet2Matrix there were facets lost
     554                        //THIS SUCKS
    534555                        dd_free_global_constants();
    535556
     
    13161337               
    13171338                /** \brief The new method of Markwig and Jensen
     1339                * Compute gcBasis and facets for the arbitrary starting cone. Store \f$(codim-1)\f$-facets as normals.
     1340                * In order to represent a facet uniquely compute also the \f$(codim-2)\f$-facets and norm by the gcd of the components.
     1341                * Keep a list of facets as a linked list containing an intvec and an integer matrix.
     1342                * Since a \f$(codim-1)\f$-facet belongs to exactly two full dimensional cones, we remove a facet from the list as
     1343                * soon as we compute this facet again. Comparison of facets is done by...
    13181344                */
    13191345                void noRevS(gcone &gc, bool usingIntPoint=FALSE)
     
    13221348                        facet *fAct = new facet();
    13231349                        fAct = gc.facetPtr;
    1324                                                
     1350                       
     1351#ifdef gfan_DEBUG
     1352                        cout << "NoRevs" << endl;
     1353                        cout << "Facets are:" << endl;
     1354                        gc.showFacets();
     1355#endif
     1356                       
    13251357                        dd_set_global_constants();
    13261358                        dd_rowrange ddrows;
     
    13501382#endif
    13511383                                        //Store the interior point and the UCN
    1352                                         fListPtr->setInteriorPoint( comp );                             
    1353                                         fListPtr->setUCN( gc.getUCN() );       
     1384                                        fListPtr->setInteriorPoint( comp );                             
     1385                                        fListPtr->setUCN( gc.getUCN() );       
    13541386                                                               
    13551387                                        dd_FreeMatrix(ddineq);
     
    13621394                                dd_rowset impl_linset, redset;
    13631395                                dd_ErrorType err;
    1364                                 dd_rowindex newpos;
    1365                                
     1396                                dd_rowindex newpos;                     
     1397
     1398#ifdef gfan_DEBUG
     1399                                cout << "before f2M" << endl;
     1400                                gc.showFacets();
    13661401                                ddineq = facets2Matrix(gc);
     1402                                cout << "after f2M" << endl;
     1403                                gc.showFacets();
     1404#endif
    13671405                               
    13681406                                /*Now set appropriate linearity*/
     
    13771415                                        dd_MatrixCanonicalize(&ddakt, &impl_linset, &redset, &newpos, &err);                   
    13781416                                       
    1379 //                                      dd_WriteMatrix(stdout,ddakt);
     1417                                        dd_WriteMatrix(stdout,ddakt);
    13801418                                        ddpolyh=dd_DDMatrix2Poly(ddakt, &err);
    13811419                                        P=dd_CopyGenerators(ddpolyh);
    13821420                                        dd_WriteMatrix(stdout,P);
    13831421                                       
    1384                                         intvec *load = new intvec(this->numVars);
     1422                                        //intvec *load = new intvec(this->numVars);
    13851423                                       
    13861424                                        dd_FreeMatrix(ddakt);
    13871425                                        dd_FreePolyhedra(ddpolyh);
    13881426                                }
     1427                                gc.showFacets();
    13891428                               
    1390                         }                               
     1429                        }                       
     1430#ifdef gfan_DEBUG
     1431                        cout << "Before writeConeToFile" << endl;
     1432                        gc.showFacets();
     1433#endif         
     1434               
    13911435                       
    13921436                        //NOTE Hm, comment in and get a crash for free...
    13931437                        //dd_free_global_constants();                           
    13941438                        gc.writeConeToFile(gc);
     1439#ifdef gfan_DEBUG                       
     1440                        cout << "After writeConeToFile" << endl;
     1441                        gc.showFacets();                       
     1442#endif
    13951443                       
    13961444                        /*2nd step
     
    13981446                        */
    13991447                        fAct = fListPtr;
    1400                         gcone *gcTmp = new gcone(gc);   //copy
     1448                        //gcone *gcTmp = new gcone(gc); //copy
    14011449                        //gcTmp->flip(gcTmp->gcBasis,fAct);
    14021450                        //NOTE: gcTmp may be deleted, gcRoot from main proc should probably not!
     
    14101458                {
    14111459                        facet *fAct = new facet();
    1412                         fAct = gc.facetPtr;                     
     1460                        fAct = gc.facetPtr;
     1461#ifdef gfan_DEBUG
     1462                        cout << "gcFacetPtr is at" << &gc.facetPtr << endl;
     1463                        cout << "fAct is at" << &fAct << endl;
     1464#endif 
    14131465                        dd_MatrixPtr M;
    14141466                        dd_rowrange ddrows;
     
    14161468                        ddcols=(this->numVars)+1;
    14171469                        ddrows=this->numFacets;
    1418                         M=dd_CreateMatrix(ddrows,ddcols);
     1470                        M=dd_CreateMatrix(ddrows,ddcols);                       
     1471#ifdef gfan_DEBUG                       
     1472                        cout << "in f2M" << endl;
     1473                        showFacets();
     1474#endif
    14191475                       
    14201476                        //dd_set_global_constants();                                           
     
    14311487                                fAct = fAct->next;                             
    14321488                        }//jj
    1433                         delete comp;           
    1434                        
     1489#ifdef gfan_DEBUG               
     1490                        cout << "in f2M" << endl;
     1491                        showFacets();
     1492#endif
     1493                       
     1494                        //delete fAct;
     1495                        //delete comp;                 
    14351496                        return M;
    14361497                }
     
    14491510                {
    14501511                        ofstream gcOutputFile("/tmp/cone1.gc");
     1512                        facet *fAct = new facet();
     1513                        fAct = gc.facetPtr;
     1514                       
    14511515                        if (!gcOutputFile)
    14521516                        {
     
    14621526                                {                                       
    14631527                                        gcOutputFile << p_String((poly)gc.gcBasis->m[ii],gc.baseRing) << endl;
    1464                                 }                       
     1528                                }                              
    14651529                               
    1466                                 facet *fAct = new facet();
    1467                                 fAct = gc.facetPtr;
    14681530                                gcOutputFile << "FACETS" << endl;                                                               
    14691531                                while(fAct!=NULL)
     
    14831545                                        }
    14841546                                        fAct=fAct->next;
     1547                                        //delete iv; iv=NULL;
    14851548                                }                               
    14861549                               
    14871550                                gcOutputFile.close();
    1488                                 delete fAct; fAct=NULL;
    1489                         }
     1551                                //delete fAct; fAct=NULL;
     1552                        }
     1553                       
    14901554                }//writeConeToFile(gcone const &gc)
    14911555               
Note: See TracChangeset for help on using the changeset viewer.