Regina Calculation Engine
Public Member Functions | Protected Attributes | List of all members
regina::Matrix< T > Class Template Reference

Represents a matrix of elements of the given type T. More...

#include <maths/matrix.h>

Inheritance diagram for regina::Matrix< T >:
regina::Output< Matrix< T > > regina::MatrixRing< T > regina::MatrixIntDomain< Integer > regina::MatrixIntDomain< T >

Public Member Functions

 Matrix (unsigned long rows, unsigned long cols)
 Creates a new matrix of the given size. More...
 
 Matrix (const Matrix &cloneMe)
 Creates a new matrix that is a clone of the given matrix. More...
 
 ~Matrix ()
 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 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...
 

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...
 

Detailed Description

template<class T>
class regina::Matrix< T >

Represents a matrix of elements of the given type T.

Precondition
Type T has a default constructor and overloads the assignment (=) operator.
An element t of type T can be written to an output stream out using the standard expression out << t.
Python:\n Not present, although the typedef MatrixInt is.

Member Function Documentation

◆ detail()

std::string regina::Output< Matrix< T > , false >::detail ( ) const
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.

Returns
a detailed text representation of this object.

◆ str()

std::string regina::Output< Matrix< T > , false >::str ( ) const
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.

Python:\n In addition to str(), this is also used as the
Python "stringification" function __str__().
Returns
a short text representation of this object.

◆ utf8()

std::string regina::Output< Matrix< T > , false >::utf8 ( ) const
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.

Returns
a short text representation of this object.

The documentation for this class was generated from the following file:

Copyright © 1999-2016, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).