[clang-tools-extra] [MLIR][Presburger] Implement matrix inverse (PR #67382)
Arjun P via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 13 03:36:34 PDT 2023
================
@@ -241,6 +245,32 @@ class IntMatrix : public Matrix<MPInt>
/// Returns the GCD of the columns of the specified row.
MPInt normalizeRow(unsigned row);
+ // Return the integer inverse of the matrix, leaving the calling object
+ // unmodified.
+ std::optional<IntMatrix> integerInverse();
+};
+
+// An inherited class for rational matrices, with no new data attributes.
+// This class is for functionality that only applies to matrices of fractions.
+class FracMatrix : public Matrix<Fraction> {
+public:
+ FracMatrix(unsigned rows, unsigned columns, unsigned reservedRows = 0,
+ unsigned reservedColumns = 0)
+ : Matrix<Fraction>(rows, columns, reservedRows, reservedColumns){};
+
+ FracMatrix(Matrix<Fraction> m)
+ : Matrix<Fraction>(m.getNumRows(), m.getNumColumns(),
+ m.getNumReservedRows(), m.getNumReservedColumns()) {
+ for (unsigned i = 0; i < m.getNumRows(); i++)
+ for (unsigned j = 0; j < m.getNumColumns(); j++)
+ at(i, j) = m(i, j);
----------------
Superty wrote:
`: Matrix<Fraction(m)`?
https://github.com/llvm/llvm-project/pull/67382
More information about the cfe-commits
mailing list