[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
Tue Jan 23 16:43:03 PST 2024


================
@@ -2104,6 +2104,22 @@ Simplex::computeIntegerBounds(ArrayRef<MPInt> coeffs) {
   return {minRoundedUp, maxRoundedDown};
 }
 
+bool Simplex::isFlatAlong(ArrayRef<MPInt> coeffs) {
+  assert(!isEmpty() && "cannot check for flatness of empty simplex!");
+  auto upOpt = computeOptimum(Simplex::Direction::Up, coeffs);
+  auto downOpt = computeOptimum(Simplex::Direction::Down, coeffs);
+
+  if (upOpt.getKind() != OptimumKind::Bounded)
+    return false;
+  if (downOpt.getKind() != OptimumKind::Bounded)
+    return false;
+
+  // Check if the upper and lower optima are equal.
+  if (*upOpt == *downOpt)
+    return true;
+  return false;
----------------
Superty wrote:

`return *upOpt == *downOpt` ;)

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


More information about the Mlir-commits mailing list