__isl_give isl_constraint *isl_constraint_set_coefficient_si(
__isl_take isl_constraint *constraint,
enum isl_dim_type type, int pos, int v);
+ __isl_give isl_constraint *
+ isl_constraint_set_coefficient_val(
+ __isl_take isl_constraint *constraint,
+ enum isl_dim_type type, int pos, isl_val *v);
__isl_give isl_basic_map *isl_basic_map_add_constraint(
__isl_take isl_basic_map *bmap,
__isl_take isl_constraint *constraint);
__isl_give isl_constraint *isl_constraint_set_coefficient_si(
__isl_take isl_constraint *constraint,
enum isl_dim_type type, int pos, int v);
+__isl_give isl_constraint *isl_constraint_set_coefficient_val(
+ __isl_take isl_constraint *constraint,
+ enum isl_dim_type type, int pos, isl_val *v);
__isl_give isl_aff *isl_constraint_get_div(__isl_keep isl_constraint *constraint,
int pos);
return constraint;
}
+/* Replace the coefficient of the variable of type "type" at position "pos"
+ * of "constraint" by "v".
+ */
+__isl_give isl_constraint *isl_constraint_set_coefficient_val(
+ __isl_take isl_constraint *constraint,
+ enum isl_dim_type type, int pos, isl_val *v)
+{
+ constraint = isl_constraint_cow(constraint);
+ if (!constraint || !v)
+ goto error;
+ if (!isl_val_is_int(v))
+ isl_die(isl_constraint_get_ctx(constraint), isl_error_invalid,
+ "expecting integer value", goto error);
+
+ if (pos >= isl_local_space_dim(constraint->ls, type))
+ isl_die(isl_constraint_get_ctx(constraint), isl_error_invalid,
+ "position out of bounds", goto error);
+
+ pos += isl_local_space_offset(constraint->ls, type);
+ constraint->v = isl_vec_set_element_val(constraint->v, pos, v);
+ if (!constraint->v)
+ constraint = isl_constraint_free(constraint);
+ return constraint;
+error:
+ isl_val_free(v);
+ return isl_constraint_free(constraint);
+}
+
__isl_give isl_constraint *isl_constraint_set_coefficient_si(
__isl_take isl_constraint *constraint,
enum isl_dim_type type, int pos, int v)