MLIR
18.0.0git
|
#include "mlir/Analysis/Presburger/Matrix.h"
Public Member Functions | |
IntMatrix (unsigned rows, unsigned columns, unsigned reservedRows=0, unsigned reservedColumns=0) | |
IntMatrix (Matrix< MPInt > m) | |
std::pair< IntMatrix, IntMatrix > | computeHermiteNormalForm () const |
Given the current matrix M, returns the matrices H, U such that H is the column hermite normal form of M, i.e. More... | |
MPInt | normalizeRow (unsigned row, unsigned nCols) |
Divide the first nCols of the specified row by their GCD. More... | |
MPInt | normalizeRow (unsigned row) |
Divide the columns of the specified row by their GCD. More... | |
MPInt | determinant (IntMatrix *inverse=nullptr) const |
![]() | |
Matrix ()=delete | |
Matrix (unsigned rows, unsigned columns, unsigned reservedRows=0, unsigned reservedColumns=0) | |
Construct a matrix with the specified number of rows and columns. More... | |
MPInt & | at (unsigned row, unsigned column) |
Access the element at the specified row and column. More... | |
MPInt | at (unsigned row, unsigned column) const |
MPInt & | operator() (unsigned row, unsigned column) |
MPInt | operator() (unsigned row, unsigned column) const |
void | swapColumns (unsigned column, unsigned otherColumn) |
Swap the given columns. More... | |
void | swapRows (unsigned row, unsigned otherRow) |
Swap the given rows. More... | |
unsigned | getNumRows () const |
unsigned | getNumColumns () const |
unsigned | getNumReservedRows () const |
Return the maximum number of rows/columns that can be added without incurring a reallocation. More... | |
unsigned | getNumReservedColumns () const |
void | reserveRows (unsigned rows) |
Reserve enough space to resize to the specified number of rows without reallocations. More... | |
MutableArrayRef< MPInt > | getRow (unsigned row) |
Get a [Mutable]ArrayRef corresponding to the specified row. More... | |
ArrayRef< MPInt > | getRow (unsigned row) const |
void | setRow (unsigned row, ArrayRef< MPInt > elems) |
Set the specified row to elems . More... | |
void | insertColumns (unsigned pos, unsigned count) |
Insert columns having positions pos, pos + 1, ... More... | |
void | insertColumn (unsigned pos) |
void | insertRows (unsigned pos, unsigned count) |
Insert rows having positions pos, pos + 1, ... More... | |
void | insertRow (unsigned pos) |
void | removeColumns (unsigned pos, unsigned count) |
Remove the columns having positions pos, pos + 1, ... More... | |
void | removeColumn (unsigned pos) |
void | removeRows (unsigned pos, unsigned count) |
Remove the rows having positions pos, pos + 1, ... More... | |
void | removeRow (unsigned pos) |
void | copyRow (unsigned sourceRow, unsigned targetRow) |
void | fillRow (unsigned row, const MPInt &value) |
void | fillRow (unsigned row, int64_t value) |
void | addToRow (unsigned sourceRow, unsigned targetRow, const MPInt &scale) |
Add scale multiples of the source row to the target row. More... | |
void | addToRow (unsigned sourceRow, unsigned targetRow, int64_t scale) |
void | addToRow (unsigned row, ArrayRef< MPInt > rowVec, const MPInt &scale) |
Add scale multiples of the rowVec row to the specified row. More... | |
void | addToColumn (unsigned sourceColumn, unsigned targetColumn, const MPInt &scale) |
Add scale multiples of the source column to the target column. More... | |
void | addToColumn (unsigned sourceColumn, unsigned targetColumn, int64_t scale) |
void | negateColumn (unsigned column) |
Negate the specified column. More... | |
void | negateRow (unsigned row) |
Negate the specified row. More... | |
SmallVector< MPInt, 8 > | preMultiplyWithRow (ArrayRef< MPInt > rowVec) const |
The given vector is interpreted as a row vector v. More... | |
SmallVector< MPInt, 8 > | postMultiplyWithColumn (ArrayRef< MPInt > colVec) const |
The given vector is interpreted as a column vector v. More... | |
void | resize (unsigned newNRows, unsigned newNColumns) |
Resize the matrix to the specified dimensions. More... | |
void | resizeHorizontally (unsigned newNColumns) |
void | resizeVertically (unsigned newNRows) |
unsigned | appendExtraRow () |
Add an extra row at the bottom of the matrix and return its position. More... | |
unsigned | appendExtraRow (ArrayRef< MPInt > elems) |
Same as above, but copy the given elements into the row. More... | |
void | print (raw_ostream &os) const |
Print the matrix. More... | |
void | dump () const |
bool | hasConsistentState () const |
Return whether the Matrix is in a consistent state with all its invariants satisfied. More... | |
Static Public Member Functions | |
static IntMatrix | identity (unsigned dimension) |
Return the identity matrix of the specified dimension. More... | |
![]() | |
static Matrix | identity (unsigned dimension) |
Return the identity matrix of the specified dimension. More... | |
Additional Inherited Members | |
![]() | |
unsigned | nRows |
The current number of rows, columns, and reserved columns. More... | |
unsigned | nColumns |
unsigned | nReservedColumns |
SmallVector< MPInt, 16 > | data |
Stores the data. More... | |
|
inline |
Definition at line 209 of file Matrix.h.
Referenced by determinant().
Given the current matrix M, returns the matrices H, U such that H is the column hermite normal form of M, i.e.
H = M * U, where U is unimodular and the matrix H has the following restrictions:
Definition at line 349 of file Matrix.cpp.
References mlir::presburger::Matrix< T >::getNumColumns(), mlir::presburger::Matrix< T >::getNumRows(), identity(), modEntryColumnOperation(), mlir::presburger::Matrix< T >::negateColumn(), and mlir::presburger::Matrix< T >::swapColumns().
Referenced by mlir::presburger::LinearTransform::makeTransformToColumnEchelon().
|
static |
Return the identity matrix of the specified dimension.
Definition at line 342 of file Matrix.cpp.
Referenced by computeHermiteNormalForm(), and mlir::presburger::Simplex::findIntegerSample().
MPInt IntMatrix::normalizeRow | ( | unsigned | row | ) |
Divide the columns of the specified row by their GCD.
Returns the GCD of the columns of the specified row.
Definition at line 439 of file Matrix.cpp.
References mlir::presburger::Matrix< MPInt >::getNumColumns(), and normalizeRow().
MPInt IntMatrix::normalizeRow | ( | unsigned | row, |
unsigned | nCols | ||
) |
Divide the first nCols
of the specified row by their GCD.
Returns the GCD of the first nCols
of the specified row.
Definition at line 435 of file Matrix.cpp.
References mlir::presburger::Matrix< MPInt >::getRow(), and mlir::presburger::normalizeRange().
Referenced by mlir::presburger::SimplexBase::addRow(), mlir::presburger::IntegerRelation::gaussianEliminate(), mlir::presburger::IntegerRelation::gaussianEliminateVars(), mlir::presburger::IntegerRelation::gcdTightenInequalities(), mlir::presburger::IntegerRelation::normalizeConstraintsByGCD(), normalizeRow(), mlir::presburger::SimplexBase::pivot(), and mlir::presburger::IntegerRelation::removeRedundantLocalVars().