Regina Calculation Engine

Represents a matrix of elements from a given ring T. More...
#include <maths/nmatrix.h>
Public Member Functions  
NMatrixRing (unsigned long rows, unsigned long cols)  
Creates a new matrix of the given size. More...  
NMatrixRing (const NMatrix< T > &cloneMe)  
Creates a new matrix that is a clone of the given matrix. 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::auto_ptr< NMatrixRing< T > >  operator* (const NMatrixRing< T > &other) const 
Multiplies this by the given matrix, and returns the result. More...  
template<class MatrixClass >  
std::auto_ptr< MatrixClass >  multiplyAs (const NMatrixRing< 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...  
Public Member Functions inherited from regina::NMatrix< T >  
NMatrix (unsigned long rows, unsigned long cols)  
Creates a new matrix of the given size. More...  
NMatrix (const NMatrix &cloneMe)  
Creates a new matrix that is a clone of the given matrix. More...  
virtual  ~NMatrix () 
Destroys this matrix. More...  
void  initialise (const T &value) 
Sets every entry in the matrix to the given value. More...  
void  initialise (List allValues) 
A Pythononly 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 NMatrix< T > &other) const 
Determines whether this and the given matrix are identical. More...  
bool  operator!= (const NMatrix< T > &other) const 
Determines whether this and the given matrix are different. More...  
virtual 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...  
Static Public Attributes  
static T  zero 
Zero in the underlying ring. More...  
static T  one 
One (the multiplicative identity) in the underlying ring. More...  
Additional Inherited Members  
Protected Attributes inherited from regina::NMatrix< T >  
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 ring T.
Note that many important functions (such as entry()) are inherited from the parent class NMatrix, and are not documented again here.
=
) 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)
. Here the value 1 refers to the multiplicative identity in the ring T.

inline 
Creates a new matrix of the given size.
All entries will be initialised using their default constructors.
rows  the number of rows in the new matrix. 
cols  the number of columns in the new matrix. 

inline 
Creates a new matrix that is a clone of the given matrix.
cloneMe  the matrix to clone. 

inline 
Adds the given source column to the given destination column.
source  the columns to add. 
dest  the column that will be added to. 

inline 
Adds the given number of copies of the given source column to the given destination column.
Note that copies is passed by value in case it is an element of the row to be changed.
source  the columns to add. 
dest  the column that will be added to. 
copies  the number of copies of source to add to dest. 

inline 
Adds the given source row to the given destination row.
source  the row to add. 
dest  the row that will be added to. 

inline 
Adds the given number of copies of the given source row to the given destination row.
Note that copies is passed by value in case it is an element of the row to be changed.
source  the row to add. 
dest  the row that will be added to. 
copies  the number of copies of source to add to dest. 

inline 
Evaluates the determinant of the matrix.
This algorithm has quartic complexity, and uses the dynamic programming approach of Mahajan and Vinay. For further details, see Meena Mahajan and V. Vinay, "Determinant: Combinatorics, algorithms, and complexity", Chicago J. Theor. Comput. Sci., Vol. 1997, Article 5.

inline 
Determines whether this matrix is a square identity matrix.
If this matrix is square, isIdentity() will return true
if and only if the matrix has ones in the main diagonal and zeroes everywhere else.
If this matrix is not square, isIdentity() will always return false
(even if makeIdentity() was called earlier).
true
if and only if this is a square identity matrix.

inline 
Determines whether this is the zero matrix.
true
if and only if all entries in the matrix are zero.

inline 
Turns this matrix into an identity matrix.
This matrix need not be square; after this routine it will have entry(r,c)
equal to one
if r == c
and zero
otherwise.

inline 
Multiplies the given column by the given factor.
Note that factor is passed by value in case it is an element of the row to be changed.
column  the column to work with. 
factor  the factor by which to multiply the given column. 

inline 
Multiplies this by the given matrix, and returns a new matrix of subclass MatrixClass.
This matrix is not changed.
other  the matrix by which to multiply this matrix. 
this * other
.

inline 
Multiplies the given row by the given factor.
Note that factor is passed by value in case it is an element of the row to be changed.
row  the row to work with. 
factor  the factor by which to multiply the given row. 

inline 
Multiplies this by the given matrix, and returns the result.
This matrix is not changed.
other  the matrix by which to multiply this matrix. 
this * other
.