Regina Calculation Engine
|
Represents a matrix of elements from a given integral domain T. More...
#include <maths/matrix.h>
Public Member Functions | |
MatrixIntDomain (unsigned long rows, unsigned long cols) | |
Creates a new matrix of the given size. More... | |
MatrixIntDomain (const MatrixIntDomain< T > &cloneMe) | |
Creates a new matrix that is a clone of the given matrix. More... | |
void | divRowExact (unsigned long row, const T &divBy) |
Divides all elements of the given row by the given integer. More... | |
void | divColExact (unsigned long col, const T &divBy) |
Divides all elements of the given column by the given integer. More... | |
T | gcdRow (unsigned long row) |
Computes the greatest common divisor of all elements of the given row. More... | |
T | gcdCol (unsigned long col) |
Computes the greatest common divisor of all elements of the given column. More... | |
void | reduceRow (unsigned long row) |
Reduces the given row by dividing all its elements by their greatest common divisor. More... | |
void | reduceCol (unsigned long col) |
Reduces the given column by dividing all its elements by their greatest common divisor. More... | |
void | makeIdentity () |
Turns this matrix into an identity matrix. More... | |
bool | isIdentity () const |
Determines whether this matrix is a square identity matrix. More... | |
bool | isZero () const |
Determines whether this is the zero matrix. More... | |
void | addRow (unsigned long source, unsigned long dest) |
Adds the given source row to the given destination row. More... | |
void | addRow (unsigned long source, unsigned long dest, T copies) |
Adds the given number of copies of the given source row to the given destination row. More... | |
void | addCol (unsigned long source, unsigned long dest) |
Adds the given source column to the given destination column. More... | |
void | addCol (unsigned long source, unsigned long dest, T copies) |
Adds the given number of copies of the given source column to the given destination column. More... | |
void | multRow (unsigned long row, T factor) |
Multiplies the given row by the given factor. More... | |
void | multCol (unsigned long column, T factor) |
Multiplies the given column by the given factor. More... | |
std::unique_ptr< MatrixRing< T > > | operator* (const MatrixRing< T > &other) const |
Multiplies this by the given matrix, and returns the result. More... | |
template<class MatrixClass > | |
std::unique_ptr< MatrixClass > | multiplyAs (const MatrixRing< T > &other) const |
Multiplies this by the given matrix, and returns a new matrix of subclass MatrixClass. More... | |
T | det () const |
Evaluates the determinant of the matrix. More... | |
void | initialise (const T &value) |
Sets every entry in the matrix to the given value. More... | |
void | initialise (List allValues) |
A Python-only routine that fills the matrix with the given set of elements. More... | |
unsigned long | rows () const |
Returns the number of rows in this matrix. More... | |
unsigned long | columns () const |
Returns the number of columns in this matrix. More... | |
T & | entry (unsigned long row, unsigned long column) |
Returns the entry at the given row and column. More... | |
const T & | entry (unsigned long row, unsigned long column) const |
Returns the entry at the given row and column. More... | |
bool | operator== (const Matrix< T > &other) const |
Determines whether this and the given matrix are identical. More... | |
bool | operator!= (const Matrix< T > &other) const |
Determines whether this and the given matrix are different. More... | |
void | writeMatrix (std::ostream &out) const |
Writes a complete representation of the matrix to the given output stream. More... | |
void | swapRows (unsigned long first, unsigned long second) |
Swaps the elements of the two given rows in the matrix. More... | |
void | swapColumns (unsigned long first, unsigned long second) |
Swaps the elements of the two given columns in the matrix. More... | |
void | writeTextShort (std::ostream &out) const |
Writes a short text representation of this object to the given output stream. More... | |
void | writeTextLong (std::ostream &out) const |
Writes a detailed text representation of this object to the given output stream. More... | |
std::string | str () const |
Returns a short text representation of this object. More... | |
std::string | utf8 () const |
Returns a short text representation of this object using unicode characters. More... | |
std::string | detail () const |
Returns a detailed text representation of this object. More... | |
Static Public Attributes | |
static const T | zero |
Zero in the underlying ring. More... | |
static const T | one |
One (the multiplicative identity) in the underlying ring. More... | |
Protected Attributes | |
unsigned long | nRows |
The number of rows in the matrix. More... | |
unsigned long | nCols |
The number of columns in the matrix. More... | |
T ** | data |
The actual entries in the matrix. More... | |
Represents a matrix of elements from a given integral domain T.
Note that many important functions (such as entry()) are inherited from the superclasses Matrix and MatrixRing, and are not documented again here. Many other algorithms that work on MatrixIntDomain<Integer> are available in the maths/matrixops.h file.
=
) operator. out << t
. +
, -
and *
and unary operators +=
, -=
and *=
. a
is of type T, then a
can be initialised to a long integer l
using a(l)
. All of Regina's integer types (Integer, LargeInteger and the various NativeInteger classes) satisfy these requirements.
|
inherited |
Returns a detailed text representation of this object.
This text may span many lines, and should provide the user with all the information they could want. It should be human-readable, should not contain extremely long lines (which cause problems for users reading the output in a terminal), and should end with a final newline. There are no restrictions on the underlying character set.
|
inherited |
Returns a short text representation of this object.
This text should be human-readable, should fit on a single line, and should not end with a newline. Where possible, it should use plain ASCII characters.
__str__()
.
|
inherited |
Returns a short text representation of this object using unicode characters.
Like str(), this text should be human-readable, should fit on a single line, and should not end with a newline. In addition, it may use unicode characters to make the output more pleasant to read. This string will be encoded in UTF-8.