[Mlir-commits] [mlir] [MLIR][Presburger] Implement Matrix::moveColumns (PR #68362)

Kunwar Grover llvmlistbot at llvm.org
Fri Oct 6 22:08:53 PDT 2023


================
@@ -189,6 +189,23 @@ static_assert(std::is_same_v<T,MPInt> || std::is_same_v<T,Fraction>, "T must be
   /// invariants satisfied.
   bool hasConsistentState() const;
 
+  /// Shift the columns in the range [srcPos, srcPos + num] by the specified
+  /// offset, i.e. to [srcPos + offset, srcPos + num + offset], while moving
+  /// the columns adjacent to the range to the left/right of the shifted
+  /// columns.
+  ///
+  /// For a positive offset (i.e. shifting the columns right), columns that
+  /// were at positions [0, srcPos) will stay where they are; columns that were
+  /// at positions [srcPos + num, srcPos + num + offset) will be moved to
+  /// [srcPos, srcPos + offset); and columns that were at positions
+  /// (src + num + offset, nCols) will remain where they were. For example,
+  /// if m = |0 1 2 3 4 5| then m.moveColumns(1, 2, 3) will result in
+  /// m = |0 3 4 5 1 2|.
+  ///
+  /// Similarly, a negative offset results in a left shift of the columns in
+  /// the range [srcPos, srcPos + num].
+  void moveColumns(unsigned srcPos, unsigned num, int offset);
----------------
Groverkss wrote:

I generally prefer the signature moveColumns(srcPos, num, dstPos) i.e. not using offset.

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


More information about the Mlir-commits mailing list