remove (some) lines
[barvinok.git] / ev_operations.h
blobb18078c81800a64754e14a62ff23f13f239a6c91
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, flooring } enode_type;
31 typedef struct _evalue {
32 Value d; /* denominator */
33 union {
34 Value n; /* numerator (if denominator > 0) */
35 struct _enode *p; /* pointer (if denominator == 0) */
36 Polyhedron *D; /* domain (if denominator == -1) */
37 } x;
38 } evalue;
40 #define EVALUE_DOMAIN(ev) ((ev).x.D)
41 #define EVALUE_SET_DOMAIN(ev, D) \
42 do { \
43 value_set_si((ev).d, -1); \
44 EVALUE_DOMAIN(ev) = D; \
45 } while(0)
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 */
55 } enode;
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 */
64 } Enumeration;
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 addeliminatedparams_enum(evalue *e, Matrix *CT, Polyhedron *CEq,
80 unsigned MaxRays, unsigned nparam);
81 void eadd(evalue *e1,evalue *res);
82 void emul (evalue *e1, evalue *res );
83 void emask(evalue *mask, evalue *res);
84 int in_domain(Polyhedron *P, Value *list_args);
85 double compute_evalue(evalue *e,Value *list_args);
86 Value *compute_poly(Enumeration *en,Value *list_args);
87 void evalue_mod2table(evalue *ev, int nparam);
88 void evalue_mod2relation(evalue *e);
89 void evalue_combine(evalue *e);
90 void evalue_range_reduction(evalue *e);
91 size_t evalue_size(evalue *e);
92 size_t domain_size(Polyhedron *D);
93 Enumeration* partition2enumeration(evalue *EP);
94 void evalue_frac2floor(evalue *e);
95 evalue *esum(evalue *E, int nvar);
97 #endif