forked from OSchip/llvm-project
[MLIR][Presburger] LinearTransform: rename multiplication functions to be more intuitive
This commit is contained in:
parent
22b0fe3fd9
commit
c1562683ee
|
@ -39,11 +39,12 @@ public:
|
|||
|
||||
// The given vector is interpreted as a row vector v. Post-multiply v with
|
||||
// this transform, say T, and return vT.
|
||||
SmallVector<int64_t, 8> postMultiplyRow(ArrayRef<int64_t> rowVec) const;
|
||||
SmallVector<int64_t, 8> preMultiplyWithRow(ArrayRef<int64_t> rowVec) const;
|
||||
|
||||
// The given vector is interpreted as a column vector v. Pre-multiply v with
|
||||
// this transform, say T, and return Tv.
|
||||
SmallVector<int64_t, 8> preMultiplyColumn(ArrayRef<int64_t> colVec) const;
|
||||
SmallVector<int64_t, 8>
|
||||
postMultiplyWithColumn(ArrayRef<int64_t> colVec) const;
|
||||
|
||||
private:
|
||||
Matrix matrix;
|
||||
|
|
|
@ -770,7 +770,7 @@ Optional<SmallVector<int64_t, 8>> IntegerPolyhedron::findIntegerSample() const {
|
|||
// 6) Return transform * concat(boundedSample, coneSample).
|
||||
SmallVector<int64_t, 8> &sample = boundedSample.getValue();
|
||||
sample.append(coneSample.begin(), coneSample.end());
|
||||
return transform.preMultiplyColumn(sample);
|
||||
return transform.postMultiplyWithColumn(sample);
|
||||
}
|
||||
|
||||
/// Helper to evaluate an affine expression at a point.
|
||||
|
|
|
@ -112,7 +112,7 @@ LinearTransform::makeTransformToColumnEchelon(Matrix m) {
|
|||
}
|
||||
|
||||
SmallVector<int64_t, 8>
|
||||
LinearTransform::postMultiplyRow(ArrayRef<int64_t> rowVec) const {
|
||||
LinearTransform::preMultiplyWithRow(ArrayRef<int64_t> rowVec) const {
|
||||
assert(rowVec.size() == matrix.getNumRows() &&
|
||||
"row vector dimension should match transform output dimension");
|
||||
|
||||
|
@ -124,7 +124,7 @@ LinearTransform::postMultiplyRow(ArrayRef<int64_t> rowVec) const {
|
|||
}
|
||||
|
||||
SmallVector<int64_t, 8>
|
||||
LinearTransform::preMultiplyColumn(ArrayRef<int64_t> colVec) const {
|
||||
LinearTransform::postMultiplyWithColumn(ArrayRef<int64_t> colVec) const {
|
||||
assert(matrix.getNumColumns() == colVec.size() &&
|
||||
"column vector dimension should match transform input dimension");
|
||||
|
||||
|
@ -144,7 +144,7 @@ LinearTransform::applyTo(const IntegerPolyhedron &poly) const {
|
|||
|
||||
int64_t c = eq.back();
|
||||
|
||||
SmallVector<int64_t, 8> newEq = postMultiplyRow(eq.drop_back());
|
||||
SmallVector<int64_t, 8> newEq = preMultiplyWithRow(eq.drop_back());
|
||||
newEq.push_back(c);
|
||||
result.addEquality(newEq);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ LinearTransform::applyTo(const IntegerPolyhedron &poly) const {
|
|||
|
||||
int64_t c = ineq.back();
|
||||
|
||||
SmallVector<int64_t, 8> newIneq = postMultiplyRow(ineq.drop_back());
|
||||
SmallVector<int64_t, 8> newIneq = preMultiplyWithRow(ineq.drop_back());
|
||||
newIneq.push_back(c);
|
||||
result.addInequality(newIneq);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ void testColumnEchelonForm(const Matrix &m, unsigned expectedRank) {
|
|||
// In column echelon form, each row's last non-zero value can be at most one
|
||||
// column to the right of the last non-zero column among the previous rows.
|
||||
for (unsigned row = 0, nRows = m.getNumRows(); row < nRows; ++row) {
|
||||
SmallVector<int64_t, 8> rowVec = transform.postMultiplyRow(m.getRow(row));
|
||||
SmallVector<int64_t, 8> rowVec =
|
||||
transform.preMultiplyWithRow(m.getRow(row));
|
||||
for (unsigned col = lastAllowedNonZeroCol + 1, nCols = m.getNumColumns();
|
||||
col < nCols; ++col) {
|
||||
EXPECT_EQ(rowVec[col], 0);
|
||||
|
|
Loading…
Reference in New Issue