source: git/kernel/gfan.cc @ 884eec

spielwiese
Last change on this file since 884eec was 884eec, checked in by Martin Monerjan, 15 years ago
*** empty log message *** git-svn-id: file:///usr/local/Singular/svn/trunk@11358 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2Compute the Grï¿œbner fan of an ideal
3Author: $Author: monerjan $
4Date: $Date: 2009-02-09 20:46:59 $
5Header: $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.6 2009-02-09 20:46:59 monerjan Exp $
6Id: $Id: gfan.cc,v 1.6 2009-02-09 20:46:59 monerjan Exp $
7*/
8
9#include "mod2.h"
10#include "kstd1.h"
11#include "intvec.h"
12#include "polys.h"
13#include "ideals.h"
14
15#ifndef gfan_DEBUG
16#define gfan_DEBUG
17#endif
18
19ideal getGB(ideal inputIdeal)
20{
21        #ifdef gfan_DEBUG
22        printf("Now in getGB\n");
23        #endif
24
25        ideal gb;
26        gb=kStd(inputIdeal,NULL,testHomog,NULL); //Possible to call without testHomog/isHomog?
27        idSkipZeroes(gb); //Get rid of zero entries
28
29        return gb;
30}
31
32/****** getWallIneq computes the inequalities ***/
33/*INPUT_TYPE: ideal                             */
34/*RETURN_TYPE: matrix                           */
35/************************************************/
36void getWallIneq(ideal I)
37{
38        #ifdef gfan_DEBUG
39        printf("Computing Inequalities...\n");
40        #endif
41
42        // Exponentenvektor
43        Exponent_t leadexp,aktexp,diffexp;
44        poly aktpoly;
45
46        int lengthGB=IDELEMS(I);
47        printf("The Gröbner basis has %i elements\n",lengthGB);
48
49        // We loop through each g\in GB
50        for (int i=0; i<IDELEMS(I); i++)
51        {
52                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;
62                pCompCount=pLength(aktpoly);
63                printf("Poly No. %i has %i components\n",i,pCompCount);
64        } //for
65        //res=(ideal)aktpoly;
66        //return res;
67}
68
69ideal gfan(ideal inputIdeal)
70{
71        #ifdef gfan_DEBUG
72        printf("Now in subroutine gfan\n");
73        #endif
74        ideal res;
75        matrix ineq; //Matrix containing the boundary inequalities
76
77        res=getGB(inputIdeal);
78        getWallIneq(res);
79        return res;
80}
Note: See TracBrowser for help on using the repository browser.