28 #ifndef _CHAINCON_COMBLINMAP_H_ 29 #define _CHAINCON_COMBLINMAP_H_ 37 #include "chomp/system/config.h" 38 #include "chomp/struct/hashsets.h" 39 #include "chomp/struct/multitab.h" 55 template <
class CellDomT,
class CellImgT>
85 int_t
add (
const CellDomT &c);
88 void add (
const CellDomT &c,
const CellImgT &d);
110 void remove (
const CellDomT &c);
148 chomp::homology::hashedset<CellDomT>
domain;
151 chomp::homology::multitable<tCombChain<CellImgT> >
images;
157 template <
class CellDomT,
class CellImgT>
164 template <
class CellDomT,
class CellImgT>
170 template <
class CellDomT,
class CellImgT>
172 (
const CellDomT &c,
const CellImgT &d)
174 int_t n =
domain. getnumber (c);
184 template <
class CellDomT,
class CellImgT>
188 int_t n =
domain. getnumber (c);
213 template <
class CellDomT,
class CellImgT>
219 for (int_t i = 0; i <
size; ++ i)
221 if (f.
images [i]. empty ())
228 template <
class CellDomT,
class CellImgT>
235 template <
class CellDomT,
class CellImgT>
246 template <
class CellDomT,
class CellImgT>
249 int_t n =
domain. getnumber (c);
255 template <
class CellDomT,
class CellImgT>
262 template <
class CellDomT,
class CellImgT>
264 (
const CellDomT &c)
const 266 int_t n =
domain. getnumber (c);
273 template <
class CellDomT,
class CellImgT>
279 for (int_t i = 0; i <
size; ++ i)
281 int_t n =
domain. getnumber (ch. getCell (i));
288 template <
class CellDomT,
class CellImgT>
295 for (int_t i = 0; i <
size; ++ i)
297 int_t n1 =
domain. getnumber (ch. left (i));
298 int_t n2 =
domain. getnumber (ch. right (i));
299 if ((n1 >= 0) && (n2 >= 0))
305 template <
class CellDomT,
class CellImgT>
311 template <
class CellDomT,
class CellImgT>
318 template <
class CellDomT,
class CellImgT>
325 template <
class CellDomT,
class CellImgT>
329 int_t n =
domain. getnumber (c);
338 template <
class CellDomT,
class CellImgT>
343 for (int_t i = 0; i < thisSize; ++ i)
345 const CellDomT &x =
domain [i];
349 int_t n = f.
domain. getnumber (x);
352 if (!(y == f.
images [n]))
356 for (int_t i = 0; i < fSize; ++ i)
358 const CellDomT &x = f.
domain [i];
362 int_t n =
domain. getnumber (x);
371 template <
class CellDomT,
class CellImgT>
383 template <
class CellDomT,
class CellImgT>
389 for (int_t n = 0; n <
size; ++ n)
395 const CellDomT &c = f [n];
396 out << c <<
" -> " << ch <<
"\n";
404 template <
class CellDomT,
class CellImgT>
408 throw "Operator >> not implemented for tCombLinMap.";
415 template <
class CellArray,
class CellT>
420 for (int_t i = 0; i <
size; ++ i)
422 const CellT &c = domain [i];
429 template <
class CellArray,
class CellT>
440 template <
class CellXT,
class CellYT,
class CellZT>
447 for (int_t i = 0; i <
size; ++ i)
449 const CellXT &x = g [i];
460 #endif // _CHAINCON_COMBLINMAP_H_ tCombChain< CellDomT > ChainDomType
The type of the corresponding domain chain.
tCombChain< CellImgT > ChainImgType
The type of the corresponding image chain.
tCombChain< CellImgT > & getImage(int_t n)
Returns the image of the given cell for editing.
tZ2 CoefType
The type of coefficients in the chain.
An element of the ring Z_2.
void swap(tCombLinMap< CellDomT, CellImgT > &f)
Swaps the data with another combinatorial linear map.
int_t size() const
Returns the number of elements in the domain of the combinatorial map.
chomp::homology::multitable< tCombChain< CellImgT > > images
The chains in the images of each domain element.
A combinatorial chain, that is, a chain with Z_2 coefficients.
const CellDomT & operator[](int_t n) const
Returns the n-th element of the domain of the combinatorial map.
std::ostream & operator<<(std::ostream &out, const tCombLinMap< CellDomT, CellImgT > &f)
Writes a combinatorial linear map to an output stream in the text mode.
int_t add(const CellDomT &c)
Adds a cell to the domain of the map, with zero image, and returns its number.
const tCombChain< CellImgT > & operator()(int_t n) const
Returns the image of the given cell.
tCombTensor< CellImgT, CellImgT > TensorImgType
The type of the corresponding image chain.
bool operator==(const tCombLinMap< CellDomT, CellImgT > &f) const
Verifies if the two combinatorial linear maps are the same.
Combinatorial tensor of cells.
A combinatorial tensor (for coefficients in Z_2).
tCombLinMap()
The default constructor.
tCombTensor< CellDomT, CellDomT > TensorDomType
The type of the corresponding domain chain.
Elements of the ring Z_2.
tCombLinMap< CellDomT, CellImgT > & negate()
Replaces all the coefficients in the map with their negation.
std::istream & operator>>(std::istream &in, tCombLinMap< CellDomT, CellImgT > &f)
Reads a combinatorial linear map from an input stream.
CellImgT CellImgType
The type of cells in the images of the combinatorial linear map.
void addIdentity(const CellArray &domain, tCombLinMap< CellT, CellT > &f)
Adds the identity map on the given domain to the map 'f'.
chomp::homology::hashedset< CellDomT > domain
The domain of the map.
A combinatorial linear map.
tCombLinMap< CellT, CellT > identity(const CellArray &domain)
Returns the identity map on the given domain.
void remove(const CellDomT &c)
Removes the given cell from the domain of the map.
CellDomT CellDomType
The type of cells in the domain of the combinatorial linear map.
void removenum(int_t n)
Removes the given cell from the domain of the map.