Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
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
Project: cocalc-sagemath-dev-slelievre
Views: 418386/*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//---------------------------------------------------------------------------2425#include <algorithm>26#include <sstream>27#include "libQnormaliz/Qinteger.h"28#include "libQnormaliz/Qvector_operations.h"2930//---------------------------------------------------------------------------3132namespace libQnormaliz {33using namespace std;3435/*36bool try_convert(long& ret, const long long& val) {37assert(false); return true;38}3940bool try_convert(long& ret, const mpq_class& val) {41assert(false); return true;42}4344bool try_convert(long long& ret, const mpq_class& val) {45assert(false); return true;46}4748bool try_convert(mpq_class& ret, const long long& val) {49assert(false); return true;50}5152bool fits_long_range(long long a) {53return sizeof(long long) == sizeof(long) || (a <= LONG_MAX && a >= LONG_MIN);54}55*/56//---------------------------------------------------------------------------5758template <typename Number>59size_t decimal_length(Number a){60/* size_t l=1;61if (a<0) {62a=-a;63l++;64}65while((a/=10)!=0)66l++;*/6768ostringstream test;69test << a;70// cout << "L " << a << " D " << test.str().size() << endl;71return test.str().size();72}7374//---------------------------------------------------------------------------7576template <typename Number>77Number permutations(const size_t& a, const size_t& b){78unsigned long i;79Number P=1;80for (i = a+1; i <= b; i++) {81P*=i;82}83return P;84}8586//---------------------------------------------------------------------------8788template<typename Number>89Number permutations_modulo(const size_t& a, const size_t& b, long m) {90unsigned long i;91Number P=1;92for (i = a+1; i <= b; i++) {93P*=i; P%=m;94}95return P;96}979899100101} //end namespace libQnormaliz102103104