2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
10 #ifndef ISL_CONSTRAINT_H
11 #define ISL_CONSTRAINT_H
13 #include <isl/aff_type.h>
15 #include <isl/set_type.h>
16 #include <isl/printer.h>
18 #if defined(__cplusplus)
22 struct isl_constraint {
26 struct isl_basic_map *bmap;
29 typedef struct isl_constraint isl_constraint;
31 isl_ctx *isl_constraint_get_ctx(__isl_keep isl_constraint *c);
33 __isl_give isl_constraint *isl_equality_alloc(__isl_take isl_dim *dim);
34 __isl_give isl_constraint *isl_inequality_alloc(__isl_take isl_dim *dim);
35 struct isl_constraint *isl_basic_set_constraint(struct isl_basic_set *bset,
38 struct isl_constraint *isl_constraint_cow(struct isl_constraint *c);
39 struct isl_constraint *isl_constraint_copy(struct isl_constraint *c);
40 void isl_constraint_free(struct isl_constraint *c);
42 __isl_give isl_constraint *isl_basic_map_first_constraint(
43 __isl_take isl_basic_map *bmap);
44 __isl_give isl_constraint *isl_basic_set_first_constraint(
45 __isl_take isl_basic_set *bset);
46 struct isl_constraint *isl_constraint_next(struct isl_constraint *c);
47 int isl_basic_map_foreach_constraint(__isl_keep isl_basic_map *bmap,
48 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
49 int isl_basic_set_foreach_constraint(__isl_keep isl_basic_set *bset,
50 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
51 int isl_constraint_is_equal(struct isl_constraint *constraint1,
52 struct isl_constraint *constraint2);
54 int isl_basic_set_foreach_bound_pair(__isl_keep isl_basic_set *bset,
55 enum isl_dim_type type, unsigned pos,
56 int (*fn)(__isl_take isl_constraint *lower,
57 __isl_take isl_constraint *upper,
58 __isl_take isl_basic_set *bset, void *user), void *user);
60 __isl_give isl_basic_map *isl_basic_map_add_constraint(
61 __isl_take isl_basic_map *bmap, __isl_take isl_constraint *constraint);
62 __isl_give isl_basic_set *isl_basic_set_add_constraint(
63 __isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint);
64 __isl_give isl_map *isl_map_add_constraint(__isl_take isl_map *map,
65 __isl_take isl_constraint *constraint);
66 __isl_give isl_set *isl_set_add_constraint(__isl_take isl_set *set,
67 __isl_take isl_constraint *constraint);
69 int isl_basic_map_has_defining_equality(
70 __isl_keep isl_basic_map *bmap, enum isl_dim_type type, int pos,
71 __isl_give isl_constraint **c);
72 int isl_basic_set_has_defining_equality(
73 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
74 struct isl_constraint **constraint);
75 int isl_basic_set_has_defining_inequalities(
76 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
77 struct isl_constraint **lower,
78 struct isl_constraint **upper);
80 __isl_give isl_dim *isl_constraint_get_dim(
81 __isl_keep isl_constraint *constraint);
82 int isl_constraint_dim(struct isl_constraint *constraint,
83 enum isl_dim_type type);
85 int isl_constraint_involves_dims(__isl_keep isl_constraint *constraint,
86 enum isl_dim_type type, unsigned first, unsigned n);
88 const char *isl_constraint_get_dim_name(__isl_keep isl_constraint *constraint,
89 enum isl_dim_type type, unsigned pos);
90 void isl_constraint_get_constant(__isl_keep isl_constraint *constraint,
92 void isl_constraint_get_coefficient(__isl_keep isl_constraint *constraint,
93 enum isl_dim_type type, int pos, isl_int *v);
94 void isl_constraint_set_constant(__isl_keep isl_constraint *constraint, isl_int v);
95 void isl_constraint_set_constant_si(__isl_keep isl_constraint *constraint,
97 void isl_constraint_set_coefficient(__isl_keep isl_constraint *constraint,
98 enum isl_dim_type type, int pos, isl_int v);
99 void isl_constraint_set_coefficient_si(__isl_keep isl_constraint *constraint,
100 enum isl_dim_type type, int pos, int v);
102 __isl_give isl_div *isl_constraint_div(__isl_keep isl_constraint *constraint,
104 struct isl_constraint *isl_constraint_add_div(struct isl_constraint *constraint,
105 struct isl_div *div, int *pos);
107 void isl_constraint_clear(struct isl_constraint *constraint);
108 struct isl_constraint *isl_constraint_negate(struct isl_constraint *constraint);
110 int isl_constraint_is_equality(__isl_keep isl_constraint *constraint);
111 int isl_constraint_is_div_constraint(__isl_keep isl_constraint *constraint);
113 __isl_give isl_basic_map *isl_basic_map_from_constraint(
114 __isl_take isl_constraint *constraint);
115 struct isl_basic_set *isl_basic_set_from_constraint(
116 struct isl_constraint *constraint);
118 __isl_give isl_aff *isl_constraint_get_bound(
119 __isl_keep isl_constraint *constraint, enum isl_dim_type type, int pos);
120 __isl_give isl_aff *isl_constraint_get_aff(
121 __isl_keep isl_constraint *constraint);
122 __isl_give isl_constraint *isl_equality_from_aff(__isl_take isl_aff *aff);
123 __isl_give isl_constraint *isl_inequality_from_aff(__isl_take isl_aff *aff);
125 __isl_give isl_basic_set *isl_basic_set_drop_constraint(
126 __isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint);
128 __isl_give isl_printer *isl_printer_print_constraint(__isl_take isl_printer *p,
129 __isl_keep isl_constraint *c);
130 void isl_constraint_dump(__isl_keep isl_constraint *c);
132 #if defined(__cplusplus)