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

Kunwar Grover llvmlistbot at llvm.org
Wed Oct 11 03:47:16 PDT 2023


================
@@ -189,6 +189,24 @@ 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 source range [srcPos, srcPos + num) to the
+  /// specified destination, i.e. to [dstPos, dstPos + num), while moving the
+  /// columns adjacent to the source range to the left/right of the shifted
+  /// columns.
+  ///
+  /// When shifting the source columns right (i.e. dstPos > srcPos), columns
+  /// that were at positions [0, srcPos) will stay where they are; columns that
+  /// were at positions [srcPos, srcPos + num) will be moved to
+  /// [dstPos, dstPos + num); columns that were at positions
+  /// [srcPos + num, dstPos + num) will be moved to [srcPos, srcPos + num);
+  /// and columns that were at positions [dstPos + num, 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).
----------------
Groverkss wrote:

The negative offset is an implementation detail and you can remove it.

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


More information about the Mlir-commits mailing list