Loading...
Searching...
No Matches
groebnerFan.h File Reference
`#include "gfanlib/gfanlib_zfan.h"`

Go to the source code of this file.

## Functions

gfan::ZFan * | groebnerFanOfPolynomial (poly g, ring r, bool onlyLowerHalfSpace=false)
BOOLEAN | groebnerFan (leftv res, leftv args)

## Function Documentation

## groebnerFan()

BOOLEAN groebnerFan | ( | leftv | res,
|  | leftv | args )

Definition at line 85 of file groebnerFan.cc.

{
leftv u = args;
if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
{
ideal I = (ideal) u->CopyD();
leftv v = u->next;
if (v==NULL)
{
if ((I->m[0]!=NULL) && (idElem(I)==1))
{
try
{
poly g = I->m[0];
gfan::ZFan* zf = groebnerFanOfPolynomial(g,currRing);
res->rtyp = fanID;
res->data = (char*) zf;
return FALSE;
}
catch (const std::exception& ex)
{
WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
return TRUE;
}
}
else
{
try
{
tropicalStrategy currentStrategy(I,currRing);
setOptionRedSB();
gfan::ZFan* zf = groebnerFan(currentStrategy);
undoSetOptionRedSB();
res->rtyp = fanID;
res->data = (char*) zf;
return FALSE;
}
catch (const std::exception& ex)
{
WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
return TRUE;
}
}
}
}
if ((u!=NULL) && (u->Typ()==POLY_CMD))
{
poly g = (poly) u->Data();
leftv v = u->next;
if (v==NULL)
{
try
{
gfan::ZFan* zf = groebnerFanOfPolynomial(g,currRing);
res->rtyp = fanID;
res->data = (char*) zf;
return FALSE;
}
catch (const std::exception& ex)
{
WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
return TRUE;
}
}
}
WerrorS("groebnerFan: unexpected parameters");
return TRUE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
fanID
VAR int fanID
Definition bbfan.cc:19
g
g
Definition cfModGcd.cc:4098
sleftv::CopyD
void * CopyD(int t)
Definition subexpr.cc:714
sleftv::Typ
int Typ()
Definition subexpr.cc:1048
sleftv::Data
void * Data()
Definition subexpr.cc:1192
sleftv::next
leftv next
Definition subexpr.h:86
tropicalStrategy
Definition tropicalStrategy.h:37
res
CanonicalForm res
Definition facAbsFact.cc:60
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
IDEAL_CMD
@ IDEAL_CMD
Definition grammar.cc:285
POLY_CMD
@ POLY_CMD
Definition grammar.cc:290
groebnerFan
gfan::ZFan * groebnerFan(const tropicalStrategy currentStrategy)
Definition groebnerFan.cc:28
setOptionRedSB
static void setOptionRedSB()
Definition groebnerFan.cc:14
undoSetOptionRedSB
static void undoSetOptionRedSB()
Definition groebnerFan.cc:23
groebnerFanOfPolynomial
gfan::ZFan * groebnerFanOfPolynomial(poly g, ring r, bool onlyLowerHalfSpace=false)
Definition groebnerFan.cc:36
NULL
#define NULL
Definition omList.c:12
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
idElem
static int idElem(const ideal F)
number of non-zero polys in F
Definition simpleideals.h:69
leftv
sleftv * leftv
Definition structs.h:53

## groebnerFanOfPolynomial()

gfan::ZFan * groebnerFanOfPolynomial | ( | poly | g,
|  | ring | r,
|  | bool | onlyLowerHalfSpace = false )

Definition at line 36 of file groebnerFan.cc.

{
int n = rVar(r);
if (g==NULL || g->next==NULL)
{
// if g is a term or zero, return the fan consisting of the whole weight space
gfan::ZFan* zf = new gfan::ZFan(gfan::ZFan::fullFan(n));
return zf;
}
else
{
gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
lowerHalfSpaceCondition[0] = -1;
// otherwise, obtain a list of all the exponent vectors
int* expv = (int*) omAlloc((n+1)*sizeof(int));
gfan::ZMatrix exponents = gfan::ZMatrix(0,n);
for (poly s=g; s; pIter(s))
{
p_GetExpV(s,expv,r);
gfan::ZVector zv = intStar2ZVector(n,expv);
exponents.appendRow(intStar2ZVector(n,expv));
}
omFreeSize(expv,(n+1)*sizeof(int));
// and construct the Groebner fan
gfan::ZFan* zf = new gfan::ZFan(n);
int l = exponents.getHeight();
for (int i=0; i<l; i++)
{
// constructs the Groebner cone such that initial form is i-th term
gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
if (onlyLowerHalfSpace)
inequalities.appendRow(lowerHalfSpaceCondition);
for (int j=0; j<l; j++)
{
if (i!=j)
inequalities.appendRow(exponents[i].toVector()-exponents[j].toVector());
}
gfan::ZCone zc = gfan::ZCone(inequalities,gfan::ZMatrix(0,inequalities.getWidth()));
zc.canonicalize();
zf->insert(zc);
}
return zf;
}
}
inequalities
BOOLEAN inequalities(leftv res, leftv args)
Definition bbcone.cc:560
intStar2ZVector
gfan::ZVector intStar2ZVector(const int d, const int *i)
Definition callgfanlib_conversion.cc:86
l
int l
Definition cfEzgcd.cc:100
i
int i
Definition cfEzgcd.cc:132
s
const CanonicalForm int s
Definition facAbsFact.cc:51
j
int j
Definition facHensel.cc:110
pIter
#define pIter(p)
Definition monomials.h:37
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1541
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598