[74a91c9] | 1 | /* |
---|
| 2 | * gfanlib_polyhedralfan.h |
---|
| 3 | * |
---|
| 4 | * Created on: Nov 16, 2010 |
---|
| 5 | * Author: anders |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #ifndef GFANLIB_POLYHEDRALFAN_H_INCLUDED |
---|
| 9 | #define GFANLIB_POLYHEDRALFAN_H_INCLUDED |
---|
| 10 | |
---|
| 11 | #include <set> |
---|
| 12 | #include <list> |
---|
| 13 | #include <map> |
---|
| 14 | #include "gfanlib_symmetry.h" |
---|
| 15 | #include "gfanlib_matrix.h" |
---|
| 16 | #include "gfanlib_zcone.h" |
---|
| 17 | #include "gfanlib_symmetriccomplex.h" |
---|
| 18 | |
---|
| 19 | namespace gfan{ |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | typedef std::set<ZCone> PolyhedralConeList; |
---|
| 23 | typedef std::list<IntVector> IntVectorList; |
---|
| 24 | typedef std::map<int,IntVectorList> IncidenceList; |
---|
| 25 | |
---|
[5ff68b] | 26 | class PolyhedralFan; |
---|
[4b5171] | 27 | PolyhedralFan refinement(const PolyhedralFan &a, const PolyhedralFan &b, int cutOffDimension=-1, bool allowASingleConeOfCutOffDimension=false); |
---|
[74a91c9] | 28 | |
---|
| 29 | /** A PolyhedralFan is simply a collection of canonicalized PolyhedralCones. |
---|
| 30 | * It contains no combinatorial information in the sense of a polyhedral complex. |
---|
| 31 | * A cone being present in the PolyhedralFan corresponds to the cone and all its facets being present |
---|
| 32 | * in the mathematical object. |
---|
| 33 | * The intersection of cones in the fan must be a face of both. |
---|
| 34 | * In particular all cones in a PolyhedralFan have the same lineality space.*/ |
---|
| 35 | class PolyhedralFan |
---|
| 36 | { |
---|
| 37 | int n; |
---|
| 38 | SymmetryGroup symmetries; |
---|
| 39 | PolyhedralConeList cones; |
---|
| 40 | public: |
---|
| 41 | static class PolyhedralFan fullSpace(int n); |
---|
| 42 | static class PolyhedralFan facetsOfCone(ZCone const &c); |
---|
| 43 | PolyhedralFan(int ambientDimension); |
---|
| 44 | PolyhedralFan(SymmetryGroup const &sym); |
---|
| 45 | std::string toString(int flags=FPF_default)const; |
---|
| 46 | /* Read in a polyhedral fan, but with the cones containing w. If |
---|
| 47 | present, only read in cones among coneIndices. If sym is |
---|
| 48 | present, read COMPRESSED section and make w containment up to |
---|
| 49 | symmetry, taking all elements in the orbit that contains w into |
---|
| 50 | the fan. If onlyMaximal is set then only maximal cones are read |
---|
| 51 | in. |
---|
| 52 | */ |
---|
| 53 | int getAmbientDimension()const; |
---|
| 54 | int getMaxDimension()const; |
---|
| 55 | int getMinDimension()const; |
---|
[5ff68b] | 56 | // friend PolyhedralFan refinement(const PolyhedralFan &a, const PolyhedralFan &b, int cutOffDimension=-1, bool allowASingleConeOfCutOffDimension=false); |
---|
[74a91c9] | 57 | ZMatrix getRays(int dim=1);//This can be called for other dimensions than 1. The term "Rays" still makes sense modulo the common linearity space |
---|
| 58 | ZMatrix getRelativeInteriorPoints(); |
---|
| 59 | void insert(ZCone const &c); |
---|
| 60 | void remove(ZCone const &c); |
---|
| 61 | void removeAllLowerDimensional(); |
---|
| 62 | /** |
---|
| 63 | Since the cones stored in a PolyhedralFan are cones of a |
---|
| 64 | polyhedral fan, it is possible to identify non maximal cones by |
---|
| 65 | just checking containment of relative interior points in other |
---|
| 66 | cones. This routine removes all non-maximal cones. |
---|
| 67 | */ |
---|
| 68 | void removeNonMaximal(); |
---|
| 69 | /** |
---|
| 70 | Returns the number of cones stored in the fan. This is not the number of cones in the fan in a mathematical sense. |
---|
| 71 | */ |
---|
| 72 | int size()const; |
---|
| 73 | int dimensionOfLinealitySpace()const; |
---|
| 74 | void makePure(); |
---|
| 75 | bool contains(ZCone const &c)const; |
---|
| 76 | /** |
---|
| 77 | * For a vector contained in the support of the fan represented by the fan object, this function |
---|
| 78 | * computes the cone that contains the vector in its relative interior. |
---|
| 79 | */ |
---|
| 80 | ZCone coneContaining(ZVector const &v)const; |
---|
| 81 | PolyhedralFan facetComplex()const; |
---|
| 82 | |
---|
| 83 | ZMatrix getRaysInPrintingOrder(bool upToSymmetry=false)const; |
---|
| 84 | IncidenceList getIncidenceList(SymmetryGroup *sym=0)const; |
---|
| 85 | bool isEmpty()const; |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | /** |
---|
| 89 | Computes the link of the face containing w in its relative interior. |
---|
| 90 | */ |
---|
| 91 | PolyhedralFan link(ZVector const &w)const; |
---|
| 92 | PolyhedralFan link(ZVector const &w, SymmetryGroup *sym)const; |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | typedef PolyhedralConeList::const_iterator coneIterator; |
---|
| 97 | PolyhedralFan::coneIterator conesBegin()const; |
---|
| 98 | PolyhedralFan::coneIterator conesEnd()const; |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | /** |
---|
| 102 | * Converts a PolyhedralFan into a SymmetricComplex. This is used for homology computations, but not for printing yet. |
---|
| 103 | */ |
---|
| 104 | SymmetricComplex toSymmetricComplex()const; |
---|
| 105 | // static PolyhedralFan readFan(string const &filename, bool onlyMaximal=true, IntegerVector *w=0, set<int> const *conesIndice=0, SymmetryGroup const *sym=0, bool readCompressedIfNotSym=false); |
---|
| 106 | }; |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | void addFacesToSymmetricComplex(SymmetricComplex &c, ZCone const &cone, ZMatrix const &facetCandidates, ZMatrix const &generatorsOfLinealitySpace); |
---|
| 110 | void addFacesToSymmetricComplex(SymmetricComplex &c, std::set<int> const &indices, ZMatrix const &facetCandidates, int dimension, Integer multiplicity); |
---|
| 111 | |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | #endif |
---|