15
15
typedef map<int,IntegerVectorList> IncidenceList;
17
/* A PolyhedralFan is simply a collection of canonicalized PolyhedralCones. It contains no combinatorial information in the sense of a polyhedral complex. */
17
enum FanPrintingFlags{
18
FPF_conesCompressed=1,
25
FPF_multiplicities=128,
28
FPF_primitiveRays=1024,
34
/** A PolyhedralFan is simply a collection of canonicalized PolyhedralCones.
35
* It contains no combinatorial information in the sense of a polyhedral complex.
36
* A cone being present in the PolyhedralFan corresponds to the cone and all its facets being present
37
* in the mathematical object.
38
* The intersection of cones in the fan must be a face of both.
39
* In particular all cones in a PolyhedralFan have the same lineality space.*/
18
40
class PolyhedralFan
21
43
PolyhedralConeList cones;
45
static IntegerVector stableRay(PolyhedralCone const &c, SymmetryGroup const *sym);
46
static IntegerVector stableRay(IntegerVector const &v, IntegerVectorList const &equations, IntegerVectorList const &inequalities, SymmetryGroup const *sym);
23
47
static class PolyhedralFan bergmanOfPrincipalIdeal(Polynomial const &p);
24
48
static class PolyhedralFan normalFanOfNewtonPolytope(Polynomial const &p);
25
49
static class PolyhedralFan fullSpace(int n);
26
50
static class PolyhedralFan halfSpace(int n, int i);
27
51
static class PolyhedralFan facetsOfCone(PolyhedralCone const &c);
53
This routine computes a fan F with minimal support with the
54
following property: the cone can be inserted to (is compatible
55
with) F and this will make F complete. The support of F is the
56
closure of the complement of C. If includec is true then C is
57
indeed inserted into F before returning.
59
static class PolyhedralFan complementOfCone(PolyhedralCone const &c, bool includec=false);
28
60
PolyhedralFan(int ambientDimension);
29
61
void print(class Printer *p)const;
30
62
//void printWithIndices(class Printer *p, SymmetryGroup *sym=0, const char *polymakeFileName=0)const; //fan must be pure
31
void printWithIndices(class Printer *p, bool printMultiplicities, SymmetryGroup *sym, bool group=false)const;
63
vector<string> renamingStrings(IntegerVectorList const &theVectors, IntegerVectorList const &originalRays, IntegerVectorList const &linealitySpace, SymmetryGroup *sym)const;
64
void printWithIndices(class Printer *p, int flags=FPF_default, SymmetryGroup *sym=0, vector<string> const *comments=0)const;
65
// void printWithIndices(class Printer *p, bool printMultiplicities, SymmetryGroup *sym, bool group=false, bool ignoreCones=false, bool xml=false, bool tPlaneSort=false, vector<string> const *comments=0)const;
66
/* Read in a polyhedral fan, but with the cones containing w. If
67
present, only read in cones among coneIndices. If sym is
68
present, read COMPRESSED section and make w containment up to
69
symmetry, taking all elements in the orbit that contains w into
70
the fan. If onlyMaximal is set then only maximal cones are read
73
static PolyhedralFan readFan(string const &filename, bool onlyMaximal=true, IntegerVector *w=0, set<int> const *conesIndice=0, SymmetryGroup const *sym=0, bool readCompressedIfNotSym=false);
32
74
int getAmbientDimension()const;
33
75
int getMaxDimension()const;
34
76
int getMinDimension()const;
35
77
friend PolyhedralFan refinement(const PolyhedralFan &a, const PolyhedralFan &b, int cutOffDimension=-1, bool allowASingleConeOfCutOffDimension=false);
78
friend PolyhedralFan product(const PolyhedralFan &a, const PolyhedralFan &b);
36
79
IntegerVectorList getRays(int dim=1);//This can be called for other dimensions than 1. The term "Rays" still makes sense modulo the common linearity space
37
80
IntegerVectorList getRelativeInteriorPoints();
38
81
PolyhedralCone const& highestDimensionalCone()const; //returns one of the cones in the fan with highest dimension
39
82
void insert(PolyhedralCone const &c);
83
void insertFacetsOfCone(PolyhedralCone const &c);
40
84
void remove(PolyhedralCone const &c);
41
85
void removeAllExcept(int a); //deletes all except the first a cones
42
86
void removeAllLowerDimensional();
88
Since the cones stored in a PolyhedralFan are cones of a
89
polyhedral fan, it is possible to identify non maximal cones by
90
just checking containment of relative interior points in other
91
cones. This routine removes all non-maximal cones.
93
void removeNonMaximal();
95
Returns the number of cones stored in the fan. This is not the number of cones in the fan in a mathematical sense.
98
int dimensionOfLinealitySpace()const;
44
100
bool contains(PolyhedralCone const &c)const;
102
* For a vector contained in the support of the fan represented by the fan object, this function
103
* computes the cone that contains the vector in its relative interior.
105
PolyhedralCone coneContaining(IntegerVector const &v)const;
45
106
PolyhedralFan facetComplex()const;
108
This routine computes all cones in the fan and returns them as a new PolyhedralFan. This routine is extremely slow.
110
PolyhedralFan fullComplex()const;
46
111
PolyhedralFan facetComplexSymmetry(SymmetryGroup const &sym, bool keepRays=false, bool dropLinealitySpace=false)const;
47
IntegerVectorList getRaysInPrintingOrder(SymmetryGroup *sym)const;
112
PolyhedralFan rayComplexSymmetry(SymmetryGroup const &sym)const;
113
IntegerVectorList getRaysInPrintingOrder(SymmetryGroup const *sym, bool upToSymmetry=false)const;
48
114
IncidenceList getIncidenceList(SymmetryGroup *sym=0)const;
49
115
bool isEmpty()const;
50
116
bool isRefinementOf(PolyhedralFan const &f)const;
118
Computes the link of the face containing w in its relative interior.
120
PolyhedralFan link(IntegerVector const &w)const;
121
PolyhedralFan link(IntegerVector const &w, SymmetryGroup *sym)const;
123
If the cones have been assigned linear forms then this specifies
124
a piecewise linear function on the support of the fan. This
125
routine evaluates that linear function.
127
int64 evaluatePiecewiseLinearFunction(IntegerVector const &x)const;
52
129
typedef PolyhedralConeList::const_iterator coneIterator;
53
130
PolyhedralFan::coneIterator conesBegin()const;
54
131
PolyhedralFan::coneIterator conesEnd()const;
133
Computes the volume of the d-dimensional cones stored in the
134
fan. If the symmetry group is specified each volume of a cone is
135
multiplied by the size of its orbit.
137
FieldElement volume(int d, SymmetryGroup *sym=0)const;
139
Assuming that the fan is pure, this function tests whether the
140
fan is connected in codimension 1. IF SYMMETRY IS SPECIFIED THEN
141
THE CHECK IS NOT COMPLETE AND IT WILL ONLY BE CHECKED IF THAT GIVEN
142
TWO CONES THAT EXIST ELEMENTS IN THE TWO RESPECTIVE ORBITS
143
WHICH ARE CONNECTED BY A RIDGE PATH.
145
bool isConnected(SymmetryGroup *sym=0)const;
146
PolyhedralFan negated()const;
150
Checks if c can be inserted in the fan without violating the fan
153
bool isCompatible(PolyhedralCone const &c)const;
155
Change the polyhedral structure of the fan and add in the cone
156
c. Overlap of c and the cones are allowed. This routine is
159
void merge(PolyhedralCone const &c);
161
* Converts a PolyhedralFan into a SymmetricComplex. This is used for homology computations, but not for printing yet.
163
class SymmetricComplex toSymmetricComplex(SymmetryGroup *sym);
167
void addFacesToSymmetricComplex(class SymmetricComplex &c, PolyhedralCone const &cone, IntegerVectorList const &facetCandidates, IntegerVectorList const &generatorsOfLinealitySpace);
168
void addFacesToSymmetricComplex(SymmetricComplex &c, set<int> const &indices, IntegerVectorList const &facetCandidates, int dimension, int multiplicity);