Frobby
0.9.5
|
#include <vector>
Go to the source code of this file.
Classes | |
class | Matrix |
Functions | |
bool | operator== (const Matrix &a, const Matrix &b) |
ostream & | operator<< (ostream &out, const Matrix &mat) |
void | print (FILE *file, const Matrix &mat) |
void | print (ColumnPrinter &printer, const Matrix &mat) |
void | product (Matrix &prod, const Matrix &a, const Matrix &b) |
Sets prod to a * b. More... | |
void | transpose (Matrix &trans, const Matrix &mat) |
Sets trans to the transpose of mat. More... | |
void | transpose (Matrix &mat) |
Transpose mat inplace. More... | |
void | addMultiplyRow (Matrix &mat, size_t resultRow, size_t sourceRow, const mpq_class &mult) |
Adds mult times row sourceRow to row resultRow of mat. More... | |
void | multiplyRow (Matrix &mat, size_t row, const mpq_class &mult) |
Multiplies row row with mult. More... | |
void | swapRows (Matrix &mat, size_t row1, size_t row2) |
Swaps row row1 and row row2 of mat. More... | |
bool | rowReduce (Matrix &mat) |
Reduces mat to row-echelon form, i.e. More... | |
size_t | matrixRank (const Matrix &mat) |
Returns the rank of mat. More... | |
void | rowReduceFully (Matrix &mat) |
Reduces mat to reduced row-echelon form, i.e. More... | |
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 interval [colBegin, colEnd). More... | |
void | copyRow (Matrix &target, size_t targetRow, const Matrix &source, size_t sourceRow) |
Copies row sourceRow from source to row targetRow of target. More... | |
bool | inverse (Matrix &inv, const Matrix &mat) |
Sets inv to the inverse of mat. More... | |
void | nullSpace (Matrix &basis, const Matrix &mat) |
Sets the columns of basis to a basis of the null space of mat. More... | |
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. More... | |
bool | hasSameColSpace (const Matrix &a, const Matrix &b) |
Returns true if a and b have the same column space. More... | |
bool | hasSameRowSpace (const Matrix &a, const Matrix &b) |
Returns true if a and b have the same row space. More... | |
mpq_class | determinant (const Matrix &mat) |
Returns the determinant of mat. More... | |
bool | isParallelogram (const Matrix &mat) |
Returns true if the rows of mat are the (4) vertices of a parallelogram. More... | |
mpq_class | getParallelogramAreaSq (const Matrix &mat) |
Returns the square of the area of the parallelogram whose vertices are the 4 rows of mat. More... | |
void addMultiplyRow | ( | Matrix & | mat, |
size_t | resultRow, | ||
size_t | sourceRow, | ||
const mpq_class & | mult | ||
) |
Adds mult times row sourceRow to row resultRow of mat.
Definition at line 147 of file Matrix.cpp.
Copies row sourceRow from source to row targetRow of target.
source and target must have the same number of columns.
Definition at line 246 of file Matrix.cpp.
mpq_class determinant | ( | const Matrix & | mat | ) |
Returns the determinant of mat.
Definition at line 410 of file Matrix.cpp.
mpq_class getParallelogramAreaSq | ( | const Matrix & | mat | ) |
Returns the square of the area of the parallelogram whose vertices are the 4 rows of mat.
Mat must be a parallelogram. The square of the are is integer if the entries of mat are integer and otherwise it is rational. The are itself can be an irrational number.
Definition at line 456 of file Matrix.cpp.
Returns true if a and b have the same column space.
Definition at line 400 of file Matrix.cpp.
Returns true if a and b have the same row space.
Definition at line 390 of file Matrix.cpp.
Sets inv to the inverse of mat.
mat must be a square matrix. Returns true if mat is invertible. Returns false and leaves inv in some valid but unspecified state if mat is not invertible.
Definition at line 257 of file Matrix.cpp.
bool isParallelogram | ( | const Matrix & | mat | ) |
Returns true if the rows of mat are the (4) vertices of a parallelogram.
Definition at line 452 of file Matrix.cpp.
size_t matrixRank | ( | const Matrix & | mat | ) |
Returns the rank of mat.
Definition at line 276 of file Matrix.cpp.
void multiplyRow | ( | Matrix & | mat, |
size_t | row, | ||
const mpq_class & | mult | ||
) |
Multiplies row row with mult.
Definition at line 156 of file Matrix.cpp.
Sets the columns of basis to a basis of the null space of mat.
Definition at line 296 of file Matrix.cpp.
ostream& operator<< | ( | ostream & | out, |
const Matrix & | mat | ||
) |
Definition at line 94 of file Matrix.cpp.
Definition at line 82 of file Matrix.cpp.
void print | ( | ColumnPrinter & | printer, |
const Matrix & | mat | ||
) |
Definition at line 107 of file Matrix.cpp.
void print | ( | FILE * | file, |
const Matrix & | mat | ||
) |
Definition at line 101 of file Matrix.cpp.
Sets prod to a * b.
Definition at line 116 of file Matrix.cpp.
bool rowReduce | ( | Matrix & | mat | ) |
Reduces mat to row-echelon form, i.e.
make it upper triangular. This does not include making the pivot entries
Definition at line 169 of file Matrix.cpp.
void rowReduceFully | ( | Matrix & | mat | ) |
Reduces mat to reduced row-echelon form, i.e.
a row-echelon matrix such that no column contains two non-zero entries and all entries are zero or one.
Definition at line 200 of file Matrix.cpp.
Sets sol to some matrix such that lhs*sol=rhs and returns true if such a matrix exists.
Otherwise returns false and does not change sol.
Definition at line 348 of file Matrix.cpp.
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 interval [colBegin, colEnd).
Definition at line 225 of file Matrix.cpp.
void swapRows | ( | Matrix & | mat, |
size_t | row1, | ||
size_t | row2 | ||
) |
Swaps row row1 and row row2 of mat.
Definition at line 161 of file Matrix.cpp.
void transpose | ( | Matrix & | mat | ) |
Transpose mat inplace.
Definition at line 141 of file Matrix.cpp.
Sets trans to the transpose of mat.
Definition at line 129 of file Matrix.cpp.