33 if (
mat.getRowCount() == 0)
83 if (
a.getRowCount() !=
b.getRowCount() ||
84 a.getColCount() !=
b.getColCount())
87 for (
size_t row = 0;
row <
a.getRowCount(); ++
row)
88 for (
size_t col = 0;
col <
a.getColCount(); ++
col)
109 for (
size_t i = 0;
i <
mat.getColCount(); ++
i)
117 ASSERT(
a.getColCount() ==
b.getRowCount());
119 prod.resize(
a.getRowCount(),
b.getColCount());
120 for (
size_t r = 0;
r <
a.getRowCount(); ++
r) {
121 for (
size_t c = 0;
c <
b.getColCount(); ++
c) {
123 for (
size_t i = 0;
i <
a.getColCount(); ++
i)
135 trans.resize(
mat.getColCount(),
mat.getRowCount());
259 size_t size =
mat.getRowCount();
264 inv.resize(size, size + size);
265 for (
size_t i = 0;
i < size; ++
i)
266 inv(
i, size +
i) = 1;
269 if (
inv(size - 1, size - 1) == 0)
284 while (
row <
mat.getRowCount() &&
col <
mat.getColCount()) {
306 while (
row <
mat.getRowCount() &&
col <
mat.getColCount()) {
374 sol.resize(
lhs.getColCount(),
rhs.getColCount());
378 for (
size_t r = 0;
r <
sol.getColCount(); ++
r)
382 for (
size_t r = 0;
r <
sol.getColCount(); ++
r)
401 if (
a.getRowCount() !=
b.getRowCount())
417 for (
size_t i = 0;
i <
reduced.getRowCount(); ++
i)
429 if (
mat.getRowCount() != 4)
430 return mat.getRowCount();
448 return mat.getRowCount();
461 for (
a = 1;
a < 4; ++
a)
467 for (
b =
a + 1;
b < 4; ++
b)
void swap(HilbertSlice &a, HilbertSlice &b)
size_t matrixRank(const Matrix &matParam)
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.
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 &matParam)
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)
ostream & operator<<(ostream &out, const Matrix &mat)
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.
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
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 getRowCount() const
Matrix(size_t rowCount=0, size_t colCount=0)