[Mlir-commits] [mlir] [MLIR][Presburger] Implement computation of generating function for unimodular cones (PR #77235)
Mehdi Amini
llvmlistbot at llvm.org
Mon Jan 8 11:06:19 PST 2024
================
@@ -63,3 +63,71 @@ MPInt mlir::presburger::detail::getIndex(ConeV cone) {
return cone.determinant();
}
+
+/// Compute the generating function for a unimodular cone.
+GeneratingFunction mlir::presburger::detail::unimodularConeGeneratingFunction(
+ ParamPoint vertex, int sign, ConeH cone) {
+ // `cone` is assumed to be unimodular.
+ assert(getIndex(getDual(cone)) == 1 && "input cone is not unimodular!");
+
+ unsigned numVar = cone.getNumVars();
+ unsigned numIneq = cone.getNumInequalities();
+
+ // Thus its ray matrix, U, is the inverse of the
+ // transpose of its inequality matrix, `cone`.
+ FracMatrix transp(numVar, numIneq);
+ for (unsigned i = 0; i < numVar; i++)
----------------
joker-eph wrote:
Even better, more functional style / range-style:
```
for (auto i : llvm:seq<uint>(0, numVar))
```
https://github.com/llvm/llvm-project/pull/77235
More information about the Mlir-commits
mailing list