* x'' = T(x') = x_0 + G x'
*
* and in constructing the new divs and the corresponding equalities,
- * we have to replace each x'' by the corresponding row from C_2.
+ * we have to replace each x'', i.e., the x'_k with (g_kk = 1),
+ * by the corresponding row from C_2.
*/
static struct isl_basic_map *normalize_divs(
struct isl_basic_map *bmap, int *progress)
for (j = 0; j < i; ++j) {
if (isl_int_is_zero(T->row[i][j]))
continue;
- if (C2)
+ if (pos[j] < T->n_row && C2)
isl_seq_submul(bmap->div[k] + 1, T->row[i][j],
C2->row[pos[j]], 1 + total);
else
assert(bset->n_div == 1);
isl_basic_set_free(bset);
+ /* test 8 */
+ dim = isl_dim_set_alloc(ctx, 0, 4);
+ bset = isl_basic_set_universe(dim);
+
+ c = isl_equality_alloc(isl_dim_copy(bset->dim));
+ isl_int_set_si(v, -1);
+ isl_constraint_set_coefficient(c, isl_dim_set, 0, v);
+ isl_int_set_si(v, -3);
+ isl_constraint_set_coefficient(c, isl_dim_set, 1, v);
+ isl_int_set_si(v, -3);
+ isl_constraint_set_coefficient(c, isl_dim_set, 3, v);
+ div = isl_div_alloc(isl_dim_copy(bset->dim));
+ c = isl_constraint_add_div(c, div, &pos);
+ isl_int_set_si(v, 6);
+ isl_constraint_set_coefficient(c, isl_dim_div, pos, v);
+ bset = isl_basic_set_add_constraint(bset, c);
+
+ c = isl_equality_alloc(isl_dim_copy(bset->dim));
+ isl_int_set_si(v, -1);
+ isl_constraint_set_coefficient(c, isl_dim_set, 0, v);
+ isl_int_set_si(v, 1);
+ isl_constraint_set_coefficient(c, isl_dim_set, 2, v);
+ isl_int_set_si(v, 1);
+ isl_constraint_set_constant(c, v);
+ bset = isl_basic_set_add_constraint(bset, c);
+
+ assert(bset->n_div == 1);
+ isl_basic_set_free(bset);
+
isl_int_clear(v);
}