1 #ifndef EV_OPERATIONS_H
2 #define EV_OPERATIONS_H
4 #include <polylib/polylibgmp.h>
6 #define polynomial new_polynomial
7 #define periodic new_periodic
8 #define evector new_evector
9 #define enode_type new_enode_type
10 #define enode_node new_enode_node
11 #define _enumeration _new_enumeration
12 #define Enumeration _new_Enumeration
13 #define enode _new_enode
14 #define _enode _new__enode
15 #define evalue _new_evalue
16 #define _evalue _new__evalue
17 #define eadd _new_eadd
18 #define ecopy _new_ecopy
19 #define new_enode _new_new_enode
20 #define free_evalue_refs _new_free_evalue_refs
21 #define print_evalue _new_print_evalue
22 #define print_enode _new_print_enode
23 #define reduce_evalue _new_reduce
24 #define compute_evalue _new_compute_evalue
25 #define compute_poly _new_compute_poly
26 #define in_domain _new_in_domain
28 typedef enum { polynomial
, periodic
, evector
, fractional
, relation
,
29 partition
} enode_type
;
31 typedef struct _evalue
{
32 Value d
; /* denominator */
34 Value n
; /* numerator (if denominator > 0) */
35 struct _enode
*p
; /* pointer (if denominator == 0) */
36 Polyhedron
*D
; /* domain (if denominator == -1) */
40 #define EVALUE_DOMAIN(ev) ((ev).x.D)
41 #define EVALUE_SET_DOMAIN(ev, D) \
43 value_set_si((ev).d, -1); \
44 EVALUE_DOMAIN(ev) = D; \
46 #define EVALUE_IS_DOMAIN(ev) (value_mone_p((ev).d))
48 #define EVALUE_IS_ZERO(ev) (value_pos_p((ev).d) && value_zero_p((ev).x.n))
50 typedef struct _enode
{
51 enode_type type
; /* polynomial or periodic or evector */
52 int size
; /* number of attached pointers */
53 int pos
; /* parameter position */
54 evalue arr
[1]; /* array of rational/pointer */
57 typedef struct _enumeration
{
59 Polyhedron
*ValidityDomain
; /* contraints on the parameters */
60 evalue EP
; /* dimension = combined space */
61 struct _enumeration
*next
; /* Ehrhart Polynomial, corresponding
62 to parameter values inside the
63 domain ValidityDomain below */
67 void evalue_set_si(evalue
*ev
, int n
, int d
);
68 void evalue_set(evalue
*ev
, Value n
, Value d
);
69 void evalue_copy(evalue
*dst
, evalue
*src
);
70 enode
*new_enode(enode_type type
,int size
,int pos
);
71 enode
*ecopy(enode
*e
);
72 int eequal(evalue
*e1
,evalue
*e2
);
73 void free_evalue_refs(evalue
*e
);
74 void print_evalue(FILE *DST
,evalue
*e
,char **pname
);
75 void print_enode(FILE *DST
,enode
*p
,char **pname
);
76 void reduce_evalue (evalue
*e
);
77 void aep_evalue(evalue
*e
, int *ref
);
78 void addeliminatedparams_evalue(evalue
*e
,Matrix
*CT
);
79 void eadd(evalue
*e1
,evalue
*res
);
80 void emul (evalue
*e1
, evalue
*res
);
81 void emask(evalue
*mask
, evalue
*res
);
82 int in_domain(Polyhedron
*P
, Value
*list_args
);
83 double compute_evalue(evalue
*e
,Value
*list_args
);
84 Value
*compute_poly(Enumeration
*en
,Value
*list_args
);
85 void evalue_mod2table(evalue
*ev
, int nparam
);
86 size_t evalue_size(evalue
*e
);