28 Matrix(
size_t rowCount = 0,
size_t colCount = 0);
37 void resize(
size_t rowCount,
size_t colCount);
39 const mpq_class&
operator()(
size_t row,
size_t col)
const
47 size_t toIndex(
size_t row,
size_t col)
const {
78 size_t sourceRow,
const mpq_class& mult);
103 size_t rowBegin,
size_t rowEnd,
104 size_t colBegin,
size_t colEnd);
109 const Matrix& source,
size_t sourceRow);
size_t matrixRank(const Matrix &mat)
Returns the rank of mat.
void multiplyRow(Matrix &mat, size_t row, const mpq_class &mult)
Multiplies row row with mult.
bool solve(Matrix &sol, const Matrix &lhs, const Matrix &rhs)
Sets sol to some matrix such that lhs*sol=rhs and returns true if such a matrix exists.
mpq_class getParallelogramAreaSq(const Matrix &mat)
Returns the square of the area of the parallelogram whose vertices are the 4 rows of mat.
void product(Matrix &prod, const Matrix &a, const Matrix &b)
Sets prod to a * b.
bool isParallelogram(const Matrix &mat)
Returns true if the rows of mat are the (4) vertices of a parallelogram.
ostream & operator<<(ostream &out, const Matrix &mat)
void addMultiplyRow(Matrix &mat, size_t resultRow, size_t sourceRow, const mpq_class &mult)
Adds mult times row sourceRow to row resultRow of mat.
bool rowReduce(Matrix &mat)
Reduces mat to row-echelon form, i.e.
void swapRows(Matrix &mat, size_t row1, size_t row2)
Swaps row row1 and row row2 of mat.
void nullSpace(Matrix &basis, const Matrix &mat)
Sets the columns of basis to a basis of the null space of mat.
mpq_class determinant(const Matrix &mat)
Returns the determinant of mat.
void print(FILE *file, const Matrix &mat)
void subMatrix(Matrix &sub, const Matrix &mat, size_t rowBegin, size_t rowEnd, size_t colBegin, size_t colEnd)
Sets sub to the sub-matrix of mat with rows in the interval [rowBegin, rowEnd) and columns in the int...
void rowReduceFully(Matrix &mat)
Reduces mat to reduced row-echelon form, i.e.
void copyRow(Matrix &target, size_t targetRow, const Matrix &source, size_t sourceRow)
Copies row sourceRow from source to row targetRow of target.
bool hasSameRowSpace(const Matrix &a, const Matrix &b)
Returns true if a and b have the same row space.
bool inverse(Matrix &inv, const Matrix &mat)
Sets inv to the inverse of mat.
bool operator==(const Matrix &a, const Matrix &b)
bool hasSameColSpace(const Matrix &a, const Matrix &b)
Returns true if a and b have the same column space.
void transpose(Matrix &trans, const Matrix &mat)
Sets trans to the transpose of mat.
const mpq_class & operator()(size_t row, size_t col) const
void resize(size_t rowCount, size_t colCount)
Set the number of rows and columns.
vector< mpq_class > _entries
size_t getColCount() const
size_t toIndex(size_t row, size_t col) const
size_t getRowCount() const
mpq_class & operator()(size_t row, size_t col)
Matrix(size_t rowCount=0, size_t colCount=0)