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

563624 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
#include <cstdlib>
25
#include <signal.h>
26
27
#include "libnormaliz/libnormaliz.h"
28
#include "libnormaliz/general.h"
29
#include "libnormaliz/my_omp.h"
30
31
namespace libnormaliz {
32
33
bool verbose = false;
34
35
bool nmz_scip=false;
36
37
volatile sig_atomic_t nmz_interrupted = 0;
38
long default_thread_limit=8;
39
long thread_limit=default_thread_limit;
40
bool parallelization_set=false;
41
42
// bool test_arithmetic_overflow = false;
43
// long overflow_test_modulus = 15401;
44
45
size_t GMP_mat=0;
46
size_t GMP_hyp=0;
47
size_t GMP_scal_prod=0;
48
size_t TotDet=0;
49
50
void interrupt_signal_handler( int signal ){
51
nmz_interrupted = 1;
52
}
53
54
namespace {
55
std::ostream* verbose_ostream_ptr = &std::cout;
56
std::ostream* error_ostream_ptr = &std::cerr;
57
} // end anonymous namespace, only accessible in this file (and when it is included)
58
59
bool setVerboseDefault(bool v) {
60
//we want to return the old value
61
bool old = verbose;
62
verbose = v;
63
return old;
64
}
65
66
long set_thread_limit(long t){
67
long old=thread_limit;
68
parallelization_set=true;
69
thread_limit=t;
70
return old;
71
}
72
73
void setVerboseOutput(std::ostream& v_out) {
74
verbose_ostream_ptr = &v_out;
75
}
76
77
void setErrorOutput(std::ostream& e_out) {
78
error_ostream_ptr = &e_out;
79
}
80
81
std::ostream& verboseOutput() {
82
return *verbose_ostream_ptr;
83
}
84
85
std::ostream& errorOutput() {
86
return *error_ostream_ptr;
87
}
88
89
InputType to_type(const std::string& type_string) {
90
91
if ( type_string=="0" || type_string=="1" || type_string=="2" || type_string=="3"
92
|| type_string=="4" || type_string=="5" || type_string=="6"
93
|| type_string=="hyperplanes"
94
|| type_string=="10") {
95
throw BadInputException("Error: deprecated type \"" + type_string
96
+ "\", please use new type string!");
97
}
98
99
if (type_string=="0"||type_string=="integral_closure") {
100
return Type::integral_closure;
101
}
102
if (type_string=="polyhedron") {
103
return Type::polyhedron;
104
}
105
if (type_string=="1"||type_string=="normalization") {
106
return Type::normalization;
107
}
108
if (type_string=="2"||type_string=="polytope") {
109
return Type::polytope;
110
}
111
if (type_string=="3"||type_string=="rees_algebra") {
112
return Type::rees_algebra;
113
}
114
if (type_string=="4"||type_string=="hyperplanes" ||type_string=="inequalities") {
115
return Type::inequalities;
116
}
117
if (type_string=="strict_inequalities") {
118
return Type::strict_inequalities;
119
}
120
if (type_string=="strict_signs") {
121
return Type::strict_signs;
122
}
123
if (type_string=="inhom_inequalities") {
124
return Type::inhom_inequalities;
125
}
126
if (type_string=="dehomogenization") {
127
return Type::dehomogenization;
128
}
129
if (type_string=="5"||type_string=="equations") {
130
return Type::equations;
131
}
132
if (type_string=="inhom_equations") {
133
return Type::inhom_equations;
134
}
135
if (type_string=="6"||type_string=="congruences") {
136
return Type::congruences;
137
}
138
if (type_string=="inhom_congruences") {
139
return Type::inhom_congruences;
140
}
141
if (type_string=="signs") {
142
return Type::signs;
143
}
144
if (type_string=="10"||type_string=="lattice_ideal") {
145
return Type::lattice_ideal;
146
}
147
if (type_string=="grading") {
148
return Type::grading;
149
}
150
if (type_string=="excluded_faces") {
151
return Type::excluded_faces;
152
}
153
if (type_string=="lattice") {
154
return Type::lattice;
155
}
156
if (type_string=="saturation") {
157
return Type::saturation;
158
}
159
if (type_string=="cone") {
160
return Type::cone;
161
}
162
if (type_string=="offset") {
163
return Type::offset;
164
}
165
if (type_string=="vertices") {
166
return Type::vertices;
167
}
168
if (type_string=="support_hyperplanes") {
169
return Type::support_hyperplanes;
170
}
171
if (type_string=="cone_and_lattice") {
172
return Type::cone_and_lattice;
173
}
174
if (type_string=="subspace") {
175
return Type::subspace;
176
}
177
178
if (type_string=="open_facets") {
179
return Type::open_facets;
180
}
181
182
throw BadInputException("Unknown type \"" + type_string + "\"!");
183
return Type::integral_closure;
184
}
185
186
long type_nr_columns_correction(InputType t) {
187
if (t == Type::polytope || t == Type::rees_algebra)
188
return -1;
189
if (t == Type::congruences || t == Type::vertices || t == Type::polyhedron
190
|| t == Type::inhom_inequalities || t == Type::inhom_equations)
191
return 1;
192
if (t == Type::inhom_congruences)
193
return 2;
194
return 0;
195
}
196
197
/* returns true if the input of this type is a vector */
198
bool type_is_vector(InputType type){
199
if (type == Type::grading || type == Type::signs || type == Type::strict_signs
200
|| type == Type::dehomogenization || type == Type::offset || type==Type::open_facets) {
201
return true;
202
}
203
return false;
204
}
205
206
} /* end namespace libnormaliz */
207
208