|
MLIR 22.0.0git
|
#include "mlir/Analysis/Presburger/Matrix.h"
Public Member Functions | |
| IntMatrix (unsigned rows, unsigned columns, unsigned reservedRows=0, unsigned reservedColumns=0) | |
| IntMatrix (Matrix< DynamicAPInt > 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. | |
| DynamicAPInt | normalizeRow (unsigned row, unsigned nCols) |
| Divide the first nCols of the specified row by their GCD. | |
| DynamicAPInt | normalizeRow (unsigned row) |
| Divide the columns of the specified row by their GCD. | |
| DynamicAPInt | determinant (IntMatrix *inverse=nullptr) const |
| Public Member Functions inherited from mlir::presburger::Matrix< DynamicAPInt > | |
| Matrix ()=delete | |
| DynamicAPInt & | at (unsigned row, unsigned column) |
| Access the element at the specified row and column. | |
| DynamicAPInt & | operator() (unsigned row, unsigned column) |
| bool | operator== (const Matrix< DynamicAPInt > &m) const |
| We cannot use the default implementation of operator== as it compares fields like reservedColumns etc., which are not part of the data. | |
| void | swapColumns (unsigned column, unsigned otherColumn) |
| Swap the given columns. | |
| void | swapRows (unsigned row, unsigned otherRow) |
| Swap the given rows. | |
| unsigned | getNumRows () const |
| unsigned | getNumColumns () const |
| unsigned | getNumReservedRows () const |
| Return the maximum number of rows/columns that can be added without incurring a reallocation. | |
| unsigned | getNumReservedColumns () const |
| void | reserveRows (unsigned rows) |
| Reserve enough space to resize to the specified number of rows without reallocations. | |
| MutableArrayRef< DynamicAPInt > | getRow (unsigned row) |
| Get a [Mutable]ArrayRef corresponding to the specified row. | |
| void | setRow (unsigned row, ArrayRef< DynamicAPInt > elems) |
| Set the specified row to elems. | |
| void | insertColumns (unsigned pos, unsigned count) |
| Insert columns having positions pos, pos + 1, ... pos + count - 1. | |
| void | insertColumn (unsigned pos) |
| void | insertRows (unsigned pos, unsigned count) |
| Insert rows having positions pos, pos + 1, ... pos + count - 1. | |
| void | insertRow (unsigned pos) |
| void | removeColumns (unsigned pos, unsigned count) |
| Remove the columns having positions pos, pos + 1, ... pos + count - 1. | |
| void | removeColumn (unsigned pos) |
| void | removeRows (unsigned pos, unsigned count) |
| Remove the rows having positions pos, pos + 1, ... pos + count - 1. | |
| void | removeRow (unsigned pos) |
| void | copyRow (unsigned sourceRow, unsigned targetRow) |
| void | fillRow (unsigned row, const DynamicAPInt &value) |
| void | addToRow (unsigned sourceRow, unsigned targetRow, const DynamicAPInt &scale) |
| Add scale multiples of the source row to the target row. | |
| void | scaleRow (unsigned row, const DynamicAPInt &scale) |
| Multiply the specified row by a factor of scale. | |
| void | addToColumn (unsigned sourceColumn, unsigned targetColumn, const DynamicAPInt &scale) |
| Add scale multiples of the source column to the target column. | |
| void | negateColumn (unsigned column) |
| Negate the specified column. | |
| void | negateRow (unsigned row) |
| Negate the specified row. | |
| void | negateMatrix () |
| Negate the entire matrix. | |
| SmallVector< DynamicAPInt, 8 > | preMultiplyWithRow (ArrayRef< DynamicAPInt > rowVec) const |
| The given vector is interpreted as a row vector v. | |
| SmallVector< DynamicAPInt, 8 > | postMultiplyWithColumn (ArrayRef< DynamicAPInt > colVec) const |
| The given vector is interpreted as a column vector v. | |
| void | resize (unsigned newNRows, unsigned newNColumns) |
| Resize the matrix to the specified dimensions. | |
| void | resizeHorizontally (unsigned newNColumns) |
| void | resizeVertically (unsigned newNRows) |
| unsigned | appendExtraRow () |
| Add an extra row at the bottom of the matrix and return its position. | |
| Matrix< DynamicAPInt > | transpose () const |
| Matrix< DynamicAPInt > | getSubMatrix (unsigned fromRow, unsigned toRow, unsigned fromColumn, unsigned toColumn) const |
| std::pair< Matrix< DynamicAPInt >, Matrix< DynamicAPInt > > | splitByBitset (ArrayRef< int > indicator) |
| Split the rows of a matrix into two matrices according to which bits are 1 and which are 0 in a given bitset. | |
| void | print (raw_ostream &os) const |
| Print the matrix. | |
| void | dump () const |
| bool | hasConsistentState () const |
| Return whether the Matrix is in a consistent state with all its invariants satisfied. | |
| void | moveColumns (unsigned srcPos, unsigned num, unsigned dstPos) |
| Move the columns in the source range [srcPos, srcPos + num) to the specified destination [dstPos, dstPos + num), while moving the columns adjacent to the source range to the left/right of the shifted columns. | |
Static Public Member Functions | |
| static IntMatrix | identity (unsigned dimension) |
| Return the identity matrix of the specified dimension. | |
| Static Public Member Functions inherited from mlir::presburger::Matrix< DynamicAPInt > | |
| static Matrix | identity (unsigned dimension) |
| Return the identity matrix of the specified dimension. | |
Additional Inherited Members | |
| Protected Attributes inherited from mlir::presburger::Matrix< DynamicAPInt > | |
| unsigned | nRows |
| The current number of rows, columns, and reserved columns. | |
| unsigned | nColumns |
| unsigned | nReservedColumns |
| SmallVector< DynamicAPInt, 16 > | data |
| Stores the data. | |
|
inline |
Definition at line 256 of file Matrix.h.
References mlir::presburger::Matrix< DynamicAPInt >::Matrix().
Referenced by computeHermiteNormalForm(), determinant(), and identity().
|
inline |
Definition at line 260 of file Matrix.h.
References mlir::presburger::Matrix< DynamicAPInt >::Matrix().
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 463 of file Matrix.cpp.
References mlir::presburger::Matrix< T >::getNumColumns(), mlir::presburger::Matrix< T >::getNumRows(), identity(), IntMatrix(), modEntryColumnOperation(), mlir::presburger::Matrix< T >::negateColumn(), and mlir::presburger::Matrix< T >::swapColumns().
Referenced by mlir::presburger::LinearTransform::makeTransformToColumnEchelon().
Definition at line 557 of file Matrix.cpp.
References mlir::presburger::Matrix< T >::at(), mlir::presburger::FracMatrix::determinant(), mlir::presburger::Fraction::getAsInteger(), IntMatrix(), mlir::presburger::Matrix< DynamicAPInt >::nColumns, and mlir::presburger::Matrix< DynamicAPInt >::nRows.
Referenced by mlir::presburger::detail::getIndex().
Return the identity matrix of the specified dimension.
Definition at line 456 of file Matrix.cpp.
References IntMatrix().
Referenced by computeHermiteNormalForm(), and mlir::presburger::Simplex::findIntegerSample().
| DynamicAPInt 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 553 of file Matrix.cpp.
References mlir::presburger::Matrix< DynamicAPInt >::getNumColumns(), and normalizeRow().
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 549 of file Matrix.cpp.
References mlir::presburger::Matrix< DynamicAPInt >::getRow(), and mlir::presburger::normalizeRange().
Referenced by normalizeRow().