Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

564010 views
1
/*
2
* Normaliz
3
* Copyright (C) 2007-2014 Winfried Bruns, Bogdan Ichim, Christof Soeger
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*
17
* As an exception, when this program is distributed through (i) the App Store
18
* by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or (iii) Google Play
19
* by Google Inc., then that store may impose any digital rights management,
20
* device limits and/or redistribution restrictions that are required by its
21
* terms of service.
22
*/
23
24
#ifndef AUTOMORPHISM_H
25
#define AUTOMORPHISM_H
26
27
#include <set>
28
#include <boost/dynamic_bitset.hpp>
29
#include "libnormaliz/matrix.h"
30
#include "libnormaliz/nmz_nauty.h"
31
#include "libnormaliz/HilbertSeries.h"
32
33
namespace libnormaliz {
34
using namespace std;
35
36
template<typename Integer> class Cone;
37
template<typename Integer> class Full_Cone;
38
template<typename Integer> class Isomorphism_Classes;
39
40
template<typename Integer>
41
class Automorphism_Group {
42
43
template<typename> friend class Cone;
44
template<typename> friend class Full_Cone;
45
template<typename> friend class Isomorphism_Classes;
46
47
Matrix<Integer> Gens, LinForms, SpecialLinForms;
48
49
vector<vector<key_t> > GenPerms;
50
vector<vector<key_t> > LinFormPerms;
51
52
vector<vector<key_t> > GenOrbits;
53
vector<vector<key_t> > LinFormOrbits;
54
55
vector<key_t> CanLabellingGens;
56
57
vector<Matrix<Integer> > LinMaps;
58
59
mpz_class order;
60
61
bool from_HB; // indicates whether the Hilbert basis was used for the computation
62
63
bool from_ambient_space;
64
bool from_input;
65
66
bool LinMaps_computed;
67
bool graded;
68
bool inhomogeneous;
69
70
bool make_linear_maps_primal(const Matrix<Integer>& GivenGens,const vector<vector<key_t> >& ComputedGenPerms);
71
void gen_data_via_lin_maps();
72
void linform_data_via_lin_maps();
73
void reset();
74
75
public:
76
77
BinaryMatrix<Integer> CanType; // see nauty
78
79
const Matrix<Integer>& getGens() const;
80
const Matrix<Integer>& getLinForms() const;
81
const Matrix<Integer>& getSpecialLinForms() const;
82
83
mpz_class getOrder() const;
84
vector<vector<key_t> > getGenPerms() const;
85
vector<vector<key_t> > getLinFormPerms() const;
86
vector<vector<key_t> > getGenOrbits() const;
87
vector<vector<key_t> > getLinFormOrbits() const;
88
vector<Matrix<Integer> > getLinMaps() const;
89
vector<key_t> getCanLabellingGens() const;
90
bool isFromAmbientSpace() const;
91
bool isGraded() const;
92
bool isInhomogeneous() const;
93
bool isFromHB() const;
94
bool isLinMapsComputed() const;
95
void setFromAmbeientSpace(bool on_off);
96
void setGraded(bool on_off);
97
void setInhomogeneous(bool on_off);
98
list<vector<Integer> > orbit_primal(const vector<Integer>& v) const;
99
void add_images_to_orbit(const vector<Integer>& v,set<vector<Integer> >& orbit) const;
100
101
BinaryMatrix<Integer> getCanType();
102
103
bool compute(const Matrix<Integer>& ExtRays,const Matrix<Integer>& GivenGens, bool given_gens_are_extrays,
104
const Matrix<Integer>& SupHyps,const Matrix<Integer>& GivenLinForms, bool given_llf_are_supps,
105
size_t nr_special_gens, const size_t nr_special_linforms);
106
107
Automorphism_Group();
108
109
}; // end class
110
111
template<typename Integer> class Isomorphism_Classes;
112
113
template<typename Integer>
114
class IsoType {
115
116
template<typename> friend class Isomorphism_Classes;
117
118
size_t rank;
119
Matrix<Integer> ExtremeRays;
120
size_t nrExtremeRays;
121
// Matrix<Integer> SupportHyperplanes;
122
size_t nrSupportHyperplanes;
123
Matrix<Integer> HilbertBasis; // without extreme rays
124
// size_t nrHilbertBasis; // with extreme rays, but not used
125
vector<Integer> Grading;
126
vector<Integer> Truncation;
127
// HilbertSeries HilbertSer;
128
mpq_class Multiplicity;
129
bool needs_Hilbert_basis;
130
131
// For the coordinate transformation to the canonical basis
132
vector<key_t> CanLabellingGens;
133
Matrix<Integer> CanTransform;
134
Integer CanDenom;
135
vector<key_t> CanBasisKey;
136
137
BinaryMatrix<Integer> CanType;
138
IsoType(); // constructs a dummy object
139
140
public:
141
142
bool isOfType(const Full_Cone<Integer>& C) const;
143
// bool isOfType(Cone<Integer>& C) const;
144
145
IsoType(const Full_Cone<Integer>& C,bool& success); // success indicates whether a class could be created
146
// IsoType(Cone<Integer>& C, bool slim=true);
147
148
// size_t getRank();
149
// Matrix<Integer> getExtremeRays() const;
150
// Matrix<Integer> getSupportHyperplanes() const;
151
const Matrix<Integer>& getHilbertBasis() const;
152
// vector<Integer> getGrading() const;
153
// vector<Integer> getTruncation() const;
154
// HilbertSeries getHilbertSeries() const;
155
mpq_class getMultiplicity() const;
156
const Matrix<Integer>& getCanTransform() const;
157
Integer getCanDenom() const;
158
BinaryMatrix<Integer> getCanType();
159
};
160
161
template<typename Integer>
162
class Isomorphism_Classes {
163
164
template<typename> friend class Cone;
165
template<typename> friend class Full_Cone;
166
167
list<IsoType<Integer> > Classes;
168
169
public:
170
171
Isomorphism_Classes();
172
const IsoType<Integer>& find_type(Full_Cone<Integer>& C, bool& found) const;
173
const IsoType<Integer>& find_type(Cone<Integer>& C, bool& found) const;
174
void add_type(Full_Cone<Integer>& C, bool& success);
175
void add_type(Cone<Integer>& C);
176
};
177
178
179
// returns all data of nauty
180
template<typename Integer>
181
vector<vector<long> > compute_automs(const Matrix<Integer>& Gens, const size_t nr_special_gens, const Matrix<Integer>& LinForms,
182
const size_t nr_special_linforms, mpz_class& group_order, BinaryMatrix<Integer>& CanType);
183
184
vector<vector<key_t> > convert_to_orbits(const vector<long>& raw_orbits);
185
186
vector<vector<key_t> > cycle_decomposition(vector<key_t> perm, bool with_fixed_points=false);
187
188
void pretty_print_cycle_dec(const vector<vector<key_t> >& dec, ostream& out);
189
190
vector<vector<key_t> > keys(const list<boost::dynamic_bitset<> >& Partition);
191
192
list<boost::dynamic_bitset<> > partition(size_t n, const vector<vector<key_t> >& Orbits);
193
194
list<boost::dynamic_bitset<> > join_partitions(const list<boost::dynamic_bitset<> >& P1,
195
const list<boost::dynamic_bitset<> >& P2);
196
197
vector<vector<key_t> > orbits(const vector<vector<key_t> >& Perms, size_t N);
198
199
} // namespace
200
201
//---------------------------------------------------------------------------
202
#endif
203
//---------------------------------------------------------------------------
204
205