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: 418384
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
#ifndef LIST_OPERATIONS_H
26
#define LIST_OPERATIONS_H
27
28
29
//---------------------------------------------------------------------------
30
31
#include <vector>
32
#include <list>
33
#include <ostream>
34
35
#include "libQnormaliz/libQnormaliz.h"
36
// #include "libQnormaliz/Qsimplex.h"
37
38
namespace libQnormaliz {
39
using std::vector;
40
using std::list;
41
42
//---------------------------------------------------------------------------
43
// Data access
44
//---------------------------------------------------------------------------
45
46
template <typename T>
47
std::ostream& operator<< (std::ostream& out, const list<T>& l) {
48
typename list<T>::const_iterator i;
49
for (i =l.begin(); i != l.end(); i++) {
50
out << *i << " ";
51
}
52
out << std::endl;
53
return out;
54
}
55
56
//---------------------------------------------------------------------------
57
// List operations
58
//---------------------------------------------------------------------------
59
60
template<typename Number>
61
vector<Number> l_multiplication(const list< vector<Number> >& l,const vector<Number>& v);
62
//the list shall contain only vectors of size=v.size(). Returns a vector
63
//containing all the scalar products (we see l as as matrix and return l*v).
64
template<typename Number>
65
list< vector<Number> > l_list_x_matrix(const list< vector<Number> >& l,const Matrix<Number>& M);
66
//the list shall contain only vectors of size=M.nr_of_rows(). Returns a list
67
//containing the product (we see l as as matrix and return l*M).
68
template<typename Number>
69
void l_cut(list< vector<Number> >& l,int size );
70
//cuts all the vectors in l to a given size.
71
template<typename Number>
72
void l_cut_front(list< vector<Number> >& l,int size );
73
//cuts all the vectors in l to a given size, maintaining the back
74
75
}
76
77
//---------------------------------------------------------------------------
78
#endif
79
//---------------------------------------------------------------------------
80
81