[clang-tools-extra] [MLIR][Presburger] Implement matrix inverse (PR #67382)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 17 10:10:24 PDT 2023
================
@@ -432,4 +432,138 @@ MPInt IntMatrix::normalizeRow(unsigned row, unsigned cols) {
MPInt IntMatrix::normalizeRow(unsigned row) {
return normalizeRow(row, getNumColumns());
+}
+
+MPInt IntMatrix::determinant() {
+ unsigned r = getNumRows();
+ unsigned c = getNumColumns();
+ assert(r == c);
+
+ FracMatrix m(r, c);
+ for (unsigned i = 0; i < r; i++)
+ for (unsigned j = 0; j < c; j++)
+ m.at(i, j) = Fraction(at(i, j), 1);
----------------
Abhinav271828 wrote:
it's ambiguous because both
`Fraction(const MPInt &oNum, const MPInt &oDen = MPInt(1))`
and
`Fraction(const MPInt &num, int64_t den = 1) : Fraction(num, MPInt(den))`
apply. should I make one of these not have a default second argument?
https://github.com/llvm/llvm-project/pull/67382
More information about the cfe-commits
mailing list