[Mlir-commits] [mlir] [MLIR][Presburger][WIP] Implement vertex enumeration and chamber decomposition for polytope generating function computation. (PR #78987)
Arjun P
llvmlistbot at llvm.org
Wed Jan 24 15:20:21 PST 2024
================
@@ -2498,6 +2499,31 @@ void IntegerRelation::printSpace(raw_ostream &os) const {
os << getNumConstraints() << " constraints\n";
}
+void IntegerRelation::removeTrivialEqualities() {
+ for (int i = getNumEqualities() - 1; i >= 0; --i)
+ if (rangeIsZero(getEquality(i)))
+ removeEquality(i);
+}
+
+bool IntegerRelation::isFullDim() {
+ if (getNumVars() == 0)
+ return true;
+ if (isEmpty())
+ return false;
+
+ // If there is a non-trivial equality, the space cannot be full-dimensional.
+ removeTrivialEqualities();
+ if (getNumEqualities() > 0)
+ return false;
+
+ // If along the direction of any of the inequalities, the upper and lower
+ // optima are the same, then the region is not full-dimensional.
+ Simplex simplex(*this);
+ return llvm::none_of(llvm::seq<int>(0, getNumInequalities()), [&](int i) {
----------------
Superty wrote:
you can omit the zero here, there seems to be a single-parameter constructor that assumes the start is zero
https://github.com/llvm/llvm-project/pull/78987
More information about the Mlir-commits
mailing list