isl_mat_dump: also indent NULL mat
[isl.git] / include / isl_set.h
blob5b13932547954292e352f0c599376bba4c0cbe24
1 #ifndef ISL_SET_H
2 #define ISL_SET_H
4 #include "isl_map.h"
5 #include "isl_list.h"
7 #if defined(__cplusplus)
8 extern "C" {
9 #endif
11 /* A "basic set" is a basic map with a zero-dimensional
12 * domain.
14 struct isl_basic_set {
15 int ref;
16 #define ISL_BASIC_SET_FINAL (1 << 0)
17 #define ISL_BASIC_SET_EMPTY (1 << 1)
18 #define ISL_BASIC_SET_NORMALIZED (1 << 5)
19 unsigned flags;
21 struct isl_ctx *ctx;
23 struct isl_dim *dim;
24 unsigned extra;
26 unsigned n_eq;
27 unsigned n_ineq;
29 size_t c_size;
30 isl_int **eq;
31 isl_int **ineq;
33 unsigned n_div;
35 isl_int **div;
37 struct isl_vec *sample;
39 struct isl_blk block;
40 struct isl_blk block2;
43 /* A "set" is a (possibly disjoint) union of basic sets.
45 * See the documentation of isl_map.
47 struct isl_set {
48 int ref;
49 #define ISL_SET_DISJOINT (1 << 0)
50 #define ISL_SET_NORMALIZED (1 << 1)
51 unsigned flags;
53 struct isl_ctx *ctx;
55 struct isl_dim *dim;
57 int n;
59 size_t size;
60 struct isl_basic_set *p[0];
63 unsigned isl_basic_set_n_dim(const struct isl_basic_set *bset);
64 unsigned isl_basic_set_n_param(const struct isl_basic_set *bset);
65 unsigned isl_basic_set_total_dim(const struct isl_basic_set *bset);
66 unsigned isl_basic_set_dim(const struct isl_basic_set *bset,
67 enum isl_dim_type type);
69 unsigned isl_set_n_dim(const struct isl_set *set);
70 unsigned isl_set_n_param(const struct isl_set *set);
72 struct isl_basic_set *isl_basic_set_alloc(struct isl_ctx *ctx,
73 unsigned nparam, unsigned dim, unsigned extra,
74 unsigned n_eq, unsigned n_ineq);
75 struct isl_basic_set *isl_basic_set_extend(struct isl_basic_set *base,
76 unsigned nparam, unsigned dim, unsigned extra,
77 unsigned n_eq, unsigned n_ineq);
78 struct isl_basic_set *isl_basic_set_extend_constraints(
79 struct isl_basic_set *base, unsigned n_eq, unsigned n_ineq);
80 struct isl_basic_set *isl_basic_set_finalize(struct isl_basic_set *bset);
81 void isl_basic_set_free(struct isl_basic_set *bset);
82 struct isl_basic_set *isl_basic_set_copy(struct isl_basic_set *bset);
83 struct isl_basic_set *isl_basic_set_dup(struct isl_basic_set *bset);
84 struct isl_basic_set *isl_basic_set_empty(struct isl_dim *dim);
85 struct isl_basic_set *isl_basic_set_empty_like(struct isl_basic_set *bset);
86 struct isl_basic_set *isl_basic_set_universe(struct isl_dim *dim);
87 struct isl_basic_set *isl_basic_set_universe_like(struct isl_basic_set *bset);
88 struct isl_basic_set *isl_basic_set_interval(struct isl_ctx *ctx,
89 isl_int min, isl_int max);
90 void isl_basic_set_dump(struct isl_basic_set *bset,
91 FILE *out, int indent);
92 struct isl_basic_set *isl_basic_set_swap_vars(
93 struct isl_basic_set *bset, unsigned n);
94 struct isl_basic_set *isl_basic_set_intersect(
95 struct isl_basic_set *bset1,
96 struct isl_basic_set *bset2);
97 struct isl_basic_set *isl_basic_set_apply(
98 struct isl_basic_set *bset,
99 struct isl_basic_map *bmap);
100 struct isl_basic_set *isl_basic_set_affine_hull(struct isl_basic_set *bset);
101 struct isl_basic_set *isl_basic_set_simplify(struct isl_basic_set *bset);
102 struct isl_basic_set *isl_basic_set_product(struct isl_basic_set_list *list);
104 #define ISL_FORMAT_POLYLIB 1
105 #define ISL_FORMAT_OMEGA 2
106 struct isl_basic_set *isl_basic_set_read_from_file(struct isl_ctx *ctx,
107 FILE *input, unsigned nparam, unsigned input_format);
108 struct isl_basic_set *isl_basic_set_read_from_str(struct isl_ctx *ctx,
109 const char *str, unsigned nparam, unsigned input_format);
110 struct isl_set *isl_set_read_from_file(struct isl_ctx *ctx,
111 FILE *input, unsigned nparam, unsigned input_format);
112 #define ISL_FORMAT_POLYLIB_CONSTRAINTS 3
113 void isl_basic_set_print(struct isl_basic_set *bset, FILE *out, int indent,
114 const char *prefix, const char *suffix, unsigned output_format);
115 void isl_set_print(struct isl_set *set, FILE *out, int indent,
116 unsigned output_format);
117 struct isl_basic_set *isl_basic_set_fix_si(struct isl_basic_set *bset,
118 enum isl_dim_type type, unsigned pos, int value);
120 struct isl_basic_set *isl_basic_set_from_underlying_set(
121 struct isl_basic_set *bset, struct isl_basic_set *like);
122 struct isl_set *isl_set_from_underlying_set(
123 struct isl_set *set, struct isl_basic_set *like);
124 struct isl_set *isl_set_to_underlying_set(struct isl_set *set);
126 int isl_basic_set_is_equal(
127 struct isl_basic_set *bset1, struct isl_basic_set *bset2);
129 struct isl_set *isl_basic_set_lexmin(struct isl_basic_set *bset);
130 struct isl_set *isl_basic_set_union(
131 struct isl_basic_set *bset1,
132 struct isl_basic_set *bset2);
134 int isl_basic_set_compare_at(struct isl_basic_set *bset1,
135 struct isl_basic_set *bset2, int pos);
137 int isl_basic_set_is_empty(struct isl_basic_set *bset);
139 struct isl_set *isl_set_alloc(struct isl_ctx *ctx,
140 unsigned nparam, unsigned dim, int n, unsigned flags);
141 struct isl_set *isl_set_extend(struct isl_set *base,
142 unsigned nparam, unsigned dim);
143 struct isl_set *isl_set_empty(struct isl_dim *dim);
144 struct isl_set *isl_set_empty_like(struct isl_set *set);
145 struct isl_set *isl_set_universe(struct isl_dim *dim);
146 struct isl_set *isl_set_add(struct isl_set *set, struct isl_basic_set *bset);
147 struct isl_set *isl_set_finalize(struct isl_set *set);
148 struct isl_set *isl_set_copy(struct isl_set *set);
149 void isl_set_free(struct isl_set *set);
150 struct isl_set *isl_set_dup(struct isl_set *set);
151 struct isl_set *isl_set_from_basic_set(struct isl_basic_set *bset);
152 struct isl_basic_set *isl_set_affine_hull(struct isl_set *set);
153 struct isl_basic_set *isl_set_convex_hull(struct isl_set *set);
154 struct isl_basic_set *isl_set_simple_hull(struct isl_set *set);
156 struct isl_set *isl_set_union_disjoint(
157 struct isl_set *set1, struct isl_set *set2);
158 struct isl_set *isl_set_union(struct isl_set *set1, struct isl_set *set2);
159 struct isl_set *isl_set_intersect(struct isl_set *set1, struct isl_set *set2);
160 struct isl_set *isl_set_subtract(struct isl_set *set1, struct isl_set *set2);
161 struct isl_set *isl_set_apply(struct isl_set *set, struct isl_map *map);
162 struct isl_set *isl_set_fix_dim_si(struct isl_set *set,
163 unsigned dim, int value);
164 struct isl_set *isl_set_lower_bound_dim(struct isl_set *set,
165 unsigned dim, isl_int value);
166 struct isl_basic_set *isl_basic_set_remove_dims(struct isl_basic_set *bset,
167 unsigned first, unsigned n);
168 struct isl_basic_set *isl_basic_set_remove_divs(struct isl_basic_set *bset);
169 struct isl_set *isl_set_eliminate_dims(struct isl_set *set,
170 unsigned first, unsigned n);
171 struct isl_set *isl_set_remove_dims(struct isl_set *set,
172 unsigned first, unsigned n);
173 struct isl_set *isl_set_remove_divs(struct isl_set *set);
175 void isl_set_dump(struct isl_set *set, FILE *out, int indent);
176 struct isl_set *isl_set_swap_vars(struct isl_set *set, unsigned n);
177 int isl_set_is_empty(struct isl_set *set);
178 int isl_set_is_subset(struct isl_set *set1, struct isl_set *set2);
179 int isl_set_is_equal(struct isl_set *set1, struct isl_set *set2);
181 struct isl_set *isl_basic_set_compute_divs(struct isl_basic_set *bset);
182 struct isl_set *isl_set_compute_divs(struct isl_set *set);
184 struct isl_basic_set *isl_set_copy_basic_set(struct isl_set *set);
185 struct isl_set *isl_set_drop_basic_set(struct isl_set *set,
186 struct isl_basic_set *bset);
188 int isl_set_fast_dim_is_fixed(struct isl_set *set, unsigned dim, isl_int *val);
189 int isl_set_fast_dim_has_fixed_lower_bound(struct isl_set *set,
190 unsigned dim, isl_int *val);
192 struct isl_basic_set *isl_basic_set_gist(struct isl_basic_set *bset,
193 struct isl_basic_set *context);
194 struct isl_set *isl_set_gist(struct isl_set *set,
195 struct isl_basic_set *context);
196 int isl_basic_set_dim_residue_class(struct isl_basic_set *bset,
197 int pos, isl_int *modulo, isl_int *residue);
199 int isl_set_fast_is_equal(struct isl_set *set1, struct isl_set *set2);
200 int isl_set_fast_is_disjoint(struct isl_set *set1, struct isl_set *set2);
202 uint32_t isl_set_get_hash(struct isl_set *set);
204 int isl_set_dim_is_unique(struct isl_set *set, unsigned dim);
206 #if defined(__cplusplus)
208 #endif
210 #endif