isl_map_simplify.c: compute_elimination_index: don't assume equalities are in order
[isl.git] / isl_output.c
blob4406a04f640e22110042cda477b52684bd67e43c
1 #include <isl_set.h>
3 static void print_constraint_polylib(struct isl_basic_set *bset,
4 int ineq, int n,
5 FILE *out, int indent, const char *prefix, const char *suffix)
7 int i;
8 unsigned dim = isl_basic_set_n_dim(bset);
9 unsigned nparam = isl_basic_set_n_param(bset);
10 isl_int *c = ineq ? bset->ineq[n] : bset->eq[n];
12 fprintf(out, "%*s%s", indent, "", prefix ? prefix : "");
13 fprintf(out, "%d", ineq);
14 for (i = 0; i < dim; ++i) {
15 fprintf(out, " ");
16 isl_int_print(out, c[1+nparam+i], 5);
18 for (i = 0; i < bset->n_div; ++i) {
19 fprintf(out, " ");
20 isl_int_print(out, c[1+nparam+dim+i], 5);
22 for (i = 0; i < nparam; ++i) {
23 fprintf(out, " ");
24 isl_int_print(out, c[1+i], 5);
26 fprintf(out, " ");
27 isl_int_print(out, c[0], 5);
28 fprintf(out, "%s\n", suffix ? suffix : "");
31 static void print_constraints_polylib(struct isl_basic_set *bset,
32 FILE *out, int indent, const char *prefix, const char *suffix)
34 int i;
36 for (i = 0; i < bset->n_eq; ++i)
37 print_constraint_polylib(bset, 0, i, out,
38 indent, prefix, suffix);
39 for (i = 0; i < bset->n_ineq; ++i)
40 print_constraint_polylib(bset, 1, i, out,
41 indent, prefix, suffix);
44 static void isl_basic_set_print_polylib(struct isl_basic_set *bset, FILE *out,
45 int indent, const char *prefix, const char *suffix)
47 unsigned total = isl_basic_set_total_dim(bset);
48 fprintf(out, "%*s%s", indent, "", prefix ? prefix : "");
49 fprintf(out, "%d %d", bset->n_eq + bset->n_ineq, 1 + total + 1);
50 fprintf(out, "%s\n", suffix ? suffix : "");
51 print_constraints_polylib(bset, out, indent, prefix, suffix);
54 static void isl_set_print_polylib(struct isl_set *set, FILE *out, int indent)
56 int i;
58 fprintf(out, "%*s", indent, "");
59 fprintf(out, "%d\n", set->n);
60 for (i = 0; i < set->n; ++i) {
61 fprintf(out, "\n");
62 isl_basic_set_print_polylib(set->p[i], out, indent, NULL, NULL);
66 void isl_basic_set_print(struct isl_basic_set *bset, FILE *out, int indent,
67 const char *prefix, const char *suffix, unsigned output_format)
69 if (!bset)
70 return;
71 if (output_format == ISL_FORMAT_POLYLIB)
72 isl_basic_set_print_polylib(bset, out, indent, prefix, suffix);
73 else if (output_format == ISL_FORMAT_POLYLIB_CONSTRAINTS)
74 print_constraints_polylib(bset, out, indent, prefix, suffix);
75 else
76 isl_assert(bset->ctx, 0, return);
79 void isl_set_print(struct isl_set *set, FILE *out, int indent,
80 unsigned output_format)
82 if (!set)
83 return;
84 if (output_format == ISL_FORMAT_POLYLIB)
85 isl_set_print_polylib(set, out, indent);
86 else
87 isl_assert(set->ctx, 0, return);