File: PointConfiguration.hh

package info (click to toggle)
topcom 1.1.2%2Bds-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 31,788 kB
  • sloc: cpp: 37,616; sh: 4,262; makefile: 497; ansic: 49
file content (165 lines) | stat: -rw-r--r-- 4,813 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
////////////////////////////////////////////////////////////////////////////////
// 
// PointConfiguration.hh 
//
//    produced: 21/08/97 jr
// last change: 30/10/97 jr
//
////////////////////////////////////////////////////////////////////////////////
#ifndef POINTCONFIGURATION_HH
#define POINTCONFIGURATION_HH

#include <assert.h>

#include "IntegerSet.hh"

#include "Vector.hh"
#include "Matrix.hh"
#include "StairCaseMatrix.hh"

#include "CommandlineOptions.hh"
#include "Simplex.hh"

namespace topcom {

  class Symmetry;
  class SymmetryGroup;

  typedef Vector Point;

  class ProductIndex {
  private:
    const size_type _size1;
    const size_type _size2;
  private:
    ProductIndex();
  public:
    inline ProductIndex(const ProductIndex& pi) :
      _size1(pi._size1), _size2(pi._size2) {}
    inline ProductIndex(const size_type size1, const size_type size2) :
      _size1(size1), _size2(size2) {}
    inline const size_type operator()(const size_type i1, const size_type i2) const {
      return i1*_size2 + i2;
    }
  };

  class CyclicIndex {
  private:
    const size_type _size1;
    const size_type _size2;
  private:
    CyclicIndex();
  public:
    inline CyclicIndex(const CyclicIndex& pi) :
      _size1(pi._size1), _size2(pi._size2) {}
    inline CyclicIndex(const size_type size1, const size_type size2) :
      _size1(size1), _size2(size2) {}
    inline const size_type operator()(const size_type i1, const size_type i2) const {
      return i1;
    }
  };

  class RevCyclicIndex {
  private:
    const size_type _size1;
    const size_type _size2;
  private:
    RevCyclicIndex();
  public:
    inline RevCyclicIndex(const RevCyclicIndex& pi) :
      _size1(pi._size1), _size2(pi._size2) {}
    inline RevCyclicIndex(const size_type size1, const size_type size2) :
      _size1(size1), _size2(size2) {}
    inline const size_type operator()(const size_type i1, const size_type i2) const {
      return i2;
    }
  };

  class PointConfiguration : public Matrix {
  public:
    // constructors:
    inline PointConfiguration();
    inline PointConfiguration(const PointConfiguration&);
    inline PointConfiguration(const Matrix&);
    inline ~PointConfiguration();
    // accessors:
    inline const parameter_type no()   const { return coldim(); }
    inline const parameter_type rank() const { return _compute_rank(); }  
    const        int            zeroes_in_row(const size_type) const;
    const        int            zeroes_in_col(const size_type) const;
    // functions
    const Field         volume()               const;
    const Field         volume(const Simplex&) const;
    // constructions in place:
    PointConfiguration& prism      ();
    PointConfiguration& pyramid    ();
    PointConfiguration& direct_sum (const PointConfiguration&);
    PointConfiguration& homogenize ();
    PointConfiguration& transform_to_full_rank();
    PointConfiguration  gale() const;
    // constructions out of place:
    PointConfiguration  product    (const PointConfiguration&) const;
    // operations in place:
    PointConfiguration& sort_rows();
    PointConfiguration& lex_abs_sort_cols(Symmetry& sym);
    PointConfiguration& preprocess(Symmetry& sym);
    PointConfiguration& reverse(Symmetry& sym);
    // std::istream:
    inline std::istream& read(std::istream&);
    inline friend std::istream& operator>>(std::istream&, PointConfiguration&);
  private:
    const parameter_type _compute_rank() const;
  };

  inline PointConfiguration::PointConfiguration() : 
    Matrix() {
  }
  inline PointConfiguration::PointConfiguration(const PointConfiguration& points) : 
    Matrix(points) {
  }
  inline PointConfiguration::PointConfiguration(const Matrix& matrix) : 
    Matrix(matrix) {
  }
  inline PointConfiguration::~PointConfiguration() {
#ifdef CONSTRUCTOR_DEBUG
    std::cerr << "destroying PointConfiguration " << *this << std::endl;
#endif
  }


  inline std::istream& PointConfiguration::read(std::istream& ist) {
    Matrix::read(ist);
#ifdef MAXNOIS64
    if (no() > block_len) {
      std::cerr << "PointConfiguration::read(std::istream& ist): " << std::endl
		<< "Code was compiled for at most "
		<< block_len << " points, " << std::endl
		<< "but the input configuration has "
		<< no() << " points." << std::endl;
      exit(1);
    }
#endif
    this->canonicalize();
    for (size_type i = 0; i < this->size(); ++i) {
      if (this->col(i).is_zero()) {
#ifdef READ_DEBUG
	std::cerr << "PointConfiguration::read(std::istream& ist): "
		  << "[0, ..., 0] not allowed."
		  << std::endl;
#endif
	ist.setstate(std::ios::failbit);
	return ist;
      }
    }
    return ist;
  }

  inline std::istream& operator>>(std::istream& ist, PointConfiguration& pc) {
    return pc.read(ist);
  }

}; // namespace topcom

#endif

// eof PointConfiguration.hh