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
25
//---------------------------------------------------------------------------
26
27
#include <iostream>
28
#include <string>
29
30
#include "libnormaliz/integer.h"
31
#include "libnormaliz/vector_operations.h"
32
#include "libnormaliz/matrix.h"
33
#include "libnormaliz/simplex.h"
34
#include "libnormaliz/list_operations.h"
35
36
//---------------------------------------------------------------------------
37
38
namespace libnormaliz {
39
using namespace std;
40
41
//---------------------------------------------------------------------------
42
43
template<typename Integer>
44
vector<Integer> l_multiplication(const list< vector<Integer> >& l,const vector<Integer>& v){
45
int s=l.size();
46
vector<Integer> p(s);
47
typename list< vector<Integer> >::const_iterator i;
48
s=0;
49
for (i =l.begin(); i != l.end(); ++i, ++s) {
50
p[s]=v_scalar_product(*i,v); //maybe we loose time here?
51
}
52
return p;
53
}
54
55
//---------------------------------------------------------------------------
56
57
template<typename Integer>
58
list< vector<Integer> > l_list_x_matrix(const list< vector<Integer> >& l,const Matrix<Integer>& M){
59
list< vector<Integer> > result;
60
vector<Integer> p;
61
typename list< vector<Integer> >::const_iterator i;
62
for (i =l.begin(); i != l.end(); i++) {
63
p=M.VxM(*i);
64
result.push_back(p);
65
}
66
return result;
67
}
68
//---------------------------------------------------------------------------
69
70
template<typename Integer>
71
void l_cut(list< vector<Integer> >& l, int size){
72
typename list< vector<Integer> >::iterator i;
73
for (i =l.begin(); i != l.end(); i++) {
74
(*i).resize(size);
75
}
76
}
77
78
//---------------------------------------------------------------------------
79
80
81
template<typename Integer>
82
void l_cut_front(list< vector<Integer> >& l, int size){
83
typename list< vector<Integer> >::iterator i;
84
vector<Integer> tmp;
85
for (i =l.begin(); i != l.end(); ) {
86
tmp=v_cut_front(*i, size);
87
i=l.erase(i); //important to decrease memory consumption
88
l.insert(i,tmp);
89
}
90
}
91
92
93
94
}
95