My Project
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
tropicalVarietyOfPolynomials.h File Reference
#include "gfanlib/gfanlib.h"
#include "polys/monomials/p_polys.h"
#include "tropicalStrategy.h"

Go to the source code of this file.

Data Structures

struct  ZConeCompareDimensionFirst
 

Typedefs

typedef std::set< gfan::ZCone, ZConeCompareDimensionFirstZConesSortedByDimension
 

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)
 

Typedef Documentation

◆ ZConesSortedByDimension

typedef std::set<gfan::ZCone,ZConeCompareDimensionFirst> ZConesSortedByDimension

Definition at line 27 of file tropicalVarietyOfPolynomials.h.

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.

21{
22 int n = rVar(r);
23 std::set<gfan::ZCone> tropVar;
24 if (g && g->next)
25 {
26 int* expv = (int*) omAlloc((n+1)*sizeof(int));
27 gfan::ZMatrix exponents = gfan::ZMatrix(0,n);
28 for (poly s=g; s; pIter(s))
29 {
30 p_GetExpV(s,expv,r);
31 gfan::ZVector zv = intStar2ZVector(n,expv);
32 exponents.appendRow(intStar2ZVector(n,expv));
33 }
34 omFreeSize(expv,(n+1)*sizeof(int));
35
36 int l = exponents.getHeight();
37 gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
38 lowerHalfSpaceCondition[0] = -1;
39 for (int i=0; i<l; i++)
40 {
41 for (int j=i+1; j<l; j++)
42 {
43 gfan::ZMatrix equation = gfan::ZMatrix(0,n);
44 equation.appendRow(exponents[i].toVector()-exponents[j].toVector());
45 gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
46 if (currentCase->restrictToLowerHalfSpace())
47 inequalities.appendRow(lowerHalfSpaceCondition);
48 for (int k=0; k<l; k++)
49 if (k!=i && k!=j) inequalities.appendRow(((gfan::ZVector)exponents[i])-exponents[k]);
50 gfan::ZCone zc = gfan::ZCone(inequalities,equation);
51 if (zc.dimension()>=n-1)
52 {
53 zc.canonicalize();
54 tropVar.insert(zc);
55 }
56 }
57 }
58 }
59 return tropVar;
60}
BOOLEAN inequalities(leftv res, leftv args)
Definition: bbcone.cc:560
gfan::ZVector intStar2ZVector(const int d, const int *i)
int l
Definition: cfEzgcd.cc:100
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
g
Definition: cfModGcd.cc:4090
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise
const CanonicalForm int s
Definition: facAbsFact.cc:51
int j
Definition: facHensel.cc:110
#define pIter(p)
Definition: monomials.h:37
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1518
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:592

◆ tropicalVarietySortedByDimension()

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

Definition at line 62 of file tropicalVarietyOfPolynomials.cc.

63{
64 int n = rVar(r);
66 if (g && g->next)
67 {
68 int* expv = (int*) omAlloc((n+1)*sizeof(int));
69 gfan::ZMatrix exponents = gfan::ZMatrix(0,n);
70 for (poly s=g; s; pIter(s))
71 {
72 p_GetExpV(s,expv,r);
73 gfan::ZVector zv = intStar2ZVector(n,expv);
74 exponents.appendRow(intStar2ZVector(n,expv));
75 }
76 omFreeSize(expv,(n+1)*sizeof(int));
77
78 int l = exponents.getHeight();
79 gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
80 lowerHalfSpaceCondition[0] = -1;
81 for (int i=0; i<l; i++)
82 {
83 for (int j=i+1; j<l; j++)
84 {
85 gfan::ZMatrix equation = gfan::ZMatrix(0,n);
86 equation.appendRow(exponents[i].toVector()-exponents[j].toVector());
87 gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
88 if (currentCase->restrictToLowerHalfSpace())
89 inequalities.appendRow(lowerHalfSpaceCondition);
90 for (int k=0; k<l; k++)
91 if (k!=i && k!=j) inequalities.appendRow(exponents[i].toVector()-exponents[k].toVector());
92 gfan::ZCone zc = gfan::ZCone(inequalities,equation);
93 if (zc.dimension()>=n-1)
94 {
95 zc.canonicalize();
96 tropVar.insert(zc);
97 }
98 }
99 }
100 }
101 return tropVar;
102}
std::set< gfan::ZCone, ZConeCompareDimensionFirst > ZConesSortedByDimension