1 | /* |
---|
2 | * gfanlib_symmetriccomplex.h |
---|
3 | * |
---|
4 | * Created on: Nov 16, 2010 |
---|
5 | * Author: anders |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef GFANLIB_SYMMETRICCOMPLEX_H_INCLUDED |
---|
9 | #define GFANLIB_SYMMETRICCOMPLEX_H_INCLUDED |
---|
10 | |
---|
11 | #include <set> |
---|
12 | #include <string> |
---|
13 | #include <map> |
---|
14 | |
---|
15 | #include "gfanlib_symmetry.h" |
---|
16 | #include "gfanlib_matrix.h" |
---|
17 | #include "gfanlib_zcone.h" |
---|
18 | |
---|
19 | namespace gfan{ |
---|
20 | enum FanPrintingFlags{ |
---|
21 | FPF_conesCompressed=1, |
---|
22 | FPF_conesExpanded=2, |
---|
23 | FPF_cones=4, |
---|
24 | FPF_maximalCones=8, |
---|
25 | FPF_boundedInfo=16, |
---|
26 | FPF_values=32, |
---|
27 | FPF_group=64, |
---|
28 | FPF_multiplicities=128, |
---|
29 | FPF_xml=256, |
---|
30 | FPF_tPlaneSort=512, |
---|
31 | FPF_primitiveRays=1024, |
---|
32 | |
---|
33 | FPF_default=2+4+8 |
---|
34 | }; |
---|
35 | |
---|
36 | class SymmetricComplex{ |
---|
37 | int n; |
---|
38 | ZMatrix linealitySpace; |
---|
39 | ZMatrix vertices; |
---|
40 | std::map<ZVector,int> indexMap; |
---|
41 | SymmetryGroup sym; |
---|
42 | IntVector dimensionsAtInfinity()const; |
---|
43 | public: |
---|
44 | int getAmbientDimension()const{return n;} |
---|
45 | class Cone |
---|
46 | { |
---|
47 | bool isKnownToBeNonMaximalFlag; |
---|
48 | public: |
---|
49 | IntVector indices;//always sorted |
---|
50 | Cone(std::set<int> const &indices_, int dimension_, Integer multiplicity_, bool sortWithSymmetry, SymmetricComplex const &complex); |
---|
51 | std::set<int> indexSet()const; |
---|
52 | int dimension; |
---|
53 | Integer multiplicity; |
---|
54 | bool isKnownToBeNonMaximal()const{return isKnownToBeNonMaximalFlag;} |
---|
55 | void setKnownToBeNonMaximal(){isKnownToBeNonMaximalFlag=true;} |
---|
56 | bool isSubsetOf(Cone const &c)const; |
---|
57 | SymmetricComplex::Cone permuted(Permutation const &permutation, SymmetricComplex const &complex, bool withSymmetry)const; |
---|
58 | ZVector sortKey; |
---|
59 | Permutation sortKeyPermutation; |
---|
60 | bool operator<(const Cone & b)const; |
---|
61 | bool isSimplicial(int linealityDim)const; |
---|
62 | void remap(SymmetricComplex &complex); |
---|
63 | /** |
---|
64 | * This routine computes a basis for the orthogonal complement of the cone. |
---|
65 | * Notice that the lineality space, which is unknown at the time, is ignored. |
---|
66 | * This routine is deterministic and used for orienting the faces when computing homology. |
---|
67 | */ |
---|
68 | ZMatrix orthogonalComplement(SymmetricComplex &complex)const; |
---|
69 | }; |
---|
70 | typedef std::set<Cone> ConeContainer; |
---|
71 | ConeContainer cones; |
---|
72 | int dimension; |
---|
73 | SymmetricComplex(ZMatrix const &rays, ZMatrix const &linealitySpace, SymmetryGroup const &sym_); |
---|
74 | /** |
---|
75 | * Returns a reference to the matrix of vertices on which the complex is build. |
---|
76 | * The reference is valid as the Symmetric complex object exists. |
---|
77 | */ |
---|
78 | ZMatrix const &getVertices()const{return vertices;} |
---|
79 | bool contains(Cone const &c)const; |
---|
80 | void insert(Cone const &c); |
---|
81 | int getMaxDim()const; |
---|
82 | int getMinDim()const; |
---|
83 | int getLinDim()const; |
---|
84 | bool isMaximal(Cone const &c)const; |
---|
85 | bool isPure()const; |
---|
86 | ZVector fvector(bool boundedPart=false)const; |
---|
87 | void buildConeLists(bool onlyMaximal, bool compressed, std::vector<std::vector<IntVector > >*conelist/*, ZMatrix *multiplicities*/)const; |
---|
88 | std::string toStringJustCones(int dimLow, int dimHigh, bool onlyMaximal, bool group, std::ostream *multiplicities=0, bool compressed=false, bool tPlaneSort=false)const; |
---|
89 | std::string toStringJustRaysAndMaximalCones(int flags=0)const; |
---|
90 | std::string toString(int flags=0)const; |
---|
91 | bool isSimplicial()const; |
---|
92 | /** |
---|
93 | Calling this function will change the representative of each cone |
---|
94 | orbit by "applying" the permutation which will give the sortkey to |
---|
95 | the set of indices of the cone. |
---|
96 | */ |
---|
97 | void remap(); |
---|
98 | /** |
---|
99 | * Looks up the index of the vector among the vertices. |
---|
100 | */ |
---|
101 | int indexOfVertex(ZVector const &v)const; |
---|
102 | int numberOfConesOfDimension(int d)const; |
---|
103 | /** |
---|
104 | * Given a cone this returns its index among all cones of that dimension. |
---|
105 | * Used for assigning "names" to cones. |
---|
106 | */ |
---|
107 | int dimensionIndex(Cone const &c); |
---|
108 | #if 0 |
---|
109 | /** |
---|
110 | * This routine is used for constructing the boundary map for homology computations. |
---|
111 | */ |
---|
112 | void boundary(Cone const &c, IntVector &indices, IntVector &signs); |
---|
113 | /** |
---|
114 | * This routine computes the ith boundary map for homology as a matrix. |
---|
115 | */ |
---|
116 | ZMatrix boundaryMap(int i); |
---|
117 | #endif |
---|
118 | ZCone makeZCone(IntVector const &indices)const; |
---|
119 | }; |
---|
120 | } |
---|
121 | |
---|
122 | #endif |
---|