[Mlir-commits] [mlir] [MLIR][Presburger] Implement vertex enumeration and chamber decomposition for polytope generating function computation. (PR #78987)

Arjun P llvmlistbot at llvm.org
Thu Jan 25 06:07:47 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 set is flat,
+  // optima are the same, then the region is not full-dimensional.
----------------
Superty wrote:

The polytope is full-dimensional iff it is not flat along any of the inequality directions.

"Optima are same" is out of context here and the reader doesn't know what optima are being referred to.


https://github.com/llvm/llvm-project/pull/78987


More information about the Mlir-commits mailing list