Changeset d7ce08d in git


Ignore:
Timestamp:
May 28, 2009, 8:27:09 AM (14 years ago)
Author:
Martin Monerjan
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
Children:
8528c1f5019b974a855d99986bbb557fb8d66ff1
Parents:
a795c77a2788b17b019279e7ee8ba39e3a523d5f
Message:
Fixed normalize


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    ra795c77 rd7ce08d  
    22Compute the Groebner fan of an ideal
    33$Author: monerjan $
    4 $Date: 2009-05-20 09:46:43 $
    5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.55 2009-05-20 09:46:43 monerjan Exp $
    6 $Id: gfan.cc,v 1.55 2009-05-20 09:46:43 monerjan Exp $
     4$Date: 2009-05-28 06:27:09 $
     5$Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.56 2009-05-28 06:27:09 monerjan Exp $
     6$Id: gfan.cc,v 1.56 2009-05-28 06:27:09 monerjan Exp $
    77*/
    88
     
    8484                 * facet::flibGB is set via facet::setFlipGB() and printed via facet::printFlipGB
    8585                 */
    86                 ideal flipGB;           //The Groebner Basis on the other side, computed via gcone::flip
    87 
     86                ideal flipGB;           //The Groebner Basis on the other side, computed via gcone::flip               
    8887                       
    8988        public:         
     
    9190                bool isIncoming;        //Is the facet incoming or outgoing?
    9291                facet *next;            //Pointer to next facet
    93                 intvec *codim2Normals;  //Integer matrix containing the (codim-2)-facets
     92                //intvec **codim2Normals =(intvec**)omAlloc0(sizeof(intvec*));  //Integer matrix containing the (codim-2)-facets
     93                struct c2N{
     94                        intvec normal;
     95                        intvec *next;
     96                };
    9497                               
    9598                /** The default constructor. Do I need a constructor of type facet(intvec)? */
     
    100103                        this->next=NULL;
    101104                        this->UCN=NULL;
    102                         this->codim2Normals=NULL;
     105                        //this->codim2Normals=NULL;                     
    103106                }
    104107               
     
    544547                                interiorPoint(ddineq, *iv);     //NOTE ddineq contains non-flippable facets
    545548                                this->setIntPoint(iv);  //stores the interior point in gcone::ivIntPt
    546                                 delete iv;
     549                                //delete iv;
    547550                        }
    548551                       
     
    551554                       
    552555                        //Clean up but don't delete the return value! (Whatever it will turn out to be)                 
    553                         dd_FreeMatrix(ddineq);
    554                         set_free(ddredrows);
    555                         free(ddnewpos);
    556                         set_free(ddlinset);
     556                        //dd_FreeMatrix(ddineq);
     557                        //set_free(ddredrows);
     558                        //free(ddnewpos);
     559                        //set_free(ddlinset);
    557560                        //NOTE Commented out. Solved the bug that after facet2Matrix there were facets lost
    558561                        //THIS SUCKS
    559                         dd_free_global_constants();
     562                        //dd_free_global_constants();
    560563
    561564                }//method getConeNormals(ideal I)       
     
    14321435                                        {
    14331436                                                intvec *n = new intvec(this->numVars);
    1434                                                 n = normalize(P,jj);
    1435                                                 //fAct->addCodim2Facet(n);                                                             
     1437                                                normalize(P,jj,*n);
     1438                                                //fAct->addCodim2Facet(n);                                             
     1439                                                n->show();
     1440                                                delete n;                                                                       
    14361441                                        }
    14371442                                       
     
    14601465                }//void noRevS(gcone &gc)
    14611466               
    1462                 intvec *normalize(dd_MatrixPtr const &M, int line)
     1467                void normalize(dd_MatrixPtr const &M, int line, intvec &n)
    14631468                {                       
    14641469                        mpz_t denom[this->numVars];
     
    14711476                        mpz_init(kgV);
    14721477                        mpz_init(tmp);
    1473                         intvec *ivres = new intvec(this->numVars);
     1478                        //intvec *ivres = new intvec(this->numVars);
     1479//                      intvec ivres(this->numVars);
    14741480                       
    14751481                        for (int ii=0;ii<(M->colsize)-1;ii++)
     
    14801486                                //mpz_out_str(stdout,10,z);
    14811487                                mpz_set( denom[ii], z);
    1482                                 //mpz_clear(z);                         
     1488                                mpz_clear(z);                           
    14831489                        }
    14841490                        /*Compute lcm of the denominators*/
     
    14861492                        for (int ii=0;ii<(M->colsize)-1;ii++)
    14871493                        {
    1488                                 mpz_lcm(kgV,tmp,denom[ii+1]);                           
     1494                                mpz_lcm(kgV,tmp,denom[ii]);                             
    14891495                        }
    14901496                        /*Multiply the nominators by kgV*/
    14911497                        mpq_t qkgV,res;
    14921498                        mpq_init(qkgV);
     1499//                      mpq_canonicalize(qkgV);
     1500                        mpq_set_str(qkgV,"1",10);
     1501//                      mpq_canonicalize(qkgV);
    14931502                        mpq_init(res);
    1494                         mpq_set_z(qkgV,kgV);
     1503                        mpq_set_str(res,"1",10);
     1504//                      mpq_canonicalize(res);
     1505                        //mpq_set_z(qkgV,kgV);
     1506                        mpq_set_num(qkgV,kgV);
     1507                        //mpq_set_den(qkgV,1);
     1508//                      mpq_canonicalize(qkgV);
    14951509                        for (int ii=0;ii<(M->colsize)-1;ii++)
    14961510                        {
    14971511                                mpq_mul(res,qkgV,M->matrix[line-1][ii+1]);
    1498                                 (*ivres)[ii]=(int)mpz_get_d(mpq_numref(res));
     1512//                              (*ivres)[ii]=(int)mpz_get_d(mpq_numref(res));
     1513                                n[ii]=(int)mpz_get_d(mpq_numref(res));
    14991514                        }
    15001515                        //mpz_clear(denom[this->numVars]);
    1501                         //mpz_clear(kgV);
    1502                         //mpq_clear(qkgV); mpq_clear(res);
    1503                        
    1504                         return ivres;
     1516                        mpz_clear(kgV);
     1517                        mpq_clear(qkgV); mpq_clear(res);
     1518                       
     1519                        //return ivres;
    15051520                }
    15061521               
Note: See TracChangeset for help on using the changeset viewer.