Regina Calculation Engine
Public Member Functions
regina::NMatrixInt Class Reference

Represents a matrix of arbitrary precision integers. More...

#include <maths/nmatrixint.h>

Inheritance diagram for regina::NMatrixInt:
regina::NMatrixRing< NLargeInteger > regina::ShareableObject regina::NMatrix< NLargeInteger > regina::boost::noncopyable

List of all members.

Public Member Functions

 NMatrixInt (unsigned long rows, unsigned long cols)
 Creates a new matrix of the given size.
 NMatrixInt (const NMatrixInt &cloneMe)
 Creates a new matrix that is a clone of the given matrix.
void divRowExact (unsigned long row, const NLargeInteger &divBy)
 Divides all elements of the given row by the given integer.
void divColExact (unsigned long col, const NLargeInteger &divBy)
 Divides all elements of the given column by the given integer.
NLargeInteger gcdRow (unsigned long row)
 Computes the greatest common divisor of all elements of the given row.
NLargeInteger gcdCol (unsigned long col)
 Computes the greatest common divisor of all elements of the given column.
void reduceRow (unsigned long row)
 Reduces the given row by dividing all its elements by their greatest common divisor.
void reduceCol (unsigned long col)
 Reduces the given column by dividing all its elements by their greatest common divisor.
virtual void writeTextShort (std::ostream &out) const
 Writes this object in short text format to the given output stream.
virtual void writeTextLong (std::ostream &out) const
 Writes this object in long text format to the given output stream.
- Public Member Functions inherited from regina::NMatrixRing< NLargeInteger >
 NMatrixRing (unsigned long rows, unsigned long cols)
 Creates a new matrix of the given size.
 NMatrixRing (const NMatrix< NLargeInteger > &cloneMe)
 Creates a new matrix that is a clone of the given matrix.
void makeIdentity ()
 Turns this matrix into an identity matrix.
bool isIdentity () const
 Determines whether this matrix is a square identity matrix.
void addRow (unsigned long source, unsigned long dest)
 Adds the given source row to the given destination row.
void addRow (unsigned long source, unsigned long dest, NLargeIntegercopies)
 Adds the given number of copies of the given source row to the given destination row.
void addCol (unsigned long source, unsigned long dest)
 Adds the given source column to the given destination column.
void addCol (unsigned long source, unsigned long dest, NLargeIntegercopies)
 Adds the given number of copies of the given source column to the given destination column.
void multRow (unsigned long row, NLargeIntegerfactor)
 Multiplies the given row by the given factor.
void multCol (unsigned long column, NLargeIntegerfactor)
 Multiplies the given column by the given factor.
std::auto_ptr< NMatrixRing
< NLargeInteger > > 
operator* (const NMatrixRing< NLargeInteger > &other) const
 Multiplies this by the given matrix, and returns the result.
std::auto_ptr< MatrixClass > multiplyAs (const NMatrixRing< NLargeInteger > &other) const
 Multiplies this by the given matrix, and returns a new matrix of subclass MatrixClass.
NLargeInteger det () const
 Evaluates the determinant of the matrix.
- Public Member Functions inherited from regina::NMatrix< NLargeInteger >
 NMatrix (unsigned long rows, unsigned long cols)
 Creates a new matrix of the given size.
 NMatrix (const NMatrix &cloneMe)
 Creates a new matrix that is a clone of the given matrix.
virtual ~NMatrix ()
 Destroys this matrix.
void initialise (const NLargeInteger &value)
 Sets every entry in the matrix to the given value.
void initialise (List allValues)
 A Python-only routine that fills the matrix with the given set of elements.
unsigned long rows () const
 Returns the number of rows in this matrix.
unsigned long columns () const
 Returns the number of columns in this matrix.
NLargeIntegerentry (unsigned long row, unsigned long column)
 Returns the entry at the given row and column.
const NLargeIntegerentry (unsigned long row, unsigned long column) const
 Returns the entry at the given row and column.
bool operator== (const NMatrix< NLargeInteger > &other) const
 Determines whether this and the given matrix are identical.
