MLIR 22.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.
4// See https://llvm.org/LICENSE.txt for license information.
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
18#include "llvm/ADT/SmallVector.h"
19
20namespace mlir {
21namespace presburger {
22
24public:
25 explicit LinearTransform(IntMatrix &&oMatrix);
26 explicit LinearTransform(const IntMatrix &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.
45 return matrix.preMultiplyWithRow(rowVec);
46 }
47
48 // The given vector is interpreted as a column vector v. Pre-multiply v with
49 // this transform, say T, and return Tv.
52 return matrix.postMultiplyWithColumn(colVec);
53 }
54
55private:
56 IntMatrix matrix;
57};
58
59} // namespace presburger
60} // namespace mlir
61
62#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 IntMatrix &m)
SmallVector< DynamicAPInt, 8 > postMultiplyWithColumn(ArrayRef< DynamicAPInt > colVec) const
IntegerRelation applyTo(const IntegerRelation &rel) const
SmallVector< DynamicAPInt, 8 > preMultiplyWithRow(ArrayRef< DynamicAPInt > rowVec) const
Include the generated interface declarations.