Regina Calculation Engine
|
Represents a 2-by-2 integer matrix. More...
#include <maths/matrix2.h>
Public Member Functions | |
Matrix2 () | |
Initialises to the zero matrix. More... | |
Matrix2 (const Matrix2 &cloneMe) | |
Initialises to a copy of the given matrix. More... | |
Matrix2 (const long values[2][2]) | |
Initialises to the given integer values. More... | |
Matrix2 (long val00, long val01, long val10, long val11) | |
Initialises to the given integer values. More... | |
Matrix2 & | operator= (const Matrix2 &cloneMe) |
Sets this matrix to be a copy of the given matrix. More... | |
Matrix2 & | operator= (const long values[2][2]) |
Sets the elements of this matrix to the given integer values. More... | |
const long * | operator[] (unsigned row) const |
Returns a single row of this matrix. More... | |
long * | operator[] (unsigned row) |
Returns a single row of this matrix. More... | |
Matrix2 | operator* (const Matrix2 &other) const |
Calculates the matrix product of this and the given matrix. More... | |
Matrix2 | operator* (long scalar) const |
Calculates the scalar product of this matrix and the given integer. More... | |
Matrix2 | operator+ (const Matrix2 &other) const |
Calculates the sum of two matrices. More... | |
Matrix2 | operator- (const Matrix2 &other) const |
Calculates the difference of two matrices. More... | |
Matrix2 | operator- () const |
Determines the negative of this matrix. More... | |
Matrix2 | transpose () const |
Returns the transpose of this matrix. More... | |
Matrix2 | inverse () const |
Calculates the inverse of this matrix. More... | |
Matrix2 & | operator+= (const Matrix2 &other) |
Adds the given matrix to this. More... | |
Matrix2 & | operator-= (const Matrix2 &other) |
Subtracts the given matrix from this. More... | |
Matrix2 & | operator*= (const Matrix2 &other) |
Multiplies this by the given matrix. More... | |
Matrix2 & | operator*= (long scalar) |
Multiplies this by the given scalar. More... | |
void | negate () |
Negates this matrix. More... | |
bool | invert () |
Inverts this matrix. More... | |
bool | operator== (const Matrix2 &compare) const |
Determines if this is equal to the given matrix. More... | |
bool | operator!= (const Matrix2 &compare) const |
Determines if this is not equal to the given matrix. More... | |
long | determinant () const |
Returns the determinant of this matrix. More... | |
bool | isIdentity () const |
Determines if this is the 2x2 identity matrix. More... | |
bool | isZero () const |
Determines if this is the 2x2 zero matrix. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Matrix2 &mat) |
Writes the given matrix to the given output stream. More... | |
Represents a 2-by-2 integer matrix.
The advantages of using this class over the larger MatrixInt and friends is that this class has less overhead and offers additional mathematical support routines that the larger classes do not.
This class only contains four long integers, and so it may be considered small enough to pass about by value.