bool operator!= (const NMatrix< NLargeInteger > &other) const
 Determines whether this and the given matrix are different.
virtual void writeMatrix (std::ostream &out) const
 Writes a complete representation of the matrix to the given output stream.
void swapRows (unsigned long first, unsigned long second)
 Swaps the elements of the two given rows in the matrix.
void swapColumns (unsigned long first, unsigned long second)
 Swaps the elements of the two given columns in the matrix.
- Public Member Functions inherited from regina::ShareableObject
 ShareableObject ()
 Default constructor that does nothing.
virtual ~ShareableObject ()
 Default destructor that does nothing.
std::string toString () const
 Returns the output from writeTextShort() as a string.
std::string toStringLong () const
 Returns the output from writeTextLong() as a string.

Additional Inherited Members

- Static Public Attributes inherited from regina::NMatrixRing< NLargeInteger >
static NLargeInteger zero
 Zero in the underlying ring.
static NLargeInteger one
 One (the multiplicative identity) in the underlying ring.

Detailed Description

Represents a matrix of arbitrary precision integers.

Calculations will be exact no matter how large the integers become.

Note that many important functions (such as entry()) are inherited from the superclasses NMatrix and NMatrixRing, and are not documented again here.

Python:
Most inherited member functions are implemented. Exceptions are noted in the documentation for each individual member function.

Member Function Documentation

void regina::NMatrixInt::divColExact ( unsigned long  col,
const NLargeInteger divBy 
)
inline

Divides all elements of the given column by the given integer.

This can only be used when the given integer divides into all column elements exactly (with no remainder), and is much faster than ordinary division.

Precondition:
The argument divBy is neither zero nor infinity, and none of the elements of the given column are infinity.
The argument divBy divides exactly into every element of the given column (i.e., it leaves no remainder).
The given column number is between 0 and columns()-1 inclusive.
Parameters:
colthe index of the column whose elements should be divided by divBy.
divBythe integer to divide each column element by.
void regina::NMatrixInt::divRowExact ( unsigned long  row,
const NLargeInteger divBy 
)
inline

Divides all elements of the given row by the given integer.

This can only be used when the given integer divides into all row elements exactly (with no remainder), and is much faster than ordinary division.

Precondition:
The argument divBy is neither zero nor infinity, and none of the elements of the given row are infinity.
The argument divBy divides exactly into every element of the given row (i.e., it leaves no remainder).
The given row number is between 0 and rows()-1 inclusive.
Parameters:
rowthe index of the row whose elements should be divided by divBy.
divBythe integer to divide each row element by.
NLargeInteger regina::NMatrixInt::gcdCol ( unsigned long  col)
inline

Computes the greatest common divisor of all elements of the given column.

The value returned is guaranteed to be non-negative.

Precondition:
The given column number is between 0 and columns()-1 inclusive.
Parameters:
colthe index of the column whose gcd should be computed.
Returns:
the greatest common divisor of all elements of this column.
NLargeInteger regina::NMatrixInt::gcdRow ( unsigned long  row)
inline

Computes the greatest common divisor of all elements of the given row.

The value returned is guaranteed to be non-negative.

Precondition:
The given row number is between 0 and rows()-1 inclusive.
Parameters:
rowthe index of the row whose gcd should be computed.
Returns:
the greatest common divisor of all elements of this row.
void regina::NMatrixInt::reduceCol ( unsigned long  col)
inline

Reduces the given column by dividing all its elements by their greatest common divisor.

It is guaranteed that, if the column is changed at all, it will be divided by a positive integer.

Precondition:
The given column number is between 0 and columns()-1 inclusive.
Parameters:
colthe index of the column to reduce.
void regina::NMatrixInt::reduceRow ( unsigned long  row)
inline

Reduces the given row by dividing all its elements by their greatest common divisor.

It is guaranteed that, if the row is changed at all, it will be divided by a positive integer.

Precondition:
The given row number is between 0 and rows()-1 inclusive.
Parameters:
rowthe index of the row to reduce.

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

Copyright © 1999-2012, The Regina development team
This software is released under the GNU General Public License.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).