28 #ifndef _CHAINCON_LINMAP_H_    29 #define _CHAINCON_LINMAP_H_    37 #include "chomp/system/config.h"    38 #include "chomp/struct/hashsets.h"    39 #include "chomp/struct/multitab.h"    54 template <
class CellDomT, 
class CellImgT, 
class CoefT>
    84         int_t 
add (
const CellDomT &c);
    87         void add (
const CellDomT &c, 
const CellImgT &d, 
const CoefT &coef);
   112         void remove (
const CellDomT &c);
   137         const chomp::homology::hashedset<CellDomT> &
getDomain () 
const;
   153         chomp::homology::hashedset<CellDomT> 
domain;
   156         chomp::homology::multitable<tChain<CellImgT,CoefT> > 
images;
   162 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   169 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   175 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   177         (
const CellDomT &c, 
const CellImgT &d, 
const CoefT &coef)
   179         int_t n = 
domain. getnumber (c);
   189 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   193         int_t n = 
domain. getnumber (c);
   218 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   224         for (int_t i = 0; i < 
size; ++ i)
   226                 if (f. 
images [i]. empty ())
   233 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   238         for (int_t i = 0; i < 
size; ++ i)
   243 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   248         for (int_t i = 0; i < 
size; ++ i)
   253 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   264 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   267         int_t n = 
domain. getnumber (c);
   273 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   280 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   282         (
const CellDomT &c) 
const   284         int_t n = 
domain. getnumber (c);
   291 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   297         for (int_t i = 0; i < 
size; ++ i)
   299                 int_t n = 
domain. getnumber (ch. getCell (i));
   302                 const CoefT &coef (ch. getCoef (i));
   315 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   322         for (int_t i = 0; i < 
size; ++ i)
   324                 int_t n1 = 
domain. getnumber (ch. left (i));
   327                 int_t n2 = 
domain. getnumber (ch. right (i));
   330                 if (ch. coef (i) == 1)
   335                         img1 *= ch. coef (i);
   342 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   348 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   355 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   356 inline const chomp::homology::hashedset<CellDomT> &
   362 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   369 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   373         int_t n = 
domain. getnumber (c);
   382 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   387         for (int_t i = 0; i < thisSize; ++ i)
   389                 const CellDomT &x = 
domain [i];
   393                 int_t n = f. 
domain. getnumber (x);
   396                 if (!(y == f. 
images [n]))
   400         for (int_t i = 0; i < fSize; ++ i)
   402                 const CellDomT &x = f. 
domain [i];
   406                 int_t n = 
domain. getnumber (x);
   415 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   427 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   433         for (int_t n = 0; n < 
size; ++ n)
   439                 const CellDomT &c = f [n];
   440                 out << c << 
" -> " << ch << 
"\n";
   448 template <
class CellDomT, 
class CellImgT, 
class CoefT>
   452         throw "Operator >> not implemented for tLinMap.";
   459 template <
class CellArray, 
class CellT, 
class CoefT>
   464         for (int_t i = 0; i < 
size; ++ i)
   466                 const CellT &c = domain [i];
   467                 f. 
add (c, c, CoefT (1));
   473 template <
class CellArray, 
class CellT, 
class CoefT>
   484 template <
class CellXT, 
class CellYT, 
class CellZT, 
class CoefT>
   491         for (int_t i = 0; i < 
size; ++ i)
   493                 const CellXT &x = g [i];
   504 #endif // _CHAINCON_LINMAP_H_ void swap(tLinMap< CellDomT, CellImgT, CoefT > &f)
Swaps the data with another linear map. 
 
std::istream & operator>>(std::istream &in, tLinMap< CellDomT, CellImgT, CoefT > &f)
Reads a linear map from an input stream. 
 
std::ostream & operator<<(std::ostream &out, const tLinMap< CellDomT, CellImgT, CoefT > &f)
Writes a linear map to an output stream in the text mode. 
 
CellImgT CellImgType
The type of cells in the images of the linear map. 
 
void remove(const CellDomT &c)
Removes the given cell from the domain of the map. 
 
int_t add(const CellDomT &c)
Adds a cell to the domain of the map, with zero image, and returns its number. 
 
tChain< CellImgT, CoefT > & getImage(int_t n)
Returns the image of the given cell for editing. 
 
tTensor< CellDomT, CellDomT, CoefT > TensorDomType
The type of the corresponding domain chain. 
 
void removenum(int_t n)
Removes the given cell from the domain of the map. 
 
tLinMap< CellDomT, CellImgT, CoefT > & operator*=(const CoefT &c)
Multiplies all the coefficients in the map by the given number. 
 
tTensor< CellImgT, CellImgT, CoefT > TensorImgType
The type of the corresponding image chain. 
 
tLinMap< CellT, CellT, CoefT > identity(const CellArray &domain)
Returns the identity map on the given domain. 
 
A chain with coefficients in an arbitrary ring. 
 
A tensor of chains with coefficients in an arbitrary commutative ring. 
 
bool operator==(const tLinMap< CellDomT, CellImgT, CoefT > &f) const
Verifies if the two linear maps are the same. 
 
const CellDomT & operator[](int_t n) const
Returns the n-th element of the domain of the map. 
 
chomp::homology::hashedset< CellDomT > domain
The domain of the map. 
 
CellDomT CellDomType
The type of cells in the domain of the linear map. 
 
const tChain< CellImgT, CoefT > & operator()(int_t n) const
Returns the image of the given cell. 
 
CoefT CoefType
The type of coefficients in the chain. 
 
int_t size() const
Returns the number of elements in the domain of the map. 
 
A chain with coefficients in an arbitrary commutative ring. 
 
chomp::homology::multitable< tChain< CellImgT, CoefT > > images
The chains in the images of each domain element. 
 
const chomp::homology::hashedset< CellDomT > & getDomain() const
Returns the domain of the map. 
 
void addIdentity(const CellArray &domain, tLinMap< CellT, CellT, CoefT > &f)
Adds the identity map on the given domain to the map 'f'. 
 
tChain< CellImgT, CoefT > ChainImgType
The type of the corresponding image chain. 
 
tChain< CellDomT, CoefT > ChainDomType
The type of the corresponding domain chain. 
 
tLinMap()
The default constructor. 
 
tLinMap< CellDomT, CellImgT, CoefT > & negate()
Replaces all the coefficients in the map with their negation.