MLIR  17.0.0git
LinearTransform.h
Go to the documentation of this file.
1 //===- LinearTransform.h - MLIR LinearTransform Class -----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Support for linear transforms and applying them to an IntegerRelation.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef MLIR_ANALYSIS_PRESBURGER_LINEARTRANSFORM_H
14 #define MLIR_ANALYSIS_PRESBURGER_LINEARTRANSFORM_H
15
19
20 namespace mlir {
21 namespace presburger {
22
24 public:
25  explicit LinearTransform(Matrix &&oMatrix);
26  explicit LinearTransform(const Matrix &oMatrix);
27
28  // Returns a linear transform T such that MT is M in column echelon form.
29  // Also returns the number of non-zero columns in MT.
30  //
31  // Specifically, T is such that in every column the first non-zero row is
32  // strictly below that of the previous column, and all columns which have only
33  // zeros are at the end.
34  static std::pair<unsigned, LinearTransform>
36
37  // Returns an IntegerRelation having a constraint vector vT for every
38  // constraint vector v in rel, where T is this transform.
39  IntegerRelation applyTo(const IntegerRelation &rel) const;
40
41  // The given vector is interpreted as a row vector v. Post-multiply v with
42  // this transform, say T, and return vT.
44  return matrix.preMultiplyWithRow(rowVec);
45  }
46
47  // The given vector is interpreted as a column vector v. Pre-multiply v with
48  // this transform, say T, and return Tv.
50  return matrix.postMultiplyWithColumn(colVec);
51  }
52
53 private:
54  Matrix matrix;
55 };
56
57 } // namespace presburger
58 } // namespace mlir
59
60 #endif // MLIR_ANALYSIS_PRESBURGER_LINEARTRANSFORM_H
An IntegerRelation represents the set of points from a PresburgerSpace that satisfy a list of affine ...
static std::pair< unsigned, LinearTransform > makeTransformToColumnEchelon(const Matrix &m)
SmallVector< MPInt, 8 > preMultiplyWithRow(ArrayRef< MPInt > rowVec) const
SmallVector< MPInt, 8 > postMultiplyWithColumn(ArrayRef< MPInt > colVec) const
IntegerRelation applyTo(const IntegerRelation &rel) const
This is a class to represent a resizable matrix.
Definition: Matrix.h:35
SmallVector< MPInt, 8 > postMultiplyWithColumn(ArrayRef< MPInt > colVec) const
The given vector is interpreted as a column vector v.
Definition: Matrix.cpp:244
SmallVector< MPInt, 8 > preMultiplyWithRow(ArrayRef< MPInt > rowVec) const
The given vector is interpreted as a row vector v.
Definition: Matrix.cpp:233
This header declares functions that assit transformations in the MemRef dialect.