33 #ifndef _CHAINCON_SNFCHOMP_H_ 34 #define _CHAINCON_SNFCHOMP_H_ 43 #include "chomp/system/config.h" 44 #include "chomp/system/textfile.h" 45 #include "chomp/system/timeused.h" 46 #include "chomp/struct/hashsets.h" 47 #include "chomp/struct/multitab.h" 48 #include "chomp/struct/integer.h" 49 #include "chomp/homology/chains.h" 85 template <
class CoefT>
108 void setSize (
int q, int_t numRows, int_t numColumns);
111 void add (
int q, int_t row, int_t column,
const CoefT &element);
172 chomp::homology::multitable
173 <chomp::homology::mmatrix<tEuclWrap<CoefT> > >
matrices;
176 chomp::homology::multitable
177 <chomp::homology::mmatrix<tEuclWrap<CoefT> > >
chgBasisA;
180 chomp::homology::multitable
181 <chomp::homology::mmatrix<tEuclWrap<CoefT> > >
chgBasisG;
194 template <
class CoefT>
200 template <
class CoefT>
206 template <
class CoefT>
209 throw "Trying to use the undefined copy constructor for tMatrixSNF.";
213 template <
class CoefT>
217 throw "Trying to use the undefined operator = for tMatrixSNF.";
223 template <
class CoefT>
225 int_t numRows, int_t numColumns)
228 matrices [q]. define (numRows, numColumns);
233 template <
class CoefT>
235 const CoefT &element)
241 template <
class CoefT>
247 template <
class CoefT>
253 template <
class CoefT>
256 using chomp::homology::sout;
257 using chomp::homology::sbug;
260 throw "Trying to compute the SNF twice.\n";
262 for (
int q = 0; q < numMatr; ++ q)
266 int_t nCols =
matrices [q]. getncols ();
289 for (
int q = numMatr - 1; q >= 0; -- q)
296 sout <<
"SNF " << q <<
": ";
311 template <
class CoefT>
314 const chomp::homology::chain<tEuclWrap<CoefT> > &column =
316 if (column. size () < 1)
322 template <
class CoefT>
325 const chomp::homology::chain<tEuclWrap<CoefT> > &column =
327 if (column. size () < 1)
330 return column. num (0);
333 template <
class CoefT>
336 const chomp::homology::chain<tEuclWrap<CoefT> > &row =
338 if (row. size () < 1)
344 template <
class CoefT>
347 const chomp::homology::chain<tEuclWrap<CoefT> > &row =
349 if (row. size () < 1)
355 template <
class CoefT>
360 int_t size = ch. size ();
361 for (int_t i = 0; i < size; ++ i)
369 template <
class CoefT>
376 template <
class CoefT>
383 template <
class CoefT>
390 template <
class CoefT>
398 #endif // _CHAINCON_SNFCHOMP_H_ CoefT getColCoef(int q, int_t n) const
Returns the coefficient in the given column of the given matrix in the SNF.
int_t getNumCols(int q) const
Returns the number of columns of the matrix.
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 ma...
~tMatrixSNF()
The destructor of a matrix.
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...
A wrapper of coefficients as defined in this sofware package for what is required by CHomP...
chomp::homology::multitable< chomp::homology::mmatrix< tEuclWrap< CoefT > > > chgBasisA
Change of basis matrices from the original one to the SNF one.
tChain< CellType, CoefT > ChainType
The type of the corresponding image chain.
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...
A chain with coefficients in an arbitrary ring.
void computeSNF(int numMatr)
Computes the almost Smith Normal Form of all the matrices whose number is provided (indexing stats fr...
tMatrixSNF< CoefT > & operator=(const tMatrixSNF< CoefT > &other)
Assignment operator is not allowed.
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 ...
chomp::homology::multitable< chomp::homology::mmatrix< tEuclWrap< CoefT > > > chgBasisG
Change of basis matrices from the SNF one to the original one.
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 ze...
int_t getNumRows(int q) const
Returns the number of rows of the matrix.
CoefT CoefType
The type of coefficients in the chain.
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...
An abstract algebraic cell.
A chain with coefficients in an arbitrary commutative ring.
void add(int q, int_t row, int_t column, const CoefT &element)
Adds an element to the matrix whose SNF will be computed.
An abstract algebraic cell, characterized by a unique identifier, dimension, and a formula for its bo...
bool computedSNF
Remembers if the SNF has already been computed.
void setSize(int q, int_t numRows, int_t numColumns)
Sets the number of rows and columns in a given sub-matrix.
chomp::homology::multitable< chomp::homology::mmatrix< tEuclWrap< CoefT > > > matrices
The matrices whose Smith Normal Form will be computed.
CoefT getRowCoef(int q, int_t n) const
Returns the coefficient in the given row of the given matrix in the SNF.
An interface for the computation of the Smith Normal Form of a series of a few rectangular matrices w...
static ChainType abstractChain(const chomp::homology::chain< tEuclWrap< CoefT > > &ch)
Coverts a column of a matrix to an abstract algebraic chain.
tCombLinMap< CellT, CellT > identity(const CellArray &domain)
Returns the identity map on the given domain.
A wrapper of a generic coefficient type for the CHomP library.
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...
tMatrixSNF()
The default constructor of a matrix.