36#ifndef _CHOMP_HOMOLOGY_GCOMPLEX_H_
37#define _CHOMP_HOMOLOGY_GCOMPLEX_H_
56template <
class cell,
class eucl
idom>
58template <
class cell,
class eucl
idom,
class element>
83template <
class cell,
class eucl
idom>
150 bool check (
const cell &c)
const;
169 bool keepused =
false);
178 bool keepused =
false);
189 bool keepused =
false);
194 bool keepused =
false);
200 bool dontadd,
bool keepused,
bool addcob);
206 bool dontadd,
bool keepused,
bool addcob);
216 bool addbd,
bool addcob,
bool disjoint,
228 bool addbd,
bool addcob,
bool disjoint,
229 const int *level = NULL,
bool quiet =
false);
251template <
class cell,
class eucl
idom>
257template <
class cell,
class eucl
idom>
266 throw "Cannot copy a geometric complex.";
273 for (
int i = 0; i < n; ++ i)
277 if (!tab [i] || !cob [i])
278 throw "Cannot copy part of a geometric complex.";
283template <
class cell,
class eucl
idom>
293 for (
int i = 0; i < n; ++ i)
299 for (
int i = 0; i < n; ++ i)
309 throw "Cannot copy a geometric complex.";
316 for (
int i = 0; i < n; ++ i)
320 if (!tab [i] || !cob [i])
321 throw "Cannot copy part of a geom. complex.";
327 for (
int i = 0; i < n; ++ i)
329 *(tab [i]) = *(c. tab [i]);
330 *(cob [i]) = *(c. cob [i]);
336template <
class cell,
class eucl
idom>
339 for (
int i = 0; i < n; ++ i)
353template <
class cell,
class eucl
idom>
359template <
class cell,
class eucl
idom>
363 for (
int i = 0; i < n; ++ i)
364 count += tab [i] -> size ();
368template <
class cell,
class eucl
idom>
373 for (
int i = 0; i < n; ++ i)
374 if (!(*(tab [i])). empty ())
379template <
class cell,
class eucl
idom>
383 if ((d < 0) || (d >= n))
384 throw "Dimension out of range for retrieving cells.";
388template <
class cell,
class eucl
idom>
392 return getcob (c, c. dim ());
395template <
class cell,
class eucl
idom>
399 if ((d < 0) || (d >= n))
400 throw "Dimension out of range for coboundary.";
401 return (*(cob [d])) (c);
404template <
class cell,
class eucl
idom>
410 throw "Negative dimension of a cell to be added.";
415 increasedimension (d);
423template <
class cell,
class eucl
idom>
429 increasedimension (d);
437template <
class cell,
class eucl
idom>
441 int_t size = c. size ();
442 for (
int_t i = 0; i < size; ++ i)
448template <
class cell,
class eucl
idom>
454 increasedimension (c. dim ());
457 for (
int i = 0; i < c. n; ++ i)
459 tab [i] -> add (*(c. tab [i]));
475template <
class cell,
class eucl
idom>
482 throw "Negative dimension of a cell to be removed.";
490 tab [d] -> remove (c);
493 if ((d == n - 1) && tab [d] -> empty ())
499template <
class cell,
class eucl
idom>
509 for (
int i = 0; i < m; ++ i)
510 tab [i] -> remove (*(c. tab [i]));
518template <
class cell,
class eucl
idom>
523 tab [d] -> remove (c);
531template <
class cell,
class eucl
idom>
535 int_t size = c. size ();
536 for (
int_t i = 0; i < size; ++ i)
542template <
class cell,
class eucl
idom>
552 else if ((d >= 0) && (d < n))
561template <
class cell,
class eucl
idom>
567 throw "Negative dimension of a cell to be checked.";
575 return tab [d] -> check (c);
578template <
class cell,
class eucl
idom>
581 bool dontadd,
bool keepused,
bool addcob)
584 if ((d <= 0) || (d >= n))
588 if (notthese && !dontadd)
591 int_t prevsize = tab [d - 1] -> size ();
593 for (
int_t i = 0; i < cset. size (); ++ i)
595 const cell &thecell = cset [i];
597 for (
int j = 0; j < len; ++ j)
603 if (!notthese || !notthese -> check (bcell))
605 tab [d - 1] -> add (bcell);
617 c -> add (d, tab [d - 1] ->
618 getnumber (bcell), i, coef);
621 (*(cob [d - 1])) [bcell].
628 if (notthese && !keepused)
629 notthese -> removeall (d);
631 return tab [d - 1] -> size () - prevsize;
634template <
class cell,
class eucl
idom>
639 int_t countadded = 0;
640 for (
int d = n - 1; d > 0; -- d)
642 dontadd, keepused, addcob);
646template <
class cell,
class eucl
idom>
652template <
class cell,
class eucl
idom>
658template <
class cell,
class eucl
idom>
662 return addboundaries (d, NULL, ¬these,
false, keepused,
false);
665template <
class cell,
class eucl
idom>
669 return addboundaries (NULL, ¬these,
false, keepused,
false);
672template <
class cell,
class eucl
idom>
679template <
class cell,
class eucl
idom>
685template <
class cell,
class eucl
idom>
690 return addboundaries (d, &c, ¬these,
false, keepused,
false);
693template <
class cell,
class eucl
idom>
697 return addboundaries (&c, ¬these,
false, keepused,
false);
704template <
class element>
711 int_t i =
static_cast<int_t> (std::rand ()) % len;
713 i =
static_cast<int_t> (1) - i;
714 int_t step =
static_cast<int_t> (std::rand () + 17) % len;
716 step =
static_cast<int_t> (1) - step;
725 int_t jumping = len >> 1;
743 for (
int_t i = 0; i < len; ++ i)
751template <
class cell,
class eucl
idom>
754 bool addbd,
bool addcob,
bool disjoint,
bool quiet)
756 if ((d <= 0) || (d > dim ()))
764 *(other. tab [d]) : empty;
766 *(other. tab [d - 1]) : empty;
768 *(keep. tab [d]) : empty;
770 *(keep. tab [d - 1]) : empty;
786 sseq <<
"\"Adding boundaries of cells in A...\"\n";
789 for (
int_t i = 0; i < cother. size (); ++ i)
792 const cell &thecell = cother [i];
798 for (
int j = 0; j < blen; ++ j)
802 if (!quiet && (
sseq. show ||
sseq. log))
804 for (
int j = 0; j < blen; ++ j)
806 (thecell, j) <<
'\n';
815 bset. remove (bother);
821 coblen. fill (0, bset. size ());
827 sseq <<
"\"Adding boundaries of cells of dimension " <<
829 bool maximal = (d == dim ());
830 for (
int_t i = 0; i < cset. size (); ++ i)
833 const cell &thecell = cset [i];
836 bool cbelongs = cother. check (thecell);
839 if (cbelongs && (disjoint || maximal))
843 cother. remove (thecell);
844 cset. removenum (i --);
852 bool keepit = ckeep. check (thecell);
855 for (
int j = 0; j < blen; ++ j)
861 bool bbelongs = bother. check (bcell);
864 if (bbelongs && disjoint)
868 int_t prev = bset. size ();
869 int_t number = addbd ? bset. add (bcell) :
870 bset. getnumber (bcell);
877 if ((prev < bset. size ()) || (coblen [number] == 0))
880 if (!quiet && !bbelongs)
881 sseq <<
'1' << bcell <<
'\n';
884 if (keepit || bkeep. check (bset [number]) ||
885 bother. check (bset [number]))
886 coblen [number] = 13;
889 coboundary [number]. add (thecell);
895 ++ (coblen [number]);
896 coboundary [number]. add (thecell);
913 sseq <<
"\"Collapsing free faces...\"\n";
924 const cell &parent = coboundary [ncell] [0];
929 for (
int j = 0; j < blen; ++ j)
932 int_t number = bset. getnumber (thecell);
933 if ((number >= 0) && (coblen [number] > 0))
935 coboundary [number]. remove (parent);
936 -- (coblen [number]);
943 sseq <<
'0' << bset [ncell] <<
'\n';
944 sseq <<
'0' << parent <<
'\n';
948 cremove. add (parent);
949 bremove. add (bset [ncell]);
953 coboundary [ncell] = empty;
959 for (
int_t i = 0; i < bset. size (); ++ i)
960 if (!bremove. check (bset [i]))
962 coboundary [i]. remove (cremove);
963 (*(cob [d - 1])) [bset [i]]. add
969 if (nremove == cset. size ())
972 other. removeall (d);
976 for (
int_t i = 0; i < nremove; ++ i)
977 cset. remove (cremove [i]);
981 for (
int_t i = 0; i < nremove; ++ i)
982 bset. remove (bremove [i]);
994template <
class cell,
class eucl
idom>
997 bool disjoint,
const int *level,
bool quiet)
1003 while ((dmin < dim ()) && (!level [dmin]))
1005 if (dmin && level [dmin])
1010 while (keep. dim () > dim ())
1013 keep. removeall (keep. dim ());
1017 if (other. dim () > dim ())
1020 other. removeall (other. dim ());
1025 for (
int d = dim (); d > dmin; -- d)
1031 counter +=
collapse (d, other, keep, addbd, addcob, disjoint,
1036 other. removeall (d);
1039 keep. removeall (d);
1043 if (!disjoint && (dim () >= dmin) && (other. dim () >= dmin))
1047 for (
int_t i = 0; i < cother. size (); ++ i)
1049 if (!(cset. check (cother [i])))
1050 cother. removenum (i --);
1055 if (!keep. empty ())
1067template <
class cell,
class eucl
idom>
1075 for (
int i = 0; i < n; ++ i)
1077 newtab [i] = tab [i];
1078 newcob [i] = cob [i];
1090 for (
int i = n; i < d + 1; ++ i)
1102template <
class cell,
class eucl
idom>
1105 while (n && tab [n - 1] -> empty ())
1127template <
class cell,
class eucl
idom>
1133 c. def_gen (0, g [0]. size ());
1134 for (
int d = 1; d <= g. dim (); ++ d)
1136 c. def_gen (d, g [d]. size ());
1137 for (
int_t i = 0; i < g [d]. size (); ++ i)
1140 for (
int j = 0; j < len; ++ j)
1146 if (g. check (thecell))
1158 c. add (d, g [d - 1]. getnumber
1159 (thecell), i, coef);
1179template <
class cell,
class eucl
idom>
1186 out <<
"chaincomplex\n\n";
1187 out <<
"maxdimension " << g. dim () <<
"\n\n";
1188 out <<
"dimension 0: " << g [0]. size () <<
"\n\n";
1189 for (
int d = 1; d <= g. dim (); ++ d)
1191 out <<
"dimension " << d <<
": " << g [d]. size () <<
"\n";
1192 for (
int_t i = 0; i < g [d]. size (); ++ i)
1194 bool cellwritten =
false;
1196 for (
int j = 0; j < len; ++ j)
1202 if (g. check (thecell))
1227 else if (-coef == 1)
1230 out <<
" + " << coef <<
1235 out << (1 + g [d - 1].
1236 getnumber (thecell));
1259template <
class cell,
class eucl
idom>
1270 int_t count0 = g [0]. size ();
1271 if (rel. dim () >= 0)
1273 count0 -= rel [0]. size ();
1275 for (
int_t i = 0; i < rel [0]. size (); ++ i)
1277 (*numbers0) [j] = g [0]. getnumber (rel [0] [i]);
1278 if ((*numbers0) [j] < 0)
1286 c. def_gen (0, count0);
1289 for (
int d = 1; d <= g. dim (); ++ d)
1293 int_t count1 = g [d]. size ();
1294 if (rel. dim () >= d)
1296 count1 -= rel [d]. size ();
1298 for (
int_t i = 0; i < rel [d]. size (); ++ i)
1301 g [d]. getnumber (rel [d] [i]);
1302 if ((*numbers1) [j] < 0)
1310 c. def_gen (d, count1);
1313 for (
int_t i = 0; i < g [d]. size (); ++ i)
1316 if ((rel. dim () >= d) &&
1317 (rel [d]. check (g [d] [i])))
1323 n1 = (*numbers1) [n1 - count1];
1329 for (
int j = 0; j < len; ++ j)
1335 if (g [d - 1]. check (thecell) &&
1336 ((rel. dim () < d - 1) ||
1337 (!rel [d - 1]. check (thecell))))
1340 int_t n0 = g [d - 1].
1341 getnumber (thecell);
1361 c. add (d, n0, n1, coef);
1368 numbers0 = numbers1;
1389template <
class cell,
class eucl
idom>
1394 bool firstlist =
true;
1395 for (
int d = 0; d <= c. dim (); ++ d)
1397 if ((!level || level [d]) && !hom [d]. empty ())
1403 if (hom [d]. size () == 1)
1404 out <<
"The generator of H_" << d <<
1405 " follows:" <<
'\n';
1407 out <<
"The " << hom [d]. size () <<
1408 " generators of H_" << d <<
1411 for (
int_t i = 0; i < hom [d]. size (); ++ i)
1413 if (hom [d]. size () > 1)
1414 out <<
"generator " << (i + 1) <<
1417 c. gethomgen (d, hom [d]. num (i));
1418 for (
int_t j = 0; j < lst. size (); ++ j)
1419 out << lst. coef (j) <<
" * " <<
1420 cset [lst. num (j)] <<
'\n';
1428template <
class cell,
class eucl
idom>
1432 for (
int_t i = 0; i < m. size (); ++ i)
1434 const cell &e = m. get (i);
1436 for (
int_t j = 0; j < f. size (); ++ j)
1437 graph. add (e * f [j]);
1446template <
class cell,
class eucl
idom>
1451 c.
collapse (empty, empty,
true,
false,
false, NULL,
true);
1452 if (c. size () == 1)
1459 cx. simple_form (
static_cast<int *
> (0),
true);
1460 cx. simple_homology (hom, 0);
1463 for (
int i = 1; i <= cx. dim (); ++ i)
1465 if (!hom [i]. empty ())
1473 if (hom [0]. size () != 1)
1480 if (hom [0]. getcoefficient (0) == 1)
1495template <
class cell,
class eucl
idom>
1499 out <<
"; Geometric complex of dimension " << c. dim () <<
1500 " (" << c. size () <<
" cells total)." <<
'\n';
1501 for (
int i = 0; i <= c. dim (); ++ i)
1502 out <<
"; Cells of dimension " << i <<
':' <<
'\n' << c [i];
1507template <
class cell,
class eucl
idom>
1528template <
class cell,
class eucl
idom,
class element>
1565 void add (
int d,
const cell &c,
1577 void add (
int d,
const cell &c,
const element &e);
1580 void add (
const cell &c,
const element &e);
1584 void add (
int d,
int_t n,
const element &e);
1600template <
class cell,
class eucl
idom,
class element>
1605 if (!g || (g -> dim () < 0))
1611 dimension = g -> dim ();
1614 throw "Cannot create a multivalued cellular map.";
1618template <
class cell,
class eucl
idom,
class element>
1623 if (!g || (g -> dim () < 0))
1629 dimension = g -> dim ();
1632 throw "Cannot create a multivalued cellular map.";
1636template <
class cell,
class eucl
idom,
class element>
1641 if (!g || (g -> dim () < 0))
1647 dimension = g -> dim ();
1650 throw "Unable to construct a copy of a multivalued "
1652 for (
int i = 0; i < dimension + 1; ++ i)
1653 images [i] = m. images [i];
1657template <
class cell,
class eucl
idom,
class element>
1664 dimension = m. dimension;
1665 if (!g || (dimension < 0))
1672 throw "Cannot copy a multivalued cellular map.";
1673 for (
int i = 0; i < dimension + 1; ++ i)
1674 images [i] = m. images [i];
1678template <
class cell,
class eucl
idom,
class element>
1686template <
class cell,
class eucl
idom,
class element>
1692template <
class cell,
class eucl
idom,
class element>
1695 if ((d < 0) || (d > dimension))
1696 throw "Wrong dimension to retrieve from mvcellmap.";
1700template <
class cell,
class eucl
idom,
class element>
1707template <
class cell,
class eucl
idom,
class element>
1709 (
const cell &c)
const
1713 throw "Trying to get the image of a cell of dim too high.";
1714 int_t n = (*g) [d]. getnumber (c);
1716 throw "Trying to get the image of a cell not in the domain.";
1717 return images [d] [n];
1720template <
class cell,
class eucl
idom,
class element>
1724 if ((d < 0) || (d > dimension))
1725 throw "Wrong dimension for adding a cell to a map.";
1726 if (!g -> check (c))
1729 images [d] [(*g) [d]. getnumber (c)]. add (set);
1733template <
class cell,
class eucl
idom,
class element>
1737 add (c. dim (), c, set);
1741template <
class cell,
class eucl
idom,
class element>
1745 if ((d < 0) || (d > dimension))
1746 throw "Wrong dimension for adding an element to the image.";
1747 images [d] [n]. add (set);
1751template <
class cell,
class eucl
idom,
class element>
1755 if ((d < 0) || (d > dimension))
1756 throw "Wrong dimension for adding a cell to a map.";
1757 if (!g -> check (c))
1760 images [d] [(*g) [d]. getnumber (c)]. add (e);
1764template <
class cell,
class eucl
idom,
class element>
1768 add (c. dim (), c, e);
1772template <
class cell,
class eucl
idom,
class element>
1776 if ((d < 0) || (d > dimension))
1777 throw "Wrong dimension for adding an element to the image.";
1778 images [d] [n]. add (set);
1787template <
class cell,
class eucl
idom,
class element>
1792 for (
int d1 = 0; d1 <= m. dim (); ++ d1)
1796 for (
int_t i = 0; i < cset. size (); ++ i)
1799 const cell &thecell = cset [i];
1802 for (
int_t j = 0; j < set. size (); ++ j)
1803 img. add (cell (set [j]));
1808 for (
int d2 = 0; d2 <= img. dim (); ++ d2)
1812 for (
int_t j = 0; j < cs. size (); ++ j)
1813 c. add (thecell * cs [j]);
1827template <
class cell,
class eucl
idom,
class element>
1833 for (
int d1 = 0; d1 <= m. dim (); ++ d1)
1837 for (
int_t i = 0; i < cset. size (); ++ i)
1840 const cell &thecell = cset [i];
1843 for (
int_t j = 0; j < set. size (); ++ j)
1844 img. add (cell (set [j]));
1849 for (
int d2 = 0; d2 <= img. dim (); ++ d2)
1853 for (
int_t j = 0; j < cs. size (); ++ j)
1855 cell bigcell = thecell * cs [j];
1856 if (!rel. check (bigcell))
1873template <
class cell,
class eucl
idom,
class element>
1880 for (
int d = m. dim (); d >= 0; -- d)
1884 for (
int_t i = 0; i < cset. size (); ++ i)
1887 const cell &thecell = cset [i];
1892 throw "An empty image of a cell found.";
1896 spacedim = set [0]. dim ();
1903 cm. add (d, thecell, cell (set [0], 0));
1909 for (
int_t j = 0; j < set. size (); ++ j)
1910 img. add (cell (set [j]));
1915 dom. getcob (thecell, d);
1916 for (
int_t j = 0; j < cob. size (); ++ j)
1917 keep. add (cm (cob [j]));
1921 img.
collapse (empty, keep, 1, 0, 0, NULL, 1);
1925 for (
int j = 0; j <= img. dim (); ++ j)
1926 cm. add (d, thecell, img [j]);
1929 if (i && !(i % 373))
1930 scon << std::setw (12) << i <<
1931 "\b\b\b\b\b\b\b\b\b\b\b\b";
1933 if (cset. size () > 373)
1934 scon <<
" \b\b\b\b\b\b\b\b\b\b\b\b";
1947template <
class cell,
class eucl
idom,
class element>
1959 int maxdim = m. dim ();
1960 for (
int d = maxdim; d >= 0; -- d)
1964 for (
int_t i = 0; i < cset. size (); ++ i)
1967 const cell &thecell = cset [i];
1972 throw "An empty image of a cell found.";
1977 if (reldom. check (thecell))
1982 cm. add (d, thecell, cell (set [0], 0));
1988 for (
int_t j = 0; j < set. size (); ++ j)
1989 img. add (cell (set [j]));
1994 dom. getcob (thecell, d);
1996 for (
int_t j = 0; j < cob. size (); ++ j)
1997 keep. add (cm (cob [j]));
2001 if (reldom. check (thecell))
2005 for (
int_t j = 0; j < relset. size (); ++ j)
2007 cell c = cell (relset [j]);
2016 img.
collapse (empty, keep, 1, 0, 0, NULL, 1);
2019 if (verifyacyclicity)
2025 verifyacyclicity =
false;
2031 img. remove (other);
2034 if (verifyacyclicity && other. size ())
2040 verifyacyclicity =
false;
2046 for (
int j = 0; j <= img. dim (); ++ j)
2047 cm. add (d, thecell, img [j]);
2050 if (i && !(i % 373))
2051 scon << std::setw (12) << i <<
2052 "\b\b\b\b\b\b\b\b\b\b\b\b";
2054 if (cset. size () > 373)
2055 scon <<
" \b\b\b\b\b\b\b\b\b\b\b\b";
2065template <
class cell,
class eucl
idom,
class element>
2069 for (
int d = 0; d <= m. dim (); ++ d)
2071 out <<
"; Dimension " << d <<
':' <<
'\n';
2073 for (
int_t i = 0; i < cset. size (); ++ i)
2075 out << cset [i] <<
" -> ";
This file contains classes and functions related to algebraic chain complexes and chain maps,...
This class defines objects which represent chains as finite sequences of elements identified by integ...
This is an implementation of a chain complex over an arbitrary ring.
The class that defines a geometric complex - a set of cells (cubes, simplices, etc).
void increasedimension(int d)
Increases the dimension of the complex to take this cell.
int n
The number of tables.
int_t size() const
Returns the number of cells in the complex.
gcomplex< cell, euclidom > & remove(const cell &c)
Remove a cell from the geometric complex.
bool check(const cell &c) const
Check whether the given cell is in the complex.
int_t collapse(int d, gcomplex< cell, euclidom > &other, const gcomplex< cell, euclidom > &keep, bool addbd, bool addcob, bool disjoint, bool quiet=false)
Adds boundaries of all the cells of the given dimension and then performs free face collapses.
const hashedset< cell > & operator[](int d) const
Returns the set of cells of the given dimension.
bool empty() const
Returns 'true' iff the cell complex is empty.
const hashedset< cell > & getcob(const cell &c) const
Returns the coboundary of the given cell.
mvmap< cell, cell > ** cob
The tables with coboundaries of cells of these dimensions.
hashedset< cell > ** tab
The tables with cells of dimension 0, 1, 2, etc.
gcomplex()
The default constructor.
int dim() const
Returns the dimension of the complex, that is, the highest dimension of any cell contained in the com...
gcomplex< cell, euclidom > & add(const cell &c)
Add a cell to the geometric complex.
void decreasedimension()
Frees empty sets if there are no cells of high dimensions.
gcomplex & operator=(const gcomplex< cell, euclidom > &c)
The assignment operator.
~gcomplex()
The destructor.
int_t addboundaries(int d, bool addcob=false)
Adds boundaries of all the cells of given dimension to the geometric complex.
gcomplex< cell, euclidom > & removeall(int d)
Remove all the cells of the given dimension.
A container for elements placed in a table (like a vector) that is actually built of many smaller tab...
This class represents a multivalued map whose domain is a geometric complex.
const hashedset< element > & operator()(const cell &c) const
Returns the image of a given cell.
mvcellmap(gcomplex< cell, euclidom > *_g=0)
The constructor of a map with its domain.
void add(int d, const cell &c, const hashedset< element > &set)
Adds a set to the image of a given cell, provided the dimension of the cell is known.
const hashedset< cell > & get(int d) const
Returns the given level of the geometric complex.
int dim() const
Returns the dimension of the domain of the map.
gcomplex< cell, euclidom > * g
A pointer to the domain of the map.
const gcomplex< cell, euclidom > & getdomain() const
Returns a reference of the domain cell complex of the map.
~mvcellmap()
The destructor.
int dimension
The dimension of the domain of the map.
multitable< hashedset< element > > * images
The array of images of the elements of each dimension.
mvcellmap & operator=(const mvcellmap< cell, euclidom, element > &m)
The assignment operator.
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
This file contains a definition of a general geometric complex which represents a polyhedron.
int int_t
Index type for indexing arrays, counting cubes, etc.
This file contains the definition of the container "hashedset" which can be used to represent a set o...
#define SMALL_SIZE
This constant passed to the function 'write' makes the hashed set be displayed in a way that is appro...
This file defines a class "integer" which represents the ring of integers or the field of integers mo...
outputstream sseq
An auxiliary stream which captures sequences of processed data.
std::ostream & writegenerators(std::ostream &out, const chain< euclidom > *hom, const chaincomplex< euclidom > &c, const gcomplex< tCell, euclidom > &g, const int *level, int xdim, int format=0)
Writes projected homology generators of a cubical complex to a file.
bool acyclic(int dim, BitField &b)
Checks whether this cube's nieghbors form an acyclic set.
int closingparenthesis(int ch)
Returns the matching closing parenthesis for the given opening one or EOF if none.
std::ostream & operator<<(std::ostream &out, const bincube< Dim, twoPower > &b)
int write(std::ostream &out, const coordtype *c, int dim, char parenthesis=40, char closing=0)
void addboundaries(gcomplex< cell, euclidom > &Xcompl, gcomplex< cell, euclidom > &Acompl, int minlevel, bool bothsets, const char *Xname, const char *Aname)
Adds boundaries to the geometric complex X or to both X and A.
int boundarylength(const tCellBase< coordtype > &q)
Returns the length of the boundary of a cell.
void collapse(gcomplex< cell, euclidom > &Xcompl, gcomplex< cell, euclidom > &Acompl, gcomplex< cell, euclidom > &Xkeepcompl, const char *Xname, const char *Aname, bool addbd=true, bool addcob=false, bool disjoint=true, const int *level=NULL)
Collapses a pair of geometric complexes.
tCellBase< coordtype > boundarycell(const tCellBase< coordtype > &q, int i, bool onlyexisting)
Computes the i-th boundary element of a cell.
void createcellmap(const mvcellmap< cell, euclidom, element > &m, mvcellmap< cell, euclidom, cell > &cm)
Creates the graph of the map as a cell complex while reducing as possible.
int_t findelem(const multitable< element > &tab, const element &e, int_t len)
Finds the given element in the table of given length.
std::istream & operator>>(std::istream &in, bincube< Dim, twoPower > &b)
std::ostream & writechaincomplex(std::ostream &out, const gcomplex< cell, euclidom > &g, bool symbolicnames=false, bool quiet=false)
Writes out a chain complex of the geometric cell complex.
void decreasedimension(gcomplex< cell, euclidom > &Acompl, int dim, const char *name)
Decreases the dimension of the geometric complex by adding boundary cells to all the cells on higher ...
outputstream scon
The console output stream to which one should put all the junk that spoils the log file,...
chaincomplex< euclidom > & createchaincomplex(chaincomplex< euclidom > &c, const gcomplex< cell, euclidom > &g, bool quiet=false)
Creates an algebraic chain complex based on the data from the given geometric cell complex.
void ignorecomments(std::istream &in)
Ignores white characters (spaces, tabulators, CRs and LFs), as well as comments from the input text f...
gcomplex< cell, euclidom > & creategraph(const mvmap< cell, cell > &m, gcomplex< cell, euclidom > &graph)
Add a graph of a multivalued cell map to the cell complex.
int boundarycoef(const tCellBase< coordtype > &q, int i)
Returns the i-th coefficient in the boundary of a cell.
This namespace contains the entire CHomP library interface.
This file contains some useful functions related to the text input/output procedures.