1 #ifndef __halfopencone_h
2 #define __halfopencone_h
3 
4 #include "polyhedralcone.h"
5 #include "termorder.h"
6 
7 #include "polyhedralfan.h"
8 
9 class HalfOpenCone{
10   static void appendList(IntegerVectorList &to, IntegerVectorList const &from, int appendValue);
11   int liftedDimension;//ambient
12  public: PolyhedralCone lifted;//remove public
13   static IntegerVectorList shrink(const IntegerVectorList &l);
14   HalfOpenCone(int dimension_, PolyhedralCone const &lifted_);
15  public:
16   int dimension;//ambient
17   HalfOpenCone(PolyhedralCone C, TermOrder const &t);//only for full dimensional cones!
18   HalfOpenCone(int dimension_, IntegerVectorList const &equations, IntegerVectorList const &nonstrict, IntegerVectorList const &strict, bool findFacets=false, bool canonicalize=false);
19   HalfOpenCone(int ambientDimension);//full space
20   bool isEmpty();
21   friend HalfOpenCone intersection(const HalfOpenCone &a, const HalfOpenCone &b, bool findFacets);
22   friend bool haveEmptyIntersection(const HalfOpenCone &a, const HalfOpenCone &b);
23   PolyhedralCone closure();
24   void splitIntoRelativelyOpenCones(list<HalfOpenCone> &l);
25   void print(class Printer &p)const;
26   bool contains(IntegerVector const &v)const;
27   friend bool operator<(HalfOpenCone const &a, HalfOpenCone const &b);
canonicalize()28   void canonicalize(){lifted.canonicalize();}
29 
30   /**
31      Remove all coordinates from the space except those listed in chosen.
32    */
33   HalfOpenCone withChosenCoordinates(list<int> chosen)const;
34   HalfOpenCone rewrite(FieldMatrix const &A, list<int> nonPivots)const;
35   HalfOpenCone rewriteExpand(list<int> pivots, IntegerVectorList const &newEquations)const;
36 };
37 
38 HalfOpenCone intersection(const HalfOpenCone &a, const HalfOpenCone &b, bool findFacets=false);
39 
40 typedef list<HalfOpenCone> HalfOpenConeList;
41 
42 HalfOpenConeList orientedBoundary(PolyhedralCone C, TermOrder const &t, HalfOpenCone *restrictingCone=0);
43 
44 HalfOpenConeList splitIntoRelativelyOpenCones(HalfOpenConeList const &l);
45 
46 class HalfOpenConeProcessor
47 {
48 public:
49   bool savePartialResult;
HalfOpenConeProcessor()50   HalfOpenConeProcessor():savePartialResult(false)
51   {
52   }
53 /**
54  * The vectors allows to look up which fans and cones were chosen at each step.
55  * Notice that chosenFan will be a permutation, and therefore
56  * SymmetryGroup::compose?Inverse?(chosenFans,chosenCone)
57  * will give the choice of cones in a non-permuted fashion.
58  *
59  * If the enumeration is restricted to a linear subspace, as it is the case in
60  * tropicalHyperSurfaceIntersectionInSubspace(), then the chosenCone vector does
61  * not make much sense.....but this is hidden anyway from the user of
62  * tropicalHyperSurfaceIntersectionClosed().
63  */
64   virtual void process(HalfOpenCone const &c, IntegerVector const &chosenFans, IntegerVector const &chosenCone)=0;
setSave()65   void setSave()
66   {
67     savePartialResult=true;
68   }
69 };
70 
71 void tropicalHyperSurfaceIntersectionWithProcessor(int dimension, PolynomialSet const &g, HalfOpenConeProcessor &myProcessor, PolyhedralCone *restrictingCone=0, bool expand=false, int intervalLow=-1, int intervalHigh=-1);
72 
73 HalfOpenConeList tropicalHyperSurfaceIntersection(int dimension, PolynomialSet const &g, HalfOpenCone *restrictingCone=0);
74 void tropicalHyperSurfaceIntersectionInSubspace(int dimension, PolynomialSet const &G, HalfOpenCone *restrictingCone, HalfOpenConeProcessor &processor, int intervalLow=-1, int intervalHigh=-1);
75 //HalfOpenConeList tropicalHyperSurfaceIntersectionInSubspace(int dimension, PolynomialSet const &g, HalfOpenCone *restrictingCone=0);
76 PolyhedralFan tropicalHyperSurfaceIntersectionClosed(int dimension, PolynomialSet const &g, PolyhedralCone *restrictingCone=0, bool expand=false, bool saveResult=false, int intervalLow=-1, int intervalHigh=-1);
77 
78 void printHalfOpenConeList(HalfOpenConeList const &l, class Printer & p);//Assuming that the union is closed and the cones have a common linearity space
79 
80 
81 PolyhedralFan faceComplexOfCone(HalfOpenCone &c);
82 
83 /**
84  * This routine tricks the tropical hypersurface intersection
85  * cone into checking whether the tropical stable intersection
86  * of the list of polynomials is non-empty. This can be used
87  * to check if a weight vector is contained in the stable
88  * intersection - simply call this routine on the initial
89  * forms of the generators.
90  */
91 bool nonEmptyStableIntersection(PolynomialSet const &g);
92 
93 
94 /**
95  * This routine tricks the tropical hypersurface intersection into
96  * checking whether the is some mixed subdivision of g with dimension D.
97  * If not, then the largest possible dimension of a mixed cell is stored in *maximalSeen.
98  */
99 //bool hasMixedCellOfDimension(PolynomialSet const &g, int D, int *maximalSeen=0, IntegerVector *choice=0);
100 
101 /**
102  * Computes the coDimension of the resultant variety of the Newton polytopes of the elements of g.
103  */
104 int coDimensionOfResultantVariety(PolynomialSet const &g, IntegerVector *choice=0);
105 int coDimensionOfResultantVariety(list<list<IntegerVector> > const &g, int d, IntegerVector *choice);
106 
107 #endif
108