Skip to content

Commit 98c994c

Browse files
committedSep 18, 2023
Revert "[MLIR][Presburger] Template Matrix to allow MPInt and Fraction (#65272)"
This reverts commit efca035. Reverting due to windows build bot failure: https://lab.llvm.org/buildbot/#/builders/13/builds/40242/steps/6/logs/stdio
1 parent 054f9c5 commit 98c994c

File tree

15 files changed

+127
-163
lines changed

15 files changed

+127
-163
lines changed
 

‎mlir/include/mlir/Analysis/Presburger/IntegerRelation.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ class IntegerRelation {
366366
/// bounded. The span of the returned vectors is guaranteed to contain all
367367
/// such vectors. The returned vectors are NOT guaranteed to be linearly
368368
/// independent. This function should not be called on empty sets.
369-
Matrix<MPInt> getBoundedDirections() const;
369+
Matrix getBoundedDirections() const;
370370

371371
/// Find an integer sample point satisfying the constraints using a
372372
/// branch and bound algorithm with generalized basis reduction, with some
@@ -792,10 +792,10 @@ class IntegerRelation {
792792
PresburgerSpace space;
793793

794794
/// Coefficients of affine equalities (in == 0 form).
795-
Matrix<MPInt> equalities;
795+
Matrix equalities;
796796

797797
/// Coefficients of affine inequalities (in >= 0 form).
798-
Matrix<MPInt> inequalities;
798+
Matrix inequalities;
799799
};
800800

801801
/// An IntegerPolyhedron represents the set of points from a PresburgerSpace

‎mlir/include/mlir/Analysis/Presburger/LinearTransform.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ namespace presburger {
2222

2323
class LinearTransform {
2424
public:
25-
explicit LinearTransform(Matrix<MPInt> &&oMatrix);
26-
explicit LinearTransform(const Matrix<MPInt> &oMatrix);
25+
explicit LinearTransform(Matrix &&oMatrix);
26+
explicit LinearTransform(const Matrix &oMatrix);
2727

2828
// Returns a linear transform T such that MT is M in column echelon form.
2929
// Also returns the number of non-zero columns in MT.
@@ -32,7 +32,7 @@ class LinearTransform {
3232
// strictly below that of the previous column, and all columns which have only
3333
// zeros are at the end.
3434
static std::pair<unsigned, LinearTransform>
35-
makeTransformToColumnEchelon(const Matrix<MPInt> &m);
35+
makeTransformToColumnEchelon(const Matrix &m);
3636

3737
// Returns an IntegerRelation having a constraint vector vT for every
3838
// constraint vector v in rel, where T is this transform.
@@ -50,12 +50,8 @@ class LinearTransform {
5050
return matrix.postMultiplyWithColumn(colVec);
5151
}
5252

53-
// Compute the determinant of the transform by converting it to row echelon
54-
// form and then taking the product of the diagonal.
55-
MPInt determinant();
56-
5753
private:
58-
Matrix<MPInt> matrix;
54+
Matrix matrix;
5955
};
6056

6157
} // namespace presburger

‎mlir/include/mlir/Analysis/Presburger/Matrix.h

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77
//===----------------------------------------------------------------------===//
88
//
99
// This is a simple 2D matrix class that supports reading, writing, resizing,
10-
// swapping rows, and swapping columns. It can hold integers (MPInt) or rational
11-
// numbers (Fraction).
10+
// swapping rows, and swapping columns.
1211
//
1312
//===----------------------------------------------------------------------===//
1413

1514
#ifndef MLIR_ANALYSIS_PRESBURGER_MATRIX_H
1615
#define MLIR_ANALYSIS_PRESBURGER_MATRIX_H
1716

17+
#include "mlir/Analysis/Presburger/MPInt.h"
1818
#include "mlir/Support/LLVM.h"
19-
#include "mlir/Analysis/Presburger/Fraction.h"
20-
#include "mlir/Analysis/Presburger/Matrix.h"
2119
#include "llvm/ADT/ArrayRef.h"
2220
#include "llvm/Support/raw_ostream.h"
2321

@@ -34,12 +32,7 @@ namespace presburger {
3432
/// (i, j) is stored at data[i*nReservedColumns + j]. The reserved but unused
3533
/// columns always have all zero values. The reserved rows are just reserved
3634
/// space in the underlying SmallVector's capacity.
37-
/// This class only works for the types MPInt and Fraction, since the method
38-
/// implementations are in the Matrix.cpp file. Only these two types have
39-
/// been explicitly instantiated there.
40-
template<typename T>
4135
class Matrix {
42-
static_assert(std::is_same_v<T,MPInt> || std::is_same_v<T,Fraction>, "T must be MPInt or Fraction.");
4336
public:
4437
Matrix() = delete;
4538

@@ -56,21 +49,21 @@ static_assert(std::is_same_v<T,MPInt> || std::is_same_v<T,Fraction>, "T must be
5649
static Matrix identity(unsigned dimension);
5750

5851
/// Access the element at the specified row and column.
59-
T &at(unsigned row, unsigned column) {
52+
MPInt &at(unsigned row, unsigned column) {
6053
assert(row < nRows && "Row outside of range");
6154
assert(column < nColumns && "Column outside of range");
6255
return data[row * nReservedColumns + column];
6356
}
6457

65-
T at(unsigned row, unsigned column) const {
58+
MPInt at(unsigned row, unsigned column) const {
6659
assert(row < nRows && "Row outside of range");
6760
assert(column < nColumns && "Column outside of range");
6861
return data[row * nReservedColumns + column];
6962
}
7063

71-
T &operator()(unsigned row, unsigned column) { return at(row, column); }
64+
MPInt &operator()(unsigned row, unsigned column) { return at(row, column); }
7265

73-
T operator()(unsigned row, unsigned column) const {
66+
MPInt operator()(unsigned row, unsigned column) const {
7467
return at(row, column);
7568
}
7669

@@ -94,11 +87,11 @@ static_assert(std::is_same_v<T,MPInt> || std::is_same_v<T,Fraction>, "T must be
9487
void reserveRows(unsigned rows);
9588

9689
/// Get a [Mutable]ArrayRef corresponding to the specified row.
97-
MutableArrayRef<T> getRow(unsigned row);
98-
ArrayRef<T> getRow(unsigned row) const;
90+
MutableArrayRef<MPInt> getRow(unsigned row);
91+
ArrayRef<MPInt> getRow(unsigned row) const;
9992

10093
/// Set the specified row to `elems`.
101-
void setRow(unsigned row, ArrayRef<T> elems);
94+
void setRow(unsigned row, ArrayRef<MPInt> elems);
10295

10396
/// Insert columns having positions pos, pos + 1, ... pos + count - 1.
10497
/// Columns that were at positions 0 to pos - 1 will stay where they are;
@@ -132,23 +125,23 @@ static_assert(std::is_same_v<T,MPInt> || std::is_same_v<T,Fraction>, "T must be
132125

133126
void copyRow(unsigned sourceRow, unsigned targetRow);
134127

135-
void fillRow(unsigned row, const T &value);
136-
void fillRow(unsigned row, int64_t value) { fillRow(row, T(value)); }
128+
void fillRow(unsigned row, const MPInt &value);
129+
void fillRow(unsigned row, int64_t value) { fillRow(row, MPInt(value)); }
137130

138131
/// Add `scale` multiples of the source row to the target row.
139-
void addToRow(unsigned sourceRow, unsigned targetRow, const T &scale);
132+
void addToRow(unsigned sourceRow, unsigned targetRow, const MPInt &scale);
140133
void addToRow(unsigned sourceRow, unsigned targetRow, int64_t scale) {
141-
addToRow(sourceRow, targetRow, T(scale));
134+
addToRow(sourceRow, targetRow, MPInt(scale));
142135
}
143136
/// Add `scale` multiples of the rowVec row to the specified row.
144-
void addToRow(unsigned row, ArrayRef<T> rowVec, const T &scale);
137+
void addToRow(unsigned row, ArrayRef<MPInt> rowVec, const MPInt &scale);
145138

146139
/// Add `scale` multiples of the source column to the target column.
147140
void addToColumn(unsigned sourceColumn, unsigned targetColumn,
148-
const T &scale);
141+
const MPInt &scale);
149142
void addToColumn(unsigned sourceColumn, unsigned targetColumn,
150143
int64_t scale) {
151-
addToColumn(sourceColumn, targetColumn, T(scale));
144+
addToColumn(sourceColumn, targetColumn, MPInt(scale));
152145
}
153146

154147
/// Negate the specified column.
@@ -159,18 +152,18 @@ static_assert(std::is_same_v<T,MPInt> || std::is_same_v<T,Fraction>, "T must be
159152

160153
/// Divide the first `nCols` of the specified row by their GCD.
161154
/// Returns the GCD of the first `nCols` of the specified row.
162-
T normalizeRow(unsigned row, unsigned nCols);
155+
MPInt normalizeRow(unsigned row, unsigned nCols);
163156
/// Divide the columns of the specified row by their GCD.
164157
/// Returns the GCD of the columns of the specified row.
165-
T normalizeRow(unsigned row);
158+
MPInt normalizeRow(unsigned row);
166159

167160
/// The given vector is interpreted as a row vector v. Post-multiply v with
168161
/// this matrix, say M, and return vM.
169-
SmallVector<T, 8> preMultiplyWithRow(ArrayRef<T> rowVec) const;
162+
SmallVector<MPInt, 8> preMultiplyWithRow(ArrayRef<MPInt> rowVec) const;
170163

171164
/// The given vector is interpreted as a column vector v. Pre-multiply v with
172165
/// this matrix, say M, and return Mv.
173-
SmallVector<T, 8> postMultiplyWithColumn(ArrayRef<T> colVec) const;
166+
SmallVector<MPInt, 8> postMultiplyWithColumn(ArrayRef<MPInt> colVec) const;
174167

175168
/// Given the current matrix M, returns the matrices H, U such that H is the
176169
/// column hermite normal form of M, i.e. H = M * U, where U is unimodular and
@@ -199,7 +192,7 @@ static_assert(std::is_same_v<T,MPInt> || std::is_same_v<T,Fraction>, "T must be
199192
unsigned appendExtraRow();
200193
/// Same as above, but copy the given elements into the row. The length of
201194
/// `elems` must be equal to the number of columns.
202-
unsigned appendExtraRow(ArrayRef<T> elems);
195+
unsigned appendExtraRow(ArrayRef<MPInt> elems);
203196

204197
/// Print the matrix.
205198
void print(raw_ostream &os) const;
@@ -218,7 +211,7 @@ static_assert(std::is_same_v<T,MPInt> || std::is_same_v<T,Fraction>, "T must be
218211

219212
/// Stores the data. data.size() is equal to nRows * nReservedColumns.
220213
/// data.capacity() / nReservedColumns is the number of reserved rows.
221-
SmallVector<T, 16> data;
214+
SmallVector<MPInt, 16> data;
222215
};
223216

224217
} // namespace presburger

‎mlir/include/mlir/Analysis/Presburger/PWMAFunction.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ enum class OrderingKind { EQ, NE, LT, LE, GT, GE };
4040
/// value of the function at a specified point.
4141
class MultiAffineFunction {
4242
public:
43-
MultiAffineFunction(const PresburgerSpace &space, const Matrix<MPInt> &output)
43+
MultiAffineFunction(const PresburgerSpace &space, const Matrix &output)
4444
: space(space), output(output),
4545
divs(space.getNumVars() - space.getNumRangeVars()) {
4646
assertIsConsistent();
4747
}
4848

49-
MultiAffineFunction(const PresburgerSpace &space, const Matrix<MPInt> &output,
49+
MultiAffineFunction(const PresburgerSpace &space, const Matrix &output,
5050
const DivisionRepr &divs)
5151
: space(space), output(output), divs(divs) {
5252
assertIsConsistent();
@@ -65,7 +65,7 @@ class MultiAffineFunction {
6565
PresburgerSpace getOutputSpace() const { return space.getRangeSpace(); }
6666

6767
/// Get a matrix with each row representing row^th output expression.
68-
const Matrix<MPInt> &getOutputMatrix() const { return output; }
68+
const Matrix &getOutputMatrix() const { return output; }
6969
/// Get the `i^th` output expression.
7070
ArrayRef<MPInt> getOutputExpr(unsigned i) const { return output.getRow(i); }
7171

@@ -124,7 +124,7 @@ class MultiAffineFunction {
124124
/// The function's output is a tuple of integers, with the ith element of the
125125
/// tuple defined by the affine expression given by the ith row of this output
126126
/// matrix.
127-
Matrix<MPInt> output;
127+
Matrix output;
128128

129129
/// Storage for division representation for each local variable in space.
130130
DivisionRepr divs;

‎mlir/include/mlir/Analysis/Presburger/Simplex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class SimplexBase {
338338
unsigned nSymbol;
339339

340340
/// The matrix representing the tableau.
341-
Matrix<MPInt> tableau;
341+
Matrix tableau;
342342

343343
/// This is true if the tableau has been detected to be empty, false
344344
/// otherwise.
@@ -861,7 +861,7 @@ class Simplex : public SimplexBase {
861861

862862
/// Reduce the given basis, starting at the specified level, using general
863863
/// basis reduction.
864-
void reduceBasis(Matrix<MPInt> &basis, unsigned level);
864+
void reduceBasis(Matrix &basis, unsigned level);
865865
};
866866

867867
/// Takes a snapshot of the simplex state on construction and rolls back to the

‎mlir/include/mlir/Analysis/Presburger/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class DivisionRepr {
182182
/// Each row of the Matrix represents a single division dividend. The
183183
/// `i^th` row represents the dividend of the variable at `divOffset + i`
184184
/// in the constraint system (and the `i^th` local variable).
185-
Matrix<MPInt> dividends;
185+
Matrix dividends;
186186

187187
/// Denominators of each division. If a denominator of a division is `0`, the
188188
/// division variable is considered to not have a division representation.

‎mlir/lib/Analysis/FlatLinearValueConstraints.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ mlir::getMultiAffineFunctionFromMap(AffineMap map,
12921292
"AffineMap cannot produce divs without local representation");
12931293

12941294
// TODO: We shouldn't have to do this conversion.
1295-
Matrix<MPInt> mat(map.getNumResults(), map.getNumInputs() + divs.getNumDivs() + 1);
1295+
Matrix mat(map.getNumResults(), map.getNumInputs() + divs.getNumDivs() + 1);
12961296
for (unsigned i = 0, e = flattenedExprs.size(); i < e; ++i)
12971297
for (unsigned j = 0, f = flattenedExprs[i].size(); j < f; ++j)
12981298
mat(i, j) = flattenedExprs[i][j];

‎mlir/lib/Analysis/Presburger/IntegerRelation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ SymbolicLexOpt IntegerRelation::findSymbolicIntegerLexMax() const {
304304
// Get lexmax by flipping range sign in the PWMA constraints.
305305
for (auto &flippedPiece :
306306
flippedSymbolicIntegerLexMax.lexopt.getAllPieces()) {
307-
Matrix<MPInt> mat = flippedPiece.output.getOutputMatrix();
307+
Matrix mat = flippedPiece.output.getOutputMatrix();
308308
for (unsigned i = 0, e = mat.getNumRows(); i < e; i++)
309309
mat.negateRow(i);
310310
MultiAffineFunction maf(flippedPiece.output.getSpace(), mat);
@@ -738,7 +738,7 @@ bool IntegerRelation::isEmptyByGCDTest() const {
738738
//
739739
// It is sufficient to check the perpendiculars of the constraints, as the set
740740
// of perpendiculars which are bounded must span all bounded directions.
741-
Matrix<MPInt> IntegerRelation::getBoundedDirections() const {
741+
Matrix IntegerRelation::getBoundedDirections() const {
742742
// Note that it is necessary to add the equalities too (which the constructor
743743
// does) even though we don't need to check if they are bounded; whether an
744744
// inequality is bounded or not depends on what other constraints, including
@@ -759,7 +759,7 @@ Matrix<MPInt> IntegerRelation::getBoundedDirections() const {
759759
// The direction vector is given by the coefficients and does not include the
760760
// constant term, so the matrix has one fewer column.
761761
unsigned dirsNumCols = getNumCols() - 1;
762-
Matrix<MPInt> dirs(boundedIneqs.size() + getNumEqualities(), dirsNumCols);
762+
Matrix dirs(boundedIneqs.size() + getNumEqualities(), dirsNumCols);
763763

764764
// Copy the bounded inequalities.
765765
unsigned row = 0;
@@ -845,7 +845,7 @@ IntegerRelation::findIntegerSample() const {
845845
// m is a matrix containing, in each row, a vector in which S is
846846
// bounded, such that the linear span of all these dimensions contains all
847847
// bounded dimensions in S.
848-
Matrix<MPInt> m = getBoundedDirections();
848+
Matrix m = getBoundedDirections();
849849
// In column echelon form, each row of m occupies only the first rank(m)
850850
// columns and has zeros on the other columns. The transform T that brings S
851851
// to column echelon form is unimodular as well, so this is a suitable

‎mlir/lib/Analysis/Presburger/LinearTransform.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
using namespace mlir;
1313
using namespace presburger;
1414

15-
LinearTransform::LinearTransform(Matrix<MPInt> &&oMatrix) : matrix(oMatrix) {}
16-
LinearTransform::LinearTransform(const Matrix<MPInt> &oMatrix) : matrix(oMatrix) {}
15+
LinearTransform::LinearTransform(Matrix &&oMatrix) : matrix(oMatrix) {}
16+
LinearTransform::LinearTransform(const Matrix &oMatrix) : matrix(oMatrix) {}
1717

1818
std::pair<unsigned, LinearTransform>
19-
LinearTransform::makeTransformToColumnEchelon(const Matrix<MPInt> &m) {
19+
LinearTransform::makeTransformToColumnEchelon(const Matrix &m) {
2020
// Compute the hermite normal form of m. This, is by definition, is in column
2121
// echelon form.
2222
auto [h, u] = m.computeHermiteNormalForm();

‎mlir/lib/Analysis/Presburger/Matrix.cpp

Lines changed: 48 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,66 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "mlir/Analysis/Presburger/Matrix.h"
10-
#include "mlir/Analysis/Presburger/Fraction.h"
1110
#include "mlir/Analysis/Presburger/Utils.h"
1211
#include "llvm/Support/MathExtras.h"
1312

1413
using namespace mlir;
1514
using namespace presburger;
1615

17-
template <typename T> Matrix<T>::Matrix(unsigned rows, unsigned columns, unsigned reservedRows,
16+
Matrix::Matrix(unsigned rows, unsigned columns, unsigned reservedRows,
1817
unsigned reservedColumns)
1918
: nRows(rows), nColumns(columns),
2019
nReservedColumns(std::max(nColumns, reservedColumns)),
2120
data(nRows * nReservedColumns) {
2221
data.reserve(std::max(nRows, reservedRows) * nReservedColumns);
2322
}
2423

25-
template <typename T> Matrix<T> Matrix<T>::identity(unsigned dimension) {
24+
Matrix Matrix::identity(unsigned dimension) {
2625
Matrix matrix(dimension, dimension);
2726
for (unsigned i = 0; i < dimension; ++i)
2827
matrix(i, i) = 1;
2928
return matrix;
3029
}
3130

32-
template <typename T> unsigned Matrix<T>::getNumReservedRows() const {
31+
unsigned Matrix::getNumReservedRows() const {
3332
return data.capacity() / nReservedColumns;
3433
}
3534

36-
template <typename T> void Matrix<T>::reserveRows(unsigned rows) {
35+
void Matrix::reserveRows(unsigned rows) {
3736
data.reserve(rows * nReservedColumns);
3837
}
3938

40-
template <typename T> unsigned Matrix<T>::appendExtraRow() {
39+
unsigned Matrix::appendExtraRow() {
4140
resizeVertically(nRows + 1);
4241
return nRows - 1;
4342
}
4443

45-
template <typename T> unsigned Matrix<T>::appendExtraRow(ArrayRef<T> elems) {
44+
unsigned Matrix::appendExtraRow(ArrayRef<MPInt> elems) {
4645
assert(elems.size() == nColumns && "elems must match row length!");
4746
unsigned row = appendExtraRow();
4847
for (unsigned col = 0; col < nColumns; ++col)
4948
at(row, col) = elems[col];
5049
return row;
5150
}
5251

53-
template <typename T> void Matrix<T>::resizeHorizontally(unsigned newNColumns) {
52+
void Matrix::resizeHorizontally(unsigned newNColumns) {
5453
if (newNColumns < nColumns)
5554
removeColumns(newNColumns, nColumns - newNColumns);
5655
if (newNColumns > nColumns)
5756
insertColumns(nColumns, newNColumns - nColumns);
5857
}
5958

60-
template <typename T> void Matrix<T>::resize(unsigned newNRows, unsigned newNColumns) {
59+
void Matrix::resize(unsigned newNRows, unsigned newNColumns) {
6160
resizeHorizontally(newNColumns);
6261
resizeVertically(newNRows);
6362
}
6463

65-
template <typename T> void Matrix<T>::resizeVertically(unsigned newNRows) {
64+
void Matrix::resizeVertically(unsigned newNRows) {
6665
nRows = newNRows;
6766
data.resize(nRows * nReservedColumns);
6867
}
6968

70-
template <typename T> void Matrix<T>::swapRows(unsigned row, unsigned otherRow) {
69+
void Matrix::swapRows(unsigned row, unsigned otherRow) {
7170
assert((row < getNumRows() && otherRow < getNumRows()) &&
7271
"Given row out of bounds");
7372
if (row == otherRow)
@@ -76,7 +75,7 @@ template <typename T> void Matrix<T>::swapRows(unsigned row, unsigned otherRow)
7675
std::swap(at(row, col), at(otherRow, col));
7776
}
7877

79-
template <typename T> void Matrix<T>::swapColumns(unsigned column, unsigned otherColumn) {
78+
void Matrix::swapColumns(unsigned column, unsigned otherColumn) {
8079
assert((column < getNumColumns() && otherColumn < getNumColumns()) &&
8180
"Given column out of bounds");
8281
if (column == otherColumn)
@@ -85,23 +84,23 @@ template <typename T> void Matrix<T>::swapColumns(unsigned column, unsigned othe
8584
std::swap(at(row, column), at(row, otherColumn));
8685
}
8786

88-
template <typename T> MutableArrayRef<T> Matrix<T>::getRow(unsigned row) {
87+
MutableArrayRef<MPInt> Matrix::getRow(unsigned row) {
8988
return {&data[row * nReservedColumns], nColumns};
9089
}
9190

92-
template <typename T> ArrayRef<T> Matrix<T>::getRow(unsigned row) const {
91+
ArrayRef<MPInt> Matrix::getRow(unsigned row) const {
9392
return {&data[row * nReservedColumns], nColumns};
9493
}
9594

96-
template <typename T> void Matrix<T>::setRow(unsigned row, ArrayRef<T> elems) {
95+
void Matrix::setRow(unsigned row, ArrayRef<MPInt> elems) {
9796
assert(elems.size() == getNumColumns() &&
9897
"elems size must match row length!");
9998
for (unsigned i = 0, e = getNumColumns(); i < e; ++i)
10099
at(row, i) = elems[i];
101100
}
102101

103-
template <typename T> void Matrix<T>::insertColumn(unsigned pos) { insertColumns(pos, 1); }
104-
template <typename T> void Matrix<T>::insertColumns(unsigned pos, unsigned count) {
102+
void Matrix::insertColumn(unsigned pos) { insertColumns(pos, 1); }
103+
void Matrix::insertColumns(unsigned pos, unsigned count) {
105104
if (count == 0)
106105
return;
107106
assert(pos <= nColumns);
@@ -116,7 +115,7 @@ template <typename T> void Matrix<T>::insertColumns(unsigned pos, unsigned count
116115
for (int ci = nReservedColumns - 1; ci >= 0; --ci) {
117116
unsigned r = ri;
118117
unsigned c = ci;
119-
T &dest = data[r * nReservedColumns + c];
118+
MPInt &dest = data[r * nReservedColumns + c];
120119
if (c >= nColumns) { // NOLINT
121120
// Out of bounds columns are zero-initialized. NOLINT because clang-tidy
122121
// complains about this branch being the same as the c >= pos one.
@@ -142,8 +141,8 @@ template <typename T> void Matrix<T>::insertColumns(unsigned pos, unsigned count
142141
}
143142
}
144143

145-
template <typename T> void Matrix<T>::removeColumn(unsigned pos) { removeColumns(pos, 1); }
146-
template <typename T> void Matrix<T>::removeColumns(unsigned pos, unsigned count) {
144+
void Matrix::removeColumn(unsigned pos) { removeColumns(pos, 1); }
145+
void Matrix::removeColumns(unsigned pos, unsigned count) {
147146
if (count == 0)
148147
return;
149148
assert(pos + count - 1 < nColumns);
@@ -156,8 +155,8 @@ template <typename T> void Matrix<T>::removeColumns(unsigned pos, unsigned count
156155
nColumns -= count;
157156
}
158157

159-
template <typename T> void Matrix<T>::insertRow(unsigned pos) { insertRows(pos, 1); }
160-
template <typename T> void Matrix<T>::insertRows(unsigned pos, unsigned count) {
158+
void Matrix::insertRow(unsigned pos) { insertRows(pos, 1); }
159+
void Matrix::insertRows(unsigned pos, unsigned count) {
161160
if (count == 0)
162161
return;
163162

@@ -170,8 +169,8 @@ template <typename T> void Matrix<T>::insertRows(unsigned pos, unsigned count) {
170169
at(r, c) = 0;
171170
}
172171

173-
template <typename T> void Matrix<T>::removeRow(unsigned pos) { removeRows(pos, 1); }
174-
template <typename T> void Matrix<T>::removeRows(unsigned pos, unsigned count) {
172+
void Matrix::removeRow(unsigned pos) { removeRows(pos, 1); }
173+
void Matrix::removeRows(unsigned pos, unsigned count) {
175174
if (count == 0)
176175
return;
177176
assert(pos + count - 1 <= nRows);
@@ -180,73 +179,73 @@ template <typename T> void Matrix<T>::removeRows(unsigned pos, unsigned count) {
180179
resizeVertically(nRows - count);
181180
}
182181

183-
template <typename T> void Matrix<T>::copyRow(unsigned sourceRow, unsigned targetRow) {
182+
void Matrix::copyRow(unsigned sourceRow, unsigned targetRow) {
184183
if (sourceRow == targetRow)
185184
return;
186185
for (unsigned c = 0; c < nColumns; ++c)
187186
at(targetRow, c) = at(sourceRow, c);
188187
}
189188

190-
template <typename T> void Matrix<T>::fillRow(unsigned row, const T &value) {
189+
void Matrix::fillRow(unsigned row, const MPInt &value) {
191190
for (unsigned col = 0; col < nColumns; ++col)
192191
at(row, col) = value;
193192
}
194193

195-
template <typename T> void Matrix<T>::addToRow(unsigned sourceRow, unsigned targetRow,
196-
const T &scale) {
194+
void Matrix::addToRow(unsigned sourceRow, unsigned targetRow,
195+
const MPInt &scale) {
197196
addToRow(targetRow, getRow(sourceRow), scale);
198197
}
199198

200-
template <typename T> void Matrix<T>::addToRow(unsigned row, ArrayRef<T> rowVec,
201-
const T &scale) {
199+
void Matrix::addToRow(unsigned row, ArrayRef<MPInt> rowVec,
200+
const MPInt &scale) {
202201
if (scale == 0)
203202
return;
204203
for (unsigned col = 0; col < nColumns; ++col)
205204
at(row, col) += scale * rowVec[col];
206205
}
207206

208-
template <typename T> void Matrix<T>::addToColumn(unsigned sourceColumn, unsigned targetColumn,
209-
const T &scale) {
207+
void Matrix::addToColumn(unsigned sourceColumn, unsigned targetColumn,
208+
const MPInt &scale) {
210209
if (scale == 0)
211210
return;
212211
for (unsigned row = 0, e = getNumRows(); row < e; ++row)
213212
at(row, targetColumn) += scale * at(row, sourceColumn);
214213
}
215214

216-
template <typename T> void Matrix<T>::negateColumn(unsigned column) {
215+
void Matrix::negateColumn(unsigned column) {
217216
for (unsigned row = 0, e = getNumRows(); row < e; ++row)
218217
at(row, column) = -at(row, column);
219218
}
220219

221-
template <typename T> void Matrix<T>::negateRow(unsigned row) {
220+
void Matrix::negateRow(unsigned row) {
222221
for (unsigned column = 0, e = getNumColumns(); column < e; ++column)
223222
at(row, column) = -at(row, column);
224223
}
225224

226-
template <> MPInt Matrix<MPInt>::normalizeRow(unsigned row, unsigned cols) {
225+
MPInt Matrix::normalizeRow(unsigned row, unsigned cols) {
227226
return normalizeRange(getRow(row).slice(0, cols));
228227
}
229228

230-
template <> MPInt Matrix<MPInt>::normalizeRow(unsigned row) {
229+
MPInt Matrix::normalizeRow(unsigned row) {
231230
return normalizeRow(row, getNumColumns());
232231
}
233232

234-
template <typename T> SmallVector<T, 8> Matrix<T>::preMultiplyWithRow(ArrayRef<T> rowVec) const {
233+
SmallVector<MPInt, 8> Matrix::preMultiplyWithRow(ArrayRef<MPInt> rowVec) const {
235234
assert(rowVec.size() == getNumRows() && "Invalid row vector dimension!");
236235

237-
SmallVector<T, 8> result(getNumColumns(), T(0));
236+
SmallVector<MPInt, 8> result(getNumColumns(), MPInt(0));
238237
for (unsigned col = 0, e = getNumColumns(); col < e; ++col)
239238
for (unsigned i = 0, e = getNumRows(); i < e; ++i)
240239
result[col] += rowVec[i] * at(i, col);
241240
return result;
242241
}
243242

244-
template <typename T> SmallVector<T, 8>
245-
Matrix<T>::postMultiplyWithColumn(ArrayRef<T> colVec) const {
243+
SmallVector<MPInt, 8>
244+
Matrix::postMultiplyWithColumn(ArrayRef<MPInt> colVec) const {
246245
assert(getNumColumns() == colVec.size() &&
247246
"Invalid column vector dimension!");
248247

249-
SmallVector<T, 8> result(getNumRows(), T(0));
248+
SmallVector<MPInt, 8> result(getNumRows(), MPInt(0));
250249
for (unsigned row = 0, e = getNumRows(); row < e; row++)
251250
for (unsigned i = 0, e = getNumColumns(); i < e; i++)
252251
result[row] += at(row, i) * colVec[i];
@@ -258,21 +257,21 @@ Matrix<T>::postMultiplyWithColumn(ArrayRef<T> colVec) const {
258257
/// sourceCol. This brings M(row, targetCol) to the range [0, M(row,
259258
/// sourceCol)). Apply the same column operation to otherMatrix, with the same
260259
/// integer multiple.
261-
static void modEntryColumnOperation(Matrix<MPInt> &m, unsigned row, unsigned sourceCol,
262-
unsigned targetCol, Matrix<MPInt> &otherMatrix) {
260+
static void modEntryColumnOperation(Matrix &m, unsigned row, unsigned sourceCol,
261+
unsigned targetCol, Matrix &otherMatrix) {
263262
assert(m(row, sourceCol) != 0 && "Cannot divide by zero!");
264263
assert(m(row, sourceCol) > 0 && "Source must be positive!");
265264
MPInt ratio = -floorDiv(m(row, targetCol), m(row, sourceCol));
266265
m.addToColumn(sourceCol, targetCol, ratio);
267266
otherMatrix.addToColumn(sourceCol, targetCol, ratio);
268267
}
269268

270-
template <> std::pair<Matrix<MPInt>, Matrix<MPInt>> Matrix<MPInt>::computeHermiteNormalForm() const {
269+
std::pair<Matrix, Matrix> Matrix::computeHermiteNormalForm() const {
271270
// We start with u as an identity matrix and perform operations on h until h
272271
// is in hermite normal form. We apply the same sequence of operations on u to
273272
// obtain a transform that takes h to hermite normal form.
274-
Matrix<MPInt> h = *this;
275-
Matrix<MPInt> u = Matrix<MPInt>::identity(h.getNumColumns());
273+
Matrix h = *this;
274+
Matrix u = Matrix::identity(h.getNumColumns());
276275

277276
unsigned echelonCol = 0;
278277
// Invariant: in all rows above row, all columns from echelonCol onwards
@@ -353,17 +352,17 @@ template <> std::pair<Matrix<MPInt>, Matrix<MPInt>> Matrix<MPInt>::computeHermit
353352
return {h, u};
354353
}
355354

356-
template <typename T> void Matrix<T>::print(raw_ostream &os) const {
355+
void Matrix::print(raw_ostream &os) const {
357356
for (unsigned row = 0; row < nRows; ++row) {
358357
for (unsigned column = 0; column < nColumns; ++column)
359358
os << at(row, column) << ' ';
360359
os << '\n';
361360
}
362361
}
363362

364-
template <typename T> void Matrix<T>::dump() const { print(llvm::errs()); }
363+
void Matrix::dump() const { print(llvm::errs()); }
365364

366-
template <typename T> bool Matrix<T>::hasConsistentState() const {
365+
bool Matrix::hasConsistentState() const {
367366
if (data.size() != nRows * nReservedColumns)
368367
return false;
369368
if (nColumns > nReservedColumns)
@@ -376,12 +375,3 @@ template <typename T> bool Matrix<T>::hasConsistentState() const {
376375
#endif
377376
return true;
378377
}
379-
380-
namespace mlir
381-
{
382-
namespace presburger
383-
{
384-
template class Matrix<MPInt>;
385-
template class Matrix<Fraction>;
386-
}
387-
}

‎mlir/lib/Analysis/Presburger/Simplex.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ LogicalResult SymbolicLexSimplex::addSymbolicCut(unsigned row) {
436436
}
437437

438438
void SymbolicLexSimplex::recordOutput(SymbolicLexOpt &result) const {
439-
Matrix<MPInt> output(0, domainPoly.getNumVars() + 1);
439+
Matrix output(0, domainPoly.getNumVars() + 1);
440440
output.reserveRows(result.lexopt.getNumOutputs());
441441
for (const Unknown &u : var) {
442442
if (u.isSymbol)
@@ -1801,7 +1801,7 @@ class presburger::GBRSimplex {
18011801
///
18021802
/// When incrementing i, no cached f values get invalidated. However, the cached
18031803
/// duals do get invalidated as the duals for the higher levels are different.
1804-
void Simplex::reduceBasis(Matrix<MPInt> &basis, unsigned level) {
1804+
void Simplex::reduceBasis(Matrix &basis, unsigned level) {
18051805
const Fraction epsilon(3, 4);
18061806

18071807
if (level == basis.getNumRows() - 1)
@@ -1975,7 +1975,7 @@ std::optional<SmallVector<MPInt, 8>> Simplex::findIntegerSample() {
19751975
return {};
19761976

19771977
unsigned nDims = var.size();
1978-
Matrix<MPInt> basis = Matrix<MPInt>::identity(nDims);
1978+
Matrix basis = Matrix::identity(nDims);
19791979

19801980
unsigned level = 0;
19811981
// The snapshot just before constraining a direction to a value at each level.

‎mlir/unittests/Analysis/Presburger/LinearTransformTest.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
using namespace mlir;
1414
using namespace presburger;
1515

16-
void testColumnEchelonForm(const Matrix<MPInt> &m, unsigned expectedRank) {
16+
void testColumnEchelonForm(const Matrix &m, unsigned expectedRank) {
1717
unsigned lastAllowedNonZeroCol = 0;
1818
std::pair<unsigned, LinearTransform> result =
1919
LinearTransform::makeTransformToColumnEchelon(m);
@@ -42,43 +42,43 @@ void testColumnEchelonForm(const Matrix<MPInt> &m, unsigned expectedRank) {
4242

4343
TEST(LinearTransformTest, transformToColumnEchelonTest) {
4444
// m1, m2, m3 are rank 1 matrices -- the first and second rows are identical.
45-
Matrix<MPInt> m1(2, 2);
45+
Matrix m1(2, 2);
4646
m1(0, 0) = 4;
4747
m1(0, 1) = -7;
4848
m1(1, 0) = 4;
4949
m1(1, 1) = -7;
5050
testColumnEchelonForm(m1, 1u);
5151

52-
Matrix<MPInt> m2(2, 2);
52+
Matrix m2(2, 2);
5353
m2(0, 0) = -4;
5454
m2(0, 1) = 7;
5555
m2(1, 0) = 4;
5656
m2(1, 1) = -7;
5757
testColumnEchelonForm(m2, 1u);
5858

59-
Matrix<MPInt> m3(2, 2);
59+
Matrix m3(2, 2);
6060
m3(0, 0) = -4;
6161
m3(0, 1) = -7;
6262
m3(1, 0) = -4;
6363
m3(1, 1) = -7;
6464
testColumnEchelonForm(m3, 1u);
6565

6666
// m4, m5, m6 are rank 2 matrices -- the first and second rows are different.
67-
Matrix<MPInt> m4(2, 2);
67+
Matrix m4(2, 2);
6868
m4(0, 0) = 4;
6969
m4(0, 1) = -7;
7070
m4(1, 0) = -4;
7171
m4(1, 1) = -7;
7272
testColumnEchelonForm(m4, 2u);
7373

74-
Matrix<MPInt> m5(2, 2);
74+
Matrix m5(2, 2);
7575
m5(0, 0) = -4;
7676
m5(0, 1) = 7;
7777
m5(1, 0) = 4;
7878
m5(1, 1) = 7;
7979
testColumnEchelonForm(m5, 2u);
8080

81-
Matrix<MPInt> m6(2, 2);
81+
Matrix m6(2, 2);
8282
m6(0, 0) = -4;
8383
m6(0, 1) = -7;
8484
m6(1, 0) = 4;

‎mlir/unittests/Analysis/Presburger/MatrixTest.cpp

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "mlir/Analysis/Presburger/Matrix.h"
10-
#include "mlir/Analysis/Presburger/Fraction.h"
1110
#include "./Utils.h"
1211
#include <gmock/gmock.h>
1312
#include <gtest/gtest.h>
@@ -16,7 +15,7 @@ using namespace mlir;
1615
using namespace presburger;
1716

1817
TEST(MatrixTest, ReadWrite) {
19-
Matrix<MPInt> mat(5, 5);
18+
Matrix mat(5, 5);
2019
for (unsigned row = 0; row < 5; ++row)
2120
for (unsigned col = 0; col < 5; ++col)
2221
mat(row, col) = 10 * row + col;
@@ -26,7 +25,7 @@ TEST(MatrixTest, ReadWrite) {
2625
}
2726

2827
TEST(MatrixTest, SwapColumns) {
29-
Matrix<MPInt> mat(5, 5);
28+
Matrix mat(5, 5);
3029
for (unsigned row = 0; row < 5; ++row)
3130
for (unsigned col = 0; col < 5; ++col)
3231
mat(row, col) = col == 3 ? 1 : 0;
@@ -48,7 +47,7 @@ TEST(MatrixTest, SwapColumns) {
4847
}
4948

5049
TEST(MatrixTest, SwapRows) {
51-
Matrix<MPInt> mat(5, 5);
50+
Matrix mat(5, 5);
5251
for (unsigned row = 0; row < 5; ++row)
5352
for (unsigned col = 0; col < 5; ++col)
5453
mat(row, col) = row == 2 ? 1 : 0;
@@ -70,7 +69,7 @@ TEST(MatrixTest, SwapRows) {
7069
}
7170

7271
TEST(MatrixTest, resizeVertically) {
73-
Matrix<MPInt> mat(5, 5);
72+
Matrix mat(5, 5);
7473
EXPECT_EQ(mat.getNumRows(), 5u);
7574
EXPECT_EQ(mat.getNumColumns(), 5u);
7675
for (unsigned row = 0; row < 5; ++row)
@@ -95,7 +94,7 @@ TEST(MatrixTest, resizeVertically) {
9594
}
9695

9796
TEST(MatrixTest, insertColumns) {
98-
Matrix<MPInt> mat(5, 5, 5, 10);
97+
Matrix mat(5, 5, 5, 10);
9998
EXPECT_EQ(mat.getNumRows(), 5u);
10099
EXPECT_EQ(mat.getNumColumns(), 5u);
101100
for (unsigned row = 0; row < 5; ++row)
@@ -132,7 +131,7 @@ TEST(MatrixTest, insertColumns) {
132131
}
133132

134133
TEST(MatrixTest, insertRows) {
135-
Matrix<MPInt> mat(5, 5, 5, 10);
134+
Matrix mat(5, 5, 5, 10);
136135
ASSERT_TRUE(mat.hasConsistentState());
137136
EXPECT_EQ(mat.getNumRows(), 5u);
138137
EXPECT_EQ(mat.getNumColumns(), 5u);
@@ -170,7 +169,7 @@ TEST(MatrixTest, insertRows) {
170169
}
171170

172171
TEST(MatrixTest, resize) {
173-
Matrix<MPInt> mat(5, 5);
172+
Matrix mat(5, 5);
174173
EXPECT_EQ(mat.getNumRows(), 5u);
175174
EXPECT_EQ(mat.getNumColumns(), 5u);
176175
for (unsigned row = 0; row < 5; ++row)
@@ -194,8 +193,8 @@ TEST(MatrixTest, resize) {
194193
EXPECT_EQ(mat(row, col), row >= 3 || col >= 3 ? 0 : int(10 * row + col));
195194
}
196195

197-
static void checkHermiteNormalForm(const Matrix<MPInt> &mat,
198-
const Matrix<MPInt> &hermiteForm) {
196+
static void checkHermiteNormalForm(const Matrix &mat,
197+
const Matrix &hermiteForm) {
199198
auto [h, u] = mat.computeHermiteNormalForm();
200199

201200
for (unsigned row = 0; row < mat.getNumRows(); row++)
@@ -209,42 +208,42 @@ TEST(MatrixTest, computeHermiteNormalForm) {
209208

210209
{
211210
// Hermite form of a unimodular matrix is the identity matrix.
212-
Matrix<MPInt> mat = makeIntMatrix(3, 3, {{2, 3, 6}, {3, 2, 3}, {17, 11, 16}});
213-
Matrix<MPInt> hermiteForm = makeIntMatrix(3, 3, {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}});
211+
Matrix mat = makeMatrix(3, 3, {{2, 3, 6}, {3, 2, 3}, {17, 11, 16}});
212+
Matrix hermiteForm = makeMatrix(3, 3, {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}});
214213
checkHermiteNormalForm(mat, hermiteForm);
215214
}
216215

217216
{
218217
// Hermite form of a unimodular is the identity matrix.
219-
Matrix<MPInt> mat = makeIntMatrix(
218+
Matrix mat = makeMatrix(
220219
4, 4,
221220
{{-6, -1, -19, -20}, {0, 1, 0, 0}, {-5, 0, -15, -16}, {6, 0, 18, 19}});
222-
Matrix<MPInt> hermiteForm = makeIntMatrix(
221+
Matrix hermiteForm = makeMatrix(
223222
4, 4, {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}});
224223
checkHermiteNormalForm(mat, hermiteForm);
225224
}
226225

227226
{
228-
Matrix<MPInt> mat = makeIntMatrix(
227+
Matrix mat = makeMatrix(
229228
4, 4, {{3, 3, 1, 4}, {0, 1, 0, 0}, {0, 0, 19, 16}, {0, 0, 0, 3}});
230-
Matrix<MPInt> hermiteForm = makeIntMatrix(
229+
Matrix hermiteForm = makeMatrix(
231230
4, 4, {{1, 0, 0, 0}, {0, 1, 0, 0}, {1, 0, 3, 0}, {18, 0, 54, 57}});
232231
checkHermiteNormalForm(mat, hermiteForm);
233232
}
234233

235234
{
236-
Matrix<MPInt> mat = makeIntMatrix(
235+
Matrix mat = makeMatrix(
237236
4, 4, {{3, 3, 1, 4}, {0, 1, 0, 0}, {0, 0, 19, 16}, {0, 0, 0, 3}});
238-
Matrix<MPInt> hermiteForm = makeIntMatrix(
237+
Matrix hermiteForm = makeMatrix(
239238
4, 4, {{1, 0, 0, 0}, {0, 1, 0, 0}, {1, 0, 3, 0}, {18, 0, 54, 57}});
240239
checkHermiteNormalForm(mat, hermiteForm);
241240
}
242241

243242
{
244-
Matrix<MPInt> mat =
245-
makeIntMatrix(3, 5, {{0, 2, 0, 7, 1}, {-1, 0, 0, -3, 0}, {0, 4, 1, 0, 8}});
246-
Matrix<MPInt> hermiteForm =
247-
makeIntMatrix(3, 5, {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}});
243+
Matrix mat =
244+
makeMatrix(3, 5, {{0, 2, 0, 7, 1}, {-1, 0, 0, -3, 0}, {0, 4, 1, 0, 8}});
245+
Matrix hermiteForm =
246+
makeMatrix(3, 5, {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}});
248247
checkHermiteNormalForm(mat, hermiteForm);
249248
}
250249
}

‎mlir/unittests/Analysis/Presburger/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ inline MultiAffineFunction parseMultiAffineFunction(StringRef str) {
5252

5353
// TODO: Add default constructor for MultiAffineFunction.
5454
MultiAffineFunction multiAff(PresburgerSpace::getRelationSpace(),
55-
Matrix<MPInt>(0, 1));
55+
Matrix(0, 1));
5656
if (getMultiAffineFunctionFromMap(parseAffineMap(str, &context), multiAff)
5757
.failed())
5858
llvm_unreachable(

‎mlir/unittests/Analysis/Presburger/Utils.h

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "mlir/Analysis/Presburger/PWMAFunction.h"
1818
#include "mlir/Analysis/Presburger/PresburgerRelation.h"
1919
#include "mlir/Analysis/Presburger/Simplex.h"
20-
#include "mlir/Analysis/Presburger/Matrix.h"
2120
#include "mlir/IR/MLIRContext.h"
2221
#include "mlir/Support/LLVM.h"
2322

@@ -27,22 +26,9 @@
2726
namespace mlir {
2827
namespace presburger {
2928

30-
inline Matrix<MPInt> makeIntMatrix(unsigned numRow, unsigned numColumns,
31-
ArrayRef<SmallVector<int, 8>> matrix) {
32-
Matrix<MPInt> results(numRow, numColumns);
33-
assert(matrix.size() == numRow);
34-
for (unsigned i = 0; i < numRow; ++i) {
35-
assert(matrix[i].size() == numColumns &&
36-
"Output expression has incorrect dimensionality!");
37-
for (unsigned j = 0; j < numColumns; ++j)
38-
results(i, j) = MPInt(matrix[i][j]);
39-
}
40-
return results;
41-
}
42-
43-
inline Matrix<Fraction> makeFracMatrix(unsigned numRow, unsigned numColumns,
44-
ArrayRef<SmallVector<Fraction, 8>> matrix) {
45-
Matrix<Fraction> results(numRow, numColumns);
29+
inline Matrix makeMatrix(unsigned numRow, unsigned numColumns,
30+
ArrayRef<SmallVector<int64_t, 8>> matrix) {
31+
Matrix results(numRow, numColumns);
4632
assert(matrix.size() == numRow);
4733
for (unsigned i = 0; i < numRow; ++i) {
4834
assert(matrix[i].size() == numColumns &&

0 commit comments

Comments
 (0)
Please sign in to comment.