[Mlir-commits] [mlir] [MLIR][Presburger] Helper functions to compute the constant term of a generating function (PR #77819)

Arjun P llvmlistbot at llvm.org
Sat Jan 13 05:39:34 PST 2024


================
@@ -113,3 +119,11 @@ QuasiPolynomial QuasiPolynomial::simplify() {
   }
   return QuasiPolynomial(getNumInputs(), newCoeffs, newAffine);
 }
+
+Fraction QuasiPolynomial::getConstantTerm() {
+  Fraction t = 0;
+  for (unsigned i = 0, e = coefficients.size(); i < e; ++i)
+    if (affine[i].size() == 0)
+      t += coefficients[i];
+  return t;
+}
----------------
Superty wrote:

`t` -> `constTerm` or something

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


More information about the Mlir-commits mailing list