bool eqInvolvesSuffixDims(const FlatAffineConstraints &fac, unsigned eqIndex,
unsigned numDims) {
- for (unsigned e = fac.getNumDimIds(), j = e - numDims; j < e; ++j)
+ for (unsigned e = fac.getNumIds(), j = e - numDims; j < e; ++j)
if (fac.atEq(eqIndex, j) != 0)
return true;
return false;
}
bool ineqInvolvesSuffixDims(const FlatAffineConstraints &fac,
unsigned ineqIndex, unsigned numDims) {
- for (unsigned e = fac.getNumDimIds(), j = e - numDims; j < e; ++j)
+ for (unsigned e = fac.getNumIds(), j = e - numDims; j < e; ++j)
if (fac.atIneq(ineqIndex, j) != 0)
return true;
return false;
FlatAffineConstraints
LinearTransform::applyTo(const FlatAffineConstraints &fac) const {
- FlatAffineConstraints result(fac.getNumDimIds());
+ FlatAffineConstraints result(fac.getNumIds());
for (unsigned i = 0, e = fac.getNumEqualities(); i < e; ++i) {
ArrayRef<int64_t> eq = fac.getEquality(i);
/// Construct a FlatAffineConstraints from a set of inequality and
/// equality constraints.
static FlatAffineConstraints
-makeFACFromConstraints(unsigned dims, ArrayRef<SmallVector<int64_t, 4>> ineqs,
- ArrayRef<SmallVector<int64_t, 4>> eqs) {
- FlatAffineConstraints fac(ineqs.size(), eqs.size(), dims + 1, dims);
+makeFACFromConstraints(unsigned ids, ArrayRef<SmallVector<int64_t, 4>> ineqs,
+ ArrayRef<SmallVector<int64_t, 4>> eqs,
+ unsigned syms = 0) {
+ FlatAffineConstraints fac(ineqs.size(), eqs.size(), ids + 1, ids - syms,
+ syms);
for (const auto &eq : eqs)
fac.addEquality(eq);
for (const auto &ineq : ineqs)
},
{{2, -3, 0, 0, 0}, {1, -1, 6, 0, -1}, {1, 1, 0, -6, -2}})
.isIntegerEmpty());
+
+ // Set with symbols.
+ FlatAffineConstraints fac6 = makeFACFromConstraints(2,
+ {
+ {1, 1, 0},
+ },
+ {
+ {1, -1, 0},
+ },
+ 1);
+ EXPECT_FALSE(fac6.isIntegerEmpty());
}
TEST(FlatAffineConstraintsTest, removeRedundantConstraintsTest) {