The ChainCon Software (Release 0.03)
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
tMatrixSNF< CoefT > Class Template Reference

An interface for the computation of the Smith Normal Form of a series of a few rectangular matrices with coefficients in a Euclidean Domain. More...

#include <snfchomp.h>

Public Types

typedef CoefT CoefType
 The type of coefficients in the chain. More...
 
typedef tAlgCell< int_t, unsigned char, CoefT > CellType
 The type of an abstract algebraic cell that is used to carry the numbers of columns or rows in the matrix. More...
 
typedef tChain< CellType, CoefT > ChainType
 The type of the corresponding image chain. More...
 

Public Member Functions

 tMatrixSNF ()
 The default constructor of a matrix. More...
 
 ~tMatrixSNF ()
 The destructor of a matrix. More...
 
void setSize (int q, int_t numRows, int_t numColumns)
 Sets the number of rows and columns in a given sub-matrix. More...
 
void add (int q, int_t row, int_t column, const CoefT &element)
 Adds an element to the matrix whose SNF will be computed. More...
 
int_t getNumRows (int q) const
 Returns the number of rows of the matrix. More...
 
int_t getNumCols (int q) const
 Returns the number of columns of the matrix. More...
 
void computeSNF (int numMatr)
 Computes the almost Smith Normal Form of all the matrices whose number is provided (indexing stats from 0 and ends at the given mumber minus 1). More...
 
CoefT getColCoef (int q, int_t n) const
 Returns the coefficient in the given column of the given matrix in the SNF. More...
 
int_t getColCell (int q, int_t n) const
 Returns the cell number in the given column of the given matrix in the SNF, or -1 if the column is zero. More...
 
CoefT getRowCoef (int q, int_t n) const
 Returns the coefficient in the given row of the given matrix in the SNF. More...
 
int_t getRowCell (int q, int_t n) const
 Returns the cell number in the given row of the given matrix in the SNF, or -1 if the row is zero. More...
 
ChainType getNewChain (int q, int_t n) const
 For a cell in the original basis, returns the corresponding combination of elements in the new basis (the column of the change-of-basis matrix in this direction). More...
 
ChainType getNewChainRow (int q, int_t n) const
 For a cell in the original basis, returns the given row of the change-of-basis matrix towards the new basis. More...
 
ChainType getOldChain (int q, int_t n) const
 For a cell in the new basis, returns a combination of the original cells that correspond to this cell (the column of the change-of-basis matrix in this direction). More...
 
ChainType getOldChainRow (int q, int_t n) const
 For a cell in the new basis, returns the given row of the change-of-basis matrix towards the original basis. More...
 

Private Member Functions

 tMatrixSNF (const tMatrixSNF< CoefT > &other)
 Copy constructor is not allowed. More...
 
tMatrixSNF< CoefT > & operator= (const tMatrixSNF< CoefT > &other)
 Assignment operator is not allowed. More...
 

Static Private Member Functions

static ChainType abstractChain (const chomp::homology::chain< tEuclWrap< CoefT > > &ch)
 Coverts a column of a matrix to an abstract algebraic chain. More...
 

Private Attributes

chomp::homology::multitable< chomp::homology::mmatrix< tEuclWrap< CoefT > > > matrices
 The matrices whose Smith Normal Form will be computed. More...
 
chomp::homology::multitable< chomp::homology::mmatrix< tEuclWrap< CoefT > > > chgBasisA
 Change of basis matrices from the original one to the SNF one. More...
 
chomp::homology::multitable< chomp::homology::mmatrix< tEuclWrap< CoefT > > > chgBasisG
 Change of basis matrices from the SNF one to the original one. More...
 
bool computedSNF
 Remembers if the SNF has already been computed. More...
 

Detailed Description

template<class CoefT>
class tMatrixSNF< CoefT >

An interface for the computation of the Smith Normal Form of a series of a few rectangular matrices with coefficients in a Euclidean Domain.

A Euclidean Domain is a commutative ring in which division with remainder is well defined; for example, the ring of integers, the ring of polynomials in one variable, or some field (like the rationals or the integers modulo a prime number p). In fact, what is to be computed, are the changes of bases in the complex such that each matrix in the series is in the SNF. The columns and rows of each matrix in the set are indexed by integer numbers starting at 0. In addition to the SNF, the change-of-basis matrices A and G are also computed, such that A is a change of basis from the original one to the new one, and G is a change of basis from the new basis back to the original one. In other words, if {M_q} is the original series of matrices and {S_q} is a series of its SNF then M_q = G_{q-1} S_q A_q, and G_q A_q = A_q G_q = identity. Please, note that it is not possible to make all the boundary matrices in the SNF with the non-zero entries starting at the 'diagonal', because the boundary of a boundary must be zero. Therefore, what is computed here, is a 'simple form' of the boundary matrices in which every column and every row has at most one nonzero entry. Please, note that the division condition required in the SNF is not satisfied either. As a consequence, the collection of coefficients that define a homology group may not be the same for isomorphic groups.

Definition at line 86 of file snfchomp.h.

Member Typedef Documentation

◆ CellType

template<class CoefT>
typedef tAlgCell<int_t,unsigned char,CoefT> tMatrixSNF< CoefT >::CellType

The type of an abstract algebraic cell that is used to carry the numbers of columns or rows in the matrix.

Please note that only the identifier of this cell is used, not its dimension, nor its boundary.

Definition at line 96 of file snfchomp.h.

◆ ChainType

template<class CoefT>
typedef tChain<CellType,CoefT> tMatrixSNF< CoefT >::ChainType

The type of the corresponding image chain.

Definition at line 99 of file snfchomp.h.

◆ CoefType

template<class CoefT>
typedef CoefT tMatrixSNF< CoefT >::CoefType

The type of coefficients in the chain.

Definition at line 90 of file snfchomp.h.

Constructor & Destructor Documentation

◆ tMatrixSNF() [1/2]

template<class CoefT >
tMatrixSNF< CoefT >::tMatrixSNF ( )
inline

The default constructor of a matrix.

Definition at line 195 of file snfchomp.h.

◆ ~tMatrixSNF()

template<class CoefT >
tMatrixSNF< CoefT >::~tMatrixSNF ( )
inline

The destructor of a matrix.

Definition at line 201 of file snfchomp.h.

◆ tMatrixSNF() [2/2]

template<class CoefT >
tMatrixSNF< CoefT >::tMatrixSNF ( const tMatrixSNF< CoefT > &  other)
inlineprivate

Copy constructor is not allowed.

Definition at line 207 of file snfchomp.h.

Member Function Documentation

◆ abstractChain()

template<class CoefT >
tMatrixSNF< CoefT >::ChainType tMatrixSNF< CoefT >::abstractChain ( const chomp::homology::chain< tEuclWrap< CoefT > > &  ch)
inlinestaticprivate

◆ add()

template<class CoefT >
void tMatrixSNF< CoefT >::add ( int  q,
int_t  row,
int_t  column,
const CoefT &  element 
)
inline

Adds an element to the matrix whose SNF will be computed.

Definition at line 234 of file snfchomp.h.

References tMatrixSNF< CoefT >::matrices.

Referenced by tMatrixSNF< CoefT >::abstractChain(), and tMatrixSNF< CoefT >::computeSNF().

◆ computeSNF()

template<class CoefT >
void tMatrixSNF< CoefT >::computeSNF ( int  numMatr)
inline

Computes the almost Smith Normal Form of all the matrices whose number is provided (indexing stats from 0 and ends at the given mumber minus 1).

After all the matrices have been defined, this procedure must be called once to compute the SNF and all the auxiliary data, including the change of basis matrices A and G. Then the results of the computations can be read with the other methods available in this class.

Definition at line 254 of file snfchomp.h.

References tMatrixSNF< CoefT >::add(), tMatrixSNF< CoefT >::chgBasisA, tMatrixSNF< CoefT >::chgBasisG, tMatrixSNF< CoefT >::computedSNF, identity(), and tMatrixSNF< CoefT >::matrices.

◆ getColCell()

template<class CoefT >
int_t tMatrixSNF< CoefT >::getColCell ( int  q,
int_t  n 
) const
inline

Returns the cell number in the given column of the given matrix in the SNF, or -1 if the column is zero.

Definition at line 323 of file snfchomp.h.

References tMatrixSNF< CoefT >::matrices.

◆ getColCoef()

template<class CoefT >
CoefT tMatrixSNF< CoefT >::getColCoef ( int  q,
int_t  n 
) const
inline

Returns the coefficient in the given column of the given matrix in the SNF.

Definition at line 312 of file snfchomp.h.

References tMatrixSNF< CoefT >::matrices.

◆ getNewChain()

template<class CoefT >
tMatrixSNF< CoefT >::ChainType tMatrixSNF< CoefT >::getNewChain ( int  q,
int_t  n 
) const
inline

For a cell in the original basis, returns the corresponding combination of elements in the new basis (the column of the change-of-basis matrix in this direction).

Definition at line 371 of file snfchomp.h.

References tMatrixSNF< CoefT >::abstractChain(), and tMatrixSNF< CoefT >::chgBasisA.

◆ getNewChainRow()

template<class CoefT >
tMatrixSNF< CoefT >::ChainType tMatrixSNF< CoefT >::getNewChainRow ( int  q,
int_t  n 
) const
inline

For a cell in the original basis, returns the given row of the change-of-basis matrix towards the new basis.

Definition at line 378 of file snfchomp.h.

References tMatrixSNF< CoefT >::abstractChain(), and tMatrixSNF< CoefT >::chgBasisA.

◆ getNumCols()

template<class CoefT >
int_t tMatrixSNF< CoefT >::getNumCols ( int  q) const
inline

Returns the number of columns of the matrix.

Definition at line 248 of file snfchomp.h.

References tMatrixSNF< CoefT >::matrices.

◆ getNumRows()

template<class CoefT >
int_t tMatrixSNF< CoefT >::getNumRows ( int  q) const
inline

Returns the number of rows of the matrix.

Definition at line 242 of file snfchomp.h.

References tMatrixSNF< CoefT >::matrices.

◆ getOldChain()

template<class CoefT >
tMatrixSNF< CoefT >::ChainType tMatrixSNF< CoefT >::getOldChain ( int  q,
int_t  n 
) const
inline

For a cell in the new basis, returns a combination of the original cells that correspond to this cell (the column of the change-of-basis matrix in this direction).

Definition at line 385 of file snfchomp.h.

References tMatrixSNF< CoefT >::abstractChain(), and tMatrixSNF< CoefT >::chgBasisG.

◆ getOldChainRow()

template<class CoefT >
tMatrixSNF< CoefT >::ChainType tMatrixSNF< CoefT >::getOldChainRow ( int  q,
int_t  n 
) const
inline

For a cell in the new basis, returns the given row of the change-of-basis matrix towards the original basis.

Definition at line 392 of file snfchomp.h.

References tMatrixSNF< CoefT >::abstractChain(), and tMatrixSNF< CoefT >::chgBasisG.

◆ getRowCell()

template<class CoefT >
int_t tMatrixSNF< CoefT >::getRowCell ( int  q,
int_t  n 
) const
inline

Returns the cell number in the given row of the given matrix in the SNF, or -1 if the row is zero.

Definition at line 345 of file snfchomp.h.

References tMatrixSNF< CoefT >::abstractChain(), and tMatrixSNF< CoefT >::matrices.

◆ getRowCoef()

template<class CoefT >
CoefT tMatrixSNF< CoefT >::getRowCoef ( int  q,
int_t  n 
) const
inline

Returns the coefficient in the given row of the given matrix in the SNF.

Definition at line 334 of file snfchomp.h.

References tMatrixSNF< CoefT >::matrices.

◆ operator=()

template<class CoefT >
tMatrixSNF< CoefT > & tMatrixSNF< CoefT >::operator= ( const tMatrixSNF< CoefT > &  other)
inlineprivate

Assignment operator is not allowed.

Definition at line 215 of file snfchomp.h.

◆ setSize()

template<class CoefT >
void tMatrixSNF< CoefT >::setSize ( int  q,
int_t  numRows,
int_t  numColumns 
)
inline

Sets the number of rows and columns in a given sub-matrix.

Definition at line 224 of file snfchomp.h.

References tMatrixSNF< CoefT >::matrices.

Member Data Documentation

◆ chgBasisA

template<class CoefT>
chomp::homology::multitable<chomp::homology::mmatrix<tEuclWrap<CoefT> > > tMatrixSNF< CoefT >::chgBasisA
private

Change of basis matrices from the original one to the SNF one.

Definition at line 177 of file snfchomp.h.

Referenced by tMatrixSNF< CoefT >::computeSNF(), tMatrixSNF< CoefT >::getNewChain(), and tMatrixSNF< CoefT >::getNewChainRow().

◆ chgBasisG

template<class CoefT>
chomp::homology::multitable<chomp::homology::mmatrix<tEuclWrap<CoefT> > > tMatrixSNF< CoefT >::chgBasisG
private

Change of basis matrices from the SNF one to the original one.

Definition at line 181 of file snfchomp.h.

Referenced by tMatrixSNF< CoefT >::computeSNF(), tMatrixSNF< CoefT >::getOldChain(), and tMatrixSNF< CoefT >::getOldChainRow().

◆ computedSNF

template<class CoefT>
bool tMatrixSNF< CoefT >::computedSNF
private

Remembers if the SNF has already been computed.

Definition at line 188 of file snfchomp.h.

Referenced by tMatrixSNF< CoefT >::computeSNF().

◆ matrices

template<class CoefT>
chomp::homology::multitable<chomp::homology::mmatrix<tEuclWrap<CoefT> > > tMatrixSNF< CoefT >::matrices
private

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