Changeset 03de21 in git


Ignore:
Timestamp:
Feb 10, 2009, 1:03:50 PM (15 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
198a3392c9c3fdba4fd627b0d5f123a0bde019f3
Parents:
ddc52f476994f64e5e45e74617b4caac7a4162bc
Message:
-No more printf, various ways of #including cddlib, more on class facet, tried to get facet::f->printFacet() to work, rmoved some no longer useful cddlib stuff


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

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    rddc52f r03de21  
    22Compute the Groebner fan of an ideal
    33Author: $Author: monerjan $
    4 Date: $Date: 2009-02-09 20:51:48 $
    5 Header: $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.7 2009-02-09 20:51:48 monerjan Exp $
    6 Id: $Id: gfan.cc,v 1.7 2009-02-09 20:51:48 monerjan Exp $
     4Date: $Date: 2009-02-10 12:03:50 $
     5Header: $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.8 2009-02-10 12:03:50 monerjan Exp $
     6Id: $Id: gfan.cc,v 1.8 2009-02-10 12:03:50 monerjan Exp $
    77*/
    88
     
    3737{
    3838        #ifdef gfan_DEBUG
    39         printf("Computing Inequalities...\n");
     39        printf("*** Computing Inequalities... ***\n");
    4040        #endif
    4141
    42         // Exponentenvektor
    43         Exponent_t leadexp,aktexp,diffexp;
     42        //All variables go here - except ineq matrix
     43        int lengthGB=IDELEMS(I);        // # of polys in the groebner basis
     44        int pCompCount;                 // # of terms in a poly
    4445        poly aktpoly;
     46        int numvar = pVariables;        // # of variables in a polynomial (or ring?)
     47        int leadexp[numvar];            // dirty hack of exp.vects
     48        int aktexp[numvar];
     49        int cols,rows;                  // will contain the dimensions of the ineq matrix
     50        // End of var declaration
    4551
    46         int lengthGB=IDELEMS(I);
    4752        printf("The Gröbner basis has %i elements\n",lengthGB);
     53        printf("The current ring has %i variables\n",numvar);
     54        cols = numvar;
     55
     56        //Compute the # inequalities i.e. rows of the matrix
     57        rows=0; //Initialization
     58        for (int ii=0;ii<IDELEMS(I);ii++)
     59        {
     60                aktpoly=(poly)I->m[ii];
     61                rows=rows+pLength(aktpoly)-1;
     62        }
     63        printf("rows=%i\n",rows);
     64        printf("Will create a %i x %i - matrix to store inequalities\n",rows,cols);
     65        matrix ineq[rows][cols];
     66
    4867
    4968        // We loop through each g\in GB
     
    5170        {
    5271                aktpoly=(poly)I->m[i];
    53                 leadexp = pGetExp(aktpoly,1); //get the exp.vect of leading monomial
    54                 for (int j=2;j<=pLength(aktpoly);j++)
    55                 {
    56                         aktexp=pGetExp(aktpoly,j);
    57                         //diffexp=pSubExp(aktpoly, leadexp,aktexp); //Dang! => runtime error
    58                         //printf("Exponentenvektor=%i\n",expmark);
    59                         //printf("Diff=%i\n",expmark-pGetExp(aktpoly,j));
    60                 }
    61                 int pCompCount;
    6272                pCompCount=pLength(aktpoly);
    6373                printf("Poly No. %i has %i components\n",i,pCompCount);
     74
     75                int *v=(int *)omAlloc((numvar+1)*sizeof(int));
     76                pGetExpV(aktpoly,v);    //find the exp.vect in v[1],...,v[n], use pNext(p)
     77
     78                //Store leadexp for aktpoly
     79                for (int kk=0;kk<numvar;kk++)
     80                {
     81                        leadexp[kk]=v[kk+1];
     82                        printf("Leadexpcomp=%i\n",leadexp[kk]);
     83                }
     84
     85                while (pNext(aktpoly)!=NULL)
     86                {
     87                        aktpoly=pNext(aktpoly);
     88                        pSetm(aktpoly);
     89                        pGetExpV(aktpoly,v);
     90                        for (int kk=0;kk<numvar;kk++)
     91                        {
     92//The ordering somehow gets lost here but this is acceptable, since we are only interested in the inequalities
     93                                aktexp[kk]=v[kk+1];
     94                                printf("aktexpcomp=%i\n",aktexp[kk]);
     95                        }
     96                }//while
     97
    6498        } //for
    6599        //res=(ideal)aktpoly;
Note: See TracChangeset for help on using the changeset viewer.