partition2enumeration: fix memory leak when input is zero
[barvinok.git] / vertex_cone.h
blob387cb30176622cf55d232b9e18dbbf1842a2e494
1 #include <NTL/mat_ZZ.h>
2 #include <barvinok/evalue.h>
3 #include "power.h"
5 #ifdef NTL_STD_CXX
6 using namespace NTL;
7 #endif
9 /* Represents the vertex and the rays of a vertex cone */
10 struct vertex_cone {
11 unsigned dim;
12 /* The coefficients of the rays, ordered according
13 * to the first non-zero coefficient.
15 Vector **coeff;
16 Matrix Rays;
18 /* The powers of the coefficients of the rays */
19 struct power ***coeff_power;
21 /* The coordinates of the integer point in the fundamental
22 * parallelepiped, in the basis formed by the rays of
23 * the vertex cone.
25 evalue **E_vertex;
26 unsigned max_power;
27 /* Bernoulli polynomials corresponding to each E_vertex */
28 evalue ***bernoulli_t;
30 vertex_cone(unsigned dim);
31 void init(const mat_ZZ &rays, Param_Vertices *V, unsigned max_power);
32 void clear();
34 const evalue *get_bernoulli(int n, int i);
36 ~vertex_cone() {
37 for (int i = 0; i < dim; ++i)
38 Vector_Free(coeff[i]);
39 free(coeff);
40 delete [] E_vertex;
41 free(Rays.p);
42 for (int i = 0; i < dim; ++i)
43 delete [] coeff_power[i];
44 delete [] coeff_power;
45 delete [] bernoulli_t;