1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
/*
* Normaliz 2.7
* Copyright (C) 2007-2011 Winfried Bruns, Bogdan Ichim, Christof Soeger
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
//---------------------------------------------------------------------------
// The matrix Map is assumed to be such that the rank of Map equals
// the number of columns of Map and no test is performed in the constructor
//---------------------------------------------------------------------------
#ifndef SIMPLEX_H
#define SIMPLEX_H
//---------------------------------------------------------------------------
#include <vector>
#include <list>
#include "libnormaliz.h"
//---------------------------------------------------------------------------
namespace libnormaliz {
using std::list;
using std::vector;
template<typename Integer>
class Simplex {
size_t dim;
string status;
Integer volume;
vector<size_t> key;
Matrix<Integer> Generators;
vector< Integer > diagonal;
vector< Integer > multiplicators;
vector<size_t> New_Face; // to use with a shelling
Matrix<Integer> Support_Hyperplanes;
list< vector<Integer> > Hilbert_Basis;
list< vector<Integer> > Ht1_Elements;
vector<Integer> H_Vector;
//---------------------------------------------------------------------------
// Private routines, used in the public routines
//---------------------------------------------------------------------------
void reduce_and_insert_interior(const vector< Integer >& new_element);
//adds a new element to the Hilbert basis
//---------------------------------------------------------------------------
public:
//---------------------------------------------------------------------------
// Construction and destruction
//---------------------------------------------------------------------------
Simplex();
Simplex(const vector<size_t>& k); //constructor, only key is initialized
Simplex(const Matrix<Integer>& Map); //contructor of the first in lexicographic
//order simplex inside Map, the rank of Map is assumed to equal the number of
//columns of Map
Simplex(const vector<size_t>& k, const Matrix<Integer>& Map); //main constuctor
//the rank of M is assumed to equal the number of columns of M
Simplex(const Simplex<Integer>& S); //copy constructor
~Simplex(); //destructor
//---------------------------------------------------------------------------
// Data acces
//---------------------------------------------------------------------------
void write_new_face(const vector<size_t>& Face);//writes the new face in case of a shelling
void read() const; // to be modified, just for tests
void read_k() const; // to be modified, just for tests
size_t read_dimension() const; // returns dim
string read_status() const; // returns status
void write_volume(const Integer& vol); // writes volume
Integer read_volume() const; // returns volume
vector<size_t> read_key() const; // returns key
Matrix<Integer> read_generators() const; // returns generators
vector<Integer> read_diagonal() const; // returns diagonal
vector<Integer> read_multiplicators() const; // returns multiplicators
vector<size_t> read_new_face() const; // returns new face
size_t read_new_face_size() const; // returns new face size
Matrix<Integer> read_support_hyperplanes() const; // returns the support hyperplanes
Matrix<Integer> read_hilbert_basis()const; //read the Hilbert basis
list< vector<Integer> > read_ht1_elements()const; //read the ht1 elements
const list< vector<Integer> >& acces_hilbert_basis()const; //read the Hilbert basis
vector<Integer> read_h_vector() const; //returns the h-vector
size_t read_hilbert_basis_size() const; //returns the size of the Hilbert basis
//---------------------------------------------------------------------------
// Algoritms
//---------------------------------------------------------------------------
int compare(const Simplex<Integer>& S) const; //compare the key of this with the key of S
void initialize(const Matrix<Integer>& Map); //change status from "key initialized" to "initialized"
void hilbert_basis_interior(); // computes the Hilbert basis,
//the generators are not considered !!!, status must be "initialized"
void hilbert_basis_interior(const Matrix<Integer>& Map); // computes the Hilbert basis,
//the generators are not considered !!!, status may be "key initialized" or "initialized"
void ht1_elements(const vector<Integer>& Form); //computes the volume and ht1 elements (unique without generators, stored in Hilbert_Basis)
void h_vector(const vector<Integer>& Form);
// computes the new elements of h vector in case of a shelling,
// status must be "initialized"
void h_vector(const Matrix<Integer>& Map, const vector<Integer>& Form); // computes
// computes the new elements of h vector in case of a shelling,
// status must be "key initialized"
void hilbert_basis_interior_h_vector(const vector<Integer>& Form); // computes the Hilbert basis
//and the new elements of h vector in case of a shelling,
//the generators are not considered !!!, status must be "initialized"
void hilbert_basis_interior_h_vector(const Matrix<Integer>& Map, const vector<Integer>& Form); // computes the Hilbert basis
//and the new elements of h vector in case of a shelling,
//the generators are not considered !!!, status must be "key initialized"
Integer evaluate(Full_Cone<Integer>& C, const Integer& height);
};
//class end *****************************************************************
}
//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
|