Param_Polyhedron_Enumerate: plug memory leak in case of exception
[barvinok.git] / vertex_cone.h
blob7fb7e4ad59983cafcd1e1252b7bdad71060a9d85
1 #include <NTL/mat_ZZ.h>
2 #include <barvinok/evalue.h>
3 #include "power.h"
5 using namespace NTL;
7 /* Represents the vertex and the rays of a vertex cone */
8 struct vertex_cone {
9 unsigned dim;
10 /* The coefficients of the rays, ordered according
11 * to the first non-zero coefficient.
13 Vector **coeff;
14 Matrix Rays;
16 /* The powers of the coefficients of the rays */
17 struct power ***coeff_power;
19 /* The coordinates of the integer point in the fundamental
20 * parallelepiped, in the basis formed by the rays of
21 * the vertex cone.
23 evalue **E_vertex;
24 unsigned max_power;
25 /* Bernoulli polynomials corresponding to each E_vertex */
26 evalue ***bernoulli_t;
28 vertex_cone(unsigned dim);
29 void init(const mat_ZZ &rays, Param_Vertices *V, unsigned max_power);
30 void clear();
32 const evalue *get_bernoulli(int n, int i);
34 ~vertex_cone() {
35 for (int i = 0; i < dim; ++i)
36 Vector_Free(coeff[i]);
37 free(coeff);
38 delete [] E_vertex;
39 free(Rays.p);
40 for (int i = 0; i < dim; ++i)
41 delete [] coeff_power[i];
42 delete [] coeff_power;
43 delete [] bernoulli_t;