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

« back to all changes in this revision

Viewing changes to gfanlib_symmetriccomplex.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:
 
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
  bool isMaximal(Cone const &c)const;
 
84
  bool isPure()const;
 
85
  ZVector fvector(bool boundedPart=false)const;
 
86
  void buildConeLists(bool onlyMaximal, bool compressed, std::vector<std::vector<IntVector > >*conelist/*, ZMatrix *multiplicities*/)const;
 
87
  std::string toStringJustCones(int dimLow, int dimHigh, bool onlyMaximal, bool group, std::ostream *multiplicities=0, bool compressed=false, bool tPlaneSort=false)const;
 
88
  std::string toString(int flags=0)const;
 
89
  bool isSimplicial()const;
 
90
  /**
 
91
     Calling this function will change the representative of each cone
 
92
     orbit by "applying" the permutation which will give the sortkey to
 
93
     the set of indices of the cone.
 
94
   */
 
95
  void remap();
 
96
  /**
 
97
   * Looks up the index of the vector among the vertices.
 
98
   */
 
99
  int indexOfVertex(ZVector const &v)const;
 
100
  int numberOfConesOfDimension(int d)const;
 
101
  /**
 
102
   * Given a cone this returns its index among all cones of that dimension.
 
103
   * Used for assigning "names" to cones.
 
104
   */
 
105
  int dimensionIndex(Cone const &c);
 
106
#if 0
 
107
  /**
 
108
   * This routine is used for constructing the boundary map for homology computations.
 
109
   */
 
110
  void boundary(Cone const &c, IntVector &indices, IntVector &signs);
 
111
/**
 
112
 * This routine computes the ith boundary map for homology as a matrix.
 
113
 */
 
114
  ZMatrix boundaryMap(int i);
 
115
#endif
 
116
  ZCone makeZCone(IntVector const &indices)const;
 
117
};
 
118
}
 
119
 
 
120
#endif