CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

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

Views: 418425
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 CONE_PROPERTY_H_
25
#define CONE_PROPERTY_H_
26
27
#include <bitset>
28
#include <ostream>
29
30
namespace libnormaliz {
31
32
/* An enumeration of things, that can be computed for a cone.
33
* The namespace prevents interfering with other names.
34
* Remember to change also the string conversion if you change this enum!
35
*/
36
namespace ConeProperty {
37
enum Enum {
38
//
39
// goals that can be computed (or are defined by input data)
40
//
41
// matrix valued
42
Generators,
43
ExtremeRays,
44
VerticesFloat,
45
VerticesOfPolyhedron,
46
SupportHyperplanes,
47
HilbertBasis,
48
ModuleGenerators,
49
Deg1Elements,
50
ModuleGeneratorsOverOriginalMonoid,
51
Sublattice,
52
ExcludedFaces,
53
OriginalMonoidGenerators,
54
MaximalSubspace,
55
Equations,
56
Congruences,
57
//vector valued
58
Grading,
59
Dehomogenization,
60
WitnessNotIntegrallyClosed,
61
GeneratorOfInterior,
62
// Cardinalities
63
TriangulationSize,
64
// Integer valued,
65
TriangulationDetSum,
66
ReesPrimaryMultiplicity,
67
GradingDenom,
68
UnitGroupIndex,
69
InternalIndex,
70
ExternalIndex,
71
// rational valued
72
Multiplicity,
73
Integral,
74
VirtualMultiplicity,
75
// dimensions
76
RecessionRank,
77
AffineDim,
78
ModuleRank,
79
Rank,
80
EmbeddingDim,
81
// boolean valued
82
IsPointed,
83
IsDeg1ExtremeRays,
84
IsDeg1HilbertBasis,
85
IsIntegrallyClosed,
86
IsReesPrimary,
87
IsInhomogeneous,
88
IsGorenstein,
89
// complex structures
90
Triangulation,
91
StanleyDec,
92
InclusionExclusionData,
93
ClassGroup,
94
IntegerHull,
95
ConeDecomposition,
96
HilbertSeries,
97
HilbertQuasiPolynomial,
98
WeightedEhrhartSeries,
99
WeightedEhrhartQuasiPolynomial,
100
//
101
// integer type for computations
102
//
103
BigInt,
104
//
105
// algorithmic variants
106
//
107
DefaultMode,
108
Approximate,
109
BottomDecomposition,
110
NoBottomDec,
111
DualMode,
112
PrimalMode,
113
Projection,
114
ProjectionFloat,
115
NoProjection,
116
Symmetrize,
117
NoSymmetrization,
118
NoSubdivision,
119
NoNestedTri, // synonym for NoSubdivision
120
KeepOrder,
121
HSOP,
122
NoPeriodBound,
123
SCIP,
124
//
125
// checking properties of already computed data
126
// (cannot be used as a computation goal)
127
//
128
IsTriangulationNested,
129
IsTriangulationPartial,
130
131
EnumSize // this has to be the last entry, to get the number of entries in the enum
132
}; // remember to change also the string conversion function if you change this enum
133
}
134
135
class ConeProperties {
136
public:
137
/* Constructors */
138
ConeProperties();
139
ConeProperties(ConeProperty::Enum);
140
ConeProperties(ConeProperty::Enum, ConeProperty::Enum);
141
ConeProperties(ConeProperty::Enum, ConeProperty::Enum, ConeProperty::Enum);
142
ConeProperties(const std::bitset<ConeProperty::EnumSize>&);
143
144
/* set properties */
145
ConeProperties& set(ConeProperty::Enum, bool value=true);
146
ConeProperties& set(const std::string s, bool value=true);
147
ConeProperties& set(ConeProperty::Enum, ConeProperty::Enum);
148
ConeProperties& set(ConeProperty::Enum, ConeProperty::Enum, ConeProperty::Enum);
149
ConeProperties& set(const ConeProperties&);
150
151
/* reset (=unset) properties */
152
ConeProperties& reset(ConeProperty::Enum Property);
153
ConeProperties& reset(const ConeProperties&);
154
ConeProperties& reset_compute_options();
155
156
/* test which/how many properties are set */
157
bool test(ConeProperty::Enum Property) const;
158
bool any() const;
159
bool none() const;
160
size_t count () const;
161
162
/* return the restriction of this to the goals / options */
163
ConeProperties goals();
164
ConeProperties options();
165
166
/* the following methods are used internally */
167
void set_preconditions(bool inhomogeneous); // activate properties which are needed implicitly
168
void prepare_compute_options(bool inhomogeneous);
169
void check_sanity(bool inhomogeneous);
170
void check_conflicting_variants();
171
172
/* print it in a nice way */
173
friend std::ostream& operator<<(std::ostream&, const ConeProperties&);
174
175
176
private:
177
std::bitset<ConeProperty::EnumSize> CPs;
178
179
};
180
181
// conversion to/from strings
182
bool isConeProperty(ConeProperty::Enum& cp, const std::string& s);
183
ConeProperty::Enum toConeProperty(const std::string&);
184
const std::string& toString(ConeProperty::Enum);
185
std::ostream& operator<<(std::ostream&, const ConeProperties&);
186
187
}
188
189
#endif /* CONE_PROPERTY_H_ */
190
191