Loading...
Searching...
No Matches
tropicalVarietyOfPolynomials.cc File Reference
`#include "gfanlib/gfanlib.h"`
`#include "polys/monomials/p_polys.h"`
`#include "callgfanlib_conversion.h"`
`#include "tropicalStrategy.h"`
`#include "tropicalVarietyOfPolynomials.h"`

Go to the source code of this file.

## Functions

std::set< gfan::ZCone > | tropicalVariety (const poly g, const ring r, const tropicalStrategy *currentCase)
ZConesSortedByDimension | tropicalVarietySortedByDimension (const poly g, const ring r, const tropicalStrategy *currentCase)

## Function Documentation

## tropicalVariety()

std::set< gfan::ZCone > tropicalVariety | ( | const poly | g,
|  | const ring | r,
|  | const tropicalStrategy * | currentCase )

Definition at line 20 of file tropicalVarietyOfPolynomials.cc.

{
int n = rVar(r);
std::set<gfan::ZCone> tropVar;
if (g && g->next)
{
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));
int l = exponents.getHeight();
gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
lowerHalfSpaceCondition[0] = -1;
for (int i=0; i<l; i++)
{
for (int j=i+1; j<l; j++)
{
gfan::ZMatrix equation = gfan::ZMatrix(0,n);
equation.appendRow(exponents[i].toVector()-exponents[j].toVector());
gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
if (currentCase->restrictToLowerHalfSpace())
inequalities.appendRow(lowerHalfSpaceCondition);
for (int k=0; k<l; k++)
if (k!=i && k!=j) inequalities.appendRow(((gfan::ZVector)exponents[i])-exponents[k]);
gfan::ZCone zc = gfan::ZCone(inequalities,equation);
if (zc.dimension()>=n-1)
{
zc.canonicalize();
tropVar.insert(zc);
}
}
}
}
return tropVar;
}
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
k
int k
Definition cfEzgcd.cc:99
g
g
Definition cfModGcd.cc:4098
tropicalStrategy::restrictToLowerHalfSpace
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise
Definition tropicalStrategy.h:238
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

## tropicalVarietySortedByDimension()

ZConesSortedByDimension tropicalVarietySortedByDimension | ( | const poly | g,
|  | const ring | r,
|  | const tropicalStrategy * | currentCase )

Definition at line 62 of file tropicalVarietyOfPolynomials.cc.

{
int n = rVar(r);
ZConesSortedByDimension tropVar;
if (g && g->next)
{
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));
int l = exponents.getHeight();
gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
lowerHalfSpaceCondition[0] = -1;
for (int i=0; i<l; i++)
{
for (int j=i+1; j<l; j++)
{
gfan::ZMatrix equation = gfan::ZMatrix(0,n);
equation.appendRow(exponents[i].toVector()-exponents[j].toVector());
gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
if (currentCase->restrictToLowerHalfSpace())
inequalities.appendRow(lowerHalfSpaceCondition);
for (int k=0; k<l; k++)
if (k!=i && k!=j) inequalities.appendRow(exponents[i].toVector()-exponents[k].toVector());
gfan::ZCone zc = gfan::ZCone(inequalities,equation);
if (zc.dimension()>=n-1)
{
zc.canonicalize();
tropVar.insert(zc);
}
}
}
}
return tropVar;
}
ZConesSortedByDimension
std::set< gfan::ZCone, ZConeCompareDimensionFirst > ZConesSortedByDimension
Definition tropicalVarietyOfPolynomials.h:27