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
16 #if defined(__cplusplus)
20 struct isl_constraint {
24 struct isl_basic_map *bmap;
27 typedef struct isl_constraint isl_constraint;
29 __isl_give isl_constraint *isl_equality_alloc(__isl_take isl_dim *dim);
30 __isl_give isl_constraint *isl_inequality_alloc(__isl_take isl_dim *dim);
31 struct isl_constraint *isl_basic_set_constraint(struct isl_basic_set *bset,
34 struct isl_constraint *isl_constraint_cow(struct isl_constraint *c);
35 struct isl_constraint *isl_constraint_copy(struct isl_constraint *c);
36 void isl_constraint_free(struct isl_constraint *c);
38 __isl_give isl_constraint *isl_basic_map_first_constraint(
39 __isl_take isl_basic_map *bmap);
40 __isl_give isl_constraint *isl_basic_set_first_constraint(
41 __isl_take isl_basic_set *bset);
42 struct isl_constraint *isl_constraint_next(struct isl_constraint *c);
43 int isl_basic_map_foreach_constraint(__isl_keep isl_basic_map *bmap,
44 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
45 int isl_basic_set_foreach_constraint(__isl_keep isl_basic_set *bset,
46 int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
47 int isl_constraint_is_equal(struct isl_constraint *constraint1,
48 struct isl_constraint *constraint2);
50 int isl_basic_set_foreach_bound_pair(__isl_keep isl_basic_set *bset,
51 enum isl_dim_type type, unsigned pos,
52 int (*fn)(__isl_take isl_constraint *lower,
53 __isl_take isl_constraint *upper,
54 __isl_take isl_basic_set *bset, void *user), void *user);
56 __isl_give isl_basic_map *isl_basic_map_add_constraint(
57 __isl_take isl_basic_map *bmap, __isl_take isl_constraint *constraint);
58 __isl_give isl_basic_set *isl_basic_set_add_constraint(
59 __isl_take isl_basic_set *bset, __isl_take isl_constraint *constraint);
61 int isl_basic_map_has_defining_equality(
62 __isl_keep isl_basic_map *bmap, enum isl_dim_type type, int pos,
63 __isl_give isl_constraint **c);
64 int isl_basic_set_has_defining_equality(
65 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
66 struct isl_constraint **constraint);
67 int isl_basic_set_has_defining_inequalities(
68 struct isl_basic_set *bset, enum isl_dim_type type, int pos,
69 struct isl_constraint **lower,
70 struct isl_constraint **upper);
72 int isl_constraint_dim(struct isl_constraint *constraint,
73 enum isl_dim_type type);
75 const char *isl_constraint_get_dim_name(__isl_keep isl_constraint *constraint,
76 enum isl_dim_type type, unsigned pos);
77 void isl_constraint_get_constant(__isl_keep isl_constraint *constraint,
79 void isl_constraint_get_coefficient(__isl_keep isl_constraint *constraint,
80 enum isl_dim_type type, int pos, isl_int *v);
81 void isl_constraint_set_constant(__isl_keep isl_constraint *constraint, isl_int v);
82 void isl_constraint_set_coefficient(__isl_keep isl_constraint *constraint,
83 enum isl_dim_type type, int pos, isl_int v);
85 __isl_give isl_div *isl_constraint_div(__isl_keep isl_constraint *constraint,
87 struct isl_constraint *isl_constraint_add_div(struct isl_constraint *constraint,
88 struct isl_div *div, int *pos);
90 void isl_constraint_clear(struct isl_constraint *constraint);
91 struct isl_constraint *isl_constraint_negate(struct isl_constraint *constraint);
93 int isl_constraint_is_equality(__isl_keep isl_constraint *constraint);
94 int isl_constraint_is_div_constraint(__isl_keep isl_constraint *constraint);
96 __isl_give isl_basic_map *isl_basic_map_from_constraint(
97 __isl_take isl_constraint *constraint);
98 struct isl_basic_set *isl_basic_set_from_constraint(
99 struct isl_constraint *constraint);
101 #if defined(__cplusplus)