GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/*1* Normaliz2* Copyright (C) 2007-2014 Winfried Bruns, Bogdan Ichim, Christof Soeger3* This program is free software: you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation, either version 3 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program. If not, see <http://www.gnu.org/licenses/>.15*16* As an exception, when this program is distributed through (i) the App Store17* by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or (iii) Google Play18* by Google Inc., then that store may impose any digital rights management,19* device limits and/or redistribution restrictions that are required by its20* terms of service.21*/2223#include <cstdlib>24#include <signal.h>2526#include "libnormaliz/libnormaliz.h"27#include "libnormaliz/general.h"28#include "libnormaliz/my_omp.h"2930namespace libnormaliz {3132bool verbose = false;3334bool nmz_scip=false;3536volatile sig_atomic_t nmz_interrupted = 0;37long default_thread_limit=8;38long thread_limit=default_thread_limit;39bool parallelization_set=false;4041// bool test_arithmetic_overflow = false;42// long overflow_test_modulus = 15401;4344size_t GMP_mat=0;45size_t GMP_hyp=0;46size_t GMP_scal_prod=0;47size_t TotDet=0;4849void interrupt_signal_handler( int signal ){50nmz_interrupted = 1;51}5253namespace {54std::ostream* verbose_ostream_ptr = &std::cout;55std::ostream* error_ostream_ptr = &std::cerr;56} // end anonymous namespace, only accessible in this file (and when it is included)5758bool setVerboseDefault(bool v) {59//we want to return the old value60bool old = verbose;61verbose = v;62return old;63}6465long set_thread_limit(long t){66long old=thread_limit;67parallelization_set=true;68thread_limit=t;69return old;70}7172void setVerboseOutput(std::ostream& v_out) {73verbose_ostream_ptr = &v_out;74}7576void setErrorOutput(std::ostream& e_out) {77error_ostream_ptr = &e_out;78}7980std::ostream& verboseOutput() {81return *verbose_ostream_ptr;82}8384std::ostream& errorOutput() {85return *error_ostream_ptr;86}8788InputType to_type(const std::string& type_string) {8990if ( type_string=="0" || type_string=="1" || type_string=="2" || type_string=="3"91|| type_string=="4" || type_string=="5" || type_string=="6"92|| type_string=="hyperplanes"93|| type_string=="10") {94throw BadInputException("Error: deprecated type \"" + type_string95+ "\", please use new type string!");96}9798if (type_string=="0"||type_string=="integral_closure") {99return Type::integral_closure;100}101if (type_string=="polyhedron") {102return Type::polyhedron;103}104if (type_string=="1"||type_string=="normalization") {105return Type::normalization;106}107if (type_string=="2"||type_string=="polytope") {108return Type::polytope;109}110if (type_string=="3"||type_string=="rees_algebra") {111return Type::rees_algebra;112}113if (type_string=="4"||type_string=="hyperplanes" ||type_string=="inequalities") {114return Type::inequalities;115}116if (type_string=="strict_inequalities") {117return Type::strict_inequalities;118}119if (type_string=="strict_signs") {120return Type::strict_signs;121}122if (type_string=="inhom_inequalities") {123return Type::inhom_inequalities;124}125if (type_string=="dehomogenization") {126return Type::dehomogenization;127}128if (type_string=="5"||type_string=="equations") {129return Type::equations;130}131if (type_string=="inhom_equations") {132return Type::inhom_equations;133}134if (type_string=="6"||type_string=="congruences") {135return Type::congruences;136}137if (type_string=="inhom_congruences") {138return Type::inhom_congruences;139}140if (type_string=="signs") {141return Type::signs;142}143if (type_string=="10"||type_string=="lattice_ideal") {144return Type::lattice_ideal;145}146if (type_string=="grading") {147return Type::grading;148}149if (type_string=="excluded_faces") {150return Type::excluded_faces;151}152if (type_string=="lattice") {153return Type::lattice;154}155if (type_string=="saturation") {156return Type::saturation;157}158if (type_string=="cone") {159return Type::cone;160}161if (type_string=="offset") {162return Type::offset;163}164if (type_string=="vertices") {165return Type::vertices;166}167if (type_string=="support_hyperplanes") {168return Type::support_hyperplanes;169}170if (type_string=="cone_and_lattice") {171return Type::cone_and_lattice;172}173if (type_string=="subspace") {174return Type::subspace;175}176177if (type_string=="open_facets") {178return Type::open_facets;179}180181throw BadInputException("Unknown type \"" + type_string + "\"!");182return Type::integral_closure;183}184185long type_nr_columns_correction(InputType t) {186if (t == Type::polytope || t == Type::rees_algebra)187return -1;188if (t == Type::congruences || t == Type::vertices || t == Type::polyhedron189|| t == Type::inhom_inequalities || t == Type::inhom_equations)190return 1;191if (t == Type::inhom_congruences)192return 2;193return 0;194}195196/* returns true if the input of this type is a vector */197bool type_is_vector(InputType type){198if (type == Type::grading || type == Type::signs || type == Type::strict_signs199|| type == Type::dehomogenization || type == Type::offset || type==Type::open_facets) {200return true;201}202return false;203}204205} /* end namespace libnormaliz */206207208