~ubuntu-branches/ubuntu/saucy/gfan/saucy-proposed

« back to all changes in this revision

Viewing changes to polyhedralfan.h

  • Committer: Package Import Robot
  • Author(s): Cédric Boutillier
  • Date: 2013-07-09 10:44:01 UTC
  • mfrom: (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130709104401-5q66ozz5j5af0dak
Tags: 0.5+dfsg-3
* Upload to unstable.
* modify remove_failing_tests_on_32bits.patch to replace command of
  0009RenderStairCase test with an empty one instead of deleting it.
* remove lintian override about spelling error

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
typedef map<int,IntegerVectorList> IncidenceList;
16
16
 
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,
 
19
  FPF_conesExpanded=2,
 
20
  FPF_cones=4,
 
21
  FPF_maximalCones=8,
 
22
  FPF_boundedInfo=16,
 
23
  FPF_values=32,
 
24
  FPF_group=64,
 
25
  FPF_multiplicities=128,
 
26
  FPF_xml=256,
 
27
  FPF_tPlaneSort=512,
 
28
  FPF_primitiveRays=1024,
 
29
 
 
30
  FPF_default=2+4+8
 
31
};
 
32
 
 
33
 
 
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
19
41
{
20
42
  int n;
21
43
  PolyhedralConeList cones;
22
44
 public:
 
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);
 
52
  /**
 
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.
 
58
   */
 
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
 
71
     in.
 
72
   */
 
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();
 
87
  /**
 
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.
 
92
   */
 
93
  void removeNonMaximal();
 
94
  /**
 
95
     Returns the number of cones stored in the fan. This is not the number of cones in the fan in a mathematical sense.
 
96
   */
 
97
  int size()const;
 
98
  int dimensionOfLinealitySpace()const;
43
99
  void makePure();
44
100
  bool contains(PolyhedralCone const &c)const;
 
101
  /**
 
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.
 
104
   */
 
105
  PolyhedralCone coneContaining(IntegerVector const &v)const;
45
106
  PolyhedralFan facetComplex()const;
 
107
  /**
 
108
     This routine computes all cones in the fan and returns them as a new PolyhedralFan. This routine is extremely slow.
 
109
   */
 
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;
 
117
  /**
 
118
     Computes the link of the face containing w in its relative interior.
 
119
   */
 
120
  PolyhedralFan link(IntegerVector const &w)const;
 
121
  PolyhedralFan link(IntegerVector const &w, SymmetryGroup *sym)const;
 
122
  /**
 
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.
 
126
   */
 
127
  int64 evaluatePiecewiseLinearFunction(IntegerVector const &x)const;
51
128
 
52
129
  typedef PolyhedralConeList::const_iterator coneIterator;
53
130
  PolyhedralFan::coneIterator conesBegin()const;
54
131
  PolyhedralFan::coneIterator conesEnd()const;
 
132
  /**
 
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.
 
136
   */
 
137
  FieldElement volume(int d, SymmetryGroup *sym=0)const;
 
138
  /**
 
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.
 
144
   */
 
145
  bool isConnected(SymmetryGroup *sym=0)const;
 
146
  PolyhedralFan negated()const;
 
147
 
 
148
 
 
149
  /**
 
150
     Checks if c can be inserted in the fan without violating the fan
 
151
     axioms. Very slow.
 
152
   */
 
153
  bool isCompatible(PolyhedralCone const &c)const;
 
154
  /**
 
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
 
157
     extremely slow.
 
158
   */
 
159
  void merge(PolyhedralCone const &c);
 
160
  /**
 
161
   * Converts a PolyhedralFan into a SymmetricComplex. This is used for homology computations, but not for printing yet.
 
162
   */
 
163
  class SymmetricComplex toSymmetricComplex(SymmetryGroup *sym);
55
164
};
56
165
 
 
166
 
 
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);
 
169
 
 
170
 
57
171
#endif