source: git/kernel/gfan.cc @ 2c6535

spielwiese
Last change on this file since 2c6535 was 2c6535, checked in by Martin Monerjan, 15 years ago
*** empty log message *** git-svn-id: file:///usr/local/Singular/svn/trunk@11356 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2Compute the Gröbner fan of an ideal
3*/
4
5#include "mod2.h"
6#include "kstd1.h"
7#include "intvec.h"
8#include "polys.h"
9#include "ideals.h"
10
11#ifndef gfan_DEBUG
12#define gfan_DEBUG
13#endif
14
15ideal getGB(ideal inputIdeal)
16{
17        #ifdef gfan_DEBUG
18        printf("Now in getGB\n");
19        #endif
20
21        ideal gb;
22        gb=kStd(inputIdeal,NULL,testHomog,NULL); //Possible to call without testHomog/isHomog?
23        idSkipZeroes(gb); //Get rid of zero entries
24
25        return gb;
26}
27
28/****** getWallIneq computes the inequalities ***/
29/*INPUT_TYPE: ideal                             */
30/*RETURN_TYPE: matrix                           */
31/************************************************/
32void getWallIneq(ideal I)
33{
34        #ifdef gfan_DEBUG
35        printf("Computing Inequalities...\n");
36        #endif
37
38        // Exponentenvektor
39        Exponent_t leadexp,aktexp,diffexp;
40        poly aktpoly;
41
42        int lengthGB=IDELEMS(I);
43        printf("The Gröbner basis has %i elements\n",lengthGB);
44
45        // We loop through each g\in GB
46        for (int i=0; i<IDELEMS(I); i++)
47        {
48                aktpoly=(poly)I->m[i];
49                leadexp = pGetExp(aktpoly,1); //get the exp.vect of leading monomial
50                for (int j=2;j<=pLength(aktpoly);j++)
51                {
52                        aktexp=pGetExp(aktpoly,j);
53                        //diffexp=pSubExp(aktpoly, leadexp,aktexp); //Dang! => runtime error
54                        //printf("Exponentenvektor=%i\n",expmark);
55                        //printf("Diff=%i\n",expmark-pGetExp(aktpoly,j));
56                }
57                int pCompCount;
58                pCompCount=pLength(aktpoly);
59                printf("Poly No. %i has %i components\n",i,pCompCount);
60        } //for
61        //res=(ideal)aktpoly;
62        //return res;
63}
64
65ideal gfan(ideal inputIdeal)
66{
67        #ifdef gfan_DEBUG
68        printf("Now in subroutine gfan\n");
69        #endif
70        ideal res;
71        matrix ineq; //Matrix containing the boundary inequalities
72
73        res=getGB(inputIdeal);
74        getWallIneq(res);
75        return res;
76}
77
Note: See TracBrowser for help on using the repository browser.