The Original CHomP Software
Namespaces | Classes | Typedefs | Functions | Variables
chomp::homology Namespace Reference

This namespace contains the core of the homology computation procedures and related classes and templates contained in the CHomP C++ library. More...

Namespaces

namespace  reduction0
 
namespace  reduction1
 

Classes

class  Acyclic1d
 This class defines a procedure for verifying if a full-cubical neighborhood in a given set of a full cube of dimension 1 is acyclic. More...
 
class  Acyclic2d
 This class defines a procedure for verifying if a full-cubical neighborhood in a given set of a full cube of dimension 2 is acyclic. More...
 
class  Acyclic3d
 This class defines a procedure for verifying if a full-cubical neighborhood in a given set of a full cube of dimension 3 is acyclic. More...
 
class  argelement
 This is a helper class which defines common properties of a command-line argument bound with any type of a variable. More...
 
class  argflags
 This is a helper class which defines specific flags indicating various types of command-line arguments and the state of interpreting them. More...
 
class  arguments
 The objects of this class gather the expected command-line arguments and decode them. More...
 
class  argunit
 This is a helper class which defines one command-line argument which is bound with some specific variable. More...
 
class  auto_array
 An auto_array template that mimics selected behaviors of the std::auto_ptr template, but releases the memory with delete[], and thus should be applied to arrays. More...
 
class  bincube
 A binary n-dimensional hypercube for storing cubes as bits. More...
 
class  BitField
 This class defines a bit field that is part of some larger array or that uses an allocated piece of memory. More...
 
class  BitFields
 This class defines a simple table of bit fields with very limited functionality that is used for storing the information on the verified combinations of cubes' neighbors. More...
 
class  BitSets
 This class uses bit representation to store many small sets. More...
 
class  bmpfile
 The class 'bmpfile' is an elementary interface that can be used to read or create and write images in the uncompressed Windows BMP format. More...
 
class  BufferedMapClass
 This class is a wrapper for a map that computes the image of a cube as a rectangular box (i.e., using the interval arithmetic). More...
 
class  chain
 This class defines objects which represent chains as finite sequences of elements identified by integral numbers with coefficients in a given Euclidean domain. More...
 
class  chaincomplex
 This is an implementation of a chain complex over an arbitrary ring. More...
 
class  chainmap
 This class defines a chain map between two chain complexes. More...
 
class  ColorPalette
 Provides a palette of distinct RGB colors. More...
 
class  diGraph
 This class defines a directed graph with very limited number of operations, and a few specific algorithms implemented on it, like DFS. More...
 
class  dummyArray
 A dummy array of integers that ignores all the assigned values. More...
 
class  dummyRounding
 A dummy class for rounding operations which does not actually do any rounding. More...
 
class  FibonacciHeap
 This template contains the definition of a Fibonacci heap that can be used as an efficient priority queue, for example, in the Dijxtra graph algorithm. More...
 
class  FixDimBitmap
 A fixed-dimensional bitmap of the size 2^n in each direction. More...
 
class  flatMatrix
 This class defines a simple data structure for a flat 2-dim square matrix whose entries are stored in a single array. More...
 
class  gcomplex
 The class that defines a geometric complex - a set of cells (cubes, simplices, etc). More...
 
class  hashedset
 This is a template for a set of objects of the given type. More...
 
class  HashingGlobal
 A hashing method using globally defined functions that calculate the two required hashing keys. More...
 
class  HashingMember
 A hashing method using member functions that calculate the two required hashing keys. More...
 
class  hashNumber
 A class of numbers that can be used in a hashed set. More...
 
class  hashstat
 This is a small class used to gather and display hashing statistics for the hashing tables in the class "hashedset". More...
 
class  integer
 This class defines integer numbers with overflow control and with some specific properties of an Euclidean domain. More...
 
class  local_var
 Local variable guardian. More...
 
class  MapCanExpand
 A class for the procecure checking if the image of a given map can be expanded without any harm to the homology of the codomain when a given full cube is moved from X\A to A in the domain during the expansion procedure conducted in the domain. More...
 
class  MapCanExpandDummy
 A dummy class that substitutes MapCanExpand if there is no map to check, so the verification always results in an approval. More...
 
class  MapClass
 This is a general map class that may be inherited by your particular class that computes a map. More...
 
class  MapRemainsAcyclic
 A wrapper class for the procecure checking if a given map remains acyclic when a given full cube is removed from its domain during the reduction of this domain. More...
 
class  matrices
 
class  mmatrix
 A class for representing sparse matrices containing elements of the 'euclidom' type. More...
 
class  multitable
 A container for elements placed in a table (like a vector) that is actually built of many smaller tables. More...
 
class  mvcellmap
 This class represents a multivalued map whose domain is a geometric complex. More...
 
class  mvmap
 This class defines a multivalued map. More...
 
class  Neighbors
 The neighborhood of a cube in a set of cubes. More...
 
class  NeighborsBdd
 This is a class used by the classes "Acyclic1d", "Acyclic2d", and "Acyclic3d" to use binary decision diagrams for the verification if a cubical neighborhood of a cube in the class "bincube" is acyclic. More...
 
class  outputstream
 This class defines an output stream for replacing the standard 'cout'. More...
 
class  pool
 This template contains the definition of a pool of elements that are stored in an extensible table. More...
 
class  Power
 This is a helper class which makes the compiler compute n^k during the compilation of the program. More...
 
class  Power< number, 0 >
 This is a specialization which defines n^0, necessary to stop the recursion defined in the "Power" template. More...
 
class  PredecessorsCycle
 A helper class for determining a cycle that realizes the minimum. More...
 
struct  PredecessorsIgnore
 A helper class for ignoring predecessor information. More...
 
class  primeint
 This is a simple class which is a wrapper for computing the smallest prime number greater or equal to the given integer. More...
 
class  psethashstat
 This is a small class used only to collect and display statistics on how successful the hashing procedures were. More...
 
class  SetOfBitFields
 This class defines a set of bit fields of the same length which are to be stored in a contiguous piece of memory to avoid multiple memory allocation/deallocation. More...
 
class  SetOfFullCubes
 This is an abstract class which defines a set of full cubes represented as a bitmap for the purpose of the class "bincube". More...
 
class  setunion
 A union of two hashed sets. More...
 
class  simplelist
 This class defines a simple list of pointers to objects of the given type. More...
 
class  Simplex
 This class defines a simplex as a geometric cell that can be used as a member of a geometric complex. More...
 
class  Tabulated
 A class for storing tabulated configurations of neighbors for various dimensions. More...
 
class  tCell2l
 A general cubical cell with additional information about the layer number. More...
 
class  tCellBase
 This class defines cubical cell in R^n with edges parallel to the axes and with size 0 or 1 in each direction. More...
 
class  tCellFix
 This class defines cubical cell in R^n with edges parallel to the axes and with size 0 or 1 in each direction. More...
 
class  tCellVar
 This class defines cubical cell in R^n with edges parallel to the axes and with size 0 or 1 in each direction. More...
 
class  tCube2l
 A (hyper)cube with additional information about the layer number. More...
 
class  tCubeBase
 This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each direction. More...
 
class  tCubeFix
 This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each direction. More...
 
class  tCubeVar
 This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each direction. More...
 
class  textfile
 A class for reading text data from a text file. More...
 
class  timeused
 A class that stores the time at which it was initialized and then returns or displays the time used since the initialization. More...
 
class  tNeighbors
 This class can be used for iterating point's neighbors. More...
 
class  tPointBase
 This class keeps a common set of points which are indexed for the use of other classes, like cubes or cubical cells. More...
 
class  tPointBaseInitializer
 This class is used to deallocate memory kept in the static variables of the corresponding class "tPointBase" upon program exit, and also to show the information on how many points were in use. More...
 
class  tPointset
 This class represents a set of points in R^n with integer coordinates. More...
 
class  tRectangle
 This class can be used for iterating a rectangular set of points, given its left and right bound. More...
 
class  tWrapBase
 This class is a simplified version of the point base class used only for the space wrapping support. More...
 
class  word
 A word, that is, a string with very few properties. More...
 

Typedefs

typedef hashedset< hashNumber< int > > hashIntQueue
 
typedef tCellBase< coordinateCubicalCell
 The default type of a cubical cell. More...
 
typedef CubicalCell ElementaryCell
 An alternative name for a cubical cell. More...
 
typedef hashedset< CubicalCellSetOfCubicalCells
 The default type of a set of cubical cells. More...
 
typedef gcomplex< CubicalCell, integerCubicalComplex
 The default type of a cubical complex. More...
 
typedef mvcellmap< CubicalCell, integer, CubicalCellCubicalMultivaluedMap
 The default type of a cubical multivalued map. More...
 
typedef CubicalCell qcell
 An abbreviation for a cubical cell [deprecated]. More...
 
typedef SetOfCubicalCells qcells
 An abbreviation for a set of cubical cell [deprecated]. More...
 
typedef CubicalComplex cubicalcomplex
 An abbreviation for a cubical complex [deprecated]. More...
 
typedef tCubeBase< coordinateCube
 The default cube type. More...
 
typedef Cube FullCube
 An alternative name for a cube. More...
 
typedef Cube HyperCube
 An alternative name for a cube. More...
 
typedef hashedset< CubeSetOfCubes
 The default type of a set of cubes. More...
 
typedef mvmap< Cube, CubeCombinatorialMultivaluedMap
 The default type of a combinatorial cubical multivalued map. More...
 
typedef Cube cube
 A lower-case name of a cube [deprecated]. More...
 
typedef SetOfCubes cubes
 An abbreviation for a set of cubes [deprecated]. More...
 
typedef CombinatorialMultivaluedMap CubicalMap
 An abbreviation for a combinatorial cubical multivalued map. More...
 
typedef CombinatorialMultivaluedMap cubicalmap
 A lower-case version of the name of a combinatorial cubical multivalued map [deprecated]. More...
 
typedef tPointBase< coordinatePointBase
 The default type of the point base class. More...
 
typedef short int coordinate
 The default type of coordinates. More...
 
typedef tPointset< coordinatepointset
 The pointset class with the default type of coordinates. More...
 
typedef tNeighbors< coordinateneighbors
 The neighbors class with the default type of coordinates. More...
 
typedef tRectangle< coordinaterectangle
 The rectangle class with the default type of coordinates. More...
 
typedef short int theLayerType
 The type of the layer variable. More...
 
typedef tCube2l< tCubeBase< coordinate > > Cube2l
 A typical full cube in the two-layer setting. More...
 
typedef tCell2l< tCellBase< coordinate > > CubicalCell2l
 A typical cubical cell in the two-layer setting. More...
 
typedef mvmap< Cube2l, Cube2lCombinatorialMultivaluedMap2l
 A typical multivalued map on full cubes in the two-layer setting. More...
 
typedef hashedset< Cube2lSetOfCubes2l
 A typical set of full cubes in the two-layer setting. More...
 
typedef hashedset< CubicalCell2lSetOfCubicalCells2l
 A typical set of cubical cells in the two-layer setting. More...
 
typedef gcomplex< CubicalCell2l, integerCubicalComplex2l
 A typical cubical complex in the two-layer setting. More...
 
typedef mvcellmap< CubicalCell2l, integer, CubicalCell2lCubicalMultivaluedMap2l
 A typical multivalued cubical-cellular map in the two-layer setting. More...
 
typedef chaincomplex< integerChainComplex
 A class for representing a chain complex with integral coefficients. More...
 
typedef chainmap< integerChainMap
 A class for representing a chain map with integral coefficients. More...
 
typedef chain< integerChain
 A class for representing a chain with integral coefficients. More...
 
typedef hashedset< simplexSetOfSimplices
 A class for representing a set of simplices. More...
 
typedef gcomplex< simplex, integerSimplicialComplex
 A class for representing a simplicial complex. More...
 
typedef Simplex simplex
 A lower-case name for a simplex [deprecated]. More...
 
typedef gcomplex< simplex, integersimplicialcomplex
 A lower-case name for a simplicial complex [deprecated]. More...
 
typedef hashedset< simplexsimplices
 An alternative name for a set of simplices [deprecated]. More...
 
typedef BitField bitfield
 A lower-case version of the name of a bit field [deprecated]. More...
 
typedef SetOfBitFields bitfieldset
 A lower-case version of the name of a bit field set [deprecated]. More...
 
typedef signed short numbertype
 The type of number used to store the value of an object of type "integer". More...
 
typedef hashedset< wordwords
 The default type of a set of words. More...
 

Functions

template<class coordinate >
void bit2neighborAlg (int number, const coordinate *src, coordinate *dest, int Dim)
 
template<class settype >
settype::iterator bit2neighborAlg (const typename settype::iterator &q, int n)
 
template<int Dim, int twoPower>
bool operator== (const typename bincube< Dim, twoPower >::neighborhood_iterator &x1, const typename bincube< Dim, twoPower >::neighborhood_iterator &x2)
 
template<int Dim, int twoPower>
bool operator!= (const typename bincube< Dim, twoPower >::neighborhood_iterator &x1, const typename bincube< Dim, twoPower >::neighborhood_iterator &x2)
 
template<int Dim, int twoPower>
std::ostream & operator<< (std::ostream &out, const bincube< Dim, twoPower > &b)
 
template<int Dim, int twoPower>
std::istream & operator>> (std::istream &in, bincube< Dim, twoPower > &b)
 
template<class Number >
int_t hashkey1 (const hashNumber< Number > &n)
 The first hashing key. More...
 
template<class Number >
int_t hashkey2 (const hashNumber< Number > &n)
 The second hashing key. More...
 
template<class SetT , class QueueT >
void addneighbors (const int &c, const SetT &s, QueueT &q)
 Adds the neighbors of the cube 'c' in the set 's' to the set 'q'. More...
 
template<typename SetT , typename Acyclic , typename QueueT >
int reduceFullCubesAlg (SetT &X, bool quiet)
 Reduces the set of full cubes. More...
 
template<class FullCubSet >
int reduceFullCubes (FullCubSet &X, bool quiet=false)
 Reduces the set of full cubes. More...
 
int readbitpoints (std::istream &in, pointset &p, int *bitcode_depth=NULL)
 Reads a set of full cubical sets represented as a set of points from a file encoded in the "bitcode" format used by Bill Kalies. More...
 
int writebitpoints (std::ostream &out, pointset &p, bool sorted=true, int fixed_depth=0, coordinate *fixed_corner=NULL)
 Writes a full cubical set represented by a set of points to a file in the "bitcode" format. More...
 
template<class coordtype >
int_t hashkey1 (const tCellBase< coordtype > &c)
 
template<class coordtype >
int_t hashkey2 (const tCellBase< coordtype > &c)
 
template<class coordtype >
int operator!= (const tCellBase< coordtype > &c1, const tCellBase< coordtype > &c2)
 Checks if the two cells are different. More...
 
template<class coordtype >
tCellBase< coordtype > operator* (const tCellBase< coordtype > &c1, const tCellBase< coordtype > &c2)
 Computes the Cartesian product of two cells. More...
 
template<class coordtype >
std::ostream & operator<< (std::ostream &out, const tCellBase< coordtype > &c)
 Writes a cell to an output stream. More...
 
template<class coordtype >
std::istream & operator>> (std::istream &in, tCellBase< coordtype > &c)
 Reads a cell from an input stream. More...
 
template<class coordtype >
tCellBase< coordtype > boundarycell (const tCellBase< coordtype > &q, int i, bool onlyexisting)
 Computes the i-th boundary element of a cell. More...
 
template<class coordtype >
tCellBase< coordtype > boundarycell (const tCellBase< coordtype > &q, int i)
 Computes the i-th boundary element of a cell. More...
 
template<class coordtype >
int boundarylength (const tCellBase< coordtype > &q)
 Returns the length of the boundary of a cell. More...
 
template<class coordtype >
int boundarycoef (const tCellBase< coordtype > &q, int i)
 Returns the i-th coefficient in the boundary of a cell. More...
 
template<int dimfix, class coordtype >
int_t hashkey1 (const tCellFix< dimfix, coordtype > &c)
 
template<int dimfix, class coordtype >
int_t hashkey2 (const tCellFix< dimfix, coordtype > &c)
 
template<int dimfix, class coordtype >
int operator!= (const tCellFix< dimfix, coordtype > &c1, const tCellFix< dimfix, coordtype > &c2)
 Checks if the two cells are different. More...
 
template<int dim1, int dim2, class coordtype >
tCellFix< dim1+dim2, coordtype > operator* (const tCellFix< dim1, coordtype > &c1, const tCellFix< dim2, coordtype > &c2)
 Computes the Cartesian product of two cells. More...
 
template<int dimfix, class coordtype >
std::ostream & operator<< (std::ostream &out, const tCellFix< dimfix, coordtype > &c)
 Writes a cell to an output stream. More...
 
template<int dimfix, class coordtype >
std::istream & operator>> (std::istream &in, tCellFix< dimfix, coordtype > &c)
 Reads a cell from an input stream. More...
 
template<int dimfix, class coordtype >
tCellFix< dimfix, coordtype > boundarycell (const tCellFix< dimfix, coordtype > &q, int i, bool onlyexisting)
 Computes the i-th boundary element of a cell. More...
 
template<int dimfix, class coordtype >
tCellFix< dimfix, coordtype > boundarycell (const tCellFix< dimfix, coordtype > &q, int i)
 Computes the i-th boundary element of a cell. More...
 
template<int dimfix, class coordtype >
int boundarylength (const tCellFix< dimfix, coordtype > &q)
 Returns the length of the boundary of a cell. More...
 
template<int dimfix, class coordtype >
int boundarycoef (const tCellFix< dimfix, coordtype > &q, int i)
 Returns the i-th coefficient in the boundary of a cell. More...
 
template<class celltype >
celltype CubicalBoundaryCell (const celltype &q, int i, bool onlyexisting)
 Returns the i-th boundary element of a cell. More...
 
template<class celltype >
celltype CubicalBoundaryCell (const celltype &q, int i)
 Returns the i-th cell in the boundary of the given cell. More...
 
template<class celltype >
int CubicalBoundaryLength (const celltype &q)
 Returns the length of the boundary of a cubical cell. More...
 
template<class celltype >
int CubicalBoundaryCoef (const celltype &q, int i)
 Returns the i-th coefficient in the boundary of a cubical cell. More...
 
template<class celltype >
std::ostream & WriteCubicalCell (std::ostream &out, const celltype &c)
 Writes a cubical cell to the output stream in the text form. More...
 
template<class celltype >
std::istream & ReadCubicalCell (std::istream &in, celltype &c)
 Reads a cubical cell form the input text stream. More...
 
template<class coordtype >
int CommonCell (coordtype *left, coordtype *right, const coordtype *c1, const coordtype *c2, int spcdim, const coordtype *wrap=0)
 Computes the left and right corner of a cell which is the intersection of the two given cubes. More...
 
template<class coordtype >
int_t hashkey1 (const tCellVar< coordtype > &c)
 
template<class coordtype >
int_t hashkey2 (const tCellVar< coordtype > &c)
 
template<class coordtype >
int operator!= (const tCellVar< coordtype > &c1, const tCellVar< coordtype > &c2)
 Checks if the two cells are different. More...
 
template<class coordtype >
tCellVar< coordtype > operator* (const tCellVar< coordtype > &c1, const tCellVar< coordtype > &c2)
 Computes the Cartesian product of two cells. More...
 
template<class coordtype >
std::ostream & operator<< (std::ostream &out, const tCellVar< coordtype > &c)
 Writes a cell to an output stream. More...
 
template<class coordtype >
std::istream & operator>> (std::istream &in, tCellVar< coordtype > &c)
 Reads a cell from an input stream. More...
 
template<class coordtype >
tCellVar< coordtype > boundarycell (const tCellVar< coordtype > &q, int i, bool onlyexisting)
 Computes the i-th boundary element of a cell. More...
 
template<class coordtype >
tCellVar< coordtype > boundarycell (const tCellVar< coordtype > &q, int i)
 Computes the i-th boundary element of a cell. More...
 
template<class coordtype >
int boundarylength (const tCellVar< coordtype > &q)
 Returns the length of the boundary of a cell. More...
 
template<class coordtype >
int boundarycoef (const tCellVar< coordtype > &q, int i)
 Returns the i-th coefficient in the boundary of a cell. More...
 
template<class coordtype >
int_t hashkey1 (const tCubeBase< coordtype > &c)
 
template<class coordtype >
int_t hashkey2 (const tCubeBase< coordtype > &c)
 
template<class coordtype >
int operator!= (const tCubeBase< coordtype > &c1, const tCubeBase< coordtype > &c2)
 The operator != for comparing full cubes. More...
 
template<class coordtype >
tCubeBase< coordtype > operator* (const tCubeBase< coordtype > &c1, const tCubeBase< coordtype > &c2)
 Computes the Cartesian product of two cubes. More...
 
template<class coordtype >
std::ostream & operator<< (std::ostream &out, const tCubeBase< coordtype > &c)
 Writes a cube to an output stream in the text mode. More...
 
template<class coordtype >
std::istream & operator>> (std::istream &in, tCubeBase< coordtype > &c)
 Reads a cube from an input stream in the text mode. More...
 
template<class coordtype >
std::istream & operator>> (std::istream &in, hashedset< tCubeBase< coordtype > > &s)
 Reads a set of cubes from an input stream in the text mode. More...
 
template<class coordtype >
std::istream & operator>> (std::istream &in, mvmap< tCubeBase< coordtype >, tCubeBase< coordtype > > &m)
 Reads a cubical map from an input stream in the text mode. More...
 
template<int dimfix, class coordtype >
int_t hashkey1 (const tCubeFix< dimfix, coordtype > &c)
 
template<int dimfix, class coordtype >
int_t hashkey2 (const tCubeFix< dimfix, coordtype > &c)
 
template<int dim1, int dim2, class coordtype >
int operator!= (const tCubeFix< dim1, coordtype > &c1, const tCubeFix< dim2, coordtype > &c2)
 The operator != for comparing full cubes. More...
 
template<int dim1, int dim2, class coordtype >
tCubeFix< dim1+dim2, coordtype > operator* (const tCubeFix< dim1, coordtype > &c1, const tCubeFix< dim2, coordtype > &c2)
 Computes the Cartesian product of two cubes. More...
 
template<int dimfix, class coordtype >
std::ostream & operator<< (std::ostream &out, const tCubeFix< dimfix, coordtype > &c)
 Writes a cube to an output stream in the text mode. More...
 
template<int dimfix, class coordtype >
std::istream & operator>> (std::istream &in, tCubeFix< dimfix, coordtype > &c)
 Reads a cube from an input stream in the text mode. More...
 
template<int dimfix, class coordtype >
std::istream & operator>> (std::istream &in, hashedset< tCubeFix< dimfix, coordtype > > &s)
 Reads a set of cubes from an input stream in the text mode. More...
 
template<int dimfix, class coordtype >
std::istream & operator>> (std::istream &in, mvmap< tCubeFix< dimfix, coordtype >, tCubeFix< dimfix, coordtype > > &m)
 Reads a cubical map from an input stream in the text mode. More...
 
template<class dest_cube , class src_cube >
dest_cube cube_cast (const src_cube &src)
 Converts one cube into another. More...
 
template<class cubetype >
std::ostream & WriteCube (std::ostream &out, const cubetype &c)
 Writes a cube to the output stream in the text mode. More...
 
template<class cubetype >
std::istream & ReadCubeFix (std::istream &in, cubetype &c, int dimfix)
 Reads a cube from the input text stream. More...
 
template<class cubetype >
std::istream & ReadCube (std::istream &in, cubetype &c)
 Reads a cube from the input text stream. More...
 
template<class cubsettype >
std::istream & ReadCubes (std::istream &in, cubsettype &s)
 Reads a set of cubes and ignores the line at the beginning of the file which starts with the letter 'd' (like "dimension 2"). More...
 
template<class tCube >
std::istream & ReadCubicalMap (std::istream &in, mvmap< tCube, tCube > &m)
 Reads a combinatorial cubical multivalued map from an input text stream. More...
 
template<class coordtype >
int_t hashkey1 (const tCubeVar< coordtype > &c)
 
template<class coordtype >
int_t hashkey2 (const tCubeVar< coordtype > &c)
 
template<class coordtype >
int operator!= (const tCubeVar< coordtype > &c1, const tCubeVar< coordtype > &c2)
 The operator != for comparing full cubes. More...
 
template<class coordtype >
tCubeVar< coordtype > operator* (const tCubeVar< coordtype > &c1, const tCubeVar< coordtype > &c2)
 Computes the Cartesian product of two cubes. More...
 
template<class coordtype >
std::ostream & operator<< (std::ostream &out, const tCubeVar< coordtype > &c)
 Writes a cube to an output stream in the text mode. More...
 
template<class coordtype >
std::istream & operator>> (std::istream &in, tCubeVar< coordtype > &c)
 Reads a cube from an input stream in the text mode. More...
 
template<class coordtype >
std::istream & operator>> (std::istream &in, hashedset< tCubeVar< coordtype > > &s)
 Reads a set of cubes from an input stream in the text mode. More...
 
template<class coordtype >
std::istream & operator>> (std::istream &in, mvmap< tCubeVar< coordtype >, tCubeVar< coordtype > > &m)
 Reads a cubical map from an input stream in the text mode. More...
 
template<class euclidom , class tCell >
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. More...
 
template<class euclidom , class tCell , class tCube >
int_t createimages (mvcellmap< tCell, euclidom, tCube > &m, const mvmap< tCube, tCube > &f1, const mvmap< tCube, tCube > &f2, const hashedset< tCube > &dom1, const hashedset< tCube > &dom2)
 Creates images of cells in 'm' as unions of cubes determined by f1 and f2. More...
 
template<class euclidom , class tCell , class tCube >
int_t createimages (mvcellmap< tCell, euclidom, tCube > &m, const mvmap< tCube, tCube > &f, const hashedset< tCube > &dom)
 A wrapper for the above function if there is only one map. More...
 
template<class euclidom , class tCell , class tCube >
int_t createimages (mvcellmap< tCell, euclidom, tCube > &m, const mvmap< tCube, tCube > &f1, const mvmap< tCube, tCube > &f2)
 Creates images of cells in m as unions of cubes determined by f1 and f2. More...
 
template<class euclidom , class tCell , class tCube >
int_t createimages (mvcellmap< tCell, euclidom, tCube > &m, const mvmap< tCube, tCube > &f)
 A wrapper for the above function if there is only one map. More...
 
template<class euclidom , class tCell >
void createprojection (const gcomplex< tCell, euclidom > &Fcompl, const gcomplex< tCell, euclidom > &Ycompl, chainmap< euclidom > &cmap, int offset, int outdim, int discarddim, int *level=NULL)
 Creates the chain map of the projection from a cell complex of the graph of a map to a cell complex of the codomain of the map. More...
 
template<class euclidom , class tCell >
void project (const gcomplex< tCell, euclidom > &c, gcomplex< tCell, euclidom > &img, const gcomplex< tCell, euclidom > &only, int offset, int outdim, int discarddim, const int *level, bool watchforimages)
 Creates the image of the projection from the set of cubical cells in the given geometric complex to the subspace of R^n spanned by the 'outdim' subsequent standard vectors with the first number 'offset'. More...
 
template<class tCube >
std::istream & readdomain (std::istream &in, hashedset< tCube > &dom)
 Reads the domain of a multivalued cubical map. More...
 
template<class tCube >
std::istream & readimage (std::istream &in, hashedset< tCube > &img)
 Reads the image of a multivalued cubical map. More...
 
template<class tCube >
std::istream & readimage (std::istream &in, const hashedset< tCube > &dom, hashedset< tCube > &img)
 Read the image of a set under a multivalued cubical map. More...
 
template<class tCube >
std::istream & readselective (std::istream &in, const hashedset< tCube > &dom1, const hashedset< tCube > &dom2, mvmap< tCube, tCube > &m)
 Reads the restriction of a multivalued map to the given pair of sets. More...
 
template<class tCube >
std::istream & readselective (std::istream &in, const hashedset< tCube > &dom, mvmap< tCube, tCube > &m)
 Reads a restriction of a multivalued cubical map to the given set. More...
 
int_t getmaxneighbors (int dim)
 Returns the maximal number of neighbors of a cube: 3^dim - 1. More...
 
template<class tCube >
int_t neighbor2bit (const tCube &q, const tCube &neighbor)
 Returns the number of the neighbor bit for the given neighbor of 'q' or -1 if not a neighbor or the same cube as 'q'. More...
 
template<class tCube >
int_t neighbor2bit (const tCube &q, const typename tCube::CellType &face)
 Returns the number of the neighbor bit for the neighbor which intersects the given cube at the face provided. More...
 
template<class tCube >
tCube bit2neighbor (const tCube &q, int_t number, bool unconditional=false)
 Creates the neighbor of the given cube with the specified number. More...
 
template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t getneighbors_scan (const tCube &q, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
 Gets neighbors of the given cube from the given set and indicates them in the bit field provided. More...
 
template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t getneighbors_generate (const tCube &q, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
 Gets neighbors of the given cube from the given set and indicates them in the bit field provided. More...
 
template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t getneighbors (const tCube &q, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
 Gets neighbors of the given cube from the given set and indicates them in the bit field provided. More...
 
template<class tCube , class tCubeSet >
int_t getneighbors (const tCube &q, BitField *bits, const tCubeSet &theset, int_t limit)
 Gets neighbors of the given cube from the given set and indicates them in the bit field provided. More...
 
template<class tCube , class tCubeSet >
int_t addneighbors (const tCube &q, const BitField &bits, tCubeSet &set, const tCubeSet &notthese)
 Adds neighbors listed in the given bit field to the set of cubes unless they are in the 'forbidden' set. More...
 
template<class tCube , class tCubeSet >
int_t addneighbors (const tCube &q, const BitField &bits, tCubeSet &set, bool unconditional=false)
 Adds neighbors listed in the given bit field to the set of cubes. More...
 
template<class tCube , class tCell >
int_t addneighbors (const tCube &q, const BitField &bits, gcomplex< tCell, integer > &c, bool unconditional=false)
 Adds intersections of neighbors listed in the given bit field with the given cube to the cubical complex. More...
 
template<class coordtype >
int thesame (const coordtype *c1, const coordtype *c2, int dim)
 Compare two points. Returns true iff they have the same coordinates. More...
 
template<class coordtype >
void copycoord (coordtype *destination, const coordtype *source, int dim)
 Copies the coordinates of one point to another. More...
 
template<class coordtype >
void wrapcoord (coordtype *destination, const coordtype *source, const coordtype *wrap, int dim)
 Wraps coordinates stored in 'c' accordint to the wrap table 'wrap' and store the result in the table called 'result'. More...
 
template<>
void wrapcoord< double > (double *destination, const double *source, const double *wrap, int dim)
 Wraps coordinates stored in 'c' accordint to the wrap table 'wrap' and store the result in the table called 'result'. More...
 
bool numberisprime (unsigned n)
 Verifies if the given number is a prime number. More...
 
unsigned ceilprimenumber (unsigned n)
 Computes the smallest prime number greater than or equal to the given number. More...
 
template<class coordtype >
int_t pointhashkey (const coordtype *c, int dim, int_t hashsize)
 Generates the main hashing key for points. More...
 
template<class coordtype >
int_t pointhashadd (const coordtype *c, int dim, int_t hashsize)
 Generates the second hashing key for points. More...
 
template<class coordtype >
coordtype rounddown (double x)
 Rounds down the given real number to an integral type. More...
 
template<class coordtype >
void roundpoint (const double *p, coordtype *c, const double *grid, int dim)
 Rounds down the double coordinates of a point to integer ones. More...
 
template<class coordtype >
void cubemiddle (coordtype *c, double *p, double *grid, int dim)
 Computes the middle of a cube with its left lower etc. More...
 
template<class coordtype >
coordtype * allocatepoint (int dim, char *errormessage=NULL)
 Allocate a point with 'new'. In case of failure throw an error message. More...
 
template<class coordtype >
int countneighbors (const tPointset< coordtype > &p, const coordtype *c, int which=1, int maxcount=0)
 Counts how many neighbors of the point there are in the set, depending on 'which': 1 = in the set, 0 = out of the set. More...
 
template<class coordtype >
int countneighbors (const tPointset< coordtype > &p, const tPointset< coordtype > &q, const coordtype *c, int which=1, int maxcount=0)
 Counts neighbors with respect to the union of the sets 'p' and 'q'. More...
 
template<class coordtype >
int attheborder (const tPointset< coordtype > &p, const coordtype *c)
 Verifies if the point is at the border of a given set. More...
 
template<class coordtype >
int_t findboundarypoint (tPointset< coordtype > &p, int_t n, int direction=1)
 Finds a boundary point starting at the given one. More...
 
template<class coordtype >
int_t findboundarypoint (tPointset< coordtype > &p, tPointset< coordtype > &q, int_t n, int direction=1)
 Finds a point in 'p' at the boundary of the union of 'p' and 'q'. More...
 
template<class coordtype >
tPointset< coordtype > * computeboundary (tPointset< coordtype > &p)
 Creates the set of all the boundary points with the 'new' operator. More...
 
template<class coordtype >
void computeboundary (tPointset< coordtype > &p, tPointset< coordtype > &b)
 Computes the boundary points of the given set and adds them to the other set of points. More...
 
template<class coordtype >
void enhancepoint (tPointset< coordtype > &p, coordtype *c)
 Enhances the set by adding the neighborhood of the point with given coordinates. More...
 
template<class coordtype >
void enhancepoint (tPointset< coordtype > &p, int_t n)
 Enhances the set by adding the neighborhood of the point with given number. More...
 
template<class coordtype >
void enhance (tPointset< coordtype > &p)
 Enhances the set of points by adding to it all the neighbors of all the points in the set. More...
 
template<class coordtype >
int read (textfile &f, coordtype *c, int maxdim)
 Reads a point from a text file and removes a pair of parentheses, braces or brackets if present. More...
 
template<class coordtype >
int read (std::istream &in, coordtype *c, int maxdim)
 Reads a point from a text file and removes a pair of parentheses, braces or brackets if present. More...
 
template<class coordtype >
int write (std::ostream &out, const coordtype *c, int dim, char parenthesis=40, char closing=0)
 
template<class coordtype >
int readcubeorcell (std::istream &in, coordtype *left, coordtype *right, int maxdim, int *type=NULL)
 Reads a cube or a cell from a text file. More...
 
template<class coordtype >
int_t read (textfile &f, tPointset< coordtype > &p, int_t first=0, int_t howmany=-1, coordtype *wrap=NULL, int maxdim=0, int quiet=0, tPointset< coordtype > *notthese=NULL)
 Reads a set of points from an input stream (starting at the point given). More...
 
template<class coordtype >
int_t read (std::istream &in, tPointset< coordtype > &p, int_t first=0, int_t howmany=-1, coordtype *wrap=NULL, int maxdim=0, int quiet=0, tPointset< coordtype > *notthese=NULL)
 Reads a set of points from an input stream (starting at the point given). More...
 
template<class coordtype >
int_t read (textfile &f, tPointset< coordtype > &p, coordtype *wrap, int maxdim, int quiet=0, tPointset< coordtype > *notthese=NULL)
 Reads a set of points from an input stream (starting at the point given). More...
 
template<class coordtype >
int_t read (std::istream &in, tPointset< coordtype > &p, coordtype *wrap, int maxdim, int quiet=0, tPointset< coordtype > *notthese=NULL)
 Reads a set of points from an input stream (starting at the point given). More...
 
template<class coordtype >
textfileoperator>> (textfile &f, tPointset< coordtype > &p)
 Reads a set of points from an input stream (starting at the point given). More...
 
template<class coordtype >
std::istream & operator>> (std::istream &in, tPointset< coordtype > &p)
 Reads a set of points from an input stream (starting at the point given). More...
 
template<class coordtype >
int_t write (std::ostream &out, tPointset< coordtype > &p, int_t first=0, int_t howmany=-1, int quiet=0)
 Writes a set of points to a file (starting at the point given). More...
 
template<class coordtype >
std::ostream & operator<< (std::ostream &out, tPointset< coordtype > &p)
 Writes a set of points to a file (starting at the point given). More...
 
std::ostream & operator<< (std::ostream &out, const psethashstat &s)
 Writes the information gathered in a hashing statistics collector object to an output stream. More...
 
template<class coordtype >
int countneighbors (const tPointset< coordtype > &p, const tPointset< coordtype > &q, coordtype *c, int which, int maxcount)
 
template<class coordtype >
void computeboundary (const tPointset< coordtype > &p, tPointset< coordtype > &b)
 
template<class coordtype >
int readcoordinates (std::istream &in, coordtype *coord, int maxdim, int closing)
 Reads the coordinates of a point. More...
 
template<class coordtype >
int readcoordinates (std::istream &in, coordtype *coord, int maxdim)
 
template<class tCube >
int_t hashkey1 (const tCube2l< tCube > &c)
 
template<class tCube >
int_t hashkey2 (const tCube2l< tCube > &c)
 
template<class tCube >
int operator== (const tCube2l< tCube > &c1, const tCube2l< tCube > &c2)
 The operator == verifies if two cubes are equal. More...
 
template<class tCube >
int operator!= (const tCube2l< tCube > &c1, const tCube2l< tCube > &c2)
 The operator != verifies whether two cubes are different. More...
 
template<class tCube >
tCube2l< tCube > operator* (const tCube2l< tCube > &c1, const tCube2l< tCube > &c2)
 The operator * computes the Cartesian product of two cubes. More...
 
template<class tCube >
std::ostream & operator<< (std::ostream &out, const tCube2l< tCube > &c)
 The operator << writes a cube to the output stream in the text mode. More...
 
template<class tCube >
std::istream & operator>> (std::istream &in, tCube2l< tCube > &c)
 The operator >> reads a cube from the input stream in the text mode. More...
 
template<class tCube >
std::istream & operator>> (std::istream &in, hashedset< tCube2l< tCube > > &s)
 A specialized version of the operator >> for reading a set of cubes and ignores the first line "dimension N". More...
 
template<class tCube >
std::istream & operator>> (std::istream &in, mvmap< tCube2l< tCube >, tCube2l< tCube > > &m)
 A specialized version of the operator >> that reads a combinatorial cubical multivalued map. More...
 
template<class tCell >
int_t hashkey1 (const tCell2l< tCell > &c)
 
template<class tCell >
int_t hashkey2 (const tCell2l< tCell > &c)
 
template<class tCell >
int operator== (const tCell2l< tCell > &c1, const tCell2l< tCell > &c2)
 The operator == verifies if two cells are equal. More...
 
template<class tCell >
int operator!= (const tCell2l< tCell > &c1, const tCell2l< tCell > &c2)
 The operator != verifies whether two cubes are different. More...
 
template<class tCell >
tCell2l< tCell > operator* (const tCell2l< tCell > &c1, const tCell2l< tCell > &c2)
 The operator * computes the Cartesian product of two cells. More...
 
template<class tCell >
std::ostream & operator<< (std::ostream &out, const tCell2l< tCell > &c)
 The operator << writes a cubical cell to the text output stream. More...
 
template<class tCell >
std::istream & operator>> (std::istream &in, tCell2l< tCell > &c)
 The operator >> reads a cubical cell from the text input stream. More...
 
template<class tCell >
tCell2l< tCell > boundarycell (const tCell2l< tCell > &q, int i, bool onlyexisting)
 Computes the given boundary element of a cell. More...
 
template<class tCell >
tCell2l< tCell > boundarycell (const tCell2l< tCell > &q, int i)
 Computes the given boundary element of a cell. More...
 
template<class tCell >
int boundarylength (const tCell2l< tCell > &q)
 Returns the length of the boundary of a cell. More...
 
template<class tCell >
int boundarycoef (const tCell2l< tCell > &q, int i)
 Returns the given coefficient in the boundary of a cell. More...
 
template<class tCube >
tCube2l< tCube > bit2neighbor (const tCube2l< tCube > &q, int_t number, bool unconditional=false)
 Specialization of the "bit2neighbor" function for two-layer cubes. More...
 
template<class tCube >
int_t neighbor2bit (const tCube2l< tCube > &q, const tCube2l< tCube > &neighbor)
 Specialization of the "neighbor2bit" function for two-layer cubes. More...
 
template<class tCube >
bool intersection2l (const tCube &q0, const tCube &q1, BitField *bits)
 Computes the intersection between two cubes at different layers. More...
 
template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t getneighbors_scan (const tCube2l< tCube > &q2l, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
 Specialization of the function which gets neighbors of the given cube by scanning the entire set of possible neighbors. More...
 
template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t getneighbors_generate (const tCube2l< tCube > &q2l, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
 Specialization of the function which gets neighbors of the given cube by generating all the possible neighbors and checking if they are present in the given set. More...
 
template<class euclidom , class tCell , class tCube >
int_t createimages (mvcellmap< tCell2l< tCell >, euclidom, tCube2l< tCube > > &m, const mvmap< tCube2l< tCube >, tCube2l< tCube > > &f1, const mvmap< tCube2l< tCube >, tCube2l< tCube > > &f2, const hashedset< tCube2l< tCube > > &dom1, const hashedset< tCube2l< tCube > > &dom2)
 Specialization of the "createimages" function for two-layer cubes. More...
 
template<class NeighborCheck >
bool acyclic1d (NeighborCheck &n)
 Verifies whether the neighborhood of a 1-dimensional "cube" is acyclic. More...
 
template<class NeighborCheck >
bool acyclic2d (NeighborCheck &n)
 Verifies whether the neighborhood of a 2-dimensional "cube" is acyclic. More...
 
template<class NeighborCheck >
bool acyclic3d_Malandain (NeighborCheck &n)
 Verifies whether the neighborhood of a 3-dimensional cube is acyclic. More...
 
template<class NeighborCheck >
bool acyclic3d (NeighborCheck &n)
 Verifies whether the neighborhood of a 3-dimensional cube is acyclic. More...
 
template<class tCube , class tCubeSet >
bool bddacyclic (const tCube &q, int dim, const tCubeSet &s, BitField &b)
 Uses binary decision diagrams to verify whether the neighborhood of the given cube in the given set is acyclic. More...
 
template<class euclidom >
outputstreamshow_homology (outputstream &out, const chain< euclidom > &c)
 Shows a chain as a list of generators of one level of a homology module. More...
 
template<class euclidom >
std::ostream & show_homology (std::ostream &out, const chain< euclidom > &c)
 Shows a chain as a list of generators of one level of a homology module. More...
 
template<class euclidom >
std::ostream & operator<< (std::ostream &out, const chain< euclidom > &c)
 Outputs the given chain to a standard output stream in the text mode. More...
 
template<class euclidom >
std::istream & operator>> (std::istream &in, chain< euclidom > &c)
 Reads a chain from a standard input stream in the text mode. More...
 
template<class euclidom >
std::ostream & operator<< (std::ostream &out, const mmatrix< euclidom > &m)
 Writes a matrix to the output stream as a map in terms of columns. More...
 
template<class euclidom >
std::ostream & operator<< (std::ostream &out, const chaincomplex< euclidom > &c)
 Writes a chain complex to an output stream in the text format. More...
 
template<class euclidom >
std::ostream & operator<< (std::ostream &out, const chainmap< euclidom > &m)
 Writes a chain map to an output stream in the text format. More...
 
bool acyclic (int dim, BitField &b)
 Checks whether this cube's nieghbors form an acyclic set. More...
 
template<class tCube >
bool acyclic (const hashedset< tCube > &cset)
 Checks whether the given set of cubes is acyclic. More...
 
template<class tCube , class tCubeSet1 , class tCubeSet2 >
bool acyclic (const tCube &q, int dim, const tCubeSet1 &cset, BitField *b, int_t maxneighbors, tCubeSet2 *neighbors)
 Verifies the acyclicity of a neighborhood of the given cube. More...
 
template<class tCube , class tCubeSet >
bool acyclic (const tCube &q, int dim, const tCubeSet &cset, BitField *b, int_t maxneighbors)
 Verifies the acyclicity of a neighborhood of the given cube. More...
 
template<class tCube , class tSet1 , class tSet2 >
bool acyclic_rel (const tCube &q, int dim, const tSet1 &cset, const tSet2 &other, BitField *b, int_t maxneighbors, hashedset< tCube > *neighbors_main, hashedset< tCube > *neighbors_other)
 Verifies whether a cube from the other set can be removed. More...
 
template<class tCube , class tCell , class tSet >
int_t computeimage (hashedset< tCube > &img, const tCell &face, const mvmap< tCube, tCube > &map, const tSet &cset, const tCube &ignore)
 Computes the image of the face under the combinatorial cubical multivalued map, but doesn't take the given cube into consideration. More...
 
template<class tCube , class tSet >
bool remainsacyclic (const mvmap< tCube, tCube > &map, const tCube &q, const tSet &cset)
 Verifies if the map remains acyclic after the addition or removal of the given cube to/from the union of the first and the second set. More...
 
template<class tCube >
int_t cubreducequiet (hashedset< tCube > &cset, hashedset< tCube > &other, mvmap< tCube, tCube > &cubmap, const hashedset< tCube > &keep, bool quiet=true)
 Reduces a pair of sets of cubes for relative homology computation. More...
 
template<class tCube >
int_t cubreduce (hashedset< tCube > &cset, hashedset< tCube > &other, mvmap< tCube, tCube > &cubmap, const hashedset< tCube > &keep)
 Reduces a pair of sets of cubes for relative homology computation. More...
 
template<class tCube >
int_t cubreducequiet (hashedset< tCube > &cset, hashedset< tCube > &other, const hashedset< tCube > &keep, bool quiet=true)
 Reduces a pair of sets of cubes for relative homology computation. More...
 
template<class tCube >
int_t cubreduce (hashedset< tCube > &cset, hashedset< tCube > &other, const hashedset< tCube > &keep)
 Reduces a pair of sets of cubes for relative homology computation. More...
 
template<class tCube >
int_t cubreducequiet (const hashedset< tCube > &maincset, hashedset< tCube > &cset, bool quiet=true)
 Reduce the set 'cset' towards 'maincset'. More...
 
template<class tCube >
int_t cubreduce (const hashedset< tCube > &maincset, hashedset< tCube > &cset)
 Reduces a set of cubes towards the main set. More...
 
template<class tCube >
int_t cubexpand (hashedset< tCube > &cset, hashedset< tCube > &other, bool quiet=false)
 Expands the set 'other' towards 'cset' without changing the homology of (cset + other, other). More...
 
template<class tCube >
int_t cubexpand (hashedset< tCube > &cset, hashedset< tCube > &other, hashedset< tCube > &imgsrc, hashedset< tCube > &img, const mvmap< tCube, tCube > &map, bool indexmap, bool checkacyclic, bool quiet=false)
 Expands the set 'other' towards 'cset' without changing the homology of (cset + other, other). More...
 
template<class cell >
int boundarycoef (const cell &, int i)
 
template<class cell >
int boundarylength (const cell &)
 
template<class cell >
cell boundarycell (const cell &, int i)
 
template<class element >
int_t findelem (const multitable< element > &tab, const element &e, int_t len)
 Finds the given element in the table of given length. More...
 
template<class cell , class euclidom >
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. More...
 
template<class cell , class euclidom >
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. More...
 
template<class cell , class euclidom >
chaincomplex< euclidom > & createchaincomplex (chaincomplex< euclidom > &c, const gcomplex< cell, euclidom > &g, const gcomplex< cell, euclidom > &rel, bool quiet=false)
 Creates a relative algebraic chain complex with the data from the given pair of geometric cell complexes. More...
 
template<class cell , class euclidom >
std::ostream & writegenerators (std::ostream &out, const chain< euclidom > *hom, const chaincomplex< euclidom > &c, const gcomplex< cell, euclidom > &g, const int *level=NULL)
 Writes the homology generators of the geometric complex to a file. More...
 
template<class cell , class euclidom >
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. More...
 
template<class cell , class euclidom >
bool acyclic (gcomplex< cell, euclidom > &c)
 Checks whether this chain complex is acyclic. More...
 
template<class cell , class euclidom >
std::ostream & operator<< (std::ostream &out, const gcomplex< cell, euclidom > &c)
 Writes a geometric complex to the output stream in the text format. More...
 
template<class cell , class euclidom >
std::istream & operator>> (std::istream &in, gcomplex< cell, euclidom > &c)
 Reads a geometric complex from an input stream in the text format. More...
 
template<class cell , class euclidom , class element >
void creategraph (const mvcellmap< cell, euclidom, element > &m, gcomplex< cell, euclidom > &c, bool addbd)
 Creates the full graph of a map as a cellular complex. More...
 
template<class cell , class euclidom , class element >
void creategraph (const mvcellmap< cell, euclidom, element > &m, const gcomplex< cell, euclidom > &rel, gcomplex< cell, euclidom > &c, bool addbd)
 Creates the full graph of a map as a cellular complex. More...
 
template<class cell , class euclidom , class element >
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. More...
 
template<class cell , class euclidom , class element >
bool createcellmap (const mvcellmap< cell, euclidom, element > &m, const mvcellmap< cell, euclidom, element > &rel, mvcellmap< cell, euclidom, cell > &cm, bool verifyacyclicity)
 Creates the graph of the map as a cell complex while reducing as possible. More...
 
template<class cell , class euclidom , class element >
std::ostream & operator<< (std::ostream &out, const mvcellmap< cell, euclidom, element > &m)
 Writes a multivalued cellular map to the output stream. More...
 
template<class euclidom >
int BettiNumber (const chain< euclidom > &c)
 Returns the Betti number that corresponds to the given chain which describes one homology group. More...
 
template<class euclidom >
int TorsionCoefficient (const chain< euclidom > &c, int start=0)
 Returns the next position in the chain containing a torsion coefficient. More...
 
template<class euclidom >
void ShowHomology (const chain< euclidom > &c)
 Shows (that is, writes to 'sout') one level of the homology module encoded in the given chain. More...
 
template<class euclidom >
void ShowHomology (const chain< euclidom > *hom, int maxlevel)
 Shows (that is, writes to 'sout') the entire homology module encoded in an array of chains. More...
 
template<class euclidom >
void ShowHomology (const chainmap< euclidom > &hmap)
 Show (that is, writes to 'sout') the homology map encoded in terms of a chain map. More...
 
template<class euclidom >
void ShowGenerator (const chain< euclidom > &c)
 Shows (that is, writes to 'sout') one generator of the homology module of a chain complex. More...
 
template<class euclidom >
void ShowGenerators (const chain< euclidom > *c, int count)
 Shows (that is, writes to 'sout') all the generators of one level of the homology module of a chain complex. More...
 
template<class euclidom >
void ShowGenerators (chain< euclidom > const *const *const gen, const chain< euclidom > *hom, int maxlevel)
 Shows (that is, writes to 'sout') all the generators of the entire homology module of a chain complex. More...
 
template<class euclidom >
void ShowGenerators (const chaincomplex< euclidom > &c, const chain< euclidom > *hom, int maxlevel)
 Shows (that is, writes to 'sout') all the generators of the entire homology module of a chain complex. More...
 
template<class cell , class euclidom >
void ShowGenerator (const chain< euclidom > &c, const hashedset< cell > &s)
 Shows (that is, writes to 'sout') one generator of the homology module of a geometric complex. More...
 
template<class cell , class euclidom >
void ShowGenerators (const chain< euclidom > *c, int count, const hashedset< cell > &s)
 Shows (that is, writes to 'sout') all the generators of one level of the homology module of a geometric complex. More...
 
template<class euclidom , class cell >
void ShowGenerators (chain< euclidom > *const *gen, const chain< euclidom > *hom, int maxlevel, const gcomplex< cell, euclidom > &gcompl)
 Shows all the generators of the entire homology module of a geometric complex. More...
 
template<class euclidom >
chain< euclidom > ** ExtractGenerators (const chaincomplex< euclidom > &cx, chain< euclidom > *hom, int maxlevel)
 Extracts homology generators from a chain complex in the simple form. More...
 
template<class euclidom >
int Homology (chaincomplex< euclidom > &cx, const char *Xname, chain< euclidom > *&hom)
 Transforms the chain complex into a simple form and compute its homology. More...
 
template<class cell , class euclidom >
int Homology (gcomplex< cell, euclidom > &Xcompl, const char *Xname, chain< euclidom > *&hom, chain< euclidom > ***gen=0)
 Computes the homology of a given cubical complex. More...
 
template<class euclidom , class cubetype >
int Homology (hashedset< cubetype > &Xcubes, const char *Xname, chain< euclidom > *&hom, chain< euclidom > ***gen=0, gcomplex< typename cubetype::CellType, euclidom > **gcompl=0)
 Computes the homology of a given set of cubes. More...
 
template<class cell , class euclidom >
int Homology (gcomplex< cell, euclidom > &Xcompl, const char *Xname, gcomplex< cell, euclidom > &Acompl, const char *Aname, chain< euclidom > *&hom, chain< euclidom > ***gen=0)
 Computes the relative homology of the given pair of cubical complexes. More...
 
template<class euclidom , class cubetype >
int Homology (hashedset< cubetype > &Xcubes, const char *Xname, hashedset< cubetype > &Acubes, const char *Aname, chain< euclidom > *&hom, chain< euclidom > ***gen=0, gcomplex< typename cubetype::CellType, euclidom > **gcompl=0)
 Computes the relative homology of a given pair of sets of cubes. More...
 
template<class euclidom >
chainmap< euclidom > * HomologyMap (const chainmap< euclidom > &cmap, const chain< euclidom > *hom_cx, const chain< euclidom > *hom_cy, int maxlevel)
 Extracts the homomorphism induced in homology from the chain map on two chain complexes whose homology has just been computed. More...
 
template<class euclidom >
chainmap< euclidom > * HomologyMap (const chainmap< euclidom > &cmap, const chain< euclidom > *hom_cx, int maxlevel)
 Extracts the endomorphism induced in homology from the chain map on one chain complex whose homology has just been computed. More...
 
template<class euclidom , class cubetype >
int Homology (mvmap< cubetype, cubetype > &Fcubmap, const char *Fname, hashedset< cubetype > &Xcubes, const char *Xname, hashedset< cubetype > &Acubes, const char *Aname, hashedset< cubetype > &Ycubes, const char *Yname, hashedset< cubetype > &Bcubes, const char *Bname, chain< euclidom > *&hom_cx, int &maxlevel_cx, chain< euclidom > *&hom_cy, int &maxlevel_cy, chainmap< euclidom > *&hom_f, bool inclusion=false, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< typename cubetype::CellType, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< typename cubetype::CellType, euclidom > **gycompl=0)
 Computes the homomorphism induced in homology by a combinatorial cubical multivalued map. More...
 
template<class euclidom , class cubetype >
int Homology (mvmap< cubetype, cubetype > &Fcubmap, hashedset< cubetype > &Xcubes, hashedset< cubetype > &Acubes, hashedset< cubetype > &Ycubes, hashedset< cubetype > &Bcubes, chain< euclidom > *&hom_cx, int &maxlevel_cx, chain< euclidom > *&hom_cy, int &maxlevel_cy, chainmap< euclidom > *&hom_f, bool inclusion=false, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< typename cubetype::CellType, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< typename cubetype::CellType, euclidom > **gycompl=0)
 A version of the above procedure with the default names. More...
 
template<class euclidom , class cubetype >
int Homology (mvmap< cubetype, cubetype > &Fcubmap, const char *Fname, hashedset< cubetype > &Xcubes, const char *Xname, hashedset< cubetype > &Acubes, const char *Aname, chain< euclidom > *&hom, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< typename cubetype::CellType, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< typename cubetype::CellType, euclidom > **gycompl=0)
 Computes the endomorphism induced in homology by a combinatorial cubical multivalued map. More...
 
template<class euclidom , class cubetype >
int Homology (mvmap< cubetype, cubetype > &Fcubmap, hashedset< cubetype > &Xcubes, hashedset< cubetype > &Acubes, chain< euclidom > *&hom, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< typename cubetype::CellType, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< typename cubetype::CellType, euclidom > **gycompl=0)
 A version of the above procedure with the default names. More...
 
template<class euclidom , class cubetype >
int Homology2l (mvmap< cubetype, cubetype > &Fcubmap0, const char *Fname, hashedset< cubetype > &Xcubes0, const char *Xname, hashedset< cubetype > &Acubes0, const char *Aname, chain< euclidom > *&hom_cx, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gycompl=0)
 Computes the endomorphism induced in homology by a combinatorial cubical multivalued map using the two-layer construction developped by P. More...
 
template<class euclidom , class cubetype >
int Homology2l (mvmap< cubetype, cubetype > &Fcubmap, hashedset< cubetype > &Xcubes, hashedset< cubetype > &Acubes, chain< euclidom > *&hom, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gycompl=0)
 A version of the above procedure with the default names. More...
 
bool acyclic (const cube &q, const cubes &X)
 Verifies whether the neighborhood of q in X is acyclic. More...
 
template<int dim, int twoPower>
void ComputeBettiNumbers (bincube< dim, twoPower > &b, int *result)
 Computes the Betti Numbers of a set of full cubes in a bincube. More...
 
template<int dim, int twoPower, class coordtype >
void ComputeBettiNumbers (char *binary_buffer, int *result, const coordtype *space_wrapping=0)
 Computes the Betti Numbers of the Homology of a full cubical set defined by means of an n-dimensional bitmap. More...
 
template<class coordtype >
void ComputeBettiNumbers (coordtype *coord, int n, int dim, int *result)
 Computes the Betti numbers of the given set of full cubes. More...
 
template<class coordtype >
void SetSpaceWrapping (int dim, const coordtype *wrap)
 Sets space wrapping in each direction separately. More...
 
template<class tCube >
void scancubes (const char *name)
 Reads all the cubes from the given file and ignores them. More...
 
template<class settype >
void readtheset (const char *name, settype &s, const char *pluralname, const char *what)
 Reads a given set from the file and shows appropriate messages. More...
 
template<class cell , class euclidom >
void readcells (const char *name, gcomplex< cell, euclidom > &s, const char *what)
 Uses the general procedure "readtheset" to read a geometric complex. More...
 
template<class element >
void readelements (const char *name, hashedset< element > &s, const char *what)
 Uses the general procedure "readtheset" to read a set of elements. More...
 
void readelements (const char *name, cubes &cub, const char *what)
 Reads a set of cubes from the given file. More...
 
template<class element >
void readmapdomain (const char *name, hashedset< element > &cub)
 Reads the domain of a cubical multivalued map from the given file. More...
 
template<class element >
void readmapimage (const char *name, hashedset< element > &cub)
 Reads the domain of a cubical multivalued map from the given file. More...
 
template<class element >
void readmapimage (const char *filename, const hashedset< element > &dom, const char *domname, hashedset< element > &cub)
 Reads the image of a set by a cubical multivalued map from the given file. More...
 
template<class element >
void readmaprestriction (mvmap< element, element > &Fcubmap, const char *mapname, const hashedset< element > &Xcubes, const hashedset< element > &Acubes, const char *Xname, const char *purpose=0)
 Reads the restriction of a multivalued map to the union of two sets. More...
 
template<class element >
void readmaprestriction (mvmap< element, element > &Fcubmap, const char *mapname, const hashedset< element > &Xcubes, const char *Xname, const char *purpose=NULL)
 Reads the restriction of a multivalued map to the given set. More...
 
template<class settype >
void savetheset (const char *name, const settype &s, const char *pluralname, const char *what, const char *filecomment=0)
 Saves a given set to a file and shows appropriate messages. More...
 
template<class cell , class euclidom >
void savecells (const char *name, const gcomplex< cell, euclidom > &s, const char *what, const char *filecomment=0)
 Uses the general procedure "savetheset" to save a geometric complex. More...
 
template<class element >
void saveelements (const char *name, const hashedset< element > &s, const char *what, const char *filecomment=0)
 Uses the general procedure "savetheset" to save a set of elements. More...
 
void saveelements (const char *name, const cubes &cub, const char *what, const char *filecomment=0)
 Saves a set of cubes to the given file. More...
 
template<class cubsettype >
bool checkinclusion (const cubsettype &Xcubes, const cubsettype &Ycubes, const cubsettype &Bcubes, const char *Xname, const char *YBname)
 Checks if X is a subset of the union of Y and B. More...
 
template<class cubsettype >
bool checkinclusion (const cubsettype &Xcubes, const cubsettype &Ycubes, const char *Xname, const char *Yname)
 Checks for the inclusion of X in Y. More...
 
template<class maptype , class cubsettype >
bool checkimagecontained (const maptype &Fcubmap, const cubsettype &Xcubes, const cubsettype &Ycubes, const cubsettype &Bcubes, const char *Xname, const char *Yname)
 Checks if the image of X by F is contained in the union of Y and B. More...
 
template<class maptype , class cubsettype >
bool checkimagecontained (const maptype &Fcubmap, const cubsettype &Xcubes, const cubsettype &Ycubes, const char *Xname, const char *Yname)
 Checks if the image of X by F is contained in the set Y alone. More...
 
template<class maptype , class cubsettype >
bool checkimagedisjoint (const maptype &Fcubmap, const cubsettype &Acubes, const cubsettype &Ycubes, const char *Aname, const char *Yname)
 Checks if the image of A by F is disjoint from Y (actually, from Y\B). More...
 
template<class tCell , class tCube , class tCoef >
bool checkacyclicmap (const mvcellmap< tCell, tCoef, tCube > &Fcellcubmap, const char *Xname)
 Checks if the image of each element of the domain of this map is acyclic. More...
 
template<class cubsettype >
void restrictAtoneighbors (const cubsettype &Xcubes, cubsettype &Acubes, const char *Xname, const char *Aname, const cubsettype *keepcubes=0)
 Restricts the set of cubes 'Acubes' to these cubes which are neighbors of any of the cubes in 'Xcubes' and displays appropriate messages. More...
 
template<class cubsettype >
void removeAfromX (cubsettype &Xcubes, const cubsettype &Acubes, const char *Xname, const char *Aname)
 Removes 'Acubes' from 'Xcubes' and shows messages. More...
 
template<class cell , class euclidom >
void removeAfromX (gcomplex< cell, euclidom > &X, const gcomplex< cell, euclidom > &A, const char *Xname, const char *Aname)
 Removes from 'X' all the cells that appear in 'A'. More...
 
template<class cubsettype >
void expandAinX (cubsettype &Xcubes, cubsettype &Acubes, const char *Xname, const char *Aname)
 Expands the other element of the pair into the main portion of the set. More...
 
template<class cubsettype , class maptype >
void expandAinX (cubsettype &Xcubes, cubsettype &Acubes, cubsettype &Ycubes, cubsettype &Bcubes, const maptype &Fcubmap, const char *Xname, const char *Aname, const char *Bname, bool indexmap, bool checkacyclic)
 Expands the other element of the pair into the main portion of the set. More...
 
template<class cubsettype >
void reducepair (cubsettype &Xcubes, cubsettype &Acubes, const cubsettype &Xkeepcubes, const char *Xname, const char *Aname)
 Reduces the pair of sets of cubes. Keeps the given cubes untouched. More...
 
template<class maptype , class cubsettype >
void reducepair (cubsettype &Xcubes, cubsettype &Acubes, maptype &Fcubmap, const cubsettype &Xkeepcubes, const char *Xname, const char *Aname)
 Reduces the pair of sets of cubes. More...
 
template<class maptype , class cubsettype >
void addmapimg (const maptype &Fcubmap, const maptype &FcubmapA, const cubsettype &Xcubes, const cubsettype &Acubes, cubsettype &Ykeepcubes, bool indexmap)
 Adds the images of both maps to the set of cubes to be kept. More...
 
template<class maptype , class cubsettype >
void addmapimg (const maptype &Fcubmap, const cubsettype &Xcubes, const cubsettype &Acubes, cubsettype &Ykeepcubes, bool indexmap)
 Adds the image of the given map to the set of cubes to be kept. More...
 
template<class tCubes , class tCell , class tCoef >
void cubes2cells (tCubes &Xcubes, gcomplex< tCell, tCoef > &Xcompl, const char *Xname, bool deletecubes=true)
 Transforms cubes to full-dimensional cells. More...
 
template<class cell , class euclidom >
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. More...
 
template<class cell , class euclidom >
void collapse (gcomplex< cell, euclidom > &Xcompl, gcomplex< cell, euclidom > &Acompl, 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. More...
 
template<class cell , class euclidom >
void collapse (gcomplex< cell, euclidom > &Xcompl, gcomplex< cell, euclidom > &Xkeepcompl, const char *Xname, bool addbd=true, bool addcob=false, bool disjoint=true, const int *level=NULL)
 Collapses a single geometric complex. More...
 
template<class cell , class euclidom >
void collapse (gcomplex< cell, euclidom > &Xcompl, const char *Xname, bool addbd=true, bool addcob=false, bool disjoint=true, const int *level=NULL)
 Collapses a single geometric complex. More...
 
template<class cell , class euclidom >
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 dimensions and then removing these cells. More...
 
template<class cell , class euclidom >
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. More...
 
template<class tCube >
int ReadBitmapFile (const char *bmpname, hashedset< tCube > &cset, int mingray=0, int maxgray=128)
 Reads the squares from a bitmap file to the set of cubes. More...
 
template<class TCube >
std::ostream & operator<< (std::ostream &out, const BufferedMapClass< TCube > &map)
 
template<class TSetOfCubes >
int neighborhood (const TSetOfCubes &X, TSetOfCubes &result)
 Computes a cubical neighborhood of width 1 around the set. More...
 
template<class TSetOfCubes , class TMap >
void invariantpart (TSetOfCubes &X, const TMap &F, TSetOfCubes &result)
 Computes X := Inv (X). More...
 
template<class HSet >
bool inclusion (const HSet &X, const HSet &Y)
 Verifies if X is a subset of Y. Returns true if yes, false if not. More...
 
template<class TSetOfCubes , class TMap >
int ExitSetM (const TSetOfCubes &N, const TSetOfCubes &Q1, const TMap &F, TSetOfCubes &resultQ2)
 Computes iteratively Q2 := (F (Q1 + Q2) - Q1) * N. More...
 
template<class TSetOfCubes , class TMap >
int IndexPairM (const TMap &F, const TSetOfCubes &initialS, TSetOfCubes &resultQ1, TSetOfCubes &resultQ2)
 Constructs a combinatorial index pair satisfying Mrozek's definition. More...
 
template<class TSetOfCubes , class TMap >
int IndexPairP (const TMap &F, const TSetOfCubes &initialS, TSetOfCubes &resultQ1, TSetOfCubes &resultQ2)
 Constructs a combinatorial index pair satisfying Pilarczyk's definition. More...
 
int_t hashkey1 (const Simplex &s)
 
int_t hashkey2 (const Simplex &s)
 
int operator== (const Simplex &s, const Simplex &t)
 The operator == that compares whether the two simplices are the same, that is, have the same vertices in the same order. More...
 
int operator!= (const Simplex &s, const Simplex &t)
 The operator != verifies if the two simplices are different. More...
 
int boundarylength (const Simplex &s)
 Returns the length of the boundary of a simplex. More...
 
int boundarycoef (const Simplex &, int i)
 Returns the i-th coefficient in the boundary of a simplex. More...
 
Simplex boundarycell (const Simplex &s, int i)
 Returns the i-th boundary face of a simplex. More...
 
Simplex boundarycell (const Simplex &s, int i, bool)
 Returns the i-th boundary face of a simplex. More...
 
std::ostream & operator<< (std::ostream &out, const Simplex &s)
 Writes a simplex to the output stream in the text format. More...
 
std::istream & operator>> (std::istream &in, Simplex &s)
 Reads a simplex from an imput stream from a text format. More...
 
int bitcountbyte (char n)
 
int bitcount (int number)
 
void int2bits (int bits, int_t length, BitField &field)
 
int bits2int (const BitField &field, int_t length)
 
template<class wType1 , class wType2 >
bool operator== (const diGraph< wType1 > &g1, const diGraph< wType2 > &g2)
 
template<class wType1 , class wType2 >
bool operator!= (const diGraph< wType1 > &g1, const diGraph< wType2 > &g2)
 
template<class wType >
std::ostream & operator<< (std::ostream &out, const diGraph< wType > &g)
 Writes a graph in the text mode to an output stream. More...
 
template<class wType , class Table1 , class Table2 >
int_t SCC (const diGraph< wType > &g, Table1 &compVertices, Table2 &compEnds, diGraph< wType > *scc=0, diGraph< wType > *transposed=0, bool copyweights=false)
 Computes strongly connected components of the graph 'g'. More...
 
template<class wType , class Table1 , class Table2 >
int_t SCC_Tarjan (const diGraph< wType > &g, Table1 &compVertices, Table2 &compEnds)
 Computes strongly connected components of the graph 'g' using Tarjan's algorithm (as described in the Wikipedia). More...
 
template<class wType >
int_t addRenumEdges (const diGraph< wType > &g, int_t vertex, const int_t *newNum, int_t cur, int_t *srcVert, diGraph< wType > &result)
 A helper function for "collapseVertices". More...
 
template<class wType , class Table1 , class Table2 >
int_t collapseVertices (const diGraph< wType > &g, int_t compNum, Table1 &compVertices, Table2 &compEnds, diGraph< wType > &result, int_t *newNumbers=0)
 Collapses disjoint subsets of vertices to single vertices and creates a corresponding graph in which the first vertices come from the collapsed ones. More...
 
template<class wType , class TabSets >
int_t addRenumEdges2 (const diGraph< wType > &g, int_t vertex, const int_t *newNum, TabSets &numSets, int_t cur, int_t *srcVert, diGraph< wType > &result)
 A helper function for "collapseVertices2". More...
 
template<class wType , class Table1 , class Table2 >
int_t collapseVertices2 (const diGraph< wType > &g, int_t compNum, Table1 &compVertices, Table2 &compEnds, diGraph< wType > &result)
 Collapses (possibly non-disjoint) subsets of vertices to single vertices and creates a corresponding graph in which the first vertices come from the collapsed ones. More...
 
template<class wType >
int_t connectionGraph (const diGraph< wType > &g, int_t nVert, diGraph< wType > &result)
 Computes the graph that represents connections between a number of the first vertices in the given graph. More...
 
template<class GraphType >
int_t computePeriod (const GraphType &g)
 Computes the period of a strongly connected graph. More...
 
template<class wType >
int_t inclusionGraph (const diGraph< wType > &g, int_t nVert, diGraph< wType > &result)
 Computes the graph that represents flow-induced relations on Morse sets. More...
 
template<class wType , class TConn >
int_t inclusionGraph (const diGraph< wType > &g, int_t nVert, diGraph< wType > &result, TConn &connections)
 A more complicated version of the 'inclusionGraph' function. More...
 
template<class wType , class matrix >
void graph2matrix (const diGraph< wType > &g, matrix &m)
 Creates the adjacency matrix of the given graph. More...
 
template<class wType , class matrix >
void matrix2graph (const matrix &m, int_t n, diGraph< wType > &g)
 Creates a graph based on the given adjacency matrix. More...
 
template<class matrix >
void transitiveClosure (matrix &m, int_t n)
 Computes the transitive closure of an acyclic graph defined by its adjacency matrix, using the Warshall's algorithm: S. More...
 
template<class matrix >
void transitiveReduction (matrix &m, int_t n)
 Computes the transitive reduction of a CLOSED acyclic graph defined by its adjacency matrix, using the algorithm by D. More...
 
template<class wType >
void transitiveReduction (const diGraph< wType > &g, diGraph< wType > &gRed)
 Computes the transitive reduction of an arbitrary acyclic graph. More...
 
std::ostream & operator<< (std::ostream &out, const hashstat &s)
 Shows hashing statistics in a concise and readable way to the output stream in the text format. More...
 
template<class stream , class element , class hashkeys >
stream & write (stream &out, const hashedset< element, hashkeys > &s, bool size)
 Writes the entire hashed set to an output stream in the text mode. More...
 
template<class element , class hashkeys >
std::ostream & operator<< (std::ostream &out, const hashedset< element, hashkeys > &s)
 Writes a hashed set to an output stream as a large one (each element is written on a separate line, with some comments at the beginning). More...
 
template<class stream , class element , class hashkeys >
stream & read (stream &in, hashedset< element, hashkeys > &s, bool size)
 Reads a hashed set from an input stream, either a small size style or a large one. More...
 
template<class element , class hashkeys >
std::istream & operator>> (std::istream &in, hashedset< element, hashkeys > &s)
 Reads a hashed set from an input stream in a large size style (each element occupies one line, any comments are ignored). More...
 
template<class element , class hashkeys >
hashedset< element, hashkeys > & operator+= (hashedset< element, hashkeys > &s, const hashedset< element, hashkeys > &u)
 Operator += adds one hashed set to another. More...
 
template<class element , class hashkeys >
hashedset< element, hashkeys > & operator-= (hashedset< element, hashkeys > &s, const hashedset< element, hashkeys > &u)
 Operator -= removes the contents of one set from another. More...
 
template<class domelement , class imgelement >
hashedset< imgelement > & retrieveimage (const mvmap< domelement, imgelement > &m, hashedset< imgelement > &img)
 Adds images of all the elements from the domain of the map to 'img'. More...
 
template<class domelement , class imgelement >
hashedset< imgelement > & creategraph (const mvmap< domelement, imgelement > &m, hashedset< imgelement > &graph)
 Adds a graph of a multivalued map to the given set. More...
 
template<class domelement , class imgelement >
std::istream & readdomain (std::istream &in, hashedset< domelement > &dom, const mvmap< domelement, imgelement > &)
 Reads the domain of a multivalued map. More...
 
template<class domelement , class imgelement >
std::istream & readimage (std::istream &in, hashedset< imgelement > &img, const mvmap< domelement, imgelement > &)
 Reads the image of a multivalued map. More...
 
template<class domelement , class imgelement >
std::istream & readselective (std::istream &in, mvmap< domelement, imgelement > &m, const hashedset< domelement > &dom1, const hashedset< domelement > &dom2)
 Reads a restriction of a multivalued map to the union of the given sets. More...
 
template<class domelement , class imgelement >
std::istream & readrestriction (std::istream &in, mvmap< domelement, imgelement > &m, const hashedset< domelement > &dom, const hashedset< imgelement > &img)
 Reads a restriction of a multivalued map to the two given sets. More...
 
template<class domelement , class imgelement >
std::istream & readselective (std::istream &in, mvmap< domelement, imgelement > &m, const hashedset< domelement > &dom)
 Reads a restriction of a multivalued map to the given set. More...
 
template<class domelement , class imgelement >
std::ostream & operator<< (std::ostream &out, const mvmap< domelement, imgelement > &m)
 Writes a multivalued map to the output stream. More...
 
template<class domelement , class imgelement >
std::istream & operator>> (std::istream &in, mvmap< domelement, imgelement > &m)
 Reads a multivalued map from an input stream. More...
 
std::ostream & operator<< (std::ostream &out, const primeint &p)
 Writes an object of the type "primeint" to an output stream. More...
 
std::istream & operator>> (std::istream &in, primeint &p)
 Reads a prime number from an input stream. More...
 
std::ostream & operator<< (std::ostream &out, const integer &n)
 
std::istream & operator>> (std::istream &in, integer &n)
 
int operator!= (const integer &n, const integer &m)
 
int operator== (const integer &n, int m)
 
int operator!= (const integer &n, int m)
 
integer operator- (const integer &n, const integer &m)
 
bool operator< (const integer &x, const integer &y)
 
bool operator> (const integer &x, const integer &y)
 
template<class set1type , class set2type >
setunion< set1type, set2type > makesetunion (const set1type &set1, const set2type &set2)
 Creates an object which represents the union of two sets. More...
 
int_t hashkey1 (const word &w)
 
int_t hashkey2 (const word &w)
 
int operator== (const word &w1, const word &w2)
 Compares two words. Returns 1 if they are the same, 0 otherwise. More...
 
int operator!= (const word &w1, const word &w2)
 Compares two words. Returns 0 if they are the same, 1 otherwise. More...
 
int operator== (const word &w, const char *c)
 Compares a word with a C-style string. More...
 
int operator!= (const word &w, const char *c)
 Compares a word with a C-style string. More...
 
int operator== (const char *c, const word &w)
 Compares a C-style string with a word. More...
 
int operator!= (const char *c, const word &w)
 Compares a C-style string with a word. More...
 
int operator< (const word &w1, const word &w2)
 Compares two words in an alphabetical way (by ASCII codes). More...
 
int operator> (const word &w1, const word &w2)
 Compares two words in an alphabetical way (by ASCII codes). More...
 
int operator<= (const word &w1, const word &w2)
 Compares two words in an alphabetical way (by ASCII codes). More...
 
int operator>= (const word &w1, const word &w2)
 Compares two words in an alphabetical way (by ASCII codes). More...
 
template<class type >
wordoperator<< (word &w, const type &elem)
 Appends the string value of a given element to a word. More...
 
std::ostream & operator<< (std::ostream &out, const word &w)
 Writes the given word to an output stream. More...
 
std::istream & operator>> (std::istream &in, word &w)
 Reads a word from an input stream. More...
 
std::ostream & operator<< (std::ostream &out, const argelement &p)
 
template<class type >
int readfromstring (char *str, type &t)
 A template for reading a variable from a string. More...
 
int readfromstring (char *str, char *&t)
 A specialization of the above template for interpreting a string as a string (no processing is necessary). More...
 
int readfromstring (char *str, const char *&t)
 A specialization of the above template for interpreting a string as a const string (no processing is necessary). More...
 
int readfromstring (char *str, bool &t)
 A specialization of the above template for reading a bool type. More...
 
template<class type >
void arg (arguments &a, const char *name, type &value)
 Adds a command line argument. More...
 
template<class type >
void arg (arguments &a, const char *name, type &value, type defaultvalue)
 Adds a command line argument with a default value. More...
 
void arg (arguments &a, const char *name, char *&value, const char *defaultvalue)
 A specialization of the above for C-style strings. More...
 
template<class type >
void arg (arguments &a, const char *name, type *value, int &count, int size)
 Adds a command line argument whose repeated occurrences fill in consecutive elements of the given array. More...
 
template<class type >
void arg (arguments &a, const char *name, type *value, int &count, int size, type defaultvalue)
 A version of the above with a default value of the arguments. More...
 
template<class type >
void argoblig (arguments &arg, const char *name, type &value)
 Defines an obligatory command line argument. More...
 
template<class type >
void argoblig (arguments &arg, const char *name, type &value, type defaultvalue)
 A version of the above with the default value provided. More...
 
void argoblig (arguments &arg, const char *name, char *&value, const char *defaultvalue)
 A version of the above for reading an array of argument values. More...
 
template<class type >
void argbreak (arguments &arg, const char *name, type &value)
 Adds an argument whose appearence interrupts the analysis of the command line and makes the analyzing function return the value of 1. More...
 
template<class type >
void argbreak (arguments &arg, const char *name, type &value, type defaultvalue)
 A version of the above with the default value provided. More...
 
void argbreak (arguments &arg, const char *name, char *&value, const char *defaultvalue)
 A version of the above for the C-style string. More...
 
void argbreak (arguments &arg, const char *name)
 A version of the above which ignores the value of the argument. More...
 
template<class type >
void argswitch (arguments &arg, const char *name, type &value, const type &defaultvalue)
 Defines a command line argument which is a switch, that is, there is no value given for it in the command line. More...
 
void argswitch (arguments &arg, const char *name, char *&value, const char *defaultvalue)
 A version of the above for the C-style string. More...
 
void argswitch (arguments &arg, const char *name)
 Defines an ignored switch (no value is set when this argument appears). More...
 
void arghelp (arguments &a)
 Adds the typical arguments which should make the program display help information. More...
 
void argstreams (arguments &a, char *&logfilename, char *&seqfilename, bool &quiet, bool &debug)
 Adds typical command line arguments for manipulating output streams. More...
 
void setstreams (const char *logfilename, char *seqfilename, bool quiet, bool debug)
 Sets the parameters of the output streams depending on the file names acquired from the command line. More...
 
template<typename type >
outputstreamoperator<< (outputstream &out, const type &object)
 The operator << for writing any kind of object to the output stream. More...
 
outputstreamoperator<< (outputstream &out, const char *object)
 A specialization of the operator << for writing a C-style string to the output stream. More...
 
outputstreamoperator<< (outputstream &out, std::ostream &(*object)(std::ostream &))
 A specialization of the operator << for putting manipulators (like std::endl, std::flush) to the output stream. More...
 
template<class type >
void swapelements (type &x, type &y)
 A simple template for swapping two elements with the use of a temporary variable of the same type and the assignment operator. More...
 
template<class type >
int sortelements (type *tab, int n)
 A simple template that sorts an array using the bubble sort method, removes repeated elements and returns the new number of the elements. More...
 
void ignoreline (std::istream &in)
 Ignores the input characters until the end of a line, including this end of the line. More...
 
void ignorecomments (std::istream &in)
 Ignores white characters (spaces, tabulators, CRs and LFs), as well as comments from the input text file. More...
 
int closingparenthesis (int ch)
 Returns the matching closing parenthesis for the given opening one or EOF if none. More...
 
int readparenthesis (std::istream &in)
 Reads an opening parenthesis from the input file. More...
 
std::string commandline (int argc, char *argv[])
 Returns the entire command line as a single string. More...
 
const char * currenttime (void)
 Retrieves the current time as a pointer to a C-style string. More...
 
template<class settype >
static void savetheset (const settype &c, const char *prefix, const char *filename, const char *name)
 Writes the given object to a file whose name is a concatenation of the prefix and the given file name. More...
 
void fileerror (const char *filename, const char *what="open")
 Throws a message about the inability to do something with a file. More...
 

Variables

const int DimBits = (sizeof (int_t) > 4) ? 7 : 6
 The number of signed bits to store the dimension (i.e., 6: max 31). More...
 
const int NumBits = (sizeof (int_t) << 3) - DimBits
 The number of bits in an integer number that remain to be used for other purposes, because the high 'DimBits' bits are used for the dimension. More...
 
const int_t SignBit = static_cast<int_t> (1) << ((sizeof (int_t) << 3) - 1)
 The sign bit of the int_t number. More...
 
const int_t NumMask = (~(static_cast<int_t> (0) ^ SignBit)) >> (DimBits - 1)
 The mask of the bits remaining after the dimension bits are excluded. More...
 
const int MaxBasDim1 = static_cast<int> (1u << (DimBits - 1))
 The maximal dimension that can be represented using 'DimBits' bits. More...
 
const int MaxBasDim2 = static_cast<int> ((sizeof (int_t) << 3) - DimBits)
 The maximal dimension which still leaves enough bits in the integer to have one bit for each direction. More...
 
const int MaxBasDim = (MaxBasDim1 < MaxBasDim2) ? MaxBasDim1 : MaxBasDim2
 The maximal dimension that can be used if the high bits of an integer store the value of the dimension, and the number of remaining bits is at least as large as the dimension. More...
 
const int MaxBddDimPossible = 3
 The maximal dimension for which binary decision diagrams are programmed. More...
 
int MaxBddDim
 The maximal dimension for which binary decision diagrams are used. More...
 
bool UseMalandainCode
 The variable which controls which binary decision diagrams should be used in dimension 3, either programmed by P. More...
 
BitFields knownbits
 The global table of BitFields which store the acyclicity information for reducing full cubical sets. More...
 
Tabulated tabulated
 The global instance of this class which stores tabulated configurations to use in the full cube reduction procedures. More...
 
unsigned char bitcounttable []
 
outputstream sout
 A replacement for standard output stream, with optional logging and other features provided by the class 'outputstream'. More...
 
outputstream scon
 The console output stream to which one should put all the junk that spoils the log file, like progress indicators. More...
 
outputstream serr
 A wrapper for the standard error stream. More...
 
outputstream slog
 The output stream to which one can send messages for logging only. More...
 
outputstream sbug
 An output stream for writing additional debug messages. More...
 
outputstream sseq
 An auxiliary stream which captures sequences of processed data. More...
 
timeused program_time
 The external variable which measures the time used by the program from its start. More...
 

Detailed Description

This namespace contains the core of the homology computation procedures and related classes and templates contained in the CHomP C++ library.

Typedef Documentation

◆ bitfield

A lower-case version of the name of a bit field [deprecated].

Definition at line 58 of file bitfield.h.

◆ bitfieldset

A lower-case version of the name of a bit field set [deprecated].

Definition at line 61 of file bitfield.h.

◆ Chain

A class for representing a chain with integral coefficients.

Definition at line 86 of file homology.h.

◆ ChainComplex

A class for representing a chain complex with integral coefficients.

Definition at line 80 of file homology.h.

◆ ChainMap

A class for representing a chain map with integral coefficients.

Definition at line 83 of file homology.h.

◆ CombinatorialMultivaluedMap

The default type of a combinatorial cubical multivalued map.

This is a map which assigns a set of cubes to each cube in its domain.

Definition at line 74 of file cube.h.

◆ CombinatorialMultivaluedMap2l

A typical multivalued map on full cubes in the two-layer setting.

Definition at line 1254 of file twolayer.h.

◆ coordinate

typedef short int chomp::homology::coordinate

The default type of coordinates.

Definition at line 63 of file pointset.h.

◆ Cube

The default cube type.

Definition at line 61 of file cube.h.

◆ cube

A lower-case name of a cube [deprecated].

Definition at line 77 of file cube.h.

◆ Cube2l

A typical full cube in the two-layer setting.

Definition at line 1248 of file twolayer.h.

◆ cubes

An abbreviation for a set of cubes [deprecated].

Definition at line 80 of file cube.h.

◆ CubicalCell

The default type of a cubical cell.

Definition at line 61 of file cell.h.

◆ CubicalCell2l

A typical cubical cell in the two-layer setting.

Definition at line 1251 of file twolayer.h.

◆ CubicalComplex

The default type of a cubical complex.

Definition at line 70 of file cell.h.

◆ cubicalcomplex

An abbreviation for a cubical complex [deprecated].

Definition at line 84 of file cell.h.

◆ CubicalComplex2l

A typical cubical complex in the two-layer setting.

Definition at line 1263 of file twolayer.h.

◆ CubicalMap

An abbreviation for a combinatorial cubical multivalued map.

Definition at line 83 of file cube.h.

◆ cubicalmap

A lower-case version of the name of a combinatorial cubical multivalued map [deprecated].

Definition at line 87 of file cube.h.

◆ CubicalMultivaluedMap

The default type of a cubical multivalued map.

The image of each cubical cell is a set of cubical cells.

Definition at line 74 of file cell.h.

◆ CubicalMultivaluedMap2l

A typical multivalued cubical-cellular map in the two-layer setting.

Definition at line 1267 of file twolayer.h.

◆ ElementaryCell

An alternative name for a cubical cell.

Definition at line 64 of file cell.h.

◆ FullCube

An alternative name for a cube.

Definition at line 64 of file cube.h.

◆ hashIntQueue

Definition at line 1042 of file bincube.h.

◆ HyperCube

An alternative name for a cube.

Definition at line 67 of file cube.h.

◆ neighbors

The neighbors class with the default type of coordinates.

Definition at line 84 of file pointset.h.

◆ numbertype

typedef signed short chomp::homology::numbertype

The type of number used to store the value of an object of type "integer".

Note that "signed short" (or even "signed char") uses less memory but limits the range of correctly stored numbers which may cause to interrupt the computations in the numbers become too large. Use "signed long" for large prime numbers.

Definition at line 126 of file integer.h.

◆ PointBase

The default type of the point base class.

Definition at line 62 of file pointbas.h.

◆ pointset

The pointset class with the default type of coordinates.

Definition at line 81 of file pointset.h.

◆ qcell

An abbreviation for a cubical cell [deprecated].

Definition at line 78 of file cell.h.

◆ qcells

An abbreviation for a set of cubical cell [deprecated].

Definition at line 81 of file cell.h.

◆ rectangle

The rectangle class with the default type of coordinates.

Definition at line 87 of file pointset.h.

◆ SetOfCubes

The default type of a set of cubes.

Definition at line 70 of file cube.h.

◆ SetOfCubes2l

A typical set of full cubes in the two-layer setting.

Definition at line 1257 of file twolayer.h.

◆ SetOfCubicalCells

The default type of a set of cubical cells.

Definition at line 67 of file cell.h.

◆ SetOfCubicalCells2l

A typical set of cubical cells in the two-layer setting.

Definition at line 1260 of file twolayer.h.

◆ SetOfSimplices

A class for representing a set of simplices.

The type of a set of simplices.

Definition at line 89 of file homology.h.

◆ simplex

A lower-case name for a simplex [deprecated].

Definition at line 62 of file simplex.h.

◆ simplices

An alternative name for a set of simplices [deprecated].

Definition at line 68 of file simplex.h.

◆ SimplicialComplex

A class for representing a simplicial complex.

The type of a simplicial complex.

Definition at line 92 of file homology.h.

◆ simplicialcomplex

A lower-case name for a simplicial complex [deprecated].

Definition at line 65 of file simplex.h.

◆ theLayerType

typedef short int chomp::homology::theLayerType

The type of the layer variable.

It holds the values for the layer numbers (0 and 1), as well as the layer numbers of the Cartesian product of cubes obtained from the layers by bitwise OR on the layer of the first cube shifted by 2 bits to the left and the layer of the other cube.

Definition at line 66 of file twolayer.h.

◆ words

The default type of a set of words.

Definition at line 56 of file words.h.

Function Documentation

◆ acyclic() [1/6]

bool chomp::homology::acyclic ( const cube q,
const cubes X 
)
inline

Verifies whether the neighborhood of q in X is acyclic.

Uses BDDs for dimensions 2 and 3, and computes homology otherwise.

Definition at line 2007 of file homology.h.

2008{
2009 int dim = q. dim ();
2010 BitField b;
2011 int_t maxneighbors = getmaxneighbors (dim);
2012 b. allocate (maxneighbors);
2013 bool result = acyclic (q, dim, X, &b, maxneighbors);
2014 b. free ();
2015 return result;
2016} /* acyclic */
This class defines a bit field that is part of some larger array or that uses an allocated piece of m...
Definition: bitfield.h:73
int int_t
Index type for indexing arrays, counting cubes, etc.
Definition: config.h:115
int_t getmaxneighbors(int dim)
Returns the maximal number of neighbors of a cube: 3^dim - 1.
Definition: neighbor.h:60
bool acyclic(const cube &q, const cubes &X)
Verifies whether the neighborhood of q in X is acyclic.
Definition: homology.h:2007

References acyclic(), and getmaxneighbors().

◆ acyclic() [2/6]

template<class tCube >
bool chomp::homology::acyclic ( const hashedset< tCube > &  cset)
inline

Checks whether the given set of cubes is acyclic.

Returns true if yes, false if not.

Definition at line 113 of file cubacycl.h.

114{
115 // the empty set is not acyclic
116 if (cset. empty ())
117 return false;
118
119 // a singleton is acyclic
120 if (cset. size () == 1)
121 return true;
122
123 // reduce the set and see if there is only one cube remaining
124 hashedset<tCube> emptycubes;
125 hashedset<tCube> theset (cset);
126 cubreducequiet (emptycubes, theset, emptycubes); // !!!
127 if (theset. size () == 1)
128 return true;
129
130 // create a cubical complex from this set of cubes
132 int_t size = cset. size ();
133 for (int_t i = 0; i < size; ++ i)
134 ccompl. add (typename tCube::CellType (cset [i]));
135
136 // check whether this geometric complex is acyclic or not
137 return acyclic (ccompl);
138} /* acyclic */
The class that defines a geometric complex - a set of cells (cubes, simplices, etc).
Definition: gcomplex.h:85
int_t cubreducequiet(const hashedset< tCube > &maincset, hashedset< tCube > &cset, hashedset< tCube > &other, const hashedset< tCube > &keep, const tVerify &verify, bool quiet=true)
Reduces a pair of sets of cubes for relative homology computation.
Definition: cubired0.h:84
bool acyclic(const tCube &q, int dim, const tCubeSet &cset, BitField *b, int_t maxneighbors)
Verifies the acyclicity of a neighborhood of the given cube.
Definition: cubacycl.h:174

References acyclic(), and cubreducequiet().

◆ acyclic() [3/6]

template<class tCube , class tCubeSet >
bool chomp::homology::acyclic ( const tCube &  q,
int  dim,
const tCubeSet &  cset,
BitField b,
int_t  maxneighbors 
)
inline

Verifies the acyclicity of a neighborhood of the given cube.

Calls the above procedure with a null pointer to the set of neighbors.

Definition at line 174 of file cubacycl.h.

176{
178 return acyclic (q, dim, cset, b, maxneighbors, neighbors);
179} /* acyclic */
This class can be used for iterating point's neighbors.
Definition: pointset.h:1450

References acyclic().

◆ acyclic() [4/6]

template<class tCube , class tCubeSet1 , class tCubeSet2 >
bool chomp::homology::acyclic ( const tCube &  q,
int  dim,
const tCubeSet1 &  cset,
BitField b,
int_t  maxneighbors,
tCubeSet2 *  neighbors 
)
inline

Verifies the acyclicity of a neighborhood of the given cube.

Parameters
q- the cube whose neighborhood is verified
dim- the dimension of the cube
cset- the set to search for the cubes adjacent to q
b- a pointer to a bitfield in which neighbors are marked
neighbors- a pointer to a set of cubes to which the neighbors are added (unless BDDs are used) if the pointer is not null
maxneighbors- the maximal possible number of neighbors: should be equal to 3^dim - 1 Uses BDDs if available. Marks verified neighbors in b.

Definition at line 151 of file cubacycl.h.

153{
154 // use a binary decision diagram code if possible
155 if (dim <= MaxBddDim)
156 return bddacyclic (q, dim, cset, *b);
157
158 // get the neighbors of the cube
159 int_t n = getneighbors (q, b, cset, neighbors, 0);
160
161 // if the answer is obvious from the number of neighbors, return it
162 if ((n == 0) || (n == maxneighbors))
163 return false;
164 if (n == 1)
165 return true;
166
167 // return the information on whether this set of neighbors is acyclic
168 return acyclic (dim, *b);
169} /* acyclic */
int MaxBddDim
The maximal dimension for which binary decision diagrams are used.
int_t getneighbors(const tCube &q, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
Gets neighbors of the given cube from the given set and indicates them in the bit field provided.
Definition: neighbor.h:302
bool bddacyclic(const tCube &q, int dim, const tCubeSet &s, BitField &b)
Uses binary decision diagrams to verify whether the neighborhood of the given cube in the given set i...
Definition: bddacycl.h:1198

References acyclic(), bddacyclic(), getneighbors(), and MaxBddDim.

◆ acyclic() [5/6]

template<class cell , class euclidom >
bool chomp::homology::acyclic ( gcomplex< cell, euclidom > &  c)

Checks whether this chain complex is acyclic.

This verification destroys the chain complex. Acknowledgement: There was a memory leak here - "hom" was not deleted. Thanks to Marc Niethammer for pointing this out. [July 29, 2004]

Definition at line 1447 of file gcomplex.h.

1448{
1449 // collapse the geometric complex and check if you can get one elem.
1451 c. collapse (empty, empty, true, false, false, NULL, true);
1452 if (c. size () == 1)
1453 return true;
1454
1455 // create the corresponding chain complex and compute its homology
1456 chaincomplex<euclidom> cx (c. dim ());
1457 createchaincomplex (cx, c, true);
1458 chain<euclidom> *hom;
1459 cx. simple_form (static_cast<int *> (0), true);
1460 cx. simple_homology (hom, 0);
1461
1462 // if there is anything above the zero level, the set is not acyclic
1463 for (int i = 1; i <= cx. dim (); ++ i)
1464 {
1465 if (!hom [i]. empty ())
1466 {
1467 delete [] hom;
1468 return false;
1469 }
1470 }
1471
1472 // if there is more than one connected component, it is not acyclic
1473 if (hom [0]. size () != 1)
1474 {
1475 delete [] hom;
1476 return false;
1477 }
1478
1479 // if the coefficient is not 1, the set is not acyclic
1480 if (hom [0]. getcoefficient (0) == 1)
1481 {
1482 delete [] hom;
1483 return true;
1484 }
1485 else
1486 {
1487 delete [] hom;
1488 return false;
1489 }
1490} /* acyclic */
This class defines objects which represent chains as finite sequences of elements identified by integ...
Definition: chains.h:94
This is an implementation of a chain complex over an arbitrary ring.
Definition: chains.h:2662
chaincomplex< euclidom > & createchaincomplex(chaincomplex< euclidom > &c, const gcomplex< cell, euclidom > &g, const gcomplex< cell, euclidom > &rel, bool quiet=false)
Creates a relative algebraic chain complex with the data from the given pair of geometric cell comple...
Definition: gcomplex.h:1260
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.
Definition: homtools.h:742

References collapse(), and createchaincomplex().

◆ acyclic() [6/6]

bool chomp::homology::acyclic ( int  dim,
BitField b 
)
inline

Checks whether this cube's nieghbors form an acyclic set.

The set of neighbors is encoded by means of a bitfield. Returns: true = yes, false = no.

Definition at line 70 of file cubacycl.h.

71{
72 // look for the answer in the tabulated data
73 const char *table = tabulated [dim];
74 if (table)
75 {
76 return Tabulated::get (table,
77 bits2int (b, getmaxneighbors (dim)));
78 }
79
80 // look for the answer among the known combinations
81 SetOfBitFields *known = knownbits [dim];
82 int answerKnown = known ? known -> check (b) : -1;
83
84 // if the answer is known then return it
85 if (answerKnown >= 0)
86 return (!!answerKnown);
87
88 // create a model cube for building the neighborhood
89 typedef tCubeBase<short> tCube;
90 if (dim > tCube::MaxDim)
91 throw "Cube dimension too high for acyclicity verification.";
92 short c [tCube::MaxDim];
93 for (int i = 0; i < dim; ++ i)
94 c [i] = 0;
95 tCube qzero (c, dim);
96
97 // find out whether the set of neighbors is acyclic or not
98 typedef tCube::CellType tCell;
99 gcomplex<tCell,integer> neighbors;
100 addneighbors (qzero, b, neighbors, true);
101 bool answerBool (acyclic (neighbors));
102
103 // add the answer to the list of known ones
104 if (known)
105 known -> add (b, answerBool);
106
107 return answerBool;
108} /* acyclic */
int bits2int(const BitField &field, int_t length)
Definition: bitfield.h:215
void addneighbors(const int &c, const SetT &s, QueueT &q)
Adds the neighbors of the cube 'c' in the set 's' to the set 'q'.
Definition: bincube.h:1048
BitFields knownbits
The global table of BitFields which store the acyclicity information for reducing full cubical sets.
Tabulated tabulated
The global instance of this class which stores tabulated configurations to use in the full cube reduc...
tNeighbors< coordinate > neighbors
The neighbors class with the default type of coordinates.
Definition: pointset.h:84

References acyclic(), addneighbors(), bits2int(), chomp::homology::Tabulated::get(), getmaxneighbors(), knownbits, and tabulated.

Referenced by acyclic(), acyclic_rel(), checkacyclicmap(), createcellmap(), chomp::homology::reduction0::cubexpand(), chomp::homology::reduction1::cubexpand(), chomp::homology::reduction0::cubreducequiet(), chomp::homology::reduction1::cubreducequiet(), Homology(), and Homology2l().

◆ acyclic1d()

template<class NeighborCheck >
bool chomp::homology::acyclic1d ( NeighborCheck &  n)

Verifies whether the neighborhood of a 1-dimensional "cube" is acyclic.

Definition at line 49 of file bddacycl.h.

50{
51 if (n. check (0)) goto K4; else goto K5;
52K4: if (n. check (1)) return false; else return true;
53K5: if (n. check (1)) return true; else return false;
54} /* acyclic1d */

Referenced by bddacyclic(), and chomp::homology::Acyclic1d< SetT >::check().

◆ acyclic2d()

template<class NeighborCheck >
bool chomp::homology::acyclic2d ( NeighborCheck &  n)

Verifies whether the neighborhood of a 2-dimensional "cube" is acyclic.

Definition at line 63 of file bddacycl.h.

64{
65 if (n. check (0)) goto L659; else goto L20;
66L12: return !n. check (5);
67L13: return n. check (5);
68L14: return !n. check (6);
69L16: return !n. check (7);
70L17: return n. check (7);
71L18: if (n. check (2)) goto L514; else goto L523;
72L20: if (n. check (1)) goto L40; else goto L18;
73L21: if (n. check (5)) return true; else goto L651;
74L23: if (n. check (4)) goto L514; else goto L21;
75L24: if (n. check (4)) return false; else goto L514;
76L40: if (n. check (2)) goto L513; else goto L637;
77L505: if (n. check (6)) return false; else goto L16;
78L507: if (n. check (5)) return true; else goto L16;
79L508: if (n. check (2)) goto L507; else goto L646;
80L513: if (n. check (5)) return true; else goto L14;
81L514: if (n. check (5)) return false; else goto L505;
82L523: if (n. check (3)) goto L24; else goto L23;
83L637: if (n. check (3)) return false; else goto L513;
84L646: if (n. check (4)) return false; else goto L507;
85L651: if (n. check (6)) goto L16; else goto L17;
86L658: if (n. check (2)) goto L12; else goto L13;
87L659: if (n. check (1)) goto L658; else goto L508;
88} /* acyclic2d */

Referenced by bddacyclic(), and chomp::homology::Acyclic2d< SetT >::check().

◆ acyclic3d()

template<class NeighborCheck >
bool chomp::homology::acyclic3d ( NeighborCheck &  n)

Verifies whether the neighborhood of a 3-dimensional cube is acyclic.

Definition at line 613 of file bddacycl.h.

614{
615 if (n. check (0)) goto K1043; else goto K978;
616K14: return !n. check (6);
617K15: return n. check (6);
618K36: return !n. check (17);
619K37: return n. check (17);
620K38: return !n. check (18);
621K39: return n. check (18);
622K48: return !n. check (23);
623K49: return n. check (23);
624K50: return !n. check (24);
625K52: return !n. check (25);
626K53: return n. check (25);
627K54: if (n. check (17)) goto K2585; else goto K154;
628K56: if (n. check (20)) return false; else goto K2302;
629K57: if (n. check (7)) goto K1863; else goto K939;
630K59: if (n. check (20)) goto K2302; else goto K2088;
631K63: if (n. check (17)) goto K15; else goto K2377;
632K64: if (n. check (4)) goto K1575; else goto K1541;
633K65: if (n. check (1)) goto K504; else goto K1046;
634K67: if (n. check (4)) goto K1402; else goto K793;
635K68: if (n. check (16)) return false; else goto K174;
636K69: if (n. check (18)) goto K49; else goto K1636;
637K76: if (n. check (19)) return false; else goto K1900;
638K78: if (n. check (19)) goto K690; else goto K1873;
639K79: if (n. check (20)) goto K57; else goto K1797;
640K80: if (n. check (20)) goto K2317; else goto K237;
641K82: if (n. check (19)) goto K1559; else goto K1414;
642K85: if (n. check (20)) goto K2317; else goto K464;
643K90: if (n. check (4)) goto K862; else goto K1928;
644K92: if (n. check (4)) goto K59; else goto K2119;
645K93: if (n. check (7)) goto K1863; else return false;
646K97: if (n. check (5)) goto K361; else goto K244;
647K98: if (n. check (1)) return false; else goto K1299;
648K101: if (n. check (13)) return false; else goto K184;
649K102: if (n. check (1)) goto K2536; else goto K2453;
650K105: if (n. check (20)) goto K248; else goto K712;
651K106: if (n. check (1)) goto K1410; else goto K139;
652K112: if (n. check (5)) goto K359; else goto K121;
653K115: if (n. check (4)) goto K307; else goto K101;
654K117: if (n. check (14)) goto K2247; else goto K580;
655K118: if (n. check (4)) goto K826; else goto K2473;
656K119: if (n. check (13)) return false; else goto K2174;
657K121: if (n. check (8)) goto K106; else goto K226;
658K123: if (n. check (4)) goto K1814; else goto K1442;
659K124: if (n. check (10)) goto K1086; else goto K1683;
660K125: if (n. check (14)) goto K355; else goto K1816;
661K127: if (n. check (1)) return false; else goto K1000;
662K131: if (n. check (17)) return false; else goto K200;
663K134: if (n. check (19)) return false; else goto K1862;
664K137: if (n. check (11)) goto K177; else goto K167;
665K139: if (n. check (4)) goto K891; else goto K1234;
666K143: if (n. check (13)) return false; else goto K2460;
667K154: if (n. check (15)) return false; else goto K342;
668K155: if (n. check (14)) goto K1410; else goto K1549;
669K156: if (n. check (1)) return false; else goto K2181;
670K158: if (n. check (4)) goto K1610; else goto K1250;
671K163: if (n. check (16)) return false; else goto K2112;
672K164: if (n. check (17)) goto K2585; else return false;
673K165: if (n. check (10)) return false; else goto K1607;
674K166: if (n. check (20)) goto K2422; else goto K2417;
675K167: if (n. check (1)) goto K504; else goto K977;
676K172: if (n. check (7)) goto K988; else goto K559;
677K174: if (n. check (19)) goto K1950; else goto K465;
678K175: if (n. check (19)) goto K1948; else goto K164;
679K177: if (n. check (1)) return false; else goto K2279;
680K181: if (n. check (14)) goto K533; else goto K118;
681K182: if (n. check (19)) return false; else goto K2368;
682K184: if (n. check (20)) goto K1607; else goto K2423;
683K185: if (n. check (20)) return false; else goto K1614;
684K192: if (n. check (20)) goto K2410; else goto K2063;
685K195: if (n. check (7)) goto K1153; else goto K268;
686K198: if (n. check (23)) return true; else goto K52;
687K199: if (n. check (1)) goto K117; else goto K1399;
688K200: if (n. check (15)) goto K2377; else goto K1992;
689K202: if (n. check (7)) goto K273; else goto K1332;
690K203: if (n. check (19)) return true; else goto K37;
691K204: if (n. check (16)) return false; else goto K1794;
692K205: if (n. check (13)) return false; else goto K1442;
693K215: if (n. check (19)) goto K545; else goto K37;
694K219: if (n. check (7)) goto K182; else goto K2264;
695K222: if (n. check (1)) goto K728; else goto K1954;
696K224: if (n. check (7)) goto K1226; else goto K261;
697K225: if (n. check (7)) goto K1922; else goto K2403;
698K226: if (n. check (9)) goto K452; else goto K1825;
699K229: if (n. check (15)) goto K1571; else goto K453;
700K230: if (n. check (19)) goto K1949; else goto K1263;
701K232: if (n. check (7)) goto K1153; else return false;
702K235: if (n. check (19)) goto K2063; else goto K1760;
703K236: if (n. check (6)) goto K1940; else goto K1506;
704K237: if (n. check (7)) goto K2112; else goto K163;
705K238: if (n. check (20)) return false; else goto K2058;
706K241: if (n. check (1)) goto K624; else goto K2371;
707K242: if (n. check (1)) goto K1832; else goto K687;
708K244: if (n. check (8)) goto K258; else goto K2277;
709K246: if (n. check (23)) return true; else goto K803;
710K248: if (n. check (7)) goto K987; else goto K1804;
711K249: if (n. check (14)) return false; else goto K1135;
712K251: if (n. check (4)) goto K872; else goto K2576;
713K254: if (n. check (7)) goto K1924; else return false;
714K255: if (n. check (17)) goto K14; else goto K2377;
715K257: if (n. check (14)) return false; else goto K832;
716K258: if (n. check (1)) goto K832; else goto K863;
717K260: if (n. check (19)) goto K839; else goto K722;
718K261: if (n. check (19)) goto K2058; else goto K873;
719K267: if (n. check (16)) return false; else goto K2313;
720K268: if (n. check (16)) return false; else goto K1253;
721K273: if (n. check (19)) return false; else goto K1769;
722K278: if (n. check (19)) goto K686; else goto K37;
723K281: if (n. check (22)) goto K2381; else goto K1559;
724K285: if (n. check (11)) goto K1257; else goto K199;
725K293: if (n. check (7)) goto K1565; else goto K2296;
726K307: if (n. check (20)) goto K1607; else goto K203;
727K342: if (n. check (6)) return false; else goto K2000;
728K350: if (n. check (6)) goto K1805; else goto K2602;
729K354: if (n. check (6)) goto K867; else goto K2002;
730K355: if (n. check (4)) goto K1762; else goto K1519;
731K356: if (n. check (7)) goto K1297; else goto K1794;
732K359: if (n. check (8)) goto K1256; else goto K2365;
733K360: if (n. check (19)) return false; else goto K1761;
734K361: if (n. check (8)) goto K1773; else goto K2344;
735K368: if (n. check (19)) return false; else goto K36;
736K399: if (n. check (17)) goto K15; else goto K1571;
737K401: if (n. check (14)) goto K427; else goto K875;
738K411: if (n. check (13)) return false; else goto K762;
739K427: if (n. check (4)) goto K928; else goto K2134;
740K428: if (n. check (1)) goto K2247; else goto K1135;
741K433: if (n. check (17)) return false; else goto K1571;
742K448: if (n. check (1)) goto K921; else goto K856;
743K451: if (n. check (7)) goto K578; else goto K1939;
744K452: if (n. check (11)) goto K222; else goto K2113;
745K453: if (n. check (6)) goto K2544; else goto K2002;
746K454: if (n. check (14)) goto K1135; else goto K67;
747K464: if (n. check (7)) goto K1799; else goto K2349;
748K465: if (n. check (17)) goto K14; else return false;
749K486: if (n. check (21)) goto K1242; else goto K198;
750K492: if (n. check (17)) goto K15; else goto K2421;
751K494: if (n. check (8)) goto K428; else goto K1147;
752K497: if (n. check (7)) goto K1924; else goto K2306;
753K504: if (n. check (20)) return false; else goto K1559;
754K507: if (n. check (7)) goto K1470; else goto K2487;
755K521: if (n. check (14)) goto K1648; else goto K1171;
756K522: if (n. check (14)) return false; else goto K1608;
757K523: if (n. check (14)) goto K248; else goto K2317;
758K524: if (n. check (12)) goto K98; else goto K2215;
759K533: if (n. check (4)) goto K1542; else return false;
760K543: if (n. check (14)) goto K2044; else goto K1405;
761K545: if (n. check (17)) return true; else goto K39;
762K559: if (n. check (22)) goto K174; else goto K1864;
763K578: if (n. check (19)) goto K2410; else goto K2063;
764K580: if (n. check (20)) goto K832; else goto K1950;
765K590: if (n. check (6)) goto K2497; else goto K2602;
766K591: if (n. check (14)) goto K863; else goto K225;
767K592: if (n. check (15)) goto K2467; else goto K2602;
768K624: if (n. check (20)) goto K37; else return true;
769K649: if (n. check (5)) goto K1520; else goto K2586;
770K685: if (n. check (10)) goto K454; else goto K2267;
771K686: if (n. check (17)) return true; else goto K2363;
772K687: if (n. check (10)) goto K2028; else goto K181;
773K690: if (n. check (17)) return false; else goto K229;
774K691: if (n. check (6)) goto K1242; else return false;
775K698: if (n. check (1)) goto K1457; else goto K685;
776K703: if (n. check (20)) goto K2302; else goto K281;
777K712: if (n. check (7)) goto K1110; else goto K2199;
778K718: if (n. check (19)) goto K2058; else return false;
779K722: if (n. check (17)) goto K2585; else goto K1593;
780K724: if (n. check (17)) goto K14; else goto K236;
781K725: if (n. check (18)) return false; else goto K1233;
782K728: if (n. check (14)) return false; else goto K1410;
783K731: if (n. check (13)) return false; else goto K2119;
784K741: if (n. check (14)) goto K1608; else goto K451;
785K751: if (n. check (7)) goto K1264; else goto K1179;
786K752: if (n. check (20)) goto K921; else goto K686;
787K761: if (n. check (7)) goto K1813; else goto K1253;
788K762: if (n. check (20)) goto K2120; else goto K2350;
789K773: if (n. check (19)) return false; else goto K433;
790K785: if (n. check (22)) goto K2533; else goto K690;
791K792: if (n. check (8)) goto K1534; else goto K2314;
792K793: if (n. check (20)) goto K225; else goto K942;
793K803: if (n. check (24)) goto K52; else goto K53;
794K826: if (n. check (20)) goto K2317; else goto K908;
795K831: if (n. check (16)) goto K2092; else goto K1623;
796K832: if (n. check (17)) goto K14; else goto K354;
797K839: if (n. check (17)) goto K2585; else goto K592;
798K843: if (n. check (22)) goto K2112; else goto K260;
799K856: if (n. check (10)) goto K2302; else goto K2120;
800K862: if (n. check (20)) goto K225; else goto K2386;
801K863: if (n. check (7)) goto K134; else goto K1527;
802K867: if (n. check (18)) return false; else goto K48;
803K871: if (n. check (10)) goto K2028; else goto K2310;
804K872: if (n. check (20)) goto K2302; else goto K2381;
805K873: if (n. check (17)) return false; else goto K198;
806K875: if (n. check (4)) goto K1957; else goto K119;
807K891: if (n. check (20)) goto K863; else goto K2367;
808K894: if (n. check (17)) goto K15; else goto K691;
809K907: if (n. check (14)) return false; else goto K2247;
810K908: if (n. check (7)) goto K175; else goto K1048;
811K909: if (n. check (16)) return false; else goto K920;
812K920: if (n. check (19)) goto K690; else goto K2175;
813K921: if (n. check (17)) return true; else goto K38;
814K924: if (n. check (10)) goto K1245; else goto K1441;
815K928: if (n. check (20)) goto K863; else goto K1972;
816K937: if (n. check (4)) goto K1204; else goto K2119;
817K939: if (n. check (16)) return false; else goto K1804;
818K942: if (n. check (7)) goto K785; else goto K843;
819K966: if (n. check (20)) goto K921; else goto K545;
820K977: if (n. check (10)) goto K2001; else goto K251;
821K978: if (n. check (2)) goto K97; else goto K1563;
822K983: if (n. check (4)) goto K1903; else goto K184;
823K987: if (n. check (19)) goto K832; else goto K1042;
824K988: if (n. check (22)) goto K2416; else goto K1862;
825K1000: if (n. check (10)) return false; else goto K983;
826K1001: if (n. check (6)) goto K1735; else goto K1090;
827K1002: if (n. check (14)) goto K1846; else goto K123;
828K1042: if (n. check (17)) goto K14; else goto K350;
829K1043: if (n. check (2)) goto K649; else goto K1904;
830K1044: if (n. check (20)) goto K2317; else goto K2057;
831K1046: if (n. check (10)) goto K2001; else goto K937;
832K1048: if (n. check (16)) return false; else goto K1179;
833K1067: if (n. check (17)) return false; else goto K1001;
834K1075: if (n. check (1)) goto K2437; else goto K2123;
835K1086: if (n. check (14)) goto K1923; else goto K90;
836K1087: if (n. check (20)) goto K1608; else goto K202;
837K1090: if (n. check (21)) goto K2602; else goto K69;
838K1095: if (n. check (19)) goto K2058; else goto K1769;
839K1108: if (n. check (1)) goto K2198; else goto K2570;
840K1110: if (n. check (19)) goto K1042; else goto K465;
841K1112: if (n. check (20)) goto K1608; else goto K761;
842K1134: if (n. check (22)) goto K175; else goto K1948;
843K1135: if (n. check (4)) goto K185; else goto K1977;
844K1136: if (n. check (22)) goto K215; else goto K545;
845K1147: if (n. check (9)) goto K285; else goto K2256;
846K1149: if (n. check (19)) goto K2144; else goto K839;
847K1153: if (n. check (22)) goto K1332; else goto K2063;
848K1171: if (n. check (4)) goto K79; else goto K1289;
849K1179: if (n. check (19)) goto K1948; else goto K54;
850K1180: if (n. check (20)) goto K2144; else goto K1948;
851K1181: if (n. check (6)) goto K1242; else goto K1506;
852K1196: if (n. check (7)) return false; else goto K2495;
853K1200: if (n. check (7)) goto K1149; else return false;
854K1204: if (n. check (20)) return false; else goto K82;
855K1210: if (n. check (19)) goto K1862; else goto K2368;
856K1211: if (n. check (7)) goto K78; else goto K909;
857K1217: if (n. check (14)) goto K1135; else goto K1633;
858K1221: if (n. check (10)) goto K591; else goto K523;
859K1226: if (n. check (19)) return false; else goto K2058;
860K1233: if (n. check (23)) return false; else goto K2352;
861K1234: if (n. check (20)) goto K248; else goto K507;
862K1238: if (n. check (7)) goto K360; else goto K1794;
863K1242: if (n. check (18)) goto K198; else return false;
864K1245: if (n. check (4)) goto K1460; else goto K762;
865K1250: if (n. check (20)) goto K1200; else goto K1300;
866K1253: if (n. check (22)) goto K1332; else goto K235;
867K1256: if (n. check (1)) goto K752; else goto K1245;
868K1257: if (n. check (1)) goto K907; else goto K1471;
869K1263: if (n. check (17)) goto K14; else goto K2421;
870K1264: if (n. check (19)) return false; else goto K131;
871K1270: if (n. check (14)) return false; else goto K863;
872K1285: if (n. check (20)) return false; else goto K690;
873K1288: if (n. check (7)) goto K2250; else goto K174;
874K1289: if (n. check (13)) return false; else goto K2490;
875K1297: if (n. check (19)) goto K1949; else goto K465;
876K1299: if (n. check (10)) return false; else goto K1302;
877K1300: if (n. check (7)) goto K1134; else goto K2092;
878K1302: if (n. check (14)) return false; else goto K2341;
879K1307: if (n. check (4)) goto K105; else goto K143;
880K1327: if (n. check (11)) goto K1910; else goto K1915;
881K1328: if (n. check (20)) goto K2120; else goto K215;
882K1332: if (n. check (19)) goto K2063; else goto K37;
883K1393: if (n. check (1)) goto K543; else goto K124;
884K1395: if (n. check (1)) goto K752; else goto K2486;
885K1399: if (n. check (10)) goto K1867; else goto K401;
886K1402: if (n. check (20)) return false; else goto K1598;
887K1405: if (n. check (20)) goto K2144; else goto K839;
888K1409: if (n. check (17)) return false; else goto K590;
889K1410: if (n. check (20)) goto K832; else goto K1949;
890K1413: if (n. check (1)) goto K966; else goto K1763;
891K1414: if (n. check (17)) return false; else goto K39;
892K1423: if (n. check (14)) goto K139; else goto K2429;
893K1438: if (n. check (17)) goto K15; else return false;
894K1441: if (n. check (4)) goto K1498; else return false;
895K1442: if (n. check (20)) goto K451; else goto K195;
896K1449: if (n. check (20)) return false; else goto K1211;
897K1457: if (n. check (14)) goto K2247; else goto K1285;
898K1460: if (n. check (20)) goto K2302; else goto K76;
899K1461: if (n. check (17)) return false; else goto K236;
900K1470: if (n. check (22)) goto K1297; else goto K1949;
901K1471: if (n. check (10)) goto K249; else goto K1217;
902K1475: if (n. check (19)) goto K2410; else goto K1760;
903K1498: if (n. check (20)) goto K2120; else goto K278;
904K1506: if (n. check (18)) goto K198; else goto K1233;
905K1507: if (n. check (4)) goto K80; else goto K1947;
906K1519: if (n. check (13)) return false; else goto K1112;
907K1520: if (n. check (8)) goto K1803; else goto K1693;
908K1521: if (n. check (4)) goto K1449; else goto K85;
909K1527: if (n. check (19)) goto K832; else goto K724;
910K1534: if (n. check (1)) goto K504; else goto K2001;
911K1538: if (n. check (20)) goto K451; else goto K2062;
912K1541: if (n. check (20)) goto K1970; else goto K1801;
913K1542: if (n. check (20)) goto K248; else goto K356;
914K1543: if (n. check (21)) goto K1506; else goto K2581;
915K1549: if (n. check (20)) goto K399; else goto K63;
916K1558: if (n. check (1)) goto K257; else goto K2173;
917K1559: if (n. check (17)) return false; else goto K38;
918K1562: if (n. check (13)) return false; else goto K1234;
919K1563: if (n. check (3)) goto K2598; else goto K112;
920K1565: if (n. check (22)) goto K174; else goto K1950;
921K1571: if (n. check (6)) goto K2544; else return false;
922K1575: if (n. check (20)) goto K863; else goto K1288;
923K1587: if (n. check (4)) goto K1328; else goto K731;
924K1593: if (n. check (15)) goto K691; else goto K1181;
925K1598: if (n. check (7)) goto K1922; else goto K920;
926K1599: if (n. check (1)) goto K624; else goto K983;
927K1607: if (n. check (19)) goto K37; else return true;
928K1608: if (n. check (7)) goto K1226; else goto K1475;
929K1610: if (n. check (20)) goto K225; else goto K751;
930K1611: if (n. check (20)) return false; else goto K224;
931K1614: if (n. check (7)) goto K134; else goto K2313;
932K1623: if (n. check (22)) goto K1179; else goto K1700;
933K1633: if (n. check (4)) goto K2209; else goto K2174;
934K1636: if (n. check (23)) return true; else goto K50;
935K1648: if (n. check (4)) goto K1542; else goto K1562;
936K1664: if (n. check (20)) goto K93; else goto K254;
937K1683: if (n. check (14)) goto K1307; else goto K1507;
938K1687: if (n. check (17)) goto K15; else goto K2467;
939K1692: if (n. check (7)) goto K1860; else goto K2411;
940K1693: if (n. check (1)) goto K37; else goto K165;
941K1700: if (n. check (19)) goto K1948; else goto K2451;
942K1705: if (n. check (8)) goto K2045; else goto K1835;
943K1728: if (n. check (10)) return false; else goto K2302;
944K1735: if (n. check (21)) goto K1805; else goto K48;
945K1760: if (n. check (17)) return true; else goto K198;
946K1761: if (n. check (17)) return false; else goto K2377;
947K1762: if (n. check (20)) goto K1608; else goto K1925;
948K1763: if (n. check (10)) goto K92; else goto K1587;
949K1764: if (n. check (4)) goto K166; else goto K2490;
950K1769: if (n. check (17)) return false; else goto K49;
951K1772: if (n. check (7)) goto K578; else return false;
952K1773: if (n. check (1)) goto K921; else goto K2302;
953K1789: if (n. check (1)) goto K2410; else goto K1608;
954K1794: if (n. check (19)) goto K63; else goto K1438;
955K1797: if (n. check (7)) goto K1794; else goto K204;
956K1798: if (n. check (19)) goto K63; else goto K492;
957K1799: if (n. check (22)) goto K2112; else goto K839;
958K1801: if (n. check (7)) goto K1565; else return false;
959K1803: if (n. check (1)) goto K36; else goto K1607;
960K1804: if (n. check (19)) goto K399; else goto K894;
961K1805: if (n. check (18)) goto K48; else return false;
962K1813: if (n. check (22)) goto K718; else goto K2058;
963K1814: if (n. check (20)) return false; else goto K1843;
964K1816: if (n. check (4)) goto K1538; else goto K205;
965K1822: if (n. check (7)) goto K1799; else return false;
966K1824: if (n. check (19)) return false; else goto K1873;
967K1825: if (n. check (11)) goto K242; else goto K524;
968K1828: if (n. check (14)) goto K863; else goto K2422;
969K1832: if (n. check (14)) goto K1410; else goto K1180;
970K1835: if (n. check (11)) goto K1075; else goto K1108;
971K1843: if (n. check (7)) goto K1095; else goto K2091;
972K1846: if (n. check (4)) goto K1611; else goto K1112;
973K1855: if (n. check (14)) goto K139; else goto K1764;
974K1859: if (n. check (7)) goto K2190; else goto K267;
975K1860: if (n. check (22)) goto K1110; else goto K1042;
976K1861: if (n. check (20)) goto K1772; else goto K232;
977K1862: if (n. check (17)) return false; else goto K354;
978K1863: if (n. check (19)) goto K399; else goto K1687;
979K1864: if (n. check (19)) goto K1950; else goto K724;
980K1867: if (n. check (14)) goto K1135; else goto K64;
981K1873: if (n. check (17)) return false; else goto K592;
982K1900: if (n. check (17)) return false; else goto K2363;
983K1903: if (n. check (20)) return false; else goto K368;
984K1904: if (n. check (5)) goto K2108; else goto K1705;
985K1905: if (n. check (13)) goto K2473; else goto K1044;
986K1910: if (n. check (1)) goto K752; else goto K924;
987K1915: if (n. check (12)) return false; else goto K1395;
988K1922: if (n. check (19)) return false; else goto K690;
989K1923: if (n. check (4)) goto K2200; else goto K2460;
990K1924: if (n. check (22)) goto K1794; else goto K63;
991K1925: if (n. check (7)) goto K718; else goto K1332;
992K1926: if (n. check (20)) goto K1998; else goto K1238;
993K1928: if (n. check (20)) goto K1200; else goto K1822;
994K1934: if (n. check (7)) goto K174; else goto K68;
995K1939: if (n. check (16)) return false; else goto K1475;
996K1940: if (n. check (18)) return false; else goto K198;
997K1947: if (n. check (13)) return false; else goto K85;
998K1948: if (n. check (17)) goto K2585; else goto K200;
999K1949: if (n. check (17)) goto K14; else goto K1001;
1000K1950: if (n. check (17)) goto K14; else goto K590;
1001K1954: if (n. check (10)) goto K2343; else goto K1855;
1002K1957: if (n. check (20)) goto K2422; else goto K1934;
1003K1970: if (n. check (7)) goto K2292; else return false;
1004K1972: if (n. check (7)) goto K2416; else goto K174;
1005K1977: if (n. check (20)) goto K863; else goto K172;
1006K1985: if (n. check (19)) goto K433; else goto K2003;
1007K1992: if (n. check (6)) goto K2321; else goto K1090;
1008K1996: if (n. check (16)) return false; else goto K1332;
1009K1998: if (n. check (7)) goto K773; else goto K1804;
1010K2000: if (n. check (21)) return false; else goto K725;
1011K2001: if (n. check (4)) goto K56; else goto K703;
1012K2002: if (n. check (18)) goto K48; else goto K1636;
1013K2003: if (n. check (17)) return false; else goto K691;
1014K2019: if (n. check (1)) return false; else goto K1728;
1015K2028: if (n. check (14)) goto K139; else goto K158;
1016K2041: if (n. check (11)) goto K156; else goto K1395;
1017K2044: if (n. check (20)) goto K832; else goto K1042;
1018K2045: if (n. check (1)) goto K238; else goto K1846;
1019K2057: if (n. check (7)) goto K1134; else goto K831;
1020K2058: if (n. check (17)) return false; else goto K48;
1021K2062: if (n. check (7)) goto K1332; else goto K1996;
1022K2063: if (n. check (17)) return true; else goto K49;
1023K2067: if (n. check (16)) return false; else goto K230;
1024K2082: if (n. check (20)) return false; else goto K2177;
1025K2084: if (n. check (13)) return false; else goto K2473;
1026K2087: if (n. check (14)) goto K832; else goto K2144;
1027K2088: if (n. check (19)) return false; else goto K1414;
1028K2091: if (n. check (16)) return false; else goto K261;
1029K2092: if (n. check (22)) return false; else goto K2099;
1030K2099: if (n. check (19)) return false; else goto K2376;
1031K2108: if (n. check (8)) goto K1599; else goto K2434;
1032K2112: if (n. check (19)) goto K839; else goto K164;
1033K2113: if (n. check (1)) goto K155; else goto K2415;
1034K2117: if (n. check (14)) return false; else goto K1846;
1035K2119: if (n. check (20)) goto K2120; else goto K1136;
1036K2120: if (n. check (19)) goto K921; else goto K545;
1037K2122: if (n. check (4)) goto K1498; else goto K411;
1038K2123: if (n. check (10)) goto K2117; else goto K1002;
1039K2134: if (n. check (13)) return false; else goto K1977;
1040K2144: if (n. check (17)) goto K2585; else goto K229;
1041K2147: if (n. check (1)) goto K2087; else goto K1221;
1042K2152: if (n. check (19)) goto K1687; else goto K894;
1043K2173: if (n. check (10)) goto K1270; else goto K1828;
1044K2174: if (n. check (20)) goto K2422; else goto K293;
1045K2175: if (n. check (17)) return false; else goto K1593;
1046K2177: if (n. check (7)) goto K1210; else goto K1985;
1047K2181: if (n. check (10)) return false; else goto K1245;
1048K2190: if (n. check (19)) goto K1862; else goto K1409;
1049K2198: if (n. check (14)) goto K238; else goto K192;
1050K2199: if (n. check (19)) goto K1687; else goto K1438;
1051K2200: if (n. check (20)) goto K863; else goto K219;
1052K2209: if (n. check (20)) return false; else goto K1859;
1053K2214: if (n. check (4)) goto K2082; else goto K2460;
1054K2215: if (n. check (1)) goto K1832; else goto K871;
1055K2232: if (n. check (4)) goto K826; else goto K1905;
1056K2245: if (n. check (15)) goto K2421; else goto K2303;
1057K2247: if (n. check (20)) return false; else goto K1862;
1058K2250: if (n. check (19)) return false; else goto K1409;
1059K2256: if (n. check (11)) goto K698; else goto K1393;
1060K2264: if (n. check (19)) goto K1042; else goto K2360;
1061K2267: if (n. check (14)) goto K2214; else goto K1521;
1062K2277: if (n. check (9)) goto K1558; else goto K2147;
1063K2279: if (n. check (10)) return false; else goto K2001;
1064K2292: if (n. check (19)) goto K832; else goto K1950;
1065K2293: if (n. check (4)) goto K1087; else goto K1861;
1066K2296: if (n. check (16)) return false; else goto K559;
1067K2302: if (n. check (19)) return false; else goto K1559;
1068K2303: if (n. check (6)) goto K486; else goto K1543;
1069K2306: if (n. check (16)) return false; else goto K2487;
1070K2310: if (n. check (14)) goto K1648; else goto K2232;
1071K2312: if (n. check (11)) goto K65; else goto K1413;
1072K2313: if (n. check (19)) goto K1862; else goto K1461;
1073K2314: if (n. check (9)) goto K137; else goto K2312;
1074K2317: if (n. check (7)) goto K1149; else goto K2557;
1075K2321: if (n. check (21)) goto K2602; else goto K49;
1076K2341: if (n. check (4)) return false; else goto K2084;
1077K2343: if (n. check (14)) return false; else goto K139;
1078K2344: if (n. check (9)) goto K2019; else goto K448;
1079K2349: if (n. check (16)) return false; else goto K843;
1080K2350: if (n. check (22)) goto K278; else goto K686;
1081K2352: if (n. check (24)) return false; else goto K52;
1082K2360: if (n. check (17)) goto K14; else goto K691;
1083K2363: if (n. check (21)) goto K39; else return true;
1084K2365: if (n. check (9)) goto K2041; else goto K1327;
1085K2367: if (n. check (7)) goto K2515; else goto K230;
1086K2368: if (n. check (17)) return false; else goto K350;
1087K2371: if (n. check (10)) goto K983; else goto K115;
1088K2376: if (n. check (17)) return false; else goto K154;
1089K2377: if (n. check (6)) goto K2321; else return false;
1090K2381: if (n. check (19)) goto K1559; else return false;
1091K2386: if (n. check (7)) goto K1824; else goto K2112;
1092K2387: if (n. check (19)) goto K1949; else goto K255;
1093K2403: if (n. check (19)) goto K2144; else goto K722;
1094K2410: if (n. check (17)) return true; else goto K48;
1095K2411: if (n. check (22)) goto K2199; else goto K2152;
1096K2412: if (n. check (14)) goto K1846; else goto K2293;
1097K2415: if (n. check (10)) goto K1423; else goto K521;
1098K2416: if (n. check (19)) goto K1862; else return false;
1099K2417: if (n. check (7)) goto K2387; else goto K2067;
1100K2421: if (n. check (6)) goto K486; else goto K2000;
1101K2422: if (n. check (7)) goto K2292; else goto K2555;
1102K2423: if (n. check (22)) goto K203; else return true;
1103K2429: if (n. check (4)) goto K1926; else goto K1664;
1104K2434: if (n. check (11)) goto K127; else goto K241;
1105K2437: if (n. check (14)) return false; else goto K238;
1106K2451: if (n. check (17)) goto K2585; else goto K2245;
1107K2453: if (n. check (10)) goto K522; else goto K741;
1108K2460: if (n. check (20)) goto K248; else goto K1692;
1109K2467: if (n. check (6)) goto K2602; else return false;
1110K2473: if (n. check (20)) return false; else goto K1196;
1111K2486: if (n. check (10)) goto K1245; else goto K2122;
1112K2487: if (n. check (22)) goto K1794; else goto K1798;
1113K2490: if (n. check (20)) goto K57; else goto K497;
1114K2495: if (n. check (16)) return false; else goto K2092;
1115K2497: if (n. check (18)) return false; else goto K49;
1116K2515: if (n. check (19)) return false; else goto K1067;
1117K2533: if (n. check (19)) goto K690; else return false;
1118K2536: if (n. check (14)) return false; else goto K2410;
1119K2544: if (n. check (18)) goto K48; else goto K49;
1120K2555: if (n. check (16)) return false; else goto K1527;
1121K2557: if (n. check (16)) return false; else goto K2403;
1122K2570: if (n. check (10)) goto K2412; else goto K125;
1123K2576: if (n. check (13)) return false; else goto K703;
1124K2581: if (n. check (18)) goto K198; else goto K246;
1125K2585: if (n. check (15)) goto K15; else return true;
1126K2586: if (n. check (8)) goto K1789; else goto K102;
1127K2598: if (n. check (5)) goto K792; else goto K494;
1128K2602: if (n. check (18)) goto K49; else return false;
1129} /* acyclic3d */

Referenced by bddacyclic(), and chomp::homology::Acyclic3d< SetT >::check().

◆ acyclic3d_Malandain()

template<class NeighborCheck >
bool chomp::homology::acyclic3d_Malandain ( NeighborCheck &  n)

Verifies whether the neighborhood of a 3-dimensional cube is acyclic.

This procedure has been received from G. Malandain, see L. Robert and G. Malandain, Computer Vision and Image Understanding, Fast Binary Image Processing Using Binary Decision Diagrams, October 1998, No. 1, Vol. 72, pp. 1–9.

Definition at line 101 of file bddacycl.h.

102{
103 int statInv = 0;
104
105/*L147001:*/ if (n. check (5)) {goto L143033;} else {goto L120232;}
106L143033: if (n. check (0)) {goto L123529;} else {goto L118136;}
107L123529: if (n. check (17)) {goto L146041;} else {goto L144920;}
108L146041: if (n. check (2)) {goto L124809;} else {goto L145112;}
109L124809: if (n. check (1)) {goto L106441;} else {goto L124904;}
110L106441: if (n. check (8)) {goto L105737;} else {goto L105736;}
111L124904: if (n. check (8)) {goto L105736;} else {goto L106537;}
112L106537: if (n. check (10)) {goto L105737;} else {goto L105736;}
113L145112: if (n. check (1)) {goto L124648;} else {goto L108505;}
114L124648: if (n. check (8)) {goto L105736;} else {goto L106473;}
115L106473: if (n. check (11)) {goto L105737;} else {goto L105736;}
116L108505: if (n. check (8)) {goto L106281;} else {goto L114329;}
117L106281: if (n. check (4)) {goto L105737;} else {goto L105736;}
118L114329: if (n. check (4)) {goto L128185;} else {goto L115769;}
119L128185: if (n. check (11)) {goto L105737;} else {goto L106537;}
120L115769: if (n. check (11)) {goto L106537;} else {goto L144408;}
121L144408: if (n. check (10)) {goto L105736;} else {goto L106569;}
122L106569: if (n. check (13)) {goto L105737;} else {goto L105736;}
123L144920: if (n. check (2)) {goto L109080;} else {goto L116761;}
124L109080: if (n. check (1)) {statInv=!statInv;goto L106441;} else {goto L118697;}
125L118697: if (n. check (19)) {goto L105737;} else {goto L124904;}
126L116761: if (n. check (20)) {goto L117817;} else {goto L127624;}
127L117817: if (n. check (1)) {goto L105737;} else {goto L117017;}
128L117017: if (n. check (19)) {goto L105737;} else {goto L108505;}
129L127624: if (n. check (1)) {goto L124648;} else {goto L114553;}
130L114553: if (n. check (19)) {goto L108505;} else {goto L118680;}
131L118680: if (n. check (8)) {goto L130584;} else {goto L130041;}
132L130584: if (n. check (22)) {statInv=!statInv;goto L106281;} else {goto L105736;}
133L130041: if (n. check (22)) {goto L126505;} else {goto L137305;}
134L126505: if (n. check (4)) {goto L127657;} else {goto L105737;}
135L127657: if (n. check (11)) {goto L106537;} else {statInv=!statInv;goto L106537;}
136L137305: if (n. check (4)) {goto L127657;} else {goto L115769;}
137L118136: if (n. check (17)) {goto L131608;} else {goto L137497;}
138L131608: if (n. check (2)) {goto L115784;} else {goto L108185;}
139L115784: if (n. check (1)) {goto L117608;} else {goto L121673;}
140L117608: if (n. check (9)) {statInv=!statInv;goto L106441;} else {goto L105736;}
141L121673: if (n. check (9)) {goto L105737;} else {goto L134921;}
142L134921: if (n. check (8)) {goto L105737;} else {goto L106537;}
143L108185: if (n. check (1)) {goto L145497;} else {goto L120857;}
144L145497: if (n. check (3)) {goto L146729;} else {goto L118584;}
145L146729: if (n. check (9)) {goto L105737;} else {goto L130201;}
146L130201: if (n. check (8)) {goto L105737;} else {goto L106473;}
147L118584: if (n. check (9)) {goto L124648;} else {goto L120680;}
148L120680: if (n. check (8)) {goto L105736;} else {goto L119432;}
149L119432: if (n. check (12)) {statInv=!statInv;goto L106473;} else {goto L105736;}
150L120857: if (n. check (3)) {goto L129049;} else {goto L115481;}
151L129049: if (n. check (9)) {goto L105737;} else {goto L120265;}
152L120265: if (n. check (8)) {goto L105737;} else {goto L114329;}
153L115481: if (n. check (9)) {goto L108505;} else {goto L126889;}
154L126889: if (n. check (8)) {goto L106281;} else {goto L146681;}
155L146681: if (n. check (4)) {goto L129465;} else {goto L121080;}
156L129465: if (n. check (12)) {goto L109273;} else {goto L106537;}
157L109273: if (n. check (11)) {goto L106537;} else {goto L105737;}
158L121080: if (n. check (12)) {goto L121864;} else {goto L107128;}
159L121864: if (n. check (11)) {statInv=!statInv;goto L106537;} else {goto L105737;}
160L107128: if (n. check (11)) {statInv=!statInv;goto L106537;} else {goto L144408;}
161L137497: if (n. check (18)) {goto L109625;} else {goto L144984;}
162L109625: if (n. check (2)) {goto L116633;} else {goto L116569;}
163L116633: if (n. check (1)) {goto L105737;} else {goto L107753;}
164L107753: if (n. check (19)) {goto L105737;} else {goto L121673;}
165L116569: if (n. check (20)) {goto L137753;} else {goto L126057;}
166L137753: if (n. check (1)) {goto L105737;} else {goto L122249;}
167L122249: if (n. check (19)) {goto L105737;} else {goto L120857;}
168L126057: if (n. check (1)) {goto L145497;} else {goto L119273;}
169L119273: if (n. check (19)) {goto L120857;} else {goto L107833;}
170L107833: if (n. check (3)) {goto L135929;} else {goto L122824;}
171L135929: if (n. check (9)) {goto L105737;} else {goto L107961;}
172L107961: if (n. check (8)) {goto L105737;} else {goto L130041;}
173L122824: if (n. check (9)) {goto L118680;} else {goto L121448;}
174L121448: if (n. check (8)) {goto L130584;} else {goto L124136;}
175L124136: if (n. check (22)) {goto L143960;} else {goto L125928;}
176L143960: if (n. check (4)) {goto L146936;} else {goto L105737;}
177L146936: if (n. check (12)) {goto L121864;} else {statInv=!statInv;goto L106537;}
178L125928: if (n. check (4)) {goto L146936;} else {goto L121080;}
179L144984: if (n. check (2)) {goto L120456;} else {goto L128441;}
180L120456: if (n. check (1)) {goto L117608;} else {goto L117657;}
181L117657: if (n. check (19)) {goto L121673;} else {goto L127016;}
182L127016: if (n. check (9)) {goto L124904;} else {statInv=!statInv;goto L134921;}
183L128441: if (n. check (20)) {goto L121577;} else {goto L114488;}
184L121577: if (n. check (1)) {goto L145497;} else {goto L124089;}
185L124089: if (n. check (19)) {goto L120857;} else {goto L129337;}
186L129337: if (n. check (3)) {goto L130169;} else {goto L135480;}
187L130169: if (n. check (9)) {goto L108505;} else {goto L107225;}
188L107225: if (n. check (8)) {goto L106281;} else {goto L126025;}
189L126025: if (n. check (4)) {goto L123049;} else {goto L121864;}
190L123049: if (n. check (11)) {goto L105737;} else {statInv=!statInv;goto L106537;}
191L135480: if (n. check (9)) {goto L130904;} else {goto L146968;}
192L130904: if (n. check (8)) {statInv=!statInv;goto L106281;} else {goto L126505;}
193L146968: if (n. check (8)) {statInv=!statInv;goto L106281;} else {goto L143960;}
194L114488: if (n. check (1)) {goto L146616;} else {goto L129881;}
195L146616: if (n. check (3)) {goto L134312;} else {goto L136217;}
196L134312: if (n. check (9)) {goto L124648;} else {statInv=!statInv;goto L130201;}
197L136217: if (n. check (21)) {goto L105737;} else {goto L118584;}
198L129881: if (n. check (19)) {goto L133913;} else {goto L125960;}
199L133913: if (n. check (3)) {goto L108953;} else {goto L122217;}
200L108953: if (n. check (9)) {goto L108505;} else {goto L136281;}
201L136281: if (n. check (8)) {goto L106281;} else {goto L143177;}
202L143177: if (n. check (4)) {goto L109273;} else {goto L121864;}
203L122217: if (n. check (21)) {goto L105737;} else {goto L115481;}
204L125960: if (n. check (3)) {goto L134536;} else {goto L134697;}
205L134536: if (n. check (9)) {goto L118680;} else {goto L135096;}
206L135096: if (n. check (8)) {goto L130584;} else {goto L137704;}
207L137704: if (n. check (22)) {goto L143128;} else {goto L121864;}
208L143128: if (n. check (4)) {goto L121864;} else {goto L105737;}
209L134697: if (n. check (21)) {goto L105737;} else {goto L122824;}
210L120232: if (n. check (0)) {goto L126936;} else {goto L126121;}
211L126936: if (n. check (17)) {goto L123272;} else {goto L132825;}
212L123272: if (n. check (2)) {goto L123848;} else {goto L131161;}
213L123848: if (n. check (1)) {goto L114968;} else {goto L119785;}
214L114968: if (n. check (14)) {statInv=!statInv;goto L106441;} else {goto L105736;}
215L119785: if (n. check (7)) {goto L135721;} else {goto L128600;}
216L135721: if (n. check (14)) {goto L105737;} else {goto L134921;}
217L128600: if (n. check (14)) {goto L124904;} else {goto L135352;}
218L135352: if (n. check (8)) {goto L105736;} else {goto L136472;}
219L136472: if (n. check (16)) {statInv=!statInv;goto L106537;} else {goto L105736;}
220L131161: if (n. check (1)) {goto L113913;} else {goto L145833;}
221L113913: if (n. check (14)) {goto L105737;} else {goto L130201;}
222L145833: if (n. check (7)) {goto L132249;} else {goto L142617;}
223L132249: if (n. check (14)) {goto L105737;} else {goto L120265;}
224L142617: if (n. check (14)) {goto L108505;} else {goto L137769;}
225L137769: if (n. check (8)) {goto L106281;} else {goto L125321;}
226L125321: if (n. check (4)) {goto L142841;} else {goto L129368;}
227L142841: if (n. check (11)) {goto L105737;} else {goto L136472;}
228L129368: if (n. check (11)) {goto L136472;} else {goto L106809;}
229L106809: if (n. check (16)) {goto L105737;} else {goto L130457;}
230L130457: if (n. check (10)) {goto L105737;} else {goto L106569;}
231L132825: if (n. check (23)) {goto L136121;} else {goto L123080;}
232L136121: if (n. check (2)) {goto L123785;} else {goto L132537;}
233L123785: if (n. check (1)) {goto L105737;} else {goto L108697;}
234L108697: if (n. check (19)) {goto L105737;} else {goto L119785;}
235L132537: if (n. check (20)) {goto L138169;} else {goto L142761;}
236L138169: if (n. check (1)) {goto L105737;} else {goto L116793;}
237L116793: if (n. check (19)) {goto L105737;} else {goto L145833;}
238L142761: if (n. check (1)) {goto L113913;} else {goto L135737;}
239L135737: if (n. check (19)) {goto L145833;} else {goto L131481;}
240L131481: if (n. check (7)) {goto L123753;} else {goto L107608;}
241L123753: if (n. check (14)) {goto L105737;} else {goto L107961;}
242L107608: if (n. check (14)) {goto L118680;} else {goto L109400;}
243L109400: if (n. check (8)) {goto L130584;} else {goto L128504;}
244L128504: if (n. check (22)) {goto L135224;} else {goto L124712;}
245L135224: if (n. check (4)) {goto L144696;} else {goto L105737;}
246L144696: if (n. check (11)) {goto L136472;} else {goto L105737;}
247L124712: if (n. check (4)) {goto L144696;} else {goto L129368;}
248L123080: if (n. check (2)) {goto L107192;} else {goto L114137;}
249L107192: if (n. check (1)) {goto L114968;} else {goto L130521;}
250L130521: if (n. check (19)) {goto L119785;} else {goto L133768;}
251L133768: if (n. check (7)) {goto L136760;} else {goto L127209;}
252L136760: if (n. check (14)) {goto L124904;} else {statInv=!statInv;goto L134921;}
253L127209: if (n. check (25)) {goto L105737;} else {goto L128600;}
254L114137: if (n. check (20)) {goto L107801;} else {goto L132280;}
255L107801: if (n. check (1)) {goto L113913;} else {goto L143225;}
256L143225: if (n. check (19)) {goto L145833;} else {goto L136249;}
257L136249: if (n. check (7)) {goto L132345;} else {goto L130361;}
258L132345: if (n. check (14)) {goto L108505;} else {goto L107225;}
259L130361: if (n. check (25)) {goto L105737;} else {goto L142617;}
260L132280: if (n. check (1)) {goto L114008;} else {goto L106649;}
261L114008: if (n. check (14)) {goto L124648;} else {statInv=!statInv;goto L130201;}
262L106649: if (n. check (19)) {goto L137465;} else {goto L121512;}
263L137465: if (n. check (7)) {goto L130329;} else {goto L144904;}
264L130329: if (n. check (14)) {goto L108505;} else {goto L136281;}
265L144904: if (n. check (14)) {goto L130904;} else {goto L132040;}
266L132040: if (n. check (8)) {statInv=!statInv;goto L106281;} else {goto L135224;}
267L121512: if (n. check (7)) {goto L134152;} else {goto L117401;}
268L134152: if (n. check (14)) {goto L118680;} else {goto L135096;}
269L117401: if (n. check (25)) {goto L105737;} else {goto L107608;}
270L126121: if (n. check (17)) {goto L123817;} else {goto L145849;}
271L123817: if (n. check (6)) {goto L123465;} else {goto L119336;}
272L123465: if (n. check (2)) {goto L122809;} else {goto L117305;}
273L122809: if (n. check (1)) {goto L118169;} else {goto L107769;}
274L118169: if (n. check (9)) {goto L105737;} else {goto L123337;}
275L123337: if (n. check (14)) {goto L105737;} else {goto L106441;}
276L107769: if (n. check (9)) {goto L105737;} else {goto L125993;}
277L125993: if (n. check (7)) {goto L135721;} else {goto L145145;}
278L145145: if (n. check (14)) {goto L134921;} else {goto L114105;}
279L114105: if (n. check (8)) {goto L105737;} else {goto L136472;}
280L117305: if (n. check (1)) {goto L143769;} else {goto L146873;}
281L143769: if (n. check (3)) {goto L125865;} else {goto L132665;}
282L125865: if (n. check (9)) {goto L105737;} else {goto L113913;}
283L132665: if (n. check (9)) {goto L113913;} else {goto L128825;}
284L128825: if (n. check (14)) {goto L105737;} else {goto L135865;}
285L135865: if (n. check (8)) {goto L105737;} else {goto L119432;}
286L146873: if (n. check (3)) {goto L146297;} else {goto L146233;}
287L146297: if (n. check (9)) {goto L105737;} else {goto L117241;}
288L117241: if (n. check (7)) {goto L132249;} else {goto L106585;}
289L106585: if (n. check (14)) {goto L120265;} else {goto L126537;}
290L126537: if (n. check (8)) {goto L105737;} else {goto L125321;}
291L146233: if (n. check (9)) {goto L145833;} else {goto L125417;}
292L125417: if (n. check (7)) {goto L134009;} else {goto L125369;}
293L134009: if (n. check (14)) {goto L105737;} else {goto L145977;}
294L145977: if (n. check (8)) {goto L105737;} else {goto L146681;}
295L125369: if (n. check (14)) {goto L126889;} else {goto L136233;}
296L136233: if (n. check (8)) {goto L106281;} else {goto L136440;}
297L136440: if (n. check (4)) {goto L136056;} else {goto L108601;}
298L136056: if (n. check (12)) {goto L144696;} else {goto L136472;}
299L108601: if (n. check (12)) {goto L105737;} else {goto L118617;}
300L118617: if (n. check (11)) {goto L105737;} else {goto L106809;}
301L119336: if (n. check (2)) {goto L134824;} else {goto L124105;}
302L134824: if (n. check (1)) {goto L115992;} else {goto L128377;}
303L115992: if (n. check (9)) {goto L114968;} else {goto L146072;}
304L146072: if (n. check (15)) {statInv=!statInv;goto L123337;} else {goto L105736;}
305L128377: if (n. check (9)) {goto L119785;} else {goto L130729;}
306L130729: if (n. check (7)) {goto L122041;} else {goto L108056;}
307L122041: if (n. check (15)) {goto L107273;} else {goto L134921;}
308L107273: if (n. check (14)) {goto L134921;} else {goto L105737;}
309L108056: if (n. check (15)) {goto L134568;} else {goto L134440;}
310L134568: if (n. check (14)) {statInv=!statInv;goto L134921;} else {statInv=!statInv;goto L106441;}
311L134440: if (n. check (14)) {statInv=!statInv;goto L134921;} else {goto L135352;}
312L124105: if (n. check (1)) {goto L136841;} else {goto L108153;}
313L136841: if (n. check (3)) {goto L143209;} else {goto L120488;}
314L143209: if (n. check (9)) {goto L113913;} else {goto L143161;}
315L143161: if (n. check (15)) {goto L123017;} else {goto L130201;}
316L123017: if (n. check (14)) {goto L130201;} else {goto L105737;}
317L120488: if (n. check (9)) {goto L114008;} else {goto L143832;}
318L143832: if (n. check (15)) {goto L123496;} else {goto L120680;}
319L123496: if (n. check (14)) {goto L120680;} else {statInv=!statInv;goto L106441;}
320L108153: if (n. check (3)) {goto L136825;} else {goto L120873;}
321L136825: if (n. check (9)) {goto L145833;} else {goto L121833;}
322L121833: if (n. check (7)) {goto L108441;} else {goto L131321;}
323L108441: if (n. check (15)) {goto L126729;} else {goto L120265;}
324L126729: if (n. check (14)) {goto L120265;} else {goto L105737;}
325L131321: if (n. check (15)) {goto L145177;} else {goto L129945;}
326L145177: if (n. check (14)) {goto L107225;} else {goto L107065;}
327L107065: if (n. check (8)) {goto L106281;} else {goto L105737;}
328L129945: if (n. check (14)) {goto L107225;} else {goto L137769;}
329L120873: if (n. check (9)) {goto L137465;} else {goto L109305;}
330L109305: if (n. check (7)) {goto L121257;} else {goto L135992;}
331L121257: if (n. check (15)) {goto L114393;} else {goto L126889;}
332L114393: if (n. check (14)) {goto L126889;} else {goto L107065;}
333L135992: if (n. check (15)) {goto L108376;} else {goto L146136;}
334L108376: if (n. check (14)) {goto L146968;} else {goto L143384;}
335L143384: if (n. check (8)) {statInv=!statInv;goto L106281;} else {goto L105737;}
336L146136: if (n. check (14)) {goto L146968;} else {goto L106968;}
337L106968: if (n. check (8)) {statInv=!statInv;goto L106281;} else {goto L136440;}
338L145849: if (n. check (23)) {goto L136025;} else {goto L131385;}
339L136025: if (n. check (18)) {goto L128953;} else {goto L144505;}
340L128953: if (n. check (6)) {goto L136921;} else {goto L115561;}
341L136921: if (n. check (2)) {goto L115705;} else {goto L124425;}
342L115705: if (n. check (1)) {goto L105737;} else {goto L116729;}
343L116729: if (n. check (19)) {goto L105737;} else {goto L107769;}
344L124425: if (n. check (20)) {goto L114617;} else {goto L133241;}
345L114617: if (n. check (1)) {goto L105737;} else {goto L116825;}
346L116825: if (n. check (19)) {goto L105737;} else {goto L146873;}
347L133241: if (n. check (1)) {goto L143769;} else {goto L123241;}
348L123241: if (n. check (19)) {goto L146873;} else {goto L125481;}
349L125481: if (n. check (3)) {goto L137737;} else {goto L123433;}
350L137737: if (n. check (9)) {goto L105737;} else {goto L108409;}
351L108409: if (n. check (7)) {goto L123753;} else {goto L135769;}
352L135769: if (n. check (14)) {goto L107961;} else {goto L134025;}
353L134025: if (n. check (8)) {goto L105737;} else {goto L128504;}
354L123433: if (n. check (9)) {goto L131481;} else {goto L114905;}
355L114905: if (n. check (7)) {goto L131865;} else {goto L108632;}
356L131865: if (n. check (14)) {goto L105737;} else {goto L129849;}
357L129849: if (n. check (8)) {goto L105737;} else {goto L124136;}
358L108632: if (n. check (14)) {goto L121448;} else {goto L109112;}
359L109112: if (n. check (8)) {goto L130584;} else {goto L116281;}
360L116281: if (n. check (22)) {goto L105737;} else {goto L135193;}
361L135193: if (n. check (4)) {goto L105737;} else {goto L108601;}
362L115561: if (n. check (2)) {goto L127913;} else {goto L134873;}
363L127913: if (n. check (1)) {goto L105737;} else {goto L145689;}
364L145689: if (n. check (19)) {goto L105737;} else {goto L128377;}
365L134873: if (n. check (20)) {goto L115353;} else {goto L116217;}
366L115353: if (n. check (1)) {goto L105737;} else {goto L131193;}
367L131193: if (n. check (19)) {goto L105737;} else {goto L108153;}
368L116217: if (n. check (1)) {goto L136841;} else {goto L137209;}
369L137209: if (n. check (19)) {goto L108153;} else {goto L107865;}
370L107865: if (n. check (3)) {goto L142969;} else {goto L124232;}
371L142969: if (n. check (9)) {goto L131481;} else {goto L129193;}
372L129193: if (n. check (7)) {goto L146201;} else {goto L106616;}
373L146201: if (n. check (15)) {goto L132297;} else {goto L107961;}
374L132297: if (n. check (14)) {goto L107961;} else {goto L105737;}
375L106616: if (n. check (15)) {goto L134280;} else {goto L121336;}
376L134280: if (n. check (14)) {goto L135096;} else {goto L124616;}
377L124616: if (n. check (8)) {goto L130584;} else {goto L105737;}
378L121336: if (n. check (14)) {goto L135096;} else {goto L109400;}
379L124232: if (n. check (9)) {goto L143576;} else {goto L145816;}
380L143576: if (n. check (7)) {goto L134152;} else {goto L105737;}
381L145816: if (n. check (7)) {goto L145656;} else {goto L145577;}
382L145656: if (n. check (15)) {goto L134408;} else {goto L121448;}
383L134408: if (n. check (14)) {goto L121448;} else {goto L124616;}
384L145577: if (n. check (15)) {goto L105737;} else {goto L122153;}
385L122153: if (n. check (14)) {goto L105737;} else {goto L119721;}
386L119721: if (n. check (8)) {goto L105737;} else {goto L116281;}
387L144505: if (n. check (6)) {goto L127689;} else {goto L117912;}
388L127689: if (n. check (2)) {goto L129081;} else {goto L142873;}
389L129081: if (n. check (1)) {goto L118169;} else {goto L120937;}
390L120937: if (n. check (19)) {goto L107769;} else {goto L122745;}
391L122745: if (n. check (9)) {goto L119785;} else {goto L108665;}
392L108665: if (n. check (7)) {goto L131129;} else {goto L134568;}
393L131129: if (n. check (14)) {goto L105737;} else {statInv=!statInv;goto L124904;}
394L142873: if (n. check (20)) {goto L125065;} else {goto L137977;}
395L125065: if (n. check (1)) {goto L143769;} else {goto L106873;}
396L106873: if (n. check (19)) {goto L146873;} else {goto L122889;}
397L122889: if (n. check (3)) {goto L120137;} else {goto L116921;}
398L120137: if (n. check (9)) {goto L145833;} else {goto L120121;}
399L120121: if (n. check (7)) {goto L128009;} else {goto L145177;}
400L128009: if (n. check (14)) {goto L105737;} else {goto L114057;}
401L114057: if (n. check (8)) {goto L105737;} else {goto L126025;}
402L116921: if (n. check (9)) {goto L136537;} else {goto L109465;}
403L136537: if (n. check (7)) {goto L121129;} else {goto L144904;}
404L121129: if (n. check (14)) {goto L105737;} else {goto L127305;}
405L127305: if (n. check (8)) {goto L105737;} else {goto L126505;}
406L109465: if (n. check (7)) {goto L126089;} else {goto L108376;}
407L126089: if (n. check (14)) {goto L105737;} else {goto L128137;}
408L128137: if (n. check (8)) {goto L105737;} else {goto L143960;}
409L137977: if (n. check (1)) {goto L137369;} else {goto L131033;}
410L137369: if (n. check (3)) {goto L121961;} else {goto L120809;}
411L121961: if (n. check (9)) {goto L113913;} else {goto L108281;}
412L108281: if (n. check (14)) {goto L105737;} else {statInv=!statInv;goto L124648;}
413L120809: if (n. check (21)) {goto L105737;} else {goto L132665;}
414L131033: if (n. check (19)) {goto L115257;} else {goto L131833;}
415L115257: if (n. check (3)) {goto L143801;} else {goto L117273;}
416L143801: if (n. check (9)) {goto L145833;} else {goto L118777;}
417L118777: if (n. check (7)) {goto L144089;} else {goto L144841;}
418L144089: if (n. check (14)) {goto L105737;} else {goto L121353;}
419L121353: if (n. check (8)) {goto L105737;} else {goto L143177;}
420L144841: if (n. check (14)) {goto L136281;} else {goto L135801;}
421L135801: if (n. check (8)) {goto L106281;} else {goto L135224;}
422L117273: if (n. check (21)) {goto L105737;} else {goto L146233;}
423L131833: if (n. check (3)) {goto L122505;} else {goto L119593;}
424L122505: if (n. check (9)) {goto L131481;} else {goto L123721;}
425L123721: if (n. check (7)) {goto L133721;} else {goto L134280;}
426L133721: if (n. check (14)) {goto L105737;} else {goto L133561;}
427L133561: if (n. check (8)) {goto L105737;} else {goto L137704;}
428L119593: if (n. check (21)) {goto L105737;} else {goto L123433;}
429L117912: if (n. check (2)) {goto L137048;} else {goto L136601;}
430L137048: if (n. check (1)) {goto L115992;} else {goto L119881;}
431L119881: if (n. check (19)) {goto L128377;} else {goto L137912;}
432L137912: if (n. check (9)) {goto L119944;} else {goto L127336;}
433L119944: if (n. check (7)) {goto L136760;} else {goto L105737;}
434L127336: if (n. check (7)) {goto L115576;} else {goto L105737;}
435L115576: if (n. check (15)) {goto L134568;} else {statInv=!statInv;goto L134921;}
436L136601: if (n. check (20)) {goto L128025;} else {goto L129304;}
437L128025: if (n. check (1)) {goto L136841;} else {goto L120985;}
438L120985: if (n. check (19)) {goto L108153;} else {goto L120041;}
439L120041: if (n. check (3)) {goto L118553;} else {goto L120712;}
440L118553: if (n. check (9)) {goto L118905;} else {goto L119177;}
441L118905: if (n. check (7)) {goto L132345;} else {goto L105737;}
442L119177: if (n. check (7)) {goto L126249;} else {goto L105737;}
443L126249: if (n. check (15)) {goto L145177;} else {goto L107225;}
444L120712: if (n. check (9)) {goto L124200;} else {goto L127848;}
445L124200: if (n. check (7)) {goto L107672;} else {goto L105737;}
446L107672: if (n. check (14)) {goto L130904;} else {goto L144024;}
447L144024: if (n. check (8)) {statInv=!statInv;goto L106281;} else {goto L143128;}
448L127848: if (n. check (7)) {goto L146920;} else {goto L105737;}
449L146920: if (n. check (15)) {goto L108376;} else {goto L146968;}
450L129304: if (n. check (1)) {goto L125560;} else {goto L132601;}
451L125560: if (n. check (3)) {goto L125576;} else {goto L121769;}
452L125576: if (n. check (9)) {goto L114008;} else {goto L124008;}
453L124008: if (n. check (15)) {goto L115496;} else {statInv=!statInv;goto L130201;}
454L115496: if (n. check (14)) {statInv=!statInv;goto L130201;} else {statInv=!statInv;goto L106441;}
455L121769: if (n. check (21)) {goto L105737;} else {goto L120488;}
456L132601: if (n. check (19)) {goto L106681;} else {goto L133080;}
457L106681: if (n. check (3)) {goto L144729;} else {goto L109209;}
458L144729: if (n. check (9)) {goto L137465;} else {goto L108985;}
459L108985: if (n. check (7)) {goto L123113;} else {goto L144568;}
460L123113: if (n. check (15)) {goto L133785;} else {goto L136281;}
461L133785: if (n. check (14)) {goto L136281;} else {goto L107065;}
462L144568: if (n. check (15)) {goto L137272;} else {goto L138440;}
463L137272: if (n. check (14)) {goto L144024;} else {goto L143384;}
464L138440: if (n. check (14)) {goto L144024;} else {goto L132040;}
465L109209: if (n. check (21)) {goto L105737;} else {goto L120873;}
466L133080: if (n. check (3)) {goto L114632;} else {goto L126409;}
467L114632: if (n. check (9)) {goto L143576;} else {goto L143896;}
468L143896: if (n. check (7)) {goto L131112;} else {goto L105737;}
469L131112: if (n. check (15)) {goto L134280;} else {goto L135096;}
470L126409: if (n. check (21)) {goto L105737;} else {goto L124232;}
471L131385: if (n. check (18)) {goto L128985;} else {goto L132920;}
472L128985: if (n. check (6)) {goto L115833;} else {goto L143816;}
473L115833: if (n. check (2)) {goto L120841;} else {goto L138329;}
474L120841: if (n. check (1)) {goto L118169;} else {goto L143481;}
475L143481: if (n. check (19)) {goto L107769;} else {goto L121801;}
476L121801: if (n. check (9)) {goto L105737;} else {goto L118809;}
477L118809: if (n. check (7)) {goto L121609;} else {goto L116665;}
478L121609: if (n. check (14)) {goto L134921;} else {statInv=!statInv;goto L124904;}
479L116665: if (n. check (25)) {goto L105737;} else {goto L145145;}
480L138329: if (n. check (20)) {goto L125225;} else {goto L124553;}
481L125225: if (n. check (1)) {goto L143769;} else {goto L117721;}
482L117721: if (n. check (19)) {goto L146873;} else {goto L127081;}
483L127081: if (n. check (3)) {goto L120905;} else {goto L130009;}
484L120905: if (n. check (9)) {goto L105737;} else {goto L126265;}
485L126265: if (n. check (7)) {goto L136137;} else {goto L107321;}
486L136137: if (n. check (14)) {goto L120265;} else {goto L114057;}
487L107321: if (n. check (25)) {goto L105737;} else {goto L106585;}
488L130009: if (n. check (9)) {goto L136249;} else {goto L124745;}
489L124745: if (n. check (7)) {goto L115609;} else {goto L115385;}
490L115609: if (n. check (14)) {goto L126889;} else {goto L109561;}
491L109561: if (n. check (8)) {goto L106281;} else {goto L143960;}
492L115385: if (n. check (25)) {goto L105737;} else {goto L125369;}
493L124553: if (n. check (1)) {goto L143417;} else {goto L129209;}
494L143417: if (n. check (3)) {goto L138297;} else {goto L130712;}
495L138297: if (n. check (9)) {goto L105737;} else {goto L126857;}
496L126857: if (n. check (14)) {goto L130201;} else {statInv=!statInv;goto L124648;}
497L130712: if (n. check (9)) {goto L114008;} else {goto L123496;}
498L129209: if (n. check (19)) {goto L144537;} else {goto L132217;}
499L144537: if (n. check (3)) {goto L117785;} else {goto L137625;}
500L117785: if (n. check (9)) {goto L105737;} else {goto L108521;}
501L108521: if (n. check (7)) {goto L125513;} else {goto L119001;}
502L125513: if (n. check (14)) {goto L120265;} else {goto L121353;}
503L119001: if (n. check (14)) {goto L127305;} else {goto L119737;}
504L119737: if (n. check (8)) {goto L105737;} else {goto L135224;}
505L137625: if (n. check (9)) {goto L137465;} else {goto L143353;}
506L143353: if (n. check (7)) {goto L114393;} else {goto L108376;}
507L132217: if (n. check (3)) {goto L137113;} else {goto L145208;}
508L137113: if (n. check (9)) {goto L105737;} else {goto L119849;}
509L119849: if (n. check (7)) {goto L132761;} else {goto L138025;}
510L132761: if (n. check (14)) {goto L107961;} else {goto L133561;}
511L138025: if (n. check (25)) {goto L105737;} else {goto L135769;}
512L145208: if (n. check (9)) {goto L121512;} else {goto L138040;}
513L138040: if (n. check (7)) {goto L134408;} else {goto L133017;}
514L133017: if (n. check (25)) {goto L105737;} else {goto L108632;}
515L143816: if (n. check (2)) {goto L137176;} else {goto L127721;}
516L137176: if (n. check (1)) {goto L115992;} else {goto L146009;}
517L146009: if (n. check (19)) {goto L128377;} else {goto L130120;}
518L130120: if (n. check (9)) {goto L133768;} else {goto L120296;}
519L120296: if (n. check (7)) {goto L115576;} else {goto L126153;}
520L126153: if (n. check (25)) {goto L105737;} else {goto L108056;}
521L127721: if (n. check (20)) {goto L125161;} else {goto L118664;}
522L125161: if (n. check (1)) {goto L136841;} else {goto L144249;}
523L144249: if (n. check (19)) {goto L108153;} else {goto L126713;}
524L126713: if (n. check (3)) {goto L123305;} else {goto L143192;}
525L123305: if (n. check (9)) {goto L136249;} else {goto L137657;}
526L137657: if (n. check (7)) {goto L126249;} else {goto L146377;}
527L146377: if (n. check (25)) {goto L105737;} else {goto L131321;}
528L143192: if (n. check (9)) {goto L116184;} else {goto L125128;}
529L116184: if (n. check (7)) {goto L107672;} else {goto L137433;}
530L137433: if (n. check (25)) {goto L105737;} else {goto L144904;}
531L125128: if (n. check (7)) {goto L146920;} else {goto L134137;}
532L134137: if (n. check (25)) {goto L105737;} else {goto L135992;}
533L118664: if (n. check (1)) {goto L109432;} else {goto L109033;}
534L109432: if (n. check (3)) {goto L125576;} else {goto L105737;}
535L109033: if (n. check (19)) {goto L134217;} else {goto L122120;}
536L134217: if (n. check (3)) {goto L144729;} else {goto L105737;}
537L122120: if (n. check (3)) {goto L115672;} else {goto L145433;}
538L115672: if (n. check (9)) {goto L121512;} else {goto L136664;}
539L136664: if (n. check (7)) {goto L131112;} else {goto L143321;}
540L143321: if (n. check (25)) {goto L105737;} else {goto L106616;}
541L145433: if (n. check (9)) {goto L105737;} else {goto L114873;}
542L114873: if (n. check (7)) {goto L105737;} else {goto L126377;}
543L126377: if (n. check (25)) {goto L105737;} else {goto L145577;}
544L132920: if (n. check (6)) {goto L118488;} else {goto L115001;}
545L118488: if (n. check (2)) {goto L133976;} else {goto L118537;}
546L133976: if (n. check (1)) {goto L107704;} else {goto L115161;}
547L107704: if (n. check (9)) {goto L114968;} else {statInv=!statInv;goto L123337;}
548L115161: if (n. check (19)) {goto L108489;} else {goto L131416;}
549L108489: if (n. check (9)) {goto L119785;} else {goto L123209;}
550L123209: if (n. check (7)) {goto L107273;} else {goto L134568;}
551L131416: if (n. check (9)) {goto L133768;} else {goto L130024;}
552L130024: if (n. check (7)) {goto L134568;} else {goto L125721;}
553L125721: if (n. check (25)) {goto L105737;} else {goto L134568;}
554L118537: if (n. check (20)) {goto L125833;} else {goto L117368;}
555L125833: if (n. check (1)) {goto L118521;} else {goto L106745;}
556L118521: if (n. check (3)) {goto L143305;} else {goto L130712;}
557L143305: if (n. check (9)) {goto L113913;} else {goto L123017;}
558L106745: if (n. check (19)) {goto L109593;} else {goto L135257;}
559L109593: if (n. check (3)) {goto L132089;} else {goto L137625;}
560L132089: if (n. check (9)) {goto L145833;} else {goto L129113;}
561L129113: if (n. check (7)) {goto L126729;} else {goto L145177;}
562L135257: if (n. check (3)) {goto L145561;} else {goto L127976;}
563L145561: if (n. check (9)) {goto L136249;} else {goto L114361;}
564L114361: if (n. check (7)) {goto L145177;} else {goto L119113;}
565L119113: if (n. check (25)) {goto L105737;} else {goto L145177;}
566L127976: if (n. check (9)) {goto L116184;} else {goto L127112;}
567L127112: if (n. check (7)) {goto L108376;} else {goto L108313;}
568L108313: if (n. check (25)) {goto L105737;} else {goto L108376;}
569L117368: if (n. check (1)) {goto L119528;} else {goto L107289;}
570L119528: if (n. check (3)) {goto L118232;} else {goto L106841;}
571L118232: if (n. check (9)) {goto L114008;} else {goto L115496;}
572L106841: if (n. check (21)) {goto L105737;} else {goto L130712;}
573L107289: if (n. check (19)) {goto L133817;} else {goto L118200;}
574L133817: if (n. check (3)) {goto L136089;} else {goto L130617;}
575L136089: if (n. check (9)) {goto L137465;} else {goto L134121;}
576L134121: if (n. check (7)) {goto L133785;} else {goto L137272;}
577L130617: if (n. check (21)) {goto L105737;} else {goto L137625;}
578L118200: if (n. check (3)) {goto L145880;} else {goto L114201;}
579L145880: if (n. check (9)) {goto L121512;} else {goto L108856;}
580L108856: if (n. check (7)) {goto L134280;} else {goto L127593;}
581L127593: if (n. check (25)) {goto L105737;} else {goto L134280;}
582L114201: if (n. check (21)) {goto L105737;} else {goto L145208;}
583L115001: if (n. check (24)) {goto L121929;} else {goto L107640;}
584L121929: if (n. check (2)) {goto L105737;} else {goto L123593;}
585L123593: if (n. check (20)) {goto L105737;} else {goto L144281;}
586L144281: if (n. check (1)) {goto L105737;} else {goto L122473;}
587L122473: if (n. check (19)) {goto L105737;} else {goto L143545;}
588L143545: if (n. check (3)) {goto L105737;} else {goto L126793;}
589L126793: if (n. check (21)) {goto L105737;} else {goto L145433;}
590L107640: if (n. check (2)) {goto L137176;} else {goto L132857;}
591L132857: if (n. check (20)) {goto L125161;} else {goto L143912;}
592L143912: if (n. check (1)) {goto L125560;} else {goto L134601;}
593L134601: if (n. check (19)) {goto L106681;} else {goto L125608;}
594L125608: if (n. check (3)) {goto L115672;} else {goto L135609;}
595L135609: if (n. check (21)) {goto L145433;} else {goto L109016;}
596L109016: if (n. check (9)) {goto L121512;} else {goto L143000;}
597L143000: if (n. check (7)) {goto L145656;} else {goto L132889;}
598L132889: if (n. check (25)) {goto L145577;} else {goto L143928;}
599L143928: if (n. check (15)) {goto L108632;} else {goto L135672;}
600L135672: if (n. check (14)) {goto L121448;} else {goto L118008;}
601L118008: if (n. check (8)) {goto L130584;} else {goto L128344;}
602L128344: if (n. check (22)) {goto L136440;} else {goto L115448;}
603L115448: if (n. check (4)) {goto L136056;} else {goto L122056;}
604L122056: if (n. check (12)) {goto L129368;} else {goto L129688;}
605L129688: if (n. check (11)) {goto L136472;} else {goto L136376;}
606L136376: if (n. check (16)) {goto L144408;} else {statInv=!statInv;goto L130457;}
607L105736: return !statInv;
608L105737: return statInv;
609} /* acyclic3d_Malandain */

Referenced by bddacyclic().

◆ acyclic_rel()

template<class tCube , class tSet1 , class tSet2 >
bool chomp::homology::acyclic_rel ( const tCube &  q,
int  dim,
const tSet1 &  cset,
const tSet2 &  other,
BitField b,
int_t  maxneighbors,
hashedset< tCube > *  neighbors_main,
hashedset< tCube > *  neighbors_other 
)

Verifies whether a cube from the other set can be removed.

Definition at line 183 of file cubacycl.h.

186{
187 // use a binary decision diagram code if possible
188 if (dim <= MaxBddDim)
189 {
190 if (!getneighbors (q, b, cset, 1))
191 return true;
192 if (!bddacyclic (q, dim, other, *b))
193 return false;
194 return bddacyclic (q, dim, makesetunion (cset, other), *b);
195 }
196
197 // get the neighbors from the other set
198 int_t nother = getneighbors (q, b, other, neighbors_other, 0);
199
200 // verify if this set of neighbors is acyclic
201 bool otheracyclic = (nother < maxneighbors) &&
202 ((nother == 1) || (nother && acyclic (dim, *b)));
203
204 // add the neighbors from 'cset'
205 int_t ncset = getneighbors (q, b, cset, neighbors_main, 0);
206
207 // if there are no cubes in 'cset', then this cube is ok
208 if (!ncset)
209 return true;
210
211 // if there are neighbors in 'cset' and the neighbors
212 // from 'other' are not acyclic, the cube canot be removed
213 if (!otheracyclic)
214 return false;
215
216 // if there are neighbors from 'cset' then check if the neighbors
217 // from both 'cset' and 'other' taken together form an acyclic set
218 if ((ncset + nother > 1) && ((ncset + nother == maxneighbors) ||
219 !acyclic (dim, *b)))
220 {
221 return false;
222 }
223 return true;
224} /* acyclic_rel */
setunion< set1type, set2type > makesetunion(const set1type &set1, const set2type &set2)
Creates an object which represents the union of two sets.
Definition: setunion.h:225

References acyclic(), bddacyclic(), getneighbors(), makesetunion(), and MaxBddDim.

Referenced by chomp::homology::reduction0::cubreducequiet(), and chomp::homology::reduction1::cubreducequiet().

◆ addboundaries()

template<class cell , class euclidom >
void chomp::homology::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.

Definition at line 835 of file homtools.h.

838{
839 // if there are no cells in the complex, there is nothing to do
840 if (Xcompl. empty ())
841 return;
842
843 // say what you are doing
844 sout << "Adding boundaries of " << cell::pluralname () << " in ";
845 if (!Acompl. empty ())
846 sout << Xname << " and " << Aname << "... ";
847 else
848 sout << Xname << "... ";
849
850 // add the boundaries and count the number of added cells
851 int_t howmany = 0;
852 for (int i = Xcompl. dim (); (i >= minlevel) && i; -- i)
853 {
854 if (bothsets)
855 {
856 howmany += Xcompl. addboundaries (i, true);
857 if (Acompl. dim () >= i)
858 howmany += Acompl. addboundaries (i,
859 true);
860 }
861 else
862 howmany += Xcompl. addboundaries (i, Acompl);
863 }
864
865 // show the total number of added cells
866 sout << howmany << ' ' << cell::pluralname () << " added.\n";
867 return;
868} /* addboundaries */
outputstream sout
A replacement for standard output stream, with optional logging and other features provided by the cl...
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.
Definition: homtools.h:835

References addboundaries(), and sout.

Referenced by addboundaries(), chomp::homology::gcomplex< cell, euclidom >::addboundaries(), chomp::homology::gcomplex< cell, euclidom >::collapse(), createcellmap(), creategraph(), decreasedimension(), Homology(), Homology2l(), and remainsacyclic().

◆ addmapimg() [1/2]

template<class maptype , class cubsettype >
void chomp::homology::addmapimg ( const maptype &  Fcubmap,
const cubsettype &  Xcubes,
const cubsettype &  Acubes,
cubsettype &  Ykeepcubes,
bool  indexmap 
)
inline

Adds the image of the given map to the set of cubes to be kept.

Includes the sets 'Xcubes' and 'Acubes' if this is an index map.

Definition at line 706 of file homtools.h.

709{
710 addmapimg (Fcubmap, Fcubmap, Xcubes, Acubes, Ykeepcubes, indexmap);
711 return;
712} /* addmapimg */
void addmapimg(const maptype &Fcubmap, const cubsettype &Xcubes, const cubsettype &Acubes, cubsettype &Ykeepcubes, bool indexmap)
Adds the image of the given map to the set of cubes to be kept.
Definition: homtools.h:706

References addmapimg().

◆ addmapimg() [2/2]

template<class maptype , class cubsettype >
void chomp::homology::addmapimg ( const maptype &  Fcubmap,
const maptype &  FcubmapA,
const cubsettype &  Xcubes,
const cubsettype &  Acubes,
cubsettype &  Ykeepcubes,
bool  indexmap 
)

Adds the images of both maps to the set of cubes to be kept.

The image of each set is taken using the corresponding map. Includes the sets 'Xcubes' and 'Acubes' if this is an index map.

Definition at line 658 of file homtools.h.

661{
662 if (Fcubmap. getdomain (). empty () &&
663 FcubmapA. getdomain (). empty ())
664 {
665 return;
666 }
667 sout << "Computing the image of the map... ";
668 int_t prev = Ykeepcubes. size ();
669 const cubsettype &Fdomain = Fcubmap. getdomain ();
670 if (!Fdomain. empty ())
671 {
672 if (Fdomain. size () == Xcubes. size ())
673 retrieveimage (Fcubmap, Ykeepcubes);
674 else
675 {
676 int_t n = Xcubes. size ();
677 for (int_t i = 0; i < n; ++ i)
678 Ykeepcubes. add (Fcubmap (Xcubes [i]));
679 }
680 }
681 const cubsettype &FdomainA = FcubmapA. getdomain ();
682 if (!FdomainA. empty ())
683 {
684 if (FdomainA. size () == Acubes. size ())
685 retrieveimage (FcubmapA, Ykeepcubes);
686 else
687 {
688 int_t n = Acubes. size ();
689 for (int_t i = 0; i < n; ++ i)
690 Ykeepcubes. add (FcubmapA (Acubes [i]));
691 }
692 }
693 if (indexmap)
694 {
695 sout << "and of the inclusion... ";
696 Ykeepcubes. add (Xcubes);
697 Ykeepcubes. add (Acubes);
698 }
699 sout << (Ykeepcubes. size () - prev) << " cubes.\n";
700 return;
701} /* addmapimg */
hashedset< imgelement > & retrieveimage(const mvmap< domelement, imgelement > &m, hashedset< imgelement > &img)
Adds images of all the elements from the domain of the map to 'img'.
Definition: hashsets.h:1128

References retrieveimage(), and sout.

Referenced by addmapimg(), and Homology2l().

◆ addneighbors() [1/4]

template<class SetT , class QueueT >
void chomp::homology::addneighbors ( const int &  c,
const SetT &  s,
QueueT &  q 
)

Adds the neighbors of the cube 'c' in the set 's' to the set 'q'.

Definition at line 1048 of file bincube.h.

1049{
1050 typename SetT::neighborhood_iterator cur = s. neighborhood_begin (c),
1051 end = s. neighborhood_end (c);
1052 while (cur != end)
1053 {
1054 q. add (hashNumber<int> (cur));
1055 ++ cur;
1056 }
1057 return;
1058} /* addneighbors */
A class of numbers that can be used in a hashed set.
Definition: bincube.h:1015

References chomp::homology::bincube< Dim, twoPower >::add(), chomp::homology::bincube< Dim, twoPower >::end(), chomp::homology::bincube< Dim, twoPower >::neighborhood_begin(), and chomp::homology::bincube< Dim, twoPower >::neighborhood_end().

Referenced by acyclic(), reduceFullCubesAlg(), and remainsacyclic().

◆ addneighbors() [2/4]

template<class tCube , class tCell >
int_t chomp::homology::addneighbors ( const tCube &  q,
const BitField bits,
gcomplex< tCell, integer > &  c,
bool  unconditional = false 
)

Adds intersections of neighbors listed in the given bit field with the given cube to the cubical complex.

If not 'unconditional', then adds only cubes which already exist.

Definition at line 386 of file neighbor.h.

388{
389 // define the type of coordinates
390 typedef typename tCube::CoordType coordType;
391
392 // determine the space dimension
393 int dim = q. dim ();
394
395 // compute the maximal number of neighbors
396 int_t maxneighbors = getmaxneighbors (dim);
397
398 // extract the coordinates of the central cube
399 coordType coord [tCube::MaxDim];
400 q. coord (coord);
401
402 // prepare arrays for the coordinates of boundary cells
403 coordType cLeft [tCube::MaxDim];
404 coordType cRight [tCube::MaxDim];
405
406 // prepare a counter of boundary cells
407 int_t count = 0;
408
409 // find the first neighbor number
410 int_t number = bits. find (0, maxneighbors);
411
412 // process all the neighbor numbers
413 while (number >= 0)
414 {
415 // prepare the coordinates of the boundary cell
416 int_t n = number + 1;
417 for (int i = dim - 1; i >= 0; -- i)
418 {
419 switch (n % 3)
420 {
421 case 2:
422 cLeft [i] = coord [i];
423 cRight [i] = coord [i];
424 break;
425 case 1:
426 cLeft [i] = coord [i] + 1;
427 cRight [i] = coord [i] + 1;
428 break;
429 case 0:
430 cLeft [i] = coord [i];
431 cRight [i] = coord [i] + 1;
432 break;
433 }
434 n /= 3;
435 }
436
437 // add the cell to the complex of boundary cells
438 c. add (tCell (cLeft, cRight, dim));
439
440 // increase the counter of boundary cells
441 ++ count;
442
443 // take the next neighbor number
444 number = bits. find (number + 1, maxneighbors);
445 }
446
447 return count;
448} /* addneighbors */

References getmaxneighbors().

◆ addneighbors() [3/4]

template<class tCube , class tCubeSet >
int_t chomp::homology::addneighbors ( const tCube &  q,
const BitField bits,
tCubeSet &  set,
bool  unconditional = false 
)

Adds neighbors listed in the given bit field to the set of cubes.

If not 'unconditional', then adds only cubes which already exist.

Definition at line 364 of file neighbor.h.

366{
367 int_t maxneighbors = getmaxneighbors (q. dim ());
368 int_t count = 0;
369
370 int_t number = bits. find (0, maxneighbors);
371 while (number >= 0)
372 {
373 tCube neighbor = bit2neighbor (q, number, unconditional);
374 set. add (neighbor);
375 number = bits. find (number + 1, maxneighbors);
376 ++ count;
377 }
378
379 return count;
380} /* addneighbors */
tCube bit2neighbor(const tCube &q, int_t number, bool unconditional=false)
Creates the neighbor of the given cube with the specified number.
Definition: neighbor.h:165

References bit2neighbor(), and getmaxneighbors().

◆ addneighbors() [4/4]

template<class tCube , class tCubeSet >
int_t chomp::homology::addneighbors ( const tCube &  q,
const BitField bits,
tCubeSet &  set,
const tCubeSet &  notthese 
)

Adds neighbors listed in the given bit field to the set of cubes unless they are in the 'forbidden' set.

Returns the number of added neighbors.

Definition at line 342 of file neighbor.h.

344{
345 int_t maxneighbors = getmaxneighbors (q. dim ());
346
347 int_t count = 0;
348 int_t number = bits. find (0, maxneighbors);
349 while (number >= 0)
350 {
351 tCube neighbor = bit2neighbor (q, number);
352 if (!notthese. check (neighbor))
353 set. add (neighbor);
354 number = bits. find (number + 1, maxneighbors);
355 ++ count;
356 }
357
358 return count;
359} /* addneighbors */

References bit2neighbor(), and getmaxneighbors().

◆ addRenumEdges()

template<class wType >
int_t chomp::homology::addRenumEdges ( const diGraph< wType > &  g,
int_t  vertex,
const int_t newNum,
int_t  cur,
int_t srcVert,
diGraph< wType > &  result 
)
inline

A helper function for "collapseVertices".

Definition at line 3498 of file digraph.h.

3501{
3502 int_t nEdges = g. countEdges (vertex);
3503 // add all the edges that start at the component
3504 for (int_t edge = 0; edge < nEdges; ++ edge)
3505 {
3506 // determine the dest. vertex of the edge
3507 int_t dest = newNum [g. getEdge (vertex, edge)];
3508 // if this is an edge to self, then ignore it
3509 if (dest == cur)
3510 continue;
3511 // if the edge has already been added,
3512 // then skip it
3513 if (srcVert [dest] == cur)
3514 continue;
3515 // remember that the dest. vertex has an edge
3516 // pointing out from the current vertex
3517 srcVert [dest] = cur;
3518 // add the edge to the result graph
3519 result. addEdge (dest);
3520 }
3521 return 0;
3522} /* addRenumEdges */

Referenced by collapseVertices().

◆ addRenumEdges2()

template<class wType , class TabSets >
int_t chomp::homology::addRenumEdges2 ( const diGraph< wType > &  g,
int_t  vertex,
const int_t newNum,
TabSets &  numSets,
int_t  cur,
int_t srcVert,
diGraph< wType > &  result 
)
inline

A helper function for "collapseVertices2".

Definition at line 3613 of file digraph.h.

3616{
3617 int_t nEdges = g. countEdges (vertex);
3618
3619 // add all the edges that start at this vertex
3620 for (int_t edge = 0; edge < nEdges; ++ edge)
3621 {
3622 // determine the dest. vertex of the edge
3623 int_t destNumber = newNum [g. getEdge (vertex, edge)];
3624
3625 // consider all the destination vertices
3626 int_t destSize = (destNumber < 0) ?
3627 numSets [-destNumber]. size () :
3628 static_cast<int_t> (1);
3629 for (int_t i = 0; i < destSize; ++ i)
3630 {
3631 // determine the consecutive destination vertex
3632 int_t dest = (destNumber < 0) ?
3633 numSets [-destNumber] [i] : destNumber;
3634
3635 // if this is an edge to self, then ignore it
3636 if (dest == cur)
3637 continue;
3638
3639 // if the edge has already been added,
3640 // then skip it
3641 if (srcVert [dest] == cur)
3642 continue;
3643
3644 // add the edge to the result graph
3645 result. addEdge (dest);
3646 }
3647 }
3648 return 0;
3649} /* addRenumEdges2 */

Referenced by collapseVertices2().

◆ allocatepoint()

template<class coordtype >
coordtype * chomp::homology::allocatepoint ( int  dim,
char *  errormessage = NULL 
)
inline

Allocate a point with 'new'. In case of failure throw an error message.

Definition at line 262 of file pointset.h.

263{
264 coordtype *temp = new coordtype [dim];
265 if (!temp)
266 {
267 throw (errormessage ? errormessage :
268 "Can't allocate memory for a temporary point.");
269 }
270 return temp;
271} /* allocatepoint */

◆ arg() [1/5]

void chomp::homology::arg ( arguments a,
const char *  name,
char *&  value,
const char *  defaultvalue 
)
inline

A specialization of the above for C-style strings.

Definition at line 624 of file arg.h.

626{
627 argunit<char *> *p =
628 new argunit<char *> (name, value,
629 const_cast<char *> (defaultvalue));
630 a. add (p);
631 return;
632} /* arg */
This is a helper class which defines one command-line argument which is bound with some specific vari...
Definition: arg.h:253

◆ arg() [2/5]

template<class type >
void chomp::homology::arg ( arguments a,
const char *  name,
type &  value 
)
inline

Adds a command line argument.

The actual argument name consists of the dash and its name provided to the function. If name == 0, then the value of this argument is read directly from the command line without any preceding string. The value variable is filled in by the value read from the command line string using the operator >>.

Definition at line 604 of file arg.h.

605{
606 argunit<type> *p = new argunit<type> (name, value);
607 a. add (p);
608 return;
609} /* arg */

Referenced by argbreak(), argoblig(), argstreams(), argswitch(), and chomp::multiwork::mwSubdivMain().

◆ arg() [3/5]

template<class type >
void chomp::homology::arg ( arguments a,
const char *  name,
type &  value,
type  defaultvalue 
)
inline

Adds a command line argument with a default value.

The name must be nonempty. If the name of the argument appears but its value is not specified, then the default value is used instead.

Definition at line 615 of file arg.h.

617{
618 argunit<type> *p = new argunit<type> (name, value, defaultvalue);
619 a. add (p);
620 return;
621} /* arg */

◆ arg() [4/5]

template<class type >
void chomp::homology::arg ( arguments a,
const char *  name,
type *  value,
int &  count,
int  size 
)
inline

Adds a command line argument whose repeated occurrences fill in consecutive elements of the given array.

The counter indicates the position in the array. The given size of the array will not be exceeded.

Definition at line 639 of file arg.h.

641{
642 argunit<type> *p = new argunit<type> (name, value, count, size);
643 a. add (p);
644 return;
645} /* arg */

◆ arg() [5/5]

template<class type >
void chomp::homology::arg ( arguments a,
const char *  name,
type *  value,
int &  count,
int  size,
type  defaultvalue 
)
inline

A version of the above with a default value of the arguments.

Definition at line 649 of file arg.h.

651{
652 argunit<type> *p = new argunit<type> (name, value, count, size,
653 defaultvalue);
654 a. add (p);
655 return;
656} /* argoblig */

◆ argbreak() [1/4]

void chomp::homology::argbreak ( arguments arg,
const char *  name 
)
inline

A version of the above which ignores the value of the argument.

Definition at line 731 of file arg.h.

732{
733 char *dummystring = NULL;
734 argunit<char *> *p = new argunit<char *> (name, dummystring);
735 p -> set (argflags::breakinterpreting);
736 p -> set (argflags::ignorevalue);
737 arg. add (p);
738 return;
739} /* argbreak */
void arg(arguments &a, const char *name, type *value, int &count, int size, type defaultvalue)
A version of the above with a default value of the arguments.
Definition: arg.h:649

References arg(), chomp::homology::argflags::breakinterpreting, and chomp::homology::argflags::ignorevalue.

◆ argbreak() [2/4]

void chomp::homology::argbreak ( arguments arg,
const char *  name,
char *&  value,
const char *  defaultvalue 
)
inline

A version of the above for the C-style string.

Definition at line 719 of file arg.h.

721{
722 argunit<char *> *p =
723 new argunit<char *> (name, value, (char *) defaultvalue);
724 p -> set (argflags::breakinterpreting);
725 p -> set (argflags::ignorevalue);
726 arg. add (p);
727 return;
728} /* argbreak */

References arg(), chomp::homology::argflags::breakinterpreting, and chomp::homology::argflags::ignorevalue.

◆ argbreak() [3/4]

template<class type >
void chomp::homology::argbreak ( arguments arg,
const char *  name,
type &  value 
)
inline

Adds an argument whose appearence interrupts the analysis of the command line and makes the analyzing function return the value of 1.

This is useful for arguments whose appearence should make the program ignore all the remaining arguments, e.g., to display help information.

Definition at line 697 of file arg.h.

698{
699 argunit<type> *p = new argunit<type> (name, value);
700 p -> set (argflags::breakinterpreting);
701 p -> set (argflags::ignorevalue);
702 arg. add (p);
703 return;
704} /* argbreak */

References arg(), chomp::homology::argflags::breakinterpreting, and chomp::homology::argflags::ignorevalue.

Referenced by arghelp().

◆ argbreak() [4/4]

template<class type >
void chomp::homology::argbreak ( arguments arg,
const char *  name,
type &  value,
type  defaultvalue 
)
inline

A version of the above with the default value provided.

Definition at line 708 of file arg.h.

710{
711 argunit<type> *p = new argunit<type> (name, value, defaultvalue);
712 p -> set (argflags::breakinterpreting);
713 p -> set (argflags::ignorevalue);
714 arg. add (p);
715 return;
716} /* argbreak */

References arg(), chomp::homology::argflags::breakinterpreting, and chomp::homology::argflags::ignorevalue.

◆ arghelp()

void chomp::homology::arghelp ( arguments a)
inline

Adds the typical arguments which should make the program display help information.

If help is requested, the command line analysis is interrupted, and the procedure returns the value 1.

Definition at line 778 of file arg.h.

779{
780 argbreak (a, "?");
781 argbreak (a, "h");
782 argbreak (a, "H");
783 argbreak (a, "-help");
784 return;
785} /* arghelp */
void argbreak(arguments &arg, const char *name)
A version of the above which ignores the value of the argument.
Definition: arg.h:731

References argbreak().

Referenced by chomp::multiwork::mwSubdivMain().

◆ argoblig() [1/3]

void chomp::homology::argoblig ( arguments arg,
const char *  name,
char *&  value,
const char *  defaultvalue 
)
inline

A version of the above for reading an array of argument values.

Definition at line 682 of file arg.h.

684{
685 argunit<char *> *p =
686 new argunit<char *> (name, value, (char *) defaultvalue);
687 p -> set (argflags::obligatory);
688 arg. add (p);
689 return;
690} /* argoblig */

References arg(), and chomp::homology::argflags::obligatory.

◆ argoblig() [2/3]

template<class type >
void chomp::homology::argoblig ( arguments arg,
const char *  name,
type &  value 
)
inline

Defines an obligatory command line argument.

If this argument does not appear, then an error is displayed and error code is returned by the analysis procedure.

Definition at line 662 of file arg.h.

663{
664 argunit<type> *p = new argunit<type> (name, value);
665 p -> set (argflags::obligatory);
666 arg. add (p);
667 return;
668} /* argoblig */

References arg(), and chomp::homology::argflags::obligatory.

◆ argoblig() [3/3]

template<class type >
void chomp::homology::argoblig ( arguments arg,
const char *  name,
type &  value,
type  defaultvalue 
)
inline

A version of the above with the default value provided.

Definition at line 672 of file arg.h.

674{
675 argunit<type> *p = new argunit<type> (name, value, defaultvalue);
676 p -> set (argflags::obligatory);
677 arg. add (p);
678 return;
679} /* argoblig */

References arg(), and chomp::homology::argflags::obligatory.

◆ argstreams()

void chomp::homology::argstreams ( arguments a,
char *&  logfilename,
char *&  seqfilename,
bool &  quiet,
bool &  debug 
)
inline

Adds typical command line arguments for manipulating output streams.

This is an internal function used by the macro "algstreamprepare".

Definition at line 793 of file arg.h.

795{
796 arg (a, "-log", logfilename);
797 arg (a, "-seq", seqfilename);
798 argswitch (a, "-quiet", quiet, true);
799 argswitch (a, "-debug", debug, true);
800 return;
801} /* argstreams */
void argswitch(arguments &arg, const char *name)
Defines an ignored switch (no value is set when this argument appears).
Definition: arg.h:766

References arg(), and argswitch().

◆ argswitch() [1/3]

void chomp::homology::argswitch ( arguments arg,
const char *  name 
)
inline

Defines an ignored switch (no value is set when this argument appears).

Definition at line 766 of file arg.h.

767{
768 char *dummystring = NULL;
769 argunit<char *> *p = new argunit<char *> (name, dummystring);
770 p -> set (argflags::ignorevalue);
771 arg. add (p);
772 return;
773} /* argswitch */

References arg(), and chomp::homology::argflags::ignorevalue.

◆ argswitch() [2/3]

void chomp::homology::argswitch ( arguments arg,
const char *  name,
char *&  value,
const char *  defaultvalue 
)
inline

A version of the above for the C-style string.

Definition at line 755 of file arg.h.

757{
758 argunit<char *> *p =
759 new argunit<char *> (name, value, (char *) defaultvalue);
760 p -> set (argflags::ignorevalue);
761 arg. add (p);
762 return;
763} /* argswitch */

References arg(), and chomp::homology::argflags::ignorevalue.

◆ argswitch() [3/3]

template<class type >
void chomp::homology::argswitch ( arguments arg,
const char *  name,
type &  value,
const type &  defaultvalue 
)
inline

Defines a command line argument which is a switch, that is, there is no value given for it in the command line.

The appearence of this argument sets the predefined default value to the given variable.

Definition at line 745 of file arg.h.

747{
748 argunit<type> *p = new argunit<type> (name, value, defaultvalue);
749 p -> set (argflags::ignorevalue);
750 arg. add (p);
751 return;
752} /* argswitch */

References arg(), and chomp::homology::argflags::ignorevalue.

Referenced by argstreams(), and chomp::multiwork::mwSubdivMain().

◆ attheborder()

template<class coordtype >
int chomp::homology::attheborder ( const tPointset< coordtype > &  p,
const coordtype *  c 
)

Verifies if the point is at the border of a given set.

Definition at line 1851 of file pointset.h.

1852{
1853 return (countneighbors (p, c, OUTSIDE, 1));
1854
1855} /* attheborder */
int countneighbors(const tPointset< coordtype > &p, const tPointset< coordtype > &q, coordtype *c, int which, int maxcount)
Definition: pointset.h:1819
#define OUTSIDE
Definition: pointset.h:274

References countneighbors(), and OUTSIDE.

Referenced by computeboundary(), and findboundarypoint().

◆ bddacyclic()

template<class tCube , class tCubeSet >
bool chomp::homology::bddacyclic ( const tCube &  q,
int  dim,
const tCubeSet &  s,
BitField b 
)

Uses binary decision diagrams to verify whether the neighborhood of the given cube in the given set is acyclic.

Uses the bitfield provided to record each tested neighbor in. Verifies whether the neighborhood of the given cube is acyclic or not using the code generated from binary decision diagrams.

Definition at line 1198 of file bddacycl.h.

1200{
1201 switch (dim)
1202 {
1203 case 1:
1204 {
1205 Neighbors<tCube,tCubeSet> n (q, s, b);
1206 return acyclic1d (n);
1207 // break;
1208 }
1209 case 2:
1210 {
1211 Neighbors<tCube,tCubeSet> n (q, s, b);
1212 return acyclic2d (n);
1213 // break;
1214 }
1215 case 3:
1216 {
1217 Neighbors<tCube,tCubeSet> n (q, s, b);
1218 if (UseMalandainCode)
1219 return acyclic3d_Malandain (n);
1220 else
1221 return acyclic3d (n);
1222 // break;
1223 }
1224 }
1225 throw "Trying to use a BDD for dimension other than 1-3.";
1226} /* bddacyclic */
The neighborhood of a cube in a set of cubes.
Definition: bddacycl.h:1139
bool acyclic3d_Malandain(NeighborCheck &n)
Verifies whether the neighborhood of a 3-dimensional cube is acyclic.
Definition: bddacycl.h:101
bool UseMalandainCode
The variable which controls which binary decision diagrams should be used in dimension 3,...
bool acyclic3d(NeighborCheck &n)
Verifies whether the neighborhood of a 3-dimensional cube is acyclic.
Definition: bddacycl.h:613
bool acyclic1d(NeighborCheck &n)
Verifies whether the neighborhood of a 1-dimensional "cube" is acyclic.
Definition: bddacycl.h:49
bool acyclic2d(NeighborCheck &n)
Verifies whether the neighborhood of a 2-dimensional "cube" is acyclic.
Definition: bddacycl.h:63

References acyclic1d(), acyclic2d(), acyclic3d(), acyclic3d_Malandain(), and UseMalandainCode.

Referenced by acyclic(), and acyclic_rel().

◆ BettiNumber()

template<class euclidom >
int chomp::homology::BettiNumber ( const chain< euclidom > &  c)

Returns the Betti number that corresponds to the given chain which describes one homology group.

Definition at line 104 of file homology.h.

105{
106 int betti = 0;
107 for (int i = 0; i < c. size (); ++ i)
108 {
109 if (c. coef (i). delta () == 1)
110 ++ betti;
111 }
112 return betti;
113} /* BettiNumber */

Referenced by ComputeBettiNumbers().

◆ bit2neighbor() [1/2]

template<class tCube >
tCube chomp::homology::bit2neighbor ( const tCube &  q,
int_t  number,
bool  unconditional = false 
)

Creates the neighbor of the given cube with the specified number.

If the coordinates of the neighbor do not belong to 'PointBase', then returns 'q', unless 'unconditional' is set to true.

Definition at line 165 of file neighbor.h.

166{
167 // define the type of coordinates
168 typedef typename tCube::CoordType coordType;
169
170 coordType c0 [tCube::MaxDim];
171 q. coord (c0);
172 coordType c1 [tCube::MaxDim];
173 int dim = q. dim ();
174
175 ++ number;
176 for (int i = dim - 1; i >= 0; -- i)
177 {
178 switch (number % 3)
179 {
180 case 2:
181 c1 [i] = c0 [i] - 1;
182 break;
183 case 1:
184 c1 [i] = c0 [i] + 1;
185 break;
186 case 0:
187 c1 [i] = c0 [i];
188 break;
189 default:
190 throw "Erratic neighbor.";
191 }
192 number /= 3;
193 }
194
195 if (unconditional || tCube::PointBase::check (c1, dim))
196 return tCube (c1, dim);
197 else
198 return q;
199} /* bit2neighbor */

Referenced by addneighbors(), chomp::homology::Neighbors< cubetype, settype >::check(), and getneighbors_generate().

◆ bit2neighbor() [2/2]

template<class tCube >
tCube2l< tCube > chomp::homology::bit2neighbor ( const tCube2l< tCube > &  q,
int_t  number,
bool  unconditional = false 
)
inline

Specialization of the "bit2neighbor" function for two-layer cubes.

Throws an exception, because there might be more than one neighbor in the given direction.

Definition at line 945 of file twolayer.h.

947{
948 throw "Trying to use 'bit2neighbor' for a 2-layer cube.";
949 return q;
950} /* bit2neighbor */

◆ bit2neighborAlg() [1/2]

template<class settype >
settype::iterator chomp::homology::bit2neighborAlg ( const typename settype::iterator &  q,
int  n 
)

Definition at line 694 of file bincube.h.

696{
697 const int Dim = settype::MaxDim;
698 int coord [Dim];
699 q. b -> num2coord (q, coord);
700 bit2neighborAlg (n, coord, coord, Dim);
701 try
702 {
703 return typename settype::iterator (q. b,
704 q. b -> coord2num (coord));
705 }
706 catch (...)
707 {
708 }
709 return q;
710} /* bit2neighborAlg */
settype::iterator bit2neighborAlg(const typename settype::iterator &q, int n)
Definition: bincube.h:695

References bit2neighborAlg(), chomp::homology::bincube< Dim, twoPower >::coord2num(), and chomp::homology::bincube< Dim, twoPower >::num2coord().

◆ bit2neighborAlg() [2/2]

template<class coordinate >
void chomp::homology::bit2neighborAlg ( int  number,
const coordinate src,
coordinate dest,
int  Dim 
)
inline

Definition at line 667 of file bincube.h.

669{
670 ++ number;
671 for (int i = Dim - 1; i >= 0; -- i)
672 {
673 switch (number % 3)
674 {
675 case 2:
676 dest [i] = src [i] - 1;
677 break;
678 case 1:
679 dest [i] = src [i] + 1;
680 break;
681 case 0:
682 dest [i] = src [i];
683 break;
684 default:
685 throw "Erratic neighbor.";
686 }
687 number /= 3;
688 }
689
690 return;
691} /* bit2neighborAlg */

Referenced by bit2neighborAlg(), and chomp::homology::bincube< Dim, twoPower >::neighborhood_iterator::operator++().

◆ bitcount()

int chomp::homology::bitcount ( int  number)
inline

Definition at line 48 of file bitcount.h.

49{
50 if (!number)
51 return 0;
52 unsigned int n = static_cast<unsigned int> (number);
53 if (n < 256)
54 return bitcountbyte (static_cast<unsigned char> (n));
55 int c = 0;
56 while (n > 255)
57 {
58 if (n & 1)
59 ++ c;
60 n >>= 1;
61 }
62 return c + bitcountbyte (static_cast<unsigned char> (n));
63} /* bitcount */
int bitcountbyte(char n)
Definition: bitcount.h:43

References bitcountbyte().

◆ bitcountbyte()

int chomp::homology::bitcountbyte ( char  n)
inline

Definition at line 43 of file bitcount.h.

44{
45 return bitcounttable [static_cast<unsigned char> (n)];
46} /* bitcountbyte */
unsigned char bitcounttable[]

References bitcounttable.

Referenced by bitcount(), and chomp::homology::bincube< Dim, twoPower >::count().

◆ bits2int()

int chomp::homology::bits2int ( const BitField field,
int_t  length 
)
inline

The length must not exceed the size of the integer.

Definition at line 215 of file bitfield.h.

216{
217 const unsigned char *tab = field. table;
218 if (!tab)
219 throw "Trying to set values to an undefined bitfield.";
220 int n = 0;
221 int shiftvalue = 0;
222 while (length >= 8)
223 {
224 n |= (*(tab ++)) << shiftvalue;
225 length -= 8;
226 shiftvalue += 8;
227 }
228 const int bitmasks [] = {0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF};
229 if (length > 0)
230 n |= ((*(tab ++)) & bitmasks [length]) << shiftvalue;
231 return n;
232} /* bits2int */

Referenced by acyclic().

◆ boundarycell() [1/11]

template<class cell >
cell chomp::homology::boundarycell ( const cell &  ,
int  i 
)

◆ boundarycell() [2/11]

Simplex chomp::homology::boundarycell ( const Simplex s,
int  i 
)
inline

Returns the i-th boundary face of a simplex.

Definition at line 347 of file simplex.h.

348{
349 return Simplex (s, i);
350} /* boundarycell */
This class defines a simplex as a geometric cell that can be used as a member of a geometric complex.
Definition: simplex.h:78

◆ boundarycell() [3/11]

Simplex chomp::homology::boundarycell ( const Simplex s,
int  i,
bool   
)
inline

Returns the i-th boundary face of a simplex.

Definition at line 353 of file simplex.h.

354{
355 return boundarycell (s, i);
356} /* boundarycell */
Simplex boundarycell(const Simplex &s, int i, bool)
Returns the i-th boundary face of a simplex.
Definition: simplex.h:353

References boundarycell().

◆ boundarycell() [4/11]

template<class tCell >
tCell2l< tCell > chomp::homology::boundarycell ( const tCell2l< tCell > &  q,
int  i 
)
inline

Computes the given boundary element of a cell.

Definition at line 914 of file twolayer.h.

915{
916 tCell c = CubicalBoundaryCell (q. cell (), i);
918 (tCell2l<tCell>::droplayer (c, q. layer ()));
919 return tCell2l<tCell> (c, l);
920} /* boundarycell */
A general cubical cell with additional information about the layer number.
Definition: twolayer.h:483
theLayerType LayerType
The type for keeping the layer number.
Definition: twolayer.h:486
celltype CubicalBoundaryCell(const celltype &q, int i, bool onlyexisting)
Returns the i-th boundary element of a cell.
Definition: cellmain.h:72

References CubicalBoundaryCell().

◆ boundarycell() [5/11]

template<class tCell >
tCell2l< tCell > chomp::homology::boundarycell ( const tCell2l< tCell > &  q,
int  i,
bool  onlyexisting 
)
inline

Computes the given boundary element of a cell.

If only existing cells are considered and the requested cell doesn't exist, returns '*this'.

Definition at line 901 of file twolayer.h.

903{
904 tCell c = CubicalBoundaryCell (q. cell (), i, onlyexisting);
905 if (c == q. cell ())
906 return q;
908 (tCell2l<tCell>::droplayer (c, q. layer ()));
909 return tCell2l<tCell> (c, l);
910} /* boundarycell */

References CubicalBoundaryCell().

◆ boundarycell() [6/11]

template<class coordtype >
tCellBase< coordtype > chomp::homology::boundarycell ( const tCellBase< coordtype > &  q,
int  i 
)
inline

Computes the i-th boundary element of a cell.

Definition at line 493 of file cellbase.h.

495{
496 return CubicalBoundaryCell (q, i);
497} /* boundarycell */

References CubicalBoundaryCell().

◆ boundarycell() [7/11]

template<class coordtype >
tCellBase< coordtype > chomp::homology::boundarycell ( const tCellBase< coordtype > &  q,
int  i,
bool  onlyexisting 
)
inline

Computes the i-th boundary element of a cell.

If only existing cells are considered, returns '*this' if the requested boundary cell doesn't exist.

Definition at line 485 of file cellbase.h.

487{
488 return CubicalBoundaryCell (q, i, onlyexisting);
489} /* boundarycell */

References CubicalBoundaryCell().

Referenced by chomp::homology::gcomplex< cell, euclidom >::addboundaries(), boundarycell(), chomp::homology::gcomplex< cell, euclidom >::collapse(), createchaincomplex(), intersection2l(), chomp::homology::tCube2l< tCube >::setlayers(), and writechaincomplex().

◆ boundarycell() [8/11]

template<int dimfix, class coordtype >
tCellFix< dimfix, coordtype > chomp::homology::boundarycell ( const tCellFix< dimfix, coordtype > &  q,
int  i 
)
inline

Computes the i-th boundary element of a cell.

Definition at line 504 of file cellfix.h.

506{
507 return CubicalBoundaryCell (q, i);
508} /* boundarycell */

References CubicalBoundaryCell().

◆ boundarycell() [9/11]

template<int dimfix, class coordtype >
tCellFix< dimfix, coordtype > chomp::homology::boundarycell ( const tCellFix< dimfix, coordtype > &  q,
int  i,
bool  onlyexisting 
)
inline

Computes the i-th boundary element of a cell.

Definition at line 496 of file cellfix.h.

498{
499 return CubicalBoundaryCell (q, i, onlyexisting);
500} /* boundarycell */

References CubicalBoundaryCell().

◆ boundarycell() [10/11]

template<class coordtype >
tCellVar< coordtype > chomp::homology::boundarycell ( const tCellVar< coordtype > &  q,
int  i 
)
inline

Computes the i-th boundary element of a cell.

Definition at line 565 of file cellvar.h.

567{
568 return CubicalBoundaryCell (q, i);
569} /* boundarycell */

References CubicalBoundaryCell().

◆ boundarycell() [11/11]

template<class coordtype >
tCellVar< coordtype > chomp::homology::boundarycell ( const tCellVar< coordtype > &  q,
int  i,
bool  onlyexisting 
)
inline

Computes the i-th boundary element of a cell.

Definition at line 557 of file cellvar.h.

559{
560 return CubicalBoundaryCell (q, i, onlyexisting);
561} /* boundarycell */

References CubicalBoundaryCell().

◆ boundarycoef() [1/6]

template<class cell >
int chomp::homology::boundarycoef ( const cell &  ,
int  i 
)

◆ boundarycoef() [2/6]

int chomp::homology::boundarycoef ( const Simplex ,
int  i 
)
inline

Returns the i-th coefficient in the boundary of a simplex.

Definition at line 338 of file simplex.h.

339{
340 if (i & 1)
341 return -1;
342 else
343 return 1;
344} /* boundarycoef */

◆ boundarycoef() [3/6]

template<class tCell >
int chomp::homology::boundarycoef ( const tCell2l< tCell > &  q,
int  i 
)
inline

Returns the given coefficient in the boundary of a cell.

Definition at line 931 of file twolayer.h.

932{
933 return CubicalBoundaryCoef (q. cell (), i);
934} /* boundarycoef */
int CubicalBoundaryCoef(const celltype &q, int i)
Returns the i-th coefficient in the boundary of a cubical cell.
Definition: cellmain.h:157

References CubicalBoundaryCoef().

◆ boundarycoef() [4/6]

template<class coordtype >
int chomp::homology::boundarycoef ( const tCellBase< coordtype > &  q,
int  i 
)
inline

Returns the i-th coefficient in the boundary of a cell.

Definition at line 508 of file cellbase.h.

509{
510 return CubicalBoundaryCoef (q, i);
511} /* boundarycoef */

References CubicalBoundaryCoef().

Referenced by chomp::homology::gcomplex< cell, euclidom >::addboundaries(), createchaincomplex(), and writechaincomplex().

◆ boundarycoef() [5/6]

template<int dimfix, class coordtype >
int chomp::homology::boundarycoef ( const tCellFix< dimfix, coordtype > &  q,
int  i 
)
inline

Returns the i-th coefficient in the boundary of a cell.

Definition at line 519 of file cellfix.h.

520{
521 return CubicalBoundaryCoef (q, i);
522} /* boundarycoef */

References CubicalBoundaryCoef().

◆ boundarycoef() [6/6]

template<class coordtype >
int chomp::homology::boundarycoef ( const tCellVar< coordtype > &  q,
int  i 
)
inline

Returns the i-th coefficient in the boundary of a cell.

Definition at line 580 of file cellvar.h.

581{
582 return CubicalBoundaryCoef (q, i);
583} /* boundarycoef */

References CubicalBoundaryCoef().

◆ boundarylength() [1/6]

template<class cell >
int chomp::homology::boundarylength ( const cell &  )

◆ boundarylength() [2/6]

int chomp::homology::boundarylength ( const Simplex s)
inline

Returns the length of the boundary of a simplex.

Definition at line 331 of file simplex.h.

332{
333 int d = s. dim ();
334 return (d ? (d + 1) : 0);
335} /* boundarylength */

◆ boundarylength() [3/6]

template<class tCell >
int chomp::homology::boundarylength ( const tCell2l< tCell > &  q)
inline

Returns the length of the boundary of a cell.

Definition at line 924 of file twolayer.h.

925{
926 return CubicalBoundaryLength (q. cell ());
927} /* boundarylength */
int CubicalBoundaryLength(const celltype &q)
Returns the length of the boundary of a cubical cell.
Definition: cellmain.h:150

References CubicalBoundaryLength().

◆ boundarylength() [4/6]

template<class coordtype >
int chomp::homology::boundarylength ( const tCellBase< coordtype > &  q)
inline

◆ boundarylength() [5/6]

template<int dimfix, class coordtype >
int chomp::homology::boundarylength ( const tCellFix< dimfix, coordtype > &  q)
inline

Returns the length of the boundary of a cell.

Definition at line 512 of file cellfix.h.

513{
514 return CubicalBoundaryLength (q);
515} /* boundarylength */

References CubicalBoundaryLength().

◆ boundarylength() [6/6]

template<class coordtype >
int chomp::homology::boundarylength ( const tCellVar< coordtype > &  q)
inline

Returns the length of the boundary of a cell.

Definition at line 573 of file cellvar.h.

574{
575 return CubicalBoundaryLength (q);
576} /* boundarylength */

References CubicalBoundaryLength().

◆ ceilprimenumber()

unsigned chomp::homology::ceilprimenumber ( unsigned  n)
inline

Computes the smallest prime number greater than or equal to the given number.

Returns the computed prime number.

Definition at line 170 of file pointset.h.

171{
172 while (!numberisprime (n))
173 ++ n;
174
175 return n;
176} /* prime number */
bool numberisprime(unsigned n)
Verifies if the given number is a prime number.
Definition: pointset.h:155

References numberisprime().

Referenced by chomp::homology::tPointset< coordtype >::rehash().

◆ checkacyclicmap()

template<class tCell , class tCube , class tCoef >
bool chomp::homology::checkacyclicmap ( const mvcellmap< tCell, tCoef, tCube > &  Fcellcubmap,
const char *  Xname 
)

Checks if the image of each element of the domain of this map is acyclic.

Shows messages and a warning if necessary. Returns true = yes.

Definition at line 454 of file homtools.h.

456{
457 sout << "Verifying if the map on " << Xname << " is acyclic... ";
458
459 // retrieve the domain cell complex and analyze each dimension
460 const gcomplex<tCell,tCoef> &dom = Fcellcubmap. getdomain ();
461 int_t counter = 0;
462 bool failed = false;
463 for (int_t d = 0; !failed && (d <= dom. dim ()); ++ d)
464 {
465 // retrieve the set of cells in this dimension and analyze it
466 const hashedset<tCell> &qset = dom [d];
467 for (int_t i = 0; !failed && (i < qset. size ()); ++ i)
468 {
469 // show progress indicator
470 if (counter && !(counter % 373))
471 scon << std::setw (10) << counter <<
472 "\b\b\b\b\b\b\b\b\b\b";
473 ++ counter;
474
475 // reduce the image of this cell
476 const hashedset<tCube> &img = Fcellcubmap (qset [i]);
477 if (img. size () == 1)
478 continue;
479
480 // if could not be reduced, compute the homology
481 if (!acyclic (img))
482 failed = true;
483 }
484 }
485 if (failed)
486 sout << "Failed.\n*** WARNING: The map on " << Xname <<
487 " is NOT acyclic. ***\n"
488 "*** The result of the computations "
489 "may be totally wrong. ***\n";
490 else
491 sout << "Passed. \n";
492 return !failed;
493} /* checkacyclicmap */
bool acyclic(int dim, BitField &b)
Checks whether this cube's nieghbors form an acyclic set.
Definition: cubacycl.h:70
outputstream scon
The console output stream to which one should put all the junk that spoils the log file,...

References acyclic(), scon, and sout.

◆ checkimagecontained() [1/2]

template<class maptype , class cubsettype >
bool chomp::homology::checkimagecontained ( const maptype &  Fcubmap,
const cubsettype &  Xcubes,
const cubsettype &  Ycubes,
const char *  Xname,
const char *  Yname 
)
inline

Checks if the image of X by F is contained in the set Y alone.

Displays messages and a warning if necessary. Returns true if yes.

Definition at line 416 of file homtools.h.

419{
420 cubsettype empty;
421 return checkimagecontained (Fcubmap, Xcubes, Ycubes, empty,
422 Xname, Yname);
423} /* checkimagecontained */
bool checkimagecontained(const maptype &Fcubmap, const cubsettype &Xcubes, const cubsettype &Ycubes, const char *Xname, const char *Yname)
Checks if the image of X by F is contained in the set Y alone.
Definition: homtools.h:416

References checkimagecontained().

◆ checkimagecontained() [2/2]

template<class maptype , class cubsettype >
bool chomp::homology::checkimagecontained ( const maptype &  Fcubmap,
const cubsettype &  Xcubes,
const cubsettype &  Ycubes,
const cubsettype &  Bcubes,
const char *  Xname,
const char *  Yname 
)

Checks if the image of X by F is contained in the union of Y and B.

Displays messages and a warning if necessary. Returns true if yes.

Definition at line 384 of file homtools.h.

387{
388 sout << "Verifying if the image of " << Xname <<
389 " is contained in " << Yname << "... ";
390 bool failed = false;
391 for (int_t i = 0; !failed && (i < Xcubes. size ()); ++ i)
392 {
393 if (!Fcubmap. getdomain (). check (Xcubes [i]))
394 continue;
395 const cubsettype &cset = Fcubmap (Xcubes [i]);
396 for (int_t j = 0; !failed && (j < cset. size ()); ++ j)
397 {
398 if (!Ycubes. check (cset [j]) &&
399 !Bcubes. check (cset [j]))
400 {
401 failed = true;
402 }
403 }
404 }
405 if (failed)
406 sout << "Failed.\nWARNING: The image of " << Xname <<
407 " is NOT contained in " << Yname << ".\n";
408 else
409 sout << "Passed.\n";
410 return !failed;
411} /* checkimagecontained */

References sout.

Referenced by checkimagecontained(), Homology(), and Homology2l().

◆ checkimagedisjoint()

template<class maptype , class cubsettype >
bool chomp::homology::checkimagedisjoint ( const maptype &  Fcubmap,
const cubsettype &  Acubes,
const cubsettype &  Ycubes,
const char *  Aname,
const char *  Yname 
)

Checks if the image of A by F is disjoint from Y (actually, from Y\B).

Displays messages and a warning if necessary. Returns true if yes.

Definition at line 428 of file homtools.h.

430{
431 sout << "Verifying if the image of " << Aname <<
432 " is disjoint from " << Yname << "... ";
433 bool failed = false;
434 for (int_t i = 0; !failed && (i < Acubes. size ()); ++ i)
435 {
436 if (!Fcubmap. getdomain (). check (Acubes [i]))
437 continue;
438 const cubsettype &cset = Fcubmap (Acubes [i]);
439 for (int_t j = 0; !failed && (j < cset. size ()); ++ j)
440 if (Ycubes. check (cset [j]))
441 failed = true;
442 }
443 if (failed)
444 sout << "Failed.\nSERIOUS WARNING: The image of " << Aname <<
445 " is NOT disjoint from " << Yname << ".\n";
446 else
447 sout << "Passed.\n";
448 return !failed;
449} /* checkimagedisjoint */

References sout.

Referenced by Homology(), and Homology2l().

◆ checkinclusion() [1/2]

template<class cubsettype >
bool chomp::homology::checkinclusion ( const cubsettype &  Xcubes,
const cubsettype &  Ycubes,
const char *  Xname,
const char *  Yname 
)
inline

Checks for the inclusion of X in Y.

Displays messages and a warning if necessary. Returns the result: true = passed.

Definition at line 374 of file homtools.h.

376{
377 cubsettype empty;
378 return checkinclusion (Xcubes, Ycubes, empty, Xname, Yname);
379} /* checkinclusion */
bool checkinclusion(const cubsettype &Xcubes, const cubsettype &Ycubes, const char *Xname, const char *Yname)
Checks for the inclusion of X in Y.
Definition: homtools.h:374

References checkinclusion().

◆ checkinclusion() [2/2]

template<class cubsettype >
bool chomp::homology::checkinclusion ( const cubsettype &  Xcubes,
const cubsettype &  Ycubes,
const cubsettype &  Bcubes,
const char *  Xname,
const char *  YBname 
)

Checks if X is a subset of the union of Y and B.

Displays messages and a warning if necessary. Returns the result: true = passed.

Definition at line 349 of file homtools.h.

351{
352 sout << "Verifying if " << Xname << " is contained in " <<
353 YBname << "... ";
354 bool failed = false;
355 for (int_t i = 0; !failed && (i < Xcubes. size ()); ++ i)
356 {
357 if (!Ycubes. check (Xcubes [i]) &&
358 !Bcubes. check (Xcubes [i]))
359 {
360 failed = true;
361 }
362 }
363 if (failed)
364 sout << "Failed.\nWARNING: The set " << Xname <<
365 " is NOT contained in " << YBname << ".\n";
366 else
367 sout << "Passed.\n";
368 return !failed;
369} /* checkinclusion */

References sout.

Referenced by checkinclusion(), and Homology().

◆ closingparenthesis()

int chomp::homology::closingparenthesis ( int  ch)
inline

Returns the matching closing parenthesis for the given opening one or EOF if none.

Definition at line 411 of file textfile.h.

412{
413 switch (ch)
414 {
415 case '(':
416 return ')';
417 case '{':
418 return '}';
419 case '[':
420 return ']';
421 case '<':
422 return '>';
423 case '/':
424 return '/';
425 default:
426 return EOF;
427 }
428} /* closingparenthesis */

Referenced by operator>>(), readcubeorcell(), ReadCubicalCell(), ReadCubicalMap(), readimage(), readparenthesis(), readtheset(), scancubes(), and write().

◆ collapse() [1/4]

template<class cell , class euclidom >
void chomp::homology::collapse ( gcomplex< cell, euclidom > &  Xcompl,
const char *  Xname,
bool  addbd = true,
bool  addcob = false,
bool  disjoint = true,
const int *  level = NULL 
)
inline

Collapses a single geometric complex.

This version does not take any complex to keep.

Definition at line 800 of file homtools.h.

803{
805 collapse (Xcompl, empty, empty, Xname, "",
806 addbd, addcob, disjoint, level);
807 return;
808} /* collapse */
void collapse(gcomplex< cell, euclidom > &Xcompl, const char *Xname, bool addbd=true, bool addcob=false, bool disjoint=true, const int *level=NULL)
Collapses a single geometric complex.
Definition: homtools.h:800

References collapse().

◆ collapse() [2/4]

template<class cell , class euclidom >
void chomp::homology::collapse ( gcomplex< cell, euclidom > &  Xcompl,
gcomplex< cell, euclidom > &  Acompl,
const char *  Xname,
const char *  Aname,
bool  addbd = true,
bool  addcob = false,
bool  disjoint = true,
const int *  level = NULL 
)
inline

Collapses a pair of geometric complexes.

This version does not take any complex to keep.

Definition at line 773 of file homtools.h.

777{
779 collapse (Xcompl, Acompl, empty, Xname, Aname,
780 addbd, addcob, disjoint, level);
781 return;
782} /* collapse */

References collapse().

◆ collapse() [3/4]

template<class cell , class euclidom >
void chomp::homology::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.

Definition at line 742 of file homtools.h.

746{
747 // say what you are about to do
748 sout << "Collapsing faces in " << Xname;
749 if (!Acompl. empty ())
750 sout << " and " << Aname;
751 sout << "... ";
752
753 // collapse the faces as requested to
754 int_t count = Xcompl. collapse (Acompl, Xkeepcompl,
755 addbd, addcob, disjoint, level);
756
757 // say something about the result
758 sout << (count << 1) << " removed, " <<
759 Xcompl. size () << " left.\n";
760
761 // if something remains in A, say it
762 if (!Acompl. empty ())
763 sout << "There are " << Acompl. size () << " faces "
764 "of dimension up to " << Acompl. dim () <<
765 " left in " << Aname << ".\n";
766
767 return;
768} /* collapse */

References collapse(), and sout.

Referenced by acyclic(), chomp::homology::gcomplex< cell, euclidom >::collapse(), collapse(), createcellmap(), Homology(), and Homology2l().

◆ collapse() [4/4]

template<class cell , class euclidom >
void chomp::homology::collapse ( gcomplex< cell, euclidom > &  Xcompl,
gcomplex< cell, euclidom > &  Xkeepcompl,
const char *  Xname,
bool  addbd = true,
bool  addcob = false,
bool  disjoint = true,
const int *  level = NULL 
)
inline

Collapses a single geometric complex.

Definition at line 786 of file homtools.h.

790{
792 collapse (Xcompl, empty, Xkeepcompl, Xname, "",
793 addbd, addcob, disjoint, level);
794 return;
795} /* collapse */

References collapse().

◆ collapseVertices()

template<class wType , class Table1 , class Table2 >
int_t chomp::homology::collapseVertices ( const diGraph< wType > &  g,
int_t  compNum,
Table1 &  compVertices,
Table2 &  compEnds,
diGraph< wType > &  result,
int_t newNumbers = 0 
)
inline

Collapses disjoint subsets of vertices to single vertices and creates a corresponding graph in which the first vertices come from the collapsed ones.

The result graph must be initially empty. Saves translation table from old to new vertex numbers. The table must have sufficient length.

Definition at line 3530 of file digraph.h.

3533{
3534 // do nothing if the input graph is empty
3535 int_t nVert = g. countVertices ();
3536 if (!nVert)
3537 return 0;
3538
3539 // compute the new numbers of vertices: newNum [i] is the
3540 // number of vertex 'i' from 'g' in the resulting graph
3541 int_t *newNum = newNumbers ? newNumbers : new int_t [nVert];
3542 for (int_t i = 0; i < nVert; ++ i)
3543 newNum [i] = -1;
3544 int_t cur = 0; // current vertex number in the new graph
3545 int_t pos = 0; // position in compVertices
3546 while (cur < compNum)
3547 {
3548 int_t posEnd = compEnds [cur];
3549 while (pos < posEnd)
3550 newNum [compVertices [pos ++]] = cur;
3551 ++ cur;
3552 }
3553 for (int_t i = 0; i < nVert; ++ i)
3554 {
3555 if (newNum [i] < 0)
3556 newNum [i] = cur ++;
3557 }
3558
3559 // prepare a table to mark the most recent source vertex for edges:
3560 // srcVert [j] contains i if the edge i -> j has just been added
3561 int_t newVert = nVert - (compNum ? compEnds [compNum - 1] :
3562 static_cast<int_t> (0)) + compNum;
3563 // debug:
3564 if (cur != newVert)
3565 throw "DEBUG: Wrong numbers.";
3566 int_t *srcVert = new int_t [newVert];
3567 for (int_t i = 0; i < newVert; ++ i)
3568 srcVert [i] = -1;
3569
3570 // scan the input graph and create the resulting graph: begin with
3571 // the vertices in the collapsed groups
3572 cur = 0, pos = 0;
3573 while (cur < compNum)
3574 {
3575 // add a new vertex to the result graph
3576 result. addVertex ();
3577 // for all the vertices in this component...
3578 int_t posEnd = compEnds [cur];
3579 while (pos < posEnd)
3580 {
3581 // take the next vertex from the component
3582 int_t vertex = compVertices [pos ++];
3583 // add the appropriate edges to the result graph
3584 addRenumEdges (g, vertex, newNum, cur,
3585 srcVert, result);
3586 }
3587 ++ cur;
3588 }
3589 // process the remaining vertices of the graph
3590 for (int_t vertex = 0; vertex < nVert; ++ vertex)
3591 {
3592 // debug
3593 if (newNum [vertex] > cur)
3594 throw "DEBUG: Wrong order.";
3595 // if the vertex has already been processed, skip it
3596 if (newNum [vertex] != cur)
3597 continue;
3598 // add the appropriate edges to the result graph
3599 result. addVertex ();
3600 addRenumEdges (g, vertex, newNum, cur, srcVert, result);
3601 ++ cur;
3602 }
3603
3604 // free memory and exit
3605 delete [] srcVert;
3606 if (!newNumbers)
3607 delete [] newNum;
3608 return 0;
3609} /* collapseVertices */
int_t addRenumEdges(const diGraph< wType > &g, int_t vertex, const int_t *newNum, int_t cur, int_t *srcVert, diGraph< wType > &result)
A helper function for "collapseVertices".
Definition: digraph.h:3498

References addRenumEdges().

◆ collapseVertices2()

template<class wType , class Table1 , class Table2 >
int_t chomp::homology::collapseVertices2 ( const diGraph< wType > &  g,
int_t  compNum,
Table1 &  compVertices,
Table2 &  compEnds,
diGraph< wType > &  result 
)
inline

Collapses (possibly non-disjoint) subsets of vertices to single vertices and creates a corresponding graph in which the first vertices come from the collapsed ones.

The result graph must be initially empty.

Definition at line 3656 of file digraph.h.

3659{
3660 // do nothing if the input graph is empty
3661 int_t nVert = g. countVertices ();
3662 if (!nVert)
3663 return 0;
3664
3665 // compute the new numbers of vertices: newNum [i] is the
3666 // number of vertex 'i' from 'g' in the resulting graph,
3667 // unless negative; then it points to a set of numbers,
3668 // with -1 meaning "not defined, yet"
3669 int_t *newNum = new int_t [nVert];
3670 for (int_t i = 0; i < nVert; ++ i)
3671 newNum [i] = -1;
3672
3673 // sets of numbers of vertices; the numbers refering to the sets
3674 // begin with 2, thus the first two sets are skipped
3676 // the number of the set waiting to be used next
3677 int_t numSetCur = 2;
3678
3679 int_t cur = 0; // current vertex number in the new graph
3680 int_t pos = 0; // position in compVertices
3681 while (cur < compNum)
3682 {
3683 int_t posEnd = compEnds [cur];
3684 while (pos < posEnd)
3685 {
3686 int_t number = compVertices [pos ++];
3687 if (newNum [number] == -1)
3688 newNum [number] = cur;
3689 else if (newNum [number] < 0)
3690 numSets [-newNum [number]]. add (cur);
3691 else
3692 {
3693 numSets [numSetCur]. add (newNum [number]);
3694 numSets [numSetCur]. add (cur);
3695 newNum [number] = -(numSetCur ++);
3696 }
3697 }
3698 ++ cur;
3699 }
3700 for (int_t i = 0; i < nVert; ++ i)
3701 {
3702 if (newNum [i] == -1)
3703 newNum [i] = cur ++;
3704 }
3705
3706 // prepare a table to mark the most recent source vertex for edges:
3707 // srcVert [j] contains i if the edge i -> j has just been added
3708 int_t newVert = cur;
3709 int_t *srcVert = new int_t [newVert];
3710 for (int_t i = 0; i < newVert; ++ i)
3711 srcVert [i] = -1;
3712
3713 // scan the input graph and create the resulting graph: begin with
3714 // the vertices in the collapsed groups
3715 cur = 0;
3716 pos = 0;
3717 while (cur < compNum)
3718 {
3719 // add a new vertex to the result graph
3720 result. addVertex ();
3721
3722 // for all the vertices in this component...
3723 int_t posEnd = compEnds [cur];
3724 while (pos < posEnd)
3725 {
3726 // take the next vertex from the component
3727 int_t vertex = compVertices [pos ++];
3728
3729 // add the appropriate edges to the result graph
3730 addRenumEdges2 (g, vertex, newNum, numSets, cur,
3731 srcVert, result);
3732 }
3733 ++ cur;
3734 }
3735
3736 // process the remaining vertices of the graph
3737 for (int_t vertex = 0; vertex < nVert; ++ vertex)
3738 {
3739 // debug
3740 if (newNum [vertex] > cur)
3741 throw "DEBUG: Wrong order 2.";
3742
3743 // if the vertex has already been processed, skip it
3744 if (newNum [vertex] != cur)
3745 continue;
3746
3747 // add the appropriate edges to the result graph
3748 result. addVertex ();
3749 addRenumEdges2 (g, vertex, newNum, numSets, cur,
3750 srcVert, result);
3751 ++ cur;
3752 }
3753
3754 // free memory and exit
3755 delete [] srcVert;
3756 delete [] newNum;
3757 return 0;
3758} /* collapseVertices2 */
A container for elements placed in a table (like a vector) that is actually built of many smaller tab...
Definition: multitab.h:65
int_t addRenumEdges2(const diGraph< wType > &g, int_t vertex, const int_t *newNum, TabSets &numSets, int_t cur, int_t *srcVert, diGraph< wType > &result)
A helper function for "collapseVertices2".
Definition: digraph.h:3613

References addRenumEdges2().

◆ commandline()

std::string chomp::homology::commandline ( int  argc,
char *  argv[] 
)
inline

Returns the entire command line as a single string.

Definition at line 441 of file textfile.h.

442{
443 std::string s;
444 for (int i = 0; i < argc; ++ i)
445 {
446 if (i)
447 s += ' ';
448 s += argv [i];
449 }
450 return s;
451} /* commandline */

◆ CommonCell()

template<class coordtype >
int chomp::homology::CommonCell ( coordtype *  left,
coordtype *  right,
const coordtype *  c1,
const coordtype *  c2,
int  spcdim,
const coordtype *  wrap = 0 
)
inline

Computes the left and right corner of a cell which is the intersection of the two given cubes.

Returns the actual dimension of this cell.

Definition at line 328 of file cellmain.h.

331{
332 // calculate the coordinates of both vertices of the cubical cell
333 // and the dimension of the cubical cell
334 int celldim = 0;
335 for (int i = 0; i < spcdim; ++ i)
336 {
337 if (c1 [i] == c2 [i])
338 {
339 left [i] = c1 [i];
340 right [i] = c1 [i];
341 ++ (right [i]);
342 ++ celldim;
343 }
344 else if ((c1 [i] - c2 [i] == -1) || (wrap && wrap [i] &&
345 (c1 [i] - c2 [i] == wrap [i] - 1)))
346 {
347 left [i] = c2 [i];
348 right [i] = c2 [i];
349 }
350 else if ((c1 [i] - c2 [i] == 1) || (wrap && wrap [i] &&
351 (c1 [i] - c2 [i] == -wrap [i] + 1)))
352 {
353 left [i] = c1 [i];
354 right [i] = c1 [i];
355 }
356 else
357 throw "The cubes do not intersect.";
358 }
359
360 return celldim;
361} /* CommonCell */

Referenced by chomp::homology::tCellBase< coordtype >::tCellBase(), and chomp::homology::tCellFix< dimfix, coordtype >::tCellFix().

◆ ComputeBettiNumbers() [1/3]

template<int dim, int twoPower>
void chomp::homology::ComputeBettiNumbers ( bincube< dim, twoPower > &  b,
int *  result 
)

Computes the Betti Numbers of a set of full cubes in a bincube.

This procedure makes use of the technique of splitting the set of cubes into connected components and computing relative homology of each component with respect to some cube in each of them.

Definition at line 2028 of file homology.h.

2029{
2030 using namespace chomp::homology;
2031 typedef typename bincube<dim,twoPower>::iterator cubetype;
2033 neighbortype;
2034
2035 // perform the reduction of full cubes in the binary cube first
2036 sout << "Reducing the binary cube";
2037 int prev = b. count ();
2038 reduceFullCubes (b);
2039 sout << (prev - b. count ()) << " cubes removed, " <<
2040 b. count () << " left.\n";
2041
2042 // create an extra binary cube to store connected components
2044
2045 // set the correct wrapping for the new binary cube and the space
2046 coordinate wrap [dim];
2047 bool setwrapping = false;
2048 for (int i = 0; i < dim; ++ i)
2049 {
2050 if (b. wrapped (i))
2051 {
2052 wrap [i] = 1 << twoPower;
2053 setwrapping = true;
2054 c. wrap (i);
2055 }
2056 else
2057 wrap [i] = 0;
2058 }
2059 if (setwrapping)
2061
2062 // reset the table to store Betti numbers
2063 for (int i = 0; i <= dim; ++ i)
2064 result [i] = 0;
2065
2066 // gather Betti numbers for each connected component separately
2067 bool first_run = true;
2068 while (!b. empty ())
2069 {
2070 // increase the 0th Betti number which counts conn. comp.
2071 ++ *result;
2072
2073 // extract a connected component
2074 if (first_run)
2075 first_run = false;
2076 else
2077 c. clear ();
2078 hashIntQueue s;
2079 s. push (static_cast<int> (b. begin ()));
2080 while (!s. empty ())
2081 {
2082 int n = s. front ();
2083 s. pop ();
2084 neighbortype cur = b. neighborhood_begin (n);
2085 neighbortype end = b. neighborhood_end (n);
2086 while (cur != end)
2087 {
2088 s. push (static_cast<int> (cur));
2089 ++ cur;
2090 }
2091 c. add (n);
2092 b. remove (n);
2093 }
2094
2095 // if the component has just one cube, the answer is obvious
2096 if (c. count () == 1)
2097 continue;
2098
2099 // transform the binary cube into the usual set of cubes
2100 // (in the future this step will be postponed)
2101 SetOfCubes X;
2102 cubetype cur (c. begin ()), end (c. end ());
2103 while (cur != end)
2104 {
2105 X. add (cube_cast<Cube> (cur));
2106 ++ cur;
2107 }
2108
2109 // say which connected component is processed
2110 sout << "Connected component no. " << *result <<
2111 " (" << X. size () << " cubes):\n";
2112
2113 // prepare a pair of sets for relative homology computation
2114 SetOfCubes A;
2115 int_t number = X. size () - 1;
2116 A. add (X [number]);
2117 X. removenum (number);
2118
2119 // compute the relative homology
2120 Chain *chn = 0;
2121 int maxlevel = Homology (X, "X", A, "A", chn);
2122
2123 // display the result
2124 ShowHomology (chn, maxlevel);
2125
2126 // update the Betti number count
2127 for (int i = 1; i <= maxlevel; ++ i)
2128 result [i] += BettiNumber (chn [i]);
2129
2130 // release the memory assigned to the table of chains
2131 if (chn)
2132 delete [] chn;
2133 }
2134
2135 sout << "Computed Betti numbers:";
2136 for (int i = 0; i <= dim; ++ i)
2137 sout << " " << result [i];
2138 sout << ".\n";
2139
2140 return;
2141} /* ComputeBettiNumbers */
The iterator of the set of cubes within a bitmap.
Definition: bincube.h:152
A binary n-dimensional hypercube for storing cubes as bits.
Definition: bincube.h:121
This class keeps a common set of points which are indexed for the use of other classes,...
Definition: pointbas.h:102
This namespace contains the core of the homology computation procedures and related classes and templ...
Definition: bitmaps.h:52
void ShowHomology(const chainmap< euclidom > &hmap)
Show (that is, writes to 'sout') the homology map encoded in terms of a chain map.
Definition: homology.h:197
int Homology(mvmap< cubetype, cubetype > &Fcubmap, hashedset< cubetype > &Xcubes, hashedset< cubetype > &Acubes, chain< euclidom > *&hom, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< typename cubetype::CellType, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< typename cubetype::CellType, euclidom > **gycompl=0)
A version of the above procedure with the default names.
Definition: homology.h:1331
short int coordinate
The default type of coordinates.
Definition: pointset.h:63
int BettiNumber(const chain< euclidom > &c)
Returns the Betti number that corresponds to the given chain which describes one homology group.
Definition: homology.h:104
int reduceFullCubes(FullCubSet &X, bool quiet=false)
Reduces the set of full cubes.
Definition: bincube.h:1167

References BettiNumber(), Homology(), reduceFullCubes(), chomp::homology::tPointBase< coordtype >::setwrapping(), ShowHomology(), and sout.

Referenced by ComputeBettiNumbers().

◆ ComputeBettiNumbers() [2/3]

template<int dim, int twoPower, class coordtype >
void chomp::homology::ComputeBettiNumbers ( char *  binary_buffer,
int *  result,
const coordtype *  space_wrapping = 0 
)

Computes the Betti Numbers of the Homology of a full cubical set defined by means of an n-dimensional bitmap.

The size of this bitmap in each direction must equal 2^n, where n=twoPower. The subsequent bits of the binary buffer correspond to the cubes (0,0,...,0), (1,0,...,0), (2,0,...,0), ..., (2^n-1,0,...,0), then (0,1,0,...,0), (1,1,0,...,0), ..., (2^n-1,1,0,...,0), ..., (2^n-1,...,2^n-1). That is, the first coordinate changes the fastest, the second changes less frequently, and the last one changes the slowest.

Definition at line 2152 of file homology.h.

2154{
2155 using namespace chomp::homology;
2156
2157 // create a binary cube based on the binary buffer
2158 bincube<dim,twoPower> b (binary_buffer);
2159
2160 // set the space wrapping if requested to
2161 if (space_wrapping)
2162 {
2163 for (int i = 0; i < dim; ++ i)
2164 {
2165 if (!space_wrapping [i])
2166 continue;
2167 int w = space_wrapping [i];
2168 if (w != (1 << twoPower))
2169 sout << "WARNING: Wrapping [" << i <<
2170 "] set to " << (1 << twoPower) <<
2171 ".\n";
2172 b. wrap (i);
2173 }
2174 }
2175
2176 ComputeBettiNumbers (b, result);
2177 return;
2178} /* ComputeBettiNumbers */
void ComputeBettiNumbers(const void *buffer, int *sizes, int dim, int *result, const char *engine=0, const int *wrapping=0, bool quiet=false)
Computes the Betti numbers of the given set of full cubes encoded in a binary bitmap.
Definition: homology.h:63

References ComputeBettiNumbers(), and sout.

◆ ComputeBettiNumbers() [3/3]

template<class coordtype >
void chomp::homology::ComputeBettiNumbers ( coordtype *  coord,
int  n,
int  dim,
int *  result 
)

Computes the Betti numbers of the given set of full cubes.

Parameters
coord- a table of coordinates of all the cubes; the i-th coordinate of the k-th cube is stored in coord [dim * k + i]
n- the number of cubes in the table,
dim- the space dimension,
result- a table into which the result is written; its size must be at least (dim + 1),

Definition at line 2194 of file homology.h.

2195{
2196 using namespace chomp::homology;
2197
2198 // create a corresponding set of cubes
2199 SetOfCubes X;
2200 coordinate c [Cube::MaxDim];
2201 coordtype const *coordpointer = coord;
2202 for (int i = 0; i < n; ++ i)
2203 {
2204 for (int j = 0; j < dim; ++ j)
2205 c [j] = static_cast<coordtype> (*(coordpointer ++));
2206 X. add (Cube (c, dim));
2207 }
2208
2209 // turn off screen output
2210 bool soutput = sout. show;
2211 sout. show = false;
2212 bool coutput = scon. show;
2213 scon. show = false;
2214
2215 // compute the homology of the constructed cubical set
2216 Chain *hom;
2217 int maxlevel = Homology (X, "X", hom);
2218
2219 // fill out the resulting table of Betti numbers
2220 for (int j = 0; j <= dim; ++ j)
2221 result [j] = (j <= maxlevel) ? BettiNumber (hom [j]) : 0;
2222
2223 // free unused memory and finish
2224 if (hom)
2225 delete [] hom;
2226 sout. show = soutput;
2227 scon. show = coutput;
2228 return;
2229} /* ComputeBettiNumbers */
This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each directi...
Definition: cubebase.h:72

References BettiNumber(), Homology(), chomp::homology::tCubeBase< coordtype >::MaxDim, scon, and sout.

◆ computeboundary() [1/3]

template<class coordtype >
void chomp::homology::computeboundary ( const tPointset< coordtype > &  p,
tPointset< coordtype > &  b 
)

Definition at line 1930 of file pointset.h.

1931{
1932 // add all the points which are at the border
1933 int_t size = p. size ();
1934 for (int_t i = 0; i < size; ++ i)
1935 {
1936 coordtype *c = p [i];
1937 if (attheborder (p, c))
1938 b. add (c);
1939 }
1940 return;
1941} /* computeboundary */
int attheborder(const tPointset< coordtype > &p, const coordtype *c)
Verifies if the point is at the border of a given set.
Definition: pointset.h:1851

References attheborder().

◆ computeboundary() [2/3]

template<class coordtype >
tPointset< coordtype > * chomp::homology::computeboundary ( tPointset< coordtype > &  p)

Creates the set of all the boundary points with the 'new' operator.

Definition at line 1944 of file pointset.h.

1945{
1946 // create a new set of points
1948
1949 // if cannot allocate memory for it, return nothing
1950 if (!boundary)
1951 return NULL;
1952
1953 // copy the global parameters (the defaults may be different)
1954 boundary -> dimension (p. dimension ());
1955 boundary -> gridsize (p. gridsize ());
1956 boundary -> wrapspace (p. wrapspace ());
1957
1958 // compute the boundary
1959 computeboundary (p, *boundary);
1960
1961 return boundary;
1962} /* computeboundary */
This class represents a set of points in R^n with integer coordinates.
Definition: pointset.h:482
void computeboundary(const tPointset< coordtype > &p, tPointset< coordtype > &b)
Definition: pointset.h:1930

References computeboundary().

Referenced by computeboundary().

◆ computeboundary() [3/3]

template<class coordtype >
void chomp::homology::computeboundary ( tPointset< coordtype > &  p,
tPointset< coordtype > &  b 
)

Computes the boundary points of the given set and adds them to the other set of points.

◆ computeimage()

template<class tCube , class tCell , class tSet >
int_t chomp::homology::computeimage ( hashedset< tCube > &  img,
const tCell &  face,
const mvmap< tCube, tCube > &  map,
const tSet &  cset,
const tCube &  ignore 
)

Computes the image of the face under the combinatorial cubical multivalued map, but doesn't take the given cube into consideration.

Returns the number of cubes whose images were added to 'img'.

Definition at line 235 of file cubacycl.h.

238{
239 // get the coordinates of the cubical cell
240 typename tCell::CoordType left [tCell::MaxDim];
241 face. leftcoord (left);
242 typename tCell::CoordType right [tCell::MaxDim];
243 face. rightcoord (right);
244
245 // find the images of all the cubes containing this cell
246 int spacedim = face. spacedim ();
247 typename tCell::CoordType leftb [tCell::MaxDim];
248 typename tCell::CoordType rightb [tCell::MaxDim];
249 for (int j = 0; j < spacedim; ++ j)
250 {
251 typename tCell::CoordType diff =
252 (left [j] == right [j]) ? 1 : 0;
253 leftb [j] = (left [j] - diff);
254 rightb [j] = (right [j] + diff);
255 }
256 tRectangle<typename tCell::CoordType> r (leftb, rightb, spacedim);
257 const typename tCell::CoordType *c;
258 int_t countimages = 0;
259 while ((c = r. get ()) != NULL)
260 {
261 if (!tCube::PointBase::check (c, spacedim))
262 continue;
263 tCube q (c, spacedim);
264 if (q == ignore)
265 continue;
266 if (!cset. check (q))
267 continue;
268 img. add (map (q));
269 ++ countimages;
270 }
271
272 return countimages;
273} /* computeimage */

Referenced by remainsacyclic().

◆ computePeriod()

template<class GraphType >
int_t chomp::homology::computePeriod ( const GraphType &  g)
inline

Computes the period of a strongly connected graph.

The period of a graph is defined as the greatest common divisor of the lengths of all the cycles in the graph. Period 1 means that the graph is aperiodic. The complexity of this operation is linear (one DFS).

Definition at line 3879 of file digraph.h.

3880{
3881 // remember the number of vertices in the input graph
3882 int_t nVertG = g. countVertices ();
3883 if (!nVertG)
3884 return 0;
3885
3886 // prepare an array to record the depth of each visited vertex
3887 std::vector<int_t> visited (nVertG, 0);
3888
3889 // run DFS starting at the first vertex
3890 // prepare stacks for the DFS algorithm
3891 std::stack<int_t> s_vertex;
3892 std::stack<int_t> s_edge;
3893
3894 // mark the starting vertex as visited
3895 visited [0] = 1;
3896
3897 // use DFS to visit vertices reachable from that vertex
3898 int_t vertex = 0;
3899 int_t edge = 0;
3900 int_t level = 1;
3901 int_t period = 0;
3902 while (1)
3903 {
3904 // go back with the recursion
3905 // if all the edges have been processed
3906 if (edge >= g. countEdges (vertex))
3907 {
3908 // if this was the top recursion level then quit
3909 if (s_vertex. empty ())
3910 break;
3911
3912 // return from the recursion
3913 vertex = s_vertex. top ();
3914 s_vertex. pop ();
3915 edge = s_edge. top ();
3916 s_edge. pop ();
3917 -- level;
3918 continue;
3919 }
3920
3921 // take the next vertex
3922 int_t next = g. getEdge (vertex, edge ++);
3923
3924 // update the GCD of the cycle lengths
3925 if (visited [next])
3926 {
3927 // determine the period provided by the cycle
3928 int_t newPeriod = visited [next] - level - 1;
3929 if (newPeriod < 0)
3930 newPeriod = -newPeriod;
3931
3932 // compute the GCD of the old and new periods
3933 int_t a = newPeriod;
3934 int_t b = period;
3935 while (b)
3936 {
3937 int_t t = b;
3938 b = a % b;
3939 a = t;
3940 }
3941 period = a;
3942
3943 // if the graph turns out to be aperiodic
3944 // then immediately return the result
3945 if (period == 1)
3946 return period;
3947 }
3948
3949 // go to the deeper recursion level if not visited
3950 else
3951 {
3952 // store the previous variables at the stacks
3953 s_vertex. push (vertex);
3954 s_edge. push (edge);
3955
3956 // take the new vertex
3957 vertex = next;
3958 edge = 0;
3959 ++ level;
3960
3961 // mark the new vertex as visited
3962 visited [vertex] = level;
3963 }
3964 }
3965
3966 // return the computed peirod and exit
3967 return period;
3968} /* computePeriod */

◆ connectionGraph()

template<class wType >
int_t chomp::homology::connectionGraph ( const diGraph< wType > &  g,
int_t  nVert,
diGraph< wType > &  result 
)
inline

Computes the graph that represents connections between a number of the first vertices in the given graph.

The vertices of the result graph are the first "nVert" vertices from the source graph. An edge is added to the new graph iff there exists a path from one vertex to another, without going through any other vertex in that set. Runs DFS starting from each of the first "nVert" vertices, and thus may be a little inefficient in some cases.

Definition at line 3769 of file digraph.h.

3771{
3772 // remember the number of vertices in the input graph
3773 int_t nVertG = g. countVertices ();
3774 if (!nVertG)
3775 return 0;
3776
3777 // prepare a bitfield in which visited vertices will be marked
3778 BitField visited;
3779 visited. allocate (nVertG);
3780 visited. clearall (nVertG);
3781
3782 // run DFS for each of the starting vertices
3783 for (int_t startVertex = 0; startVertex < nVert; ++ startVertex)
3784 {
3785 // add this vertex to the resulting graph
3786 result. addVertex ();
3787
3788 // prepare a counter and a stack of visited vertices
3789 int_t nVisited = 0;
3790 std::stack<int_t> s_visited;
3791
3792 // prepare stacks for the DFS algorithm
3793 std::stack<int_t> s_vertex;
3794 std::stack<int_t> s_edge;
3795
3796 // mark the starting vertex as visited
3797 visited. set (startVertex);
3798 s_visited. push (startVertex);
3799 ++ nVisited;
3800
3801 // use DFS to visit vertices reachable from that vertex
3802 int_t vertex = startVertex;
3803 int_t edge = 0;
3804 while (1)
3805 {
3806 // go back with the recursion
3807 // if all the edges have been processed
3808 if (edge >= g. countEdges (vertex))
3809 {
3810 // if this was the top recursion level
3811 // then quit
3812 if (s_vertex. empty ())
3813 break;
3814
3815 // return from the recursion
3816 vertex = s_vertex. top ();
3817 s_vertex. pop ();
3818 edge = s_edge. top ();
3819 s_edge. pop ();
3820 continue;
3821 }
3822
3823 // take the next vertex
3824 int_t next = g. getEdge (vertex, edge ++);
3825
3826 // go to the deeper recursion level if not visited
3827 if (!visited. test (next))
3828 {
3829 // add an edge to the result if necessary
3830 if (next < nVert)
3831 result. addEdge (next);
3832
3833 // store the previous variables at the stacks
3834 s_vertex. push (vertex);
3835 s_edge. push (edge);
3836
3837 // take the new vertex
3838 vertex = next;
3839 edge = 0;
3840
3841 // mark the new vertex as visited
3842 visited. set (vertex);
3843 s_visited. push (vertex);
3844 ++ nVisited;
3845 }
3846 }
3847
3848 // if this was the last vertex then skip the rest
3849 if (startVertex == nVert - 1)
3850 break;
3851
3852 // mark each vertex as non-visited
3853 if (nVisited > (nVertG >> 6))
3854 {
3855 visited. clearall (nVertG);
3856 }
3857 else
3858 {
3859 while (!s_visited. empty ())
3860 {
3861 int_t vertex = s_visited. top ();
3862 s_visited. pop ();
3863 visited. clear (vertex);
3864 }
3865 }
3866 }
3867
3868 // free memory and exit
3869 visited. free ();
3870 return 0;
3871} /* connectionGraph */

◆ copycoord()

template<class coordtype >
void chomp::homology::copycoord ( coordtype *  destination,
const coordtype *  source,
int  dim 
)
inline

◆ countneighbors() [1/3]

template<class coordtype >
int chomp::homology::countneighbors ( const tPointset< coordtype > &  p,
const coordtype *  c,
int  which = 1,
int  maxcount = 0 
)

Counts how many neighbors of the point there are in the set, depending on 'which': 1 = in the set, 0 = out of the set.

Returns the number of neighbors of the given point in a given set.

If 'maxcount' > 0 then counts up to this number and quits. Use countneighbors (c, OUTSIDE, 1) to check for a boundary point or countneighbors (c, INSIDE, 1) to check if the point is not isolated.

Definition at line 1785 of file pointset.h.

1787{
1788 if (p. empty ())
1789 {
1790 if (which == INSIDE)
1791 return 0;
1792 else
1793 return maxcount;
1794 }
1795
1796 int count = 0;
1797 tNeighbors<coordtype> neigh (c, p. dimension ());
1798 while ((c = neigh. get ()) != NULL)
1799 {
1800 if (which == INSIDE)
1801 {
1802 if (p. check (c))
1803 ++ count;
1804 }
1805 else if (which == OUTSIDE)
1806 {
1807 if (!p. check (c))
1808 ++ count;
1809 }
1810
1811 if (maxcount && (count >= maxcount))
1812 return count;
1813 }
1814
1815 return count;
1816} /* countneighbors */
#define INSIDE
Definition: pointset.h:273

References INSIDE, and OUTSIDE.

Referenced by attheborder(), countneighbors(), and findboundarypoint().

◆ countneighbors() [2/3]

template<class coordtype >
int chomp::homology::countneighbors ( const tPointset< coordtype > &  p,
const tPointset< coordtype > &  q,
const coordtype *  c,
int  which = 1,
int  maxcount = 0 
)

Counts neighbors with respect to the union of the sets 'p' and 'q'.

◆ countneighbors() [3/3]

template<class coordtype >
int chomp::homology::countneighbors ( const tPointset< coordtype > &  p,
const tPointset< coordtype > &  q,
coordtype *  c,
int  which,
int  maxcount 
)

Definition at line 1819 of file pointset.h.

1822{
1823 if ((q. empty ()) || (p. dimension () != q. dimension ()))
1824 return countneighbors (p, c, which, maxcount);
1825 else if (p. empty ())
1826 return countneighbors (q, c, which, maxcount);
1827
1828 int count = 0;
1829 tNeighbors<coordtype> neigh (c, p. dimension ());
1830 while ((c = neigh. get ()) != NULL)
1831 {
1832 if (which == INSIDE)
1833 {
1834 if (p. check (c) || q. check (c))
1835 ++ count;
1836 }
1837 else if (which == OUTSIDE)
1838 {
1839 if (!p. check (c) && !q. check (c))
1840 ++ count;
1841 }
1842
1843 if (maxcount && (count >= maxcount))
1844 return count;
1845 }
1846
1847 return count;
1848} /* countneighbors */

References countneighbors(), INSIDE, and OUTSIDE.

◆ createcellmap() [1/2]

template<class cell , class euclidom , class element >
bool chomp::homology::createcellmap ( const mvcellmap< cell, euclidom, element > &  m,
const mvcellmap< cell, euclidom, element > &  rel,
mvcellmap< cell, euclidom, cell > &  cm,
bool  verifyacyclicity 
)

Creates the graph of the map as a cell complex while reducing as possible.

Note: There must be a constructor for 'cell' from 'element' and the Cartesian product operator for cells. The domain of 'rel' must be a subset of the domain of 'm'. If the acyclicity is to be verified, returns true if Ok, false if not.

Definition at line 1948 of file gcomplex.h.

1951{
1952 // prepare the default result
1953 bool result = true;
1954
1955 // go through all the dimensions of the domain cell complex
1956 const gcomplex<cell,euclidom> &dom = m. getdomain ();
1957 const gcomplex<cell,euclidom> &reldom = rel. getdomain ();
1958
1959 int maxdim = m. dim ();
1960 for (int d = maxdim; d >= 0; -- d)
1961 {
1962 // go through all the cells of this dimension
1963 const hashedset<cell> &cset = m. get (d);
1964 for (int_t i = 0; i < cset. size (); ++ i)
1965 {
1966 // extract the cell of interest and its image
1967 const cell &thecell = cset [i];
1968 const hashedset<element> &set = m (thecell);
1969
1970 // the image must not be empty!
1971 if (set. empty ())
1972 throw "An empty image of a cell found.";
1973
1974 // if this is maximal dimension, extract one point
1975 if (d == maxdim)
1976 {
1977 if (reldom. check (thecell))
1978 continue;
1979 // throw "This cell shouldn't be here.";
1980 // cm. add (d, thecell, cell (set [0]. coord (),
1981 // set [0]. coord (), set [0]. dim ()));
1982 cm. add (d, thecell, cell (set [0], 0));
1983 continue;
1984 }
1985
1986 // create a cell complex of the image of this cell
1987 gcomplex<cell,euclidom> img;
1988 for (int_t j = 0; j < set. size (); ++ j)
1989 img. add (cell (set [j]));
1990
1991 // create a cell complex to keep while collapsing
1992 gcomplex<cell,euclidom> keep;
1993 const hashedset<cell> &cob =
1994 dom. getcob (thecell, d);
1995
1996 for (int_t j = 0; j < cob. size (); ++ j)
1997 keep. add (cm (cob [j]));
1998
1999 // create a cell complex from 'rel'
2000 gcomplex<cell,euclidom> other;
2001 if (reldom. check (thecell))
2002 {
2003 const hashedset<element> &relset =
2004 rel (thecell);
2005 for (int_t j = 0; j < relset. size (); ++ j)
2006 {
2007 cell c = cell (relset [j]);
2008 keep. add (c);
2009 other. add (c);
2010 // img. remove (c);
2011 }
2012 }
2013
2014 // reduce 'img' towards 'keep'
2015 gcomplex<cell,euclidom> empty;
2016 img. collapse (empty, keep, 1, 0, 0, NULL, 1);
2017
2018 // verify the acyclicity of this image if requested
2019 if (verifyacyclicity)
2020 {
2021 gcomplex<cell,euclidom> imgdupl (img);
2022 if (!acyclic (imgdupl))
2023 {
2024 result = false;
2025 verifyacyclicity = false;
2026 }
2027 }
2028
2029 // remove the other cells and their faces from img
2030 other. addboundaries ();
2031 img. remove (other);
2032
2033 // verify the acyclicity of the other complex
2034 if (verifyacyclicity && other. size ())
2035 {
2036 // note: acycl. check destroys 'other'
2037 if (!acyclic (other))
2038 {
2039 result = false;
2040 verifyacyclicity = false;
2041 }
2042 }
2043
2044 // set this to be the image of this cell
2045 // *** THIS MUST BE IMPROVED ***
2046 for (int j = 0; j <= img. dim (); ++ j)
2047 cm. add (d, thecell, img [j]);
2048
2049 // show progress indicator
2050 if (i && !(i % 373))
2051 scon << std::setw (12) << i <<
2052 "\b\b\b\b\b\b\b\b\b\b\b\b";
2053 }
2054 if (cset. size () > 373)
2055 scon << " \b\b\b\b\b\b\b\b\b\b\b\b";
2056 scon << '.';
2057 }
2058 scon << ' ';
2059 return result;
2060} /* createcellmap */
bool acyclic(gcomplex< cell, euclidom > &c)
Checks whether this chain complex is acyclic.
Definition: gcomplex.h:1447

References acyclic(), addboundaries(), collapse(), and scon.

◆ createcellmap() [2/2]

template<class cell , class euclidom , class element >
void chomp::homology::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.

Note: There must be a constructor for 'cell' from 'element' and the Cartesian product operator for cells.

Definition at line 1874 of file gcomplex.h.

1876{
1877 // go through all the dimensions of the domain cell complex
1878 int spacedim = -1;
1879 const gcomplex<cell,euclidom> &dom = m. getdomain ();
1880 for (int d = m. dim (); d >= 0; -- d)
1881 {
1882 // go through all the cells of this dimension
1883 const hashedset<cell> &cset = m. get (d);
1884 for (int_t i = 0; i < cset. size (); ++ i)
1885 {
1886 // extract the cell of interest and its image
1887 const cell &thecell = cset [i];
1888 const hashedset<element> &set = m (thecell);
1889
1890 // the image must not be empty!
1891 if (set. empty ())
1892 throw "An empty image of a cell found.";
1893
1894 // correct the dimension of the space if necessary
1895 if (spacedim < 0)
1896 spacedim = set [0]. dim ();
1897
1898 // if this is maximal dimension, extract one point
1899 if (d == spacedim)
1900 {
1901 // cm. add (d, thecell, cell (set [0]. coord (),
1902 // set [0]. coord (), spacedim));
1903 cm. add (d, thecell, cell (set [0], 0));
1904 continue;
1905 }
1906
1907 // create a cell complex of the image of this cell
1908 gcomplex<cell,euclidom> img;
1909 for (int_t j = 0; j < set. size (); ++ j)
1910 img. add (cell (set [j]));
1911
1912 // create a cell complex to keep while collapsing
1913 gcomplex<cell,euclidom> keep;
1914 const hashedset<cell> &cob =
1915 dom. getcob (thecell, d);
1916 for (int_t j = 0; j < cob. size (); ++ j)
1917 keep. add (cm (cob [j]));
1918
1919 // reduce 'img' towards 'keep'
1920 gcomplex<cell,euclidom> empty;
1921 img. collapse (empty, keep, 1, 0, 0, NULL, 1);
1922
1923 // set this to be the image of this cell
1924 // *** THIS MUST BE IMPROVED ***
1925 for (int j = 0; j <= img. dim (); ++ j)
1926 cm. add (d, thecell, img [j]);
1927
1928 // show progress indicator
1929 if (i && !(i % 373))
1930 scon << std::setw (12) << i <<
1931 "\b\b\b\b\b\b\b\b\b\b\b\b";
1932 }
1933 if (cset. size () > 373)
1934 scon << " \b\b\b\b\b\b\b\b\b\b\b\b";
1935 scon << '.';
1936 }
1937 scon << ' ';
1938 return;
1939} /* createcellmap */

References collapse(), and scon.

Referenced by Homology(), and Homology2l().

◆ createchaincomplex() [1/2]

template<class cell , class euclidom >
chaincomplex< euclidom > & chomp::homology::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.

Boundary formulas are restricted to cells which are in the geom. complex. The chain complex should already be initialized with the right dimension.

Definition at line 1128 of file gcomplex.h.

1130{
1131 if (g. dim () < 0)
1132 return c;
1133 c. def_gen (0, g [0]. size ());
1134 for (int d = 1; d <= g. dim (); ++ d)
1135 {
1136 c. def_gen (d, g [d]. size ());
1137 for (int_t i = 0; i < g [d]. size (); ++ i)
1138 {
1139 int len = boundarylength (g [d] [i]);
1140 for (int j = 0; j < len; ++ j)
1141 {
1142 // take the j-th boundary cell
1143 cell thecell = boundarycell (g [d] [i], j);
1144
1145 // add it to the chain complex
1146 if (g. check (thecell))
1147 {
1148 int icoef = boundarycoef
1149 (g [d] [i], j);
1150 euclidom coef;
1151 if (icoef < 0)
1152 {
1153 coef = -icoef;
1154 coef = -coef;
1155 }
1156 else
1157 coef = icoef;
1158 c. add (d, g [d - 1]. getnumber
1159 (thecell), i, coef);
1160 }
1161 }
1162 }
1163 if (!quiet)
1164 {
1165 if (d < g. dim ())
1166 scon << '.';
1167 else
1168 scon << ". ";
1169 }
1170 }
1171 return c;
1172} /* createchaincomplex */
int boundarylength(const cell &)
cell boundarycell(const cell &, int i)
int boundarycoef(const cell &, int i)

References boundarycell(), boundarycoef(), boundarylength(), and scon.

Referenced by acyclic(), Homology(), and Homology2l().

◆ createchaincomplex() [2/2]

template<class cell , class euclidom >
chaincomplex< euclidom > & chomp::homology::createchaincomplex ( chaincomplex< euclidom > &  c,
const gcomplex< cell, euclidom > &  g,
const gcomplex< cell, euclidom > &  rel,
bool  quiet = false 
)

Creates a relative algebraic chain complex with the data from the given pair of geometric cell complexes.

Boundary formulas are restricted to cells which are in the geom. complex. The chain complex should already be initialized with the right dimension.

Definition at line 1260 of file gcomplex.h.

1263{
1264 // if the geometric complex is empty, don't modify the chain complex
1265 if (g. dim () < 0)
1266 return c;
1267
1268 // prepare a table of numbers of ignored cells in the geom. complex
1269 multitable<int_t> *numbers0 = new multitable<int_t>;
1270 int_t count0 = g [0]. size ();
1271 if (rel. dim () >= 0)
1272 {
1273 count0 -= rel [0]. size ();
1274 int_t j = 0;
1275 for (int_t i = 0; i < rel [0]. size (); ++ i)
1276 {
1277 (*numbers0) [j] = g [0]. getnumber (rel [0] [i]);
1278 if ((*numbers0) [j] < 0)
1279 ++ count0;
1280 else
1281 ++ j;
1282 }
1283 }
1284
1285 // set the number of generators of the given dimension
1286 c. def_gen (0, count0);
1287
1288 // create boundary matrices
1289 for (int d = 1; d <= g. dim (); ++ d)
1290 {
1291 // prepare a table of numbers to be ignored
1292 multitable<int_t> *numbers1 = new multitable<int_t>;
1293 int_t count1 = g [d]. size ();
1294 if (rel. dim () >= d)
1295 {
1296 count1 -= rel [d]. size ();
1297 int_t j = 0;
1298 for (int_t i = 0; i < rel [d]. size (); ++ i)
1299 {
1300 (*numbers1) [j] =
1301 g [d]. getnumber (rel [d] [i]);
1302 if ((*numbers1) [j] < 0)
1303 ++ count1;
1304 else
1305 ++ j;
1306 }
1307 }
1308
1309 // set the number of generators of this dimension
1310 c. def_gen (d, count1);
1311
1312 // create the boundary connections with coefficients
1313 for (int_t i = 0; i < g [d]. size (); ++ i)
1314 {
1315 // if this cell is in the other complex, ignore it
1316 if ((rel. dim () >= d) &&
1317 (rel [d]. check (g [d] [i])))
1318 continue;
1319
1320 // determine the number of this cell
1321 int_t n1 = i;
1322 if (n1 >= count1)
1323 n1 = (*numbers1) [n1 - count1];
1324
1325 // get the length of the cell
1326 int len = boundarylength (g [d] [i]);
1327
1328 // retrieve boundary cells and make boundary formula
1329 for (int j = 0; j < len; ++ j)
1330 {
1331 // take the j-th boundary cell
1332 cell thecell = boundarycell (g [d] [i], j);
1333
1334 // add it to the chain complex if relevant
1335 if (g [d - 1]. check (thecell) &&
1336 ((rel. dim () < d - 1) ||
1337 (!rel [d - 1]. check (thecell))))
1338 {
1339 // determine the number of the cell
1340 int_t n0 = g [d - 1].
1341 getnumber (thecell);
1342
1343 // if out of range, translate it
1344 if (n0 >= count0)
1345 n0 = (*numbers0)
1346 [n0 - count0];
1347
1348 // determine the right coefficient
1349 int icoef = boundarycoef
1350 (g [d] [i], j);
1351 euclidom coef;
1352 if (icoef < 0)
1353 {
1354 coef = -icoef;
1355 coef = -coef;
1356 }
1357 else
1358 coef = icoef;
1359
1360 // add this link to the boundary
1361 c. add (d, n0, n1, coef);
1362 }
1363 }
1364 }
1365
1366 // forget unnecessary tables and prepare for the next loop
1367 delete numbers0;
1368 numbers0 = numbers1;
1369 count0 = count1;
1370
1371 // show progress indicator
1372 if (!quiet)
1373 {
1374 if (d < g. dim ())
1375 scon << '.';
1376 else
1377 scon << ". ";
1378 }
1379 }
1380
1381 // release used memory
1382 delete numbers0;
1383
1384 // finish
1385 return c;
1386} /* createchaincomplex */

References boundarycell(), boundarycoef(), boundarylength(), and scon.

◆ creategraph() [1/4]

template<class cell , class euclidom , class element >
void chomp::homology::creategraph ( const mvcellmap< cell, euclidom, element > &  m,
const gcomplex< cell, euclidom > &  rel,
gcomplex< cell, euclidom > &  c,
bool  addbd 
)

Creates the full graph of a map as a cellular complex.

Note: There must be a constructor for 'cell' from 'element' and the Cartesian product operator for cells.

Definition at line 1828 of file gcomplex.h.

1831{
1832 // go through all the dimensions of the domain cell complex
1833 for (int d1 = 0; d1 <= m. dim (); ++ d1)
1834 {
1835 // go through all the cells of this dimension
1836 const hashedset<cell> &cset = m. get (d1);
1837 for (int_t i = 0; i < cset. size (); ++ i)
1838 {
1839 // create a cell complex of the image of this cell
1840 const cell &thecell = cset [i];
1841 const hashedset<element> &set = m (thecell);
1843 for (int_t j = 0; j < set. size (); ++ j)
1844 img. add (cell (set [j]));
1845 if (addbd)
1846 img. addboundaries ();
1847
1848 // go through all the dimensions of this cell complex
1849 for (int d2 = 0; d2 <= img. dim (); ++ d2)
1850 {
1851 // add all the products to the graph
1852 const hashedset<cell> &cs = img [d2];
1853 for (int_t j = 0; j < cs. size (); ++ j)
1854 {
1855 cell bigcell = thecell * cs [j];
1856 if (!rel. check (bigcell))
1857 c. add (bigcell);
1858 }
1859 }
1860 }
1861 if (d1 < m. dim ())
1862 scon << '.';
1863 else
1864 scon << ' ';
1865 }
1866 return;
1867} /* creategraph */

References addboundaries(), and scon.

◆ creategraph() [2/4]

template<class cell , class euclidom , class element >
void chomp::homology::creategraph ( const mvcellmap< cell, euclidom, element > &  m,
gcomplex< cell, euclidom > &  c,
bool  addbd 
)

Creates the full graph of a map as a cellular complex.

Note: There must be a constructor for 'cell' from 'element' and the Cartesian product operator for cells.

Definition at line 1788 of file gcomplex.h.

1790{
1791 // go through all the dimensions of the domain cell complex
1792 for (int d1 = 0; d1 <= m. dim (); ++ d1)
1793 {
1794 // go through all the cells of this dimension
1795 const hashedset<cell> &cset = m. get (d1);
1796 for (int_t i = 0; i < cset. size (); ++ i)
1797 {
1798 // create a cell complex of the image of this cell
1799 const cell &thecell = cset [i];
1800 const hashedset<element> &set = m (thecell);
1802 for (int_t j = 0; j < set. size (); ++ j)
1803 img. add (cell (set [j]));
1804 if (addbd)
1805 img. addboundaries ();
1806
1807 // go through all the dimensions of this cell complex
1808 for (int d2 = 0; d2 <= img. dim (); ++ d2)
1809 {
1810 // add all the products to the graph
1811 const hashedset<cell> &cs = img [d2];
1812 for (int_t j = 0; j < cs. size (); ++ j)
1813 c. add (thecell * cs [j]);
1814 }
1815 }
1816 if (d1 < m. dim ())
1817 scon << '.';
1818 else
1819 scon << ' ';
1820 }
1821 return;
1822} /* creategraph */

References addboundaries(), and scon.

◆ creategraph() [3/4]

template<class cell , class euclidom >
gcomplex< cell, euclidom > & chomp::homology::creategraph ( const mvmap< cell, cell > &  m,
gcomplex< cell, euclidom > &  graph 
)

Add a graph of a multivalued cell map to the cell complex.

Definition at line 1429 of file gcomplex.h.

1431{
1432 for (int_t i = 0; i < m. size (); ++ i)
1433 {
1434 const cell &e = m. get (i);
1435 const hashedset<cell> &f = m (i);
1436 for (int_t j = 0; j < f. size (); ++ j)
1437 graph. add (e * f [j]);
1438 }
1439 return graph;
1440} /* creategraph */

Referenced by Homology(), and Homology2l().

◆ creategraph() [4/4]

template<class domelement , class imgelement >
hashedset< imgelement > & chomp::homology::creategraph ( const mvmap< domelement, imgelement > &  m,
hashedset< imgelement > &  graph 
)

Adds a graph of a multivalued map to the given set.

The operator * is used to create the Cartesian products (pairs) of elements from the domain and elements in their images.

Definition at line 1141 of file hashsets.h.

1143{
1144 for (int_t i = 0; i < m. getdomain (). size (); ++ i)
1145 {
1146 const domelement &e = m. get (i);
1147 const hashedset<imgelement> &f = m (i);
1148 int_t n = f. size ();
1149 for (int_t j = 0; j < n; ++ j)
1150 graph. add (e * f [j]);
1151 }
1152 return graph;
1153} /* creategraph */

◆ createimages() [1/5]

template<class euclidom , class tCell , class tCube >
int_t chomp::homology::createimages ( mvcellmap< tCell, euclidom, tCube > &  m,
const mvmap< tCube, tCube > &  f 
)
inline

A wrapper for the above function if there is only one map.

Definition at line 221 of file cubmaps.h.

223{
224 mvmap<tCube,tCube> emptymap;
225 return createimages (m, f, emptymap);
226} /* createimages */
int_t createimages(mvcellmap< tCell, euclidom, tCube > &m, const mvmap< tCube, tCube > &f)
A wrapper for the above function if there is only one map.
Definition: cubmaps.h:221

References createimages().

◆ createimages() [2/5]

template<class euclidom , class tCell , class tCube >
int_t chomp::homology::createimages ( mvcellmap< tCell, euclidom, tCube > &  m,
const mvmap< tCube, tCube > &  f,
const hashedset< tCube > &  dom 
)
inline

A wrapper for the above function if there is only one map.

Definition at line 200 of file cubmaps.h.

202{
203 mvmap<tCube,tCube> emptymap;
204 hashedset<tCube> emptyset;
205 return createimages (m, f, emptymap, dom, emptyset);
206} /* createimages */

References createimages().

◆ createimages() [3/5]

template<class euclidom , class tCell , class tCube >
int_t chomp::homology::createimages ( mvcellmap< tCell, euclidom, tCube > &  m,
const mvmap< tCube, tCube > &  f1,
const mvmap< tCube, tCube > &  f2 
)

Creates images of cells in m as unions of cubes determined by f1 and f2.

Return the total number of cubes in all the images of cells.

Definition at line 211 of file cubmaps.h.

213{
214 const hashedset<tCube> &dom1 = f1. getdomain ();
215 const hashedset<tCube> &dom2 = f2. getdomain ();
216 return createimages (m, f1, f2, dom1, dom2);
217} /* createimages */

References createimages().

◆ createimages() [4/5]

template<class euclidom , class tCell , class tCube >
int_t chomp::homology::createimages ( mvcellmap< tCell, euclidom, tCube > &  m,
const mvmap< tCube, tCube > &  f1,
const mvmap< tCube, tCube > &  f2,
const hashedset< tCube > &  dom1,
const hashedset< tCube > &  dom2 
)

Creates images of cells in 'm' as unions of cubes determined by f1 and f2.

The domains of interest must be given explicitly. Returns the total number of cubes in all the images of cells.

Definition at line 147 of file cubmaps.h.

150{
151 typedef typename tCell::CoordType coordType;
152 int_t countimages = 0;
153 coordType leftbound [tCell::MaxDim];
154 coordType rightbound [tCell::MaxDim];
155 coordType left [tCell::MaxDim];
156 coordType right [tCell::MaxDim];
157 for (int d = 0; d <= m. dim (); ++ d)
158 {
159 const hashedset<tCell> &cset = m. get (d);
160 if (cset. empty ())
161 continue;
162 const int spacedim = cset [0]. spacedim ();
163 for (int_t i = 0; i < cset. size (); ++ i)
164 {
165 cset [i]. leftcoord (left);
166 cset [i]. rightcoord (right);
167 for (int_t j = 0; j < spacedim; ++ j)
168 {
169 // compensate for space wrapping
170 if (right [j] < left [j])
171 right [j] = left [j] + 1;
172 // compute the bounds
173 leftbound [j] = static_cast<coordType>
174 (left [j] - (left [j] == right [j]));
175 rightbound [j] = static_cast<coordType>
176 (right [j] +
177 (left [j] == right [j]));
178 }
179 tRectangle<coordType> r (leftbound, rightbound,
180 spacedim);
181 const coordType *c;
182 while ((c = r. get ()) != NULL)
183 {
184 if (!tCube::PointBase::check (c, spacedim))
185 continue;
186 tCube q (c, spacedim);
187 if (dom1. check (q))
188 m. add (d, i, f1 (q));
189 if (dom2. check (q))
190 m. add (d, i, f2 (q));
191 }
192 countimages += m (cset [i]). size ();
193 }
194 }
195 return countimages;
196} /* createimages */

Referenced by createimages(), Homology(), and Homology2l().

◆ createimages() [5/5]

template<class euclidom , class tCell , class tCube >
int_t chomp::homology::createimages ( mvcellmap< tCell2l< tCell >, euclidom, tCube2l< tCube > > &  m,
const mvmap< tCube2l< tCube >, tCube2l< tCube > > &  f1,
const mvmap< tCube2l< tCube >, tCube2l< tCube > > &  f2,
const hashedset< tCube2l< tCube > > &  dom1,
const hashedset< tCube2l< tCube > > &  dom2 
)

Specialization of the "createimages" function for two-layer cubes.

This function creates images of cells in 'm' as unions of cubes determined by f1 and f2. The domains of interest are given explicitly. Returns the total number of cubes in all the images of cells.

Definition at line 1140 of file twolayer.h.

1145{
1146 typedef typename tCube::CoordType coordType;
1147 int_t countimages = 0;
1148 coordType leftbound [tCell::MaxDim];
1149 coordType rightbound [tCell::MaxDim];
1150 coordType left [tCell::MaxDim];
1151 coordType right [tCell::MaxDim];
1152
1153 // go through all the dimensions of the cellular complex separtely
1154 for (int d = 0; d <= m. dim (); ++ d)
1155 {
1156 const hashedset<tCell2l<tCell> > &cset = m. get (d);
1157 if (cset. empty ())
1158 continue;
1159 const int spacedim = cset [0]. spacedim ();
1160
1161 // go through the cells of the specified dimension
1162 for (int_t i = 0; i < cset. size (); ++ i)
1163 {
1164 // remember the cell whose image is computed
1165 const tCell2l<tCell> &thecell = cset [i];
1166
1167 // determine tha layer of the cell
1168 const typename tCube2l<tCube>::LayerType layer =
1169 thecell. layer ();
1170
1171 // check if the layers are identified at the cell
1172 bool idlayers = tCell2l<tCell>::identify ().
1173 check (thecell. cell ());
1174
1175 // get the coordinates of the corners of the cell
1176 thecell. leftcoord (left);
1177 thecell. rightcoord (right);
1178
1179 // compute the bounds for full cubes to get imgs of
1180 for (int j = 0; j < spacedim; ++ j)
1181 {
1182 // compensate for space wrapping
1183 if (right [j] < left [j])
1184 right [j] = left [j] + 1;
1185
1186 // compute the bounds for full cubes
1187 leftbound [j] = static_cast<coordType>
1188 (left [j] - (left [j] == right [j]));
1189 rightbound [j] = static_cast<coordType>
1190 (right [j] +
1191 (left [j] == right [j]));
1192 }
1193
1194 // go through the full cubes in the computed range
1195 tRectangle<coordType> r (leftbound, rightbound,
1196 spacedim);
1197 const coordType *c;
1198 while ((c = r. get ()) != NULL)
1199 {
1200 // determine the core cube
1201 if (!tCube::PointBase::check (c, spacedim))
1202 continue;
1203 tCube q0 (c, spacedim);
1204
1205 // add the images of the 2-layer cube
1206 tCube2l<tCube> q (q0, layer);
1207 if (dom1. check (q))
1208 m. add (d, i, f1 (q));
1209 if (dom2. check (q))
1210 m. add (d, i, f2 (q));
1211
1212 // determine if the cubes at the other
1213 // layer must also be considered
1214 typename tCube2l<tCube>::LayerType l = layer;
1215 if (idlayers && !layer &&
1216 tCube2l<tCube>::layer1 ().
1217 check (q0))
1218 {
1219 l = 1;
1220 }
1221 else if (idlayers && layer &&
1222 tCube2l<tCube>::layer0 ().
1223 check (q0))
1224 {
1225 l = 0;
1226 }
1227 if (l != layer)
1228 {
1229 tCube2l<tCube> ql (q0, l);
1230 if (dom1. check (ql))
1231 m. add (d, i, f1 (ql));
1232 if (dom2. check (ql))
1233 m. add (d, i, f2 (ql));
1234 }
1235 }
1236 countimages += m (thecell). size ();
1237 }
1238 }
1239 return countimages;
1240} /* createimages */
theLayerType LayerType
The type for keeping the layer number.
Definition: twolayer.h:83

References chomp::homology::tCell2l< tCell >::identify().

◆ createprojection()

template<class euclidom , class tCell >
void chomp::homology::createprojection ( const gcomplex< tCell, euclidom > &  Fcompl,
const gcomplex< tCell, euclidom > &  Ycompl,
chainmap< euclidom > &  cmap,
int  offset,
int  outdim,
int  discarddim,
int *  level = NULL 
)

Creates the chain map of the projection from a cell complex of the graph of a map to a cell complex of the codomain of the map.

If a table of levels is given, creates the map only at given levels.

Definition at line 237 of file cubmaps.h.

241{
242 typedef typename tCell::CoordType coordType;
243 // go through the list of all the dimensions which are of concern
244 for (int d = 0; d <= Ycompl. dim (); ++ d)
245 {
246 if ((!level || level [d]) && (Fcompl. dim () >= d))
247 {
248 // take sets of cells of this dimension
249 const hashedset<tCell> &Fset = Fcompl [d];
250 if (Fset. empty ())
251 continue;
252 const hashedset<tCell> &Yset = Ycompl [d];
253 if (Yset. empty ())
254 continue;
255
256 // go through the list of cells in Fcompl of dim. d
257 for (int_t i = 0; i < Fset. size (); ++ i)
258 {
259 // get this cell and its coordinates
260 const tCell &Fcell = Fset [i];
261 coordType left [tCell::MaxDim];
262 Fcell. leftcoord (left);
263 coordType right [tCell::MaxDim];
264 Fcell. rightcoord (right);
265
266 // check if this cell has no width in the
267 // directions that are discarded
268 register int j;
269 for (j = 0; j < offset; ++ j)
270 if (left [j] != right [j])
271 {
272 j = offset + 33;
273 break;
274 }
275 if (j > offset)
276 continue;
277 for (j = 0; j < discarddim; ++ j)
278 if (left [offset + outdim + j] !=
279 right [offset + outdim + j])
280 {
281 j = discarddim + 33;
282 break;
283 }
284 if (j > discarddim)
285 continue;
286
287 // create the projected cell
288 if (!(tCell::PointBase::check
289 (left + offset, outdim)))
290 continue;
291 if (!(tCell::PointBase::check
292 (right + offset, outdim)))
293 continue;
294 // tCell projected (left + offset,
295 // right + offset, outdim);
296 tCell projected (Fcell, offset, outdim);
297
298 // find its number in Y
299 int_t nr = Yset. getnumber (projected);
300
301 // if not found, discard it
302 if (nr < 0)
303 continue;
304
305 // add the pair to the projection map
306 euclidom e;
307 e = 1;
308 cmap. add (d, nr, i, e);
309 }
310 }
311 }
312 return;
313} /* createprojection */

Referenced by Homology(), and Homology2l().

◆ cube_cast()

template<class dest_cube , class src_cube >
dest_cube chomp::homology::cube_cast ( const src_cube &  src)
inline

Converts one cube into another.

Definition at line 58 of file cubemain.h.

59{
60 typename dest_cube::CoordType tab [src_cube::MaxDim];
61 src. coord (tab);
62 return dest_cube (tab, src. dim ());
63} /* cube_cast */

◆ cubemiddle()

template<class coordtype >
void chomp::homology::cubemiddle ( coordtype *  c,
double *  p,
double *  grid,
int  dim 
)
inline

Computes the middle of a cube with its left lower etc.

corner represented by the given point with respect to the given grid.

Definition at line 245 of file pointset.h.

246{
247 if (grid)
248 {
249 for (int i = 0; i < dim; ++ i)
250 p [i] = (c [i] + 0.5) * grid [i];
251 }
252 else
253 {
254 for (int i = 0; i < dim; ++ i)
255 p [i] = c [i] + 0.5;
256 }
257 return;
258} /* cubemiddle */

◆ cubes2cells()

template<class tCubes , class tCell , class tCoef >
void chomp::homology::cubes2cells ( tCubes &  Xcubes,
gcomplex< tCell, tCoef > &  Xcompl,
const char *  Xname,
bool  deletecubes = true 
)

Transforms cubes to full-dimensional cells.

Definition at line 716 of file homtools.h.

718{
719 // if there are no cubes to transform, do nothing
720 if (Xcubes. empty ())
721 return;
722
723 // transform cubes into the cells of the same dimension
724 int_t prev = Xcompl. size ();
725 sout << "Transforming " << Xname << " into cells... ";
726 for (int_t i = 0; i < Xcubes. size (); ++ i)
727 Xcompl. add (tCell (Xcubes [i]));
728 sout << (Xcompl. size () - prev) << " cells added.\n";
729
730 // forget the set of cubes if requested to
731 if (deletecubes)
732 {
733 tCubes empty;
734 Xcubes = empty;
735 }
736
737 return;
738} /* cubes2cells */

References sout.

Referenced by Homology(), and Homology2l().

◆ cubexpand() [1/2]

template<class tCube >
int_t chomp::homology::cubexpand ( hashedset< tCube > &  cset,
hashedset< tCube > &  other,
bool  quiet = false 
)

Expands the set 'other' towards 'cset' without changing the homology of (cset + other, other).

The two sets must be disjoint.

Definition at line 153 of file cubisets.h.

155{
156 MapCanExpandDummy<tCube> mapCanExpand;
157 return cubexpand (cset, other, mapCanExpand, quiet);
158} /* cubexpand */
A dummy class that substitutes MapCanExpand if there is no map to check, so the verification always r...
Definition: cubacycl.h:487
int_t cubexpand(hashedset< tCube > &cset, hashedset< tCube > &other, hashedset< tCube > &imgsrc, hashedset< tCube > &img, const mvmap< tCube, tCube > &map, bool indexmap, bool checkacyclic, bool quiet=false)
Expands the set 'other' towards 'cset' without changing the homology of (cset + other,...
Definition: cubisets.h:167

References cubexpand().

Referenced by cubexpand(), and expandAinX().

◆ cubexpand() [2/2]

template<class tCube >
int_t chomp::homology::cubexpand ( hashedset< tCube > &  cset,
hashedset< tCube > &  other,
hashedset< tCube > &  imgsrc,
hashedset< tCube > &  img,
const mvmap< tCube, tCube > &  map,
bool  indexmap,
bool  checkacyclic,
bool  quiet = false 
)
inline

Expands the set 'other' towards 'cset' without changing the homology of (cset + other, other).

The two sets must be disjoint. Increases 'img' if necessary to cover F (other), but moves cubes only if it can prove that the inclusion of the old 'img' into the new, enlarged 'img' induces an isomorphism in homology. Every cube added to 'img' is removed from 'imgsrc'.

Definition at line 167 of file cubisets.h.

171{
172 MapCanExpand<tCube> mapCanExpand (map, imgsrc, img,
173 indexmap, checkacyclic, quiet);
174 return cubexpand (cset, other, mapCanExpand, quiet);
175} /* cubexpand */
A class for the procecure checking if the image of a given map can be expanded without any harm to th...
Definition: cubacycl.h:392

References cubexpand().

◆ CubicalBoundaryCell() [1/2]

template<class celltype >
celltype chomp::homology::CubicalBoundaryCell ( const celltype &  q,
int  i 
)
inline

Returns the i-th cell in the boundary of the given cell.

Definition at line 143 of file cellmain.h.

144{
145 return CubicalBoundaryCell (q, i, false);
146} /* boundarycell */
celltype CubicalBoundaryCell(const celltype &q, int i)
Returns the i-th cell in the boundary of the given cell.
Definition: cellmain.h:143

References CubicalBoundaryCell().

◆ CubicalBoundaryCell() [2/2]

template<class celltype >
celltype chomp::homology::CubicalBoundaryCell ( const celltype &  q,
int  i,
bool  onlyexisting 
)
inline

Returns the i-th boundary element of a cell.

If only existing cells are considered, returns '*this' if the requested boundary cell doesn't exist.

For a cubical cell whose non-zero intervals in the Cartesian product are [p1-,p1+], [p2-,p2+], etc., the boundary is an alternating sum of cells in which these intervals are replaced by single elements, first by those with larger values (signs begin with a '+'), and then by those with smaller values (signs begin with a '-').

Definition at line 72 of file cellmain.h.

74{
75 typedef typename celltype::CoordType coordtype;
76 coordtype origleft [celltype::MaxDim];
77 q. leftcoord (origleft);
78 coordtype origright [celltype::MaxDim];
79 q. rightcoord (origright);
80 coordtype newcoord [celltype::MaxDim];
81 int sd = q. spacedim ();
82 int d = q. dim ();
83 int count = 0;
84
85 // if this is the first set of cells
86 if (i < d)
87 {
88 for (int j = 0; j < sd; ++ j)
89 {
90 // copy the coordinates of the right vertex
91 newcoord [j] = origleft [j];
92
93 // modify the desired coordinate and finalize
94 if (origleft [j] != origright [j])
95 {
96 if (i == count ++)
97 {
98 newcoord [j] = origright [j];
99 for (j = j + 1; j < sd; ++ j)
100 newcoord [j] = origleft [j];
101 if (onlyexisting &&
102 !celltype::PointBase::check
103 (newcoord, sd))
104 return q;
105 return celltype (newcoord,
106 origright, sd);
107 }
108 }
109 }
110 throw "False cubical cell's dimension.";
111 }
112 else
113 {
114 i -= d;
115 for (int j = 0; j < sd; ++ j)
116 {
117 // copy the coordinates of the right vertex
118 newcoord [j] = origright [j];
119
120 // modify the desired coordinate and finalize
121 if (origleft [j] != origright [j])
122 {
123 if (i == count ++)
124 {
125 newcoord [j] = origleft [j];
126 for (j = j + 1; j < sd; j ++)
127 newcoord [j] = origright [j];
128 if (onlyexisting &&
129 !celltype::PointBase::check
130 (newcoord, sd))
131 return q;
132 return celltype (origleft,
133 newcoord, sd);
134 }
135 }
136 }
137 throw "False dimension of a cubical cell.";
138 }
139} /* boundarycell */

Referenced by boundarycell(), and CubicalBoundaryCell().

◆ CubicalBoundaryCoef()

template<class celltype >
int chomp::homology::CubicalBoundaryCoef ( const celltype &  q,
int  i 
)
inline

Returns the i-th coefficient in the boundary of a cubical cell.

Definition at line 157 of file cellmain.h.

158{
159 int d = q. dim ();
160 if (i >= d)
161 i -= d - 1;
162 return (i & 1) ? 1 : -1;
163} /* boundarycoef */

Referenced by boundarycoef().

◆ CubicalBoundaryLength()

template<class celltype >
int chomp::homology::CubicalBoundaryLength ( const celltype &  q)
inline

Returns the length of the boundary of a cubical cell.

Definition at line 150 of file cellmain.h.

151{
152 return q. dim () << 1;
153} /* boundarylength */

Referenced by boundarylength().

◆ cubreduce() [1/3]

template<class tCube >
int_t chomp::homology::cubreduce ( const hashedset< tCube > &  maincset,
hashedset< tCube > &  cset 
)
inline

Reduces a set of cubes towards the main set.

Returns the number of cubes removed from the set.

Definition at line 139 of file cubisets.h.

141{
142 return cubreducequiet (maincset, cset, false);
143} /* cubreduce */
int_t cubreducequiet(const hashedset< tCube > &maincset, hashedset< tCube > &cset, bool quiet=true)
Reduce the set 'cset' towards 'maincset'.
Definition: cubisets.h:126

References cubreducequiet().

◆ cubreduce() [2/3]

template<class tCube >
int_t chomp::homology::cubreduce ( hashedset< tCube > &  cset,
hashedset< tCube > &  other,
const hashedset< tCube > &  keep 
)
inline

Reduces a pair of sets of cubes for relative homology computation.

Does not remove any cubes from the set 'keep'. Returns the number of cubes removed from both sets.

Definition at line 116 of file cubisets.h.

118{
119 return cubreducequiet (cset, other, keep, false);
120} /* cubreduce */

References cubreducequiet().

◆ cubreduce() [3/3]

template<class tCube >
int_t chomp::homology::cubreduce ( hashedset< tCube > &  cset,
hashedset< tCube > &  other,
mvmap< tCube, tCube > &  cubmap,
const hashedset< tCube > &  keep 
)
inline

Reduces a pair of sets of cubes for relative homology computation.

Does not remove any cubes from the set 'keep'. Additionally makes sure that the acyclicity of the given map is preserved. Returns the number of cubes removed from both sets.

Definition at line 91 of file cubisets.h.

93{
94 return cubreducequiet (cset, other, cubmap, keep, false);
95} /* cubreduce */

References cubreducequiet().

Referenced by reducepair().

◆ cubreducequiet() [1/3]

template<class tCube >
int_t chomp::homology::cubreducequiet ( const hashedset< tCube > &  maincset,
hashedset< tCube > &  cset,
bool  quiet = true 
)

Reduce the set 'cset' towards 'maincset'.

These sets must be disjoint. If 'quiet' is set to true, then suppresses any messages. Returns the number of cubes removed from 'cset'.

Definition at line 126 of file cubisets.h.

128{
129 mvmap<tCube,tCube> emptymap;
130 const MapRemainsAcyclic<tCube> mapRemainsAcyclic (emptymap);
131 hashedset<tCube> emptyset;
132 return cubreducequiet (maincset, cset, emptyset, emptyset,
133 mapRemainsAcyclic, quiet);
134} /* cubreducequiet */
A wrapper class for the procecure checking if a given map remains acyclic when a given full cube is r...
Definition: cubacycl.h:346

References cubreducequiet().

◆ cubreducequiet() [2/3]

template<class tCube >
int_t chomp::homology::cubreducequiet ( hashedset< tCube > &  cset,
hashedset< tCube > &  other,
const hashedset< tCube > &  keep,
bool  quiet = true 
)
inline

Reduces a pair of sets of cubes for relative homology computation.

Does not remove any cubes from the set 'keep'. If 'quiet' is set to true, then suppresses any messages. Returns the number of cubes removed from both sets.

Definition at line 102 of file cubisets.h.

104{
105 mvmap<tCube,tCube> emptymap;
106 const MapRemainsAcyclic<tCube> mapRemainsAcyclic (emptymap);
107 hashedset<tCube> emptyset;
108 return cubreducequiet (emptyset, cset, other, keep,
109 mapRemainsAcyclic, quiet);
110} /* cubreducequiet */

References cubreducequiet().

◆ cubreducequiet() [3/3]

template<class tCube >
int_t chomp::homology::cubreducequiet ( hashedset< tCube > &  cset,
hashedset< tCube > &  other,
mvmap< tCube, tCube > &  cubmap,
const hashedset< tCube > &  keep,
bool  quiet = true 
)
inline

Reduces a pair of sets of cubes for relative homology computation.

Does not remove any cubes from the set 'keep'. Additionally makes sure that the acyclicity of the given map is preserved. If 'quiet' is set to true then suppresses any messages. Returns the number of cubes removed from both sets.

Definition at line 76 of file cubisets.h.

79{
80 const MapRemainsAcyclic<tCube> mapRemainsAcyclic (cubmap);
81 hashedset<tCube> emptyset;
82 return cubreducequiet (emptyset, cset, other, keep,
83 mapRemainsAcyclic, quiet);
84} /* cubreducequiet */

References cubreducequiet().

Referenced by acyclic(), cubreduce(), cubreducequiet(), chomp::homology::MapCanExpand< tCube >::operator()(), and remainsacyclic().

◆ currenttime()

const char * chomp::homology::currenttime ( void  )
inline

Retrieves the current time as a pointer to a C-style string.

Definition at line 454 of file textfile.h.

455{
456 std::time_t t;
457 std::time (&t);
458 return std::asctime (std::localtime (&t));
459} /* currenttime */

Referenced by chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator(), and chomp::multiwork::mwSubCoordinator< dim, coord >::~mwSubCoordinator().

◆ decreasedimension()

template<class cell , class euclidom >
void chomp::homology::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 dimensions and then removing these cells.

Definition at line 813 of file homtools.h.

815{
816 if (Acompl. dim () <= dim)
817 return;
818 if (dim < 0)
819 dim = 0;
820 sout << "Adding to " << name << " boundaries of high-dim " <<
821 cell::pluralname () << "... ";
822 int_t howmany = 0;
823 for (int i = Acompl. dim (); i > dim; -- i)
824 {
825 sout << '.';
826 howmany += Acompl. addboundaries (i);
827 Acompl. removeall (i);
828 }
829 sout << ' ' << howmany << " added.\n";
830 return;
831} /* decreasedimension */

References addboundaries(), and sout.

Referenced by chomp::homology::gcomplex< cell, euclidom >::collapse(), Homology(), Homology2l(), chomp::homology::gcomplex< cell, euclidom >::remove(), and chomp::homology::gcomplex< cell, euclidom >::removeall().

◆ enhance()

template<class coordtype >
void chomp::homology::enhance ( tPointset< coordtype > &  p)

Enhances the set of points by adding to it all the neighbors of all the points in the set.

Definition at line 1984 of file pointset.h.

1985{
1986 int_t size = p. size ();
1987 for (int_t i = 0; i < size; ++ i)
1988 enhancepoint (p, p [i]);
1989
1990 return;
1991} /* enhance */
void enhancepoint(tPointset< coordtype > &p, int_t n)
Enhances the set by adding the neighborhood of the point with given number.
Definition: pointset.h:1976

References enhancepoint().

◆ enhancepoint() [1/2]

template<class coordtype >
void chomp::homology::enhancepoint ( tPointset< coordtype > &  p,
coordtype *  c 
)

Enhances the set by adding the neighborhood of the point with given coordinates.

Definition at line 1965 of file pointset.h.

1966{
1967 tNeighbors<coordtype> neigh (c, p. dimension ());
1968
1969 while ((c = neigh. get ()) != NULL)
1970 p. add (c);
1971
1972 return;
1973} /* enhancepoint */

Referenced by enhance(), and enhancepoint().

◆ enhancepoint() [2/2]

template<class coordtype >
void chomp::homology::enhancepoint ( tPointset< coordtype > &  p,
int_t  n 
)

Enhances the set by adding the neighborhood of the point with given number.

Definition at line 1976 of file pointset.h.

1977{
1978 enhancepoint (p, p [n]);
1979
1980 return;
1981} /* enhancepoint */

References enhancepoint().

◆ ExitSetM()

template<class TSetOfCubes , class TMap >
int chomp::homology::ExitSetM ( const TSetOfCubes &  N,
const TSetOfCubes &  Q1,
const TMap &  F,
TSetOfCubes &  resultQ2 
)

Computes iteratively Q2 := (F (Q1 + Q2) - Q1) * N.

Definition at line 328 of file indxpalg.h.

330{
331 // compute Q2 := (F (Q1 \cup Q2) \setminus Q1) \cap N
332 int_t countQ1 = Q1. size ();
333 int_t n = 0;
334
335 // for all the cubes in Q1 and Q2
336 while (n < countQ1 + resultQ2. size ())
337 {
338 // compute the image of the cube
339 const TSetOfCubes &img =
340 F ((n < countQ1) ? Q1 [n] : resultQ2 [n - countQ1]);
341
342 // add those image cubes to Q2 which are in N \setminus Q1
343 int_t countImg = img. size ();
344 for (int_t i = 0; i < countImg; ++ i)
345 {
346 if (!N. check (img [i]))
347 continue;
348 if (Q1. check (img [i]))
349 continue;
350 resultQ2. add (img [i]);
351 }
352 ++ n;
353 }
354 return 0;
355} /* ExitSetM */

Referenced by IndexPairM().

◆ expandAinX() [1/2]

template<class cubsettype >
void chomp::homology::expandAinX ( cubsettype &  Xcubes,
cubsettype &  Acubes,
const char *  Xname,
const char *  Aname 
)

Expands the other element of the pair into the main portion of the set.

Definition at line 580 of file homtools.h.

582{
583 if (Xcubes. empty () || Acubes. empty ())
584 return;
585 sout << "Expanding " << Aname << " in " << Xname << "... ";
586 int_t count = cubexpand (Xcubes, Acubes);
587 sout << count << " cubes moved to " << Aname << ", " <<
588 Xcubes. size () << " left in " << Xname << "\\" << Aname <<
589 ".\n";
590 return;
591} /* expandAinX */
int_t cubexpand(hashedset< tCube > &cset, hashedset< tCube > &other, const tVerify &verify, bool quiet=false)
Expands the set 'other' towards 'cset' without changing the homology of (cset + other,...
Definition: cubired0.h:239

References cubexpand(), and sout.

Referenced by Homology(), and Homology2l().

◆ expandAinX() [2/2]

template<class cubsettype , class maptype >
void chomp::homology::expandAinX ( cubsettype &  Xcubes,
cubsettype &  Acubes,
cubsettype &  Ycubes,
cubsettype &  Bcubes,
const maptype &  Fcubmap,
const char *  Xname,
const char *  Aname,
const char *  Bname,
bool  indexmap,
bool  checkacyclic 
)

Expands the other element of the pair into the main portion of the set.

Definition at line 595 of file homtools.h.

599{
600 if (Xcubes. empty () || Acubes. empty ())
601 return;
602 sout << "Expanding " << Aname << " in " << Xname << "... ";
603 int_t prevB = Bcubes. size ();
604 int_t prevY = Ycubes. size ();
605 int_t count = cubexpand (Xcubes, Acubes, Ycubes, Bcubes,
606 Fcubmap, indexmap, checkacyclic);
607 sout << count << " moved to " << Aname << ", " << Xcubes. size () <<
608 " left in " << Xname << "\\" << Aname << ", " <<
609 (Bcubes. size () - prevB) << " added to " << Bname << ".\n";
610 if (prevY - Ycubes. size () != Bcubes. size () - prevB)
611 sout << "WARNING: The image of " << Xname << "\\" << Aname <<
612 " was not contained in Y. "
613 "The result can be wrong!\n";
614 return;
615} /* expandAinX */

References cubexpand(), and sout.

◆ ExtractGenerators()

template<class euclidom >
chain< euclidom > ** chomp::homology::ExtractGenerators ( const chaincomplex< euclidom > &  cx,
chain< euclidom > *  hom,
int  maxlevel 
)

Extracts homology generators from a chain complex in the simple form.

Returns a pointer to an allocated table of tables of chains each of which defines one generator of the homology module at the specified level. Returns the zero pointer in case of error or if the homology is trivial.

Definition at line 339 of file homology.h.

343{
344 // if the maximal level is negative, then there is nothing to do
345 if (maxlevel < 0)
346 return 0;
347
348 // create a table of tables of chains
349 chain<euclidom> **gen = new chain<euclidom> * [maxlevel + 1];
350
351 // extract generators for each homology level separately
352 for (int q = 0; q <= maxlevel; ++ q)
353 {
354 // create a table of chains to hold the generators
355 gen [q] = (hom [q]. size ()) ?
356 new chain<euclidom> [hom [q]. size ()] : 0;
357
358 // copy the corresponding chain from internal data of 'cx'
359 for (int i = 0; i < hom [q]. size (); ++ i)
360 {
361 gen [q] [i] =
362 cx. gethomgen (q, hom [q]. num (i));
363 }
364 }
365
366 return gen;
367} /* ExtractGenerators */

Referenced by Homology(), and Homology2l().

◆ fileerror()

void chomp::homology::fileerror ( const char *  filename,
const char *  what = "open" 
)
inline

Throws a message about the inability to do something with a file.

By default this is a problem with opening the file, but another name of this action may be provided.

Definition at line 532 of file textfile.h.

533{
534 ERRORMSG << "Cannot " << what << " the file '" <<
535 filename << "'." << THROW
536 return;
537} /* fileerror */
#define ERRORMSG
The first macro in a pair of macrodefinitions for throwing an error message.
Definition: textfile.h:521
#define THROW
The second macro in a pair of macrodefinitions for throwing an error message.
Definition: textfile.h:525

References ERRORMSG, and THROW.

Referenced by ReadBitmapFile(), readmapdomain(), readmapimage(), readmaprestriction(), readtheset(), savetheset(), and scancubes().

◆ findboundarypoint() [1/2]

template<class coordtype >
int_t chomp::homology::findboundarypoint ( tPointset< coordtype > &  p,
int_t  n,
int  direction = 1 
)

Finds a boundary point starting at the given one.

Call with n = 0 to find the first boundary point. Direction: 1 - in ascending order, -1 - in descending order. Returns -1 if not found.

Definition at line 1858 of file pointset.h.

1859{
1860 if (direction >= 0)
1861 {
1862 if (n >= p. size ())
1863 return -1;
1864 if (n < 0)
1865 n = 0;
1866 int_t size = p. size ();
1867 while (n < size)
1868 {
1869 if (attheborder (p, p [n]))
1870 return n;
1871 else
1872 ++ n;
1873 }
1874 return -1;
1875 }
1876 else
1877 {
1878 if (n < 0)
1879 return -1;
1880 if (n >= p. size ())
1881 n = p. size () - 1;
1882 while (n >= 0)
1883 {
1884 if (attheborder (p, p [n]))
1885 return n;
1886 else
1887 -- n;
1888 }
1889 return -1;
1890 }
1891} /* findboundarypoint */

References attheborder().

◆ findboundarypoint() [2/2]

template<class coordtype >
int_t chomp::homology::findboundarypoint ( tPointset< coordtype > &  p,
tPointset< coordtype > &  q,
int_t  n,
int  direction = 1 
)

Finds a point in 'p' at the boundary of the union of 'p' and 'q'.

Definition at line 1894 of file pointset.h.

1896{
1897 if (direction >= 0)
1898 {
1899 if (n >= p. size ())
1900 return -1;
1901 if (n < 0)
1902 n = 0;
1903 while (n < p. size ())
1904 {
1905 if (countneighbors (p, q, p [n], OUTSIDE, 1))
1906 return n;
1907 else
1908 ++ n;
1909 }
1910 return -1;
1911 }
1912 else
1913 {
1914 if (n < 0)
1915 return -1;
1916 if (n >= p. size ())
1917 n = p. size () - 1;
1918 while (n >= 0)
1919 {
1920 if (countneighbors (p, q, p [n], OUTSIDE, 1))
1921 return n;
1922 else
1923 -- n;
1924 }
1925 return -1;
1926 }
1927} /* findboundarypoint */

References countneighbors(), and OUTSIDE.

◆ findelem()

template<class element >
int_t chomp::homology::findelem ( const multitable< element > &  tab,
const element &  e,
int_t  len 
)

Finds the given element in the table of given length.

Return its index or -1 if not found.

Definition at line 705 of file gcomplex.h.

706{
707 if (len <= 0)
708 return -1;
709
710 // prepare a random search starting point and step increase
711 int_t i = static_cast<int_t> (std::rand ()) % len;
712 if (i < 0)
713 i = static_cast<int_t> (1) - i;
714 int_t step = static_cast<int_t> (std::rand () + 17) % len;
715 if (step < 0)
716 step = static_cast<int_t> (1) - step;
717 if (step < 17)
718 step = 17;
719 if (step > len)
720 step = len >> 1;
721 if (step < 1)
722 step = 1;
723
724 // jump randomly in the table to find some element if possible
725 int_t jumping = len >> 1;
726 while (jumping --)
727 {
728 // if ((i < 0) || (i >= len))
729 // throw "Wrong random number.";
730 if (tab (i) == e)
731 return i;
732 // if ((i + 1 < len) && (tab (i + 1) == e))
733 // return i + 1;
734 if (jumping)
735 {
736 i += step;
737 if (i >= len)
738 i -= len;
739 }
740 }
741
742 // if not found, try finding the element thoroughly
743 for (int_t i = 0; i < len; ++ i)
744 {
745 if (tab (i) == e)
746 return i;
747 }
748 return -1;
749} /* findelem */

Referenced by chomp::homology::gcomplex< cell, euclidom >::collapse().

◆ getmaxneighbors()

int_t chomp::homology::getmaxneighbors ( int  dim)
inline

Returns the maximal number of neighbors of a cube: 3^dim - 1.

Definition at line 60 of file neighbor.h.

61{
62 if (dim < 0)
63 return 0;
64 const int maxdim = 17;
65 const int neighbors [maxdim] = {0, 2, 8, 26, 80, 242, 728,
66 2186, 6560, 19682, 59048, 177146, 531440, 1594322,
67 4782968, 14348906, 43046720};
68 if (dim < maxdim)
69 return neighbors [dim];
70 int_t ncount = neighbors [maxdim - 1] + 1;
71 for (int i = maxdim - 1; i < dim; ++ i)
72 ncount *= 3;
73 return (ncount - 1);
74} /* getmaxneighbors */

Referenced by acyclic(), addneighbors(), chomp::homology::reduction0::cubexpand(), chomp::homology::reduction1::cubexpand(), chomp::homology::reduction0::cubreducequiet(), chomp::homology::reduction1::cubreducequiet(), getneighbors(), getneighbors_generate(), and remainsacyclic().

◆ getneighbors() [1/2]

template<class tCube , class tCubeSet >
int_t chomp::homology::getneighbors ( const tCube &  q,
BitField bits,
const tCubeSet &  theset,
int_t  limit 
)

Gets neighbors of the given cube from the given set and indicates them in the bit field provided.

Returns the number of neighbors. If the limit is nonzero then quits after having found that many neighbors.

Definition at line 326 of file neighbor.h.

328{
330 return getneighbors (q, bits, theset, none, limit);
331} /* getneighbors */
int_t getneighbors(const tCube &q, BitField *bits, const tCubeSet &theset, int_t limit)
Gets neighbors of the given cube from the given set and indicates them in the bit field provided.
Definition: neighbor.h:326

References getneighbors().

◆ getneighbors() [2/2]

template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t chomp::homology::getneighbors ( const tCube &  q,
BitField bits,
const tCubeSet1 &  theset,
tCubeSet2 *  neighbors,
int_t  limit 
)

Gets neighbors of the given cube from the given set and indicates them in the bit field provided.

Returns the number of neighbors. If the limit is nonzero then quits after having found that many neighbors.

Definition at line 302 of file neighbor.h.

304{
305 // if the answer is trivial, return it
306 if (theset. empty ())
307 return 0;
308
309 // if the set is small
310 if (theset. size () < getmaxneighbors (q. dim ()))
311 {
312 return getneighbors_scan (q, bits, theset, neighbors, limit);
313 }
314 else
315 {
316 return getneighbors_generate (q, bits, theset, neighbors,
317 limit);
318 }
319} /* getneighbors */
int_t getneighbors_scan(const tCube &q, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
Gets neighbors of the given cube from the given set and indicates them in the bit field provided.
Definition: neighbor.h:211
int_t getneighbors_generate(const tCube &q, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
Gets neighbors of the given cube from the given set and indicates them in the bit field provided.
Definition: neighbor.h:255

References getmaxneighbors(), getneighbors_generate(), and getneighbors_scan().

Referenced by acyclic(), acyclic_rel(), chomp::homology::reduction1::addcubeneighbors(), chomp::homology::reduction1::cubexpand(), getneighbors(), remainsacyclic(), restrictAtoneighbors(), and chomp::homology::tCube2l< tCube >::setlayers().

◆ getneighbors_generate() [1/2]

template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t chomp::homology::getneighbors_generate ( const tCube &  q,
BitField bits,
const tCubeSet1 &  theset,
tCubeSet2 *  neighbors,
int_t  limit 
)

Gets neighbors of the given cube from the given set and indicates them in the bit field provided.

Returns the number of neighbors. If the limit is nonzero then quits after having found that many neighbors. Generates all the possible neighbors.

Definition at line 255 of file neighbor.h.

257{
258 // determine the upper bound for the number of neighbors
259 int_t maxneighbors = getmaxneighbors (q. dim ());
260
261 // prepare a counter for the number of neighbors
262 int_t count = 0;
263
264 // go through all possible neighbor numbers
265 for (int_t number = 0; number < maxneighbors; ++ number)
266 {
267 // create a neighbor cube
268 tCube neighbor = bit2neighbor (q, number);
269
270 // if the neighbor doesn't exist, ignore it
271 if (neighbor == q)
272 continue;
273
274 // if this cube is not in the set, ignore it
275 if (!theset. check (neighbor))
276 continue;
277
278 // set the appropriate bit in the bit field
279 if (bits)
280 bits -> set (number);
281
282 // add the cube to the set of neighbors
283 if (neighbors)
284 neighbors -> add (neighbor);
285
286 // increase the counter
287 ++ count;
288
289 // if this is enough then finish
290 if (limit && (count >= limit))
291 return count;
292 }
293
294 return count;
295} /* getneighbors_generate */

References bit2neighbor(), and getmaxneighbors().

Referenced by getneighbors().

◆ getneighbors_generate() [2/2]

template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t chomp::homology::getneighbors_generate ( const tCube2l< tCube > &  q2l,
BitField bits,
const tCubeSet1 &  theset,
tCubeSet2 *  neighbors,
int_t  limit 
)

Specialization of the function which gets neighbors of the given cube by generating all the possible neighbors and checking if they are present in the given set.

Definition at line 1070 of file twolayer.h.

1072{
1073 // decompose the cube into its components
1074 const tCube &q0 = q2l. cube ();
1075 typename tCube2l<tCube>::LayerType l0 (q2l. layer ());
1076
1077 // determine the upper bound for the number of neighbors
1078 int_t maxneighbors = getmaxneighbors (q0. dim ());
1079
1080 // determine the set of cubes at layer 0
1081 const hashedset<tCube> &layer0 = tCube2l<tCube>::layer0 ();
1082
1083 // determine the set of cubes at layer 1
1084 const hashedset<tCube> &layer1 = tCube2l<tCube>::layer1 ();
1085
1086 // prepare a counter for the number of neighbors
1087 int_t count = 0;
1088
1089 // go through all possible neighbor numbers
1090 for (int_t number = 0; number < maxneighbors; ++ number)
1091 {
1092 // create a neighbor cube using the generic algorithm
1093 tCube q1 = bit2neighbor (q0, number, true);
1094
1095 // determine the layer of the neighbor
1096 int l1 = layer1. check (q1) ? 1 : 0;
1097
1098 // create the neighbor cube
1099 tCube2l<tCube> q1l (q1, l1);
1100
1101 // if this cube is not in the set then skip it
1102 if (!theset. check (q1l))
1103 continue;
1104
1105 // if the cubes fully intersect then this is easy
1106 if ((l0 == l1) ||
1107 ((l0 == 0) && (l1 == 1) && (layer0. check (q0))) ||
1108 ((l0 == 1) && (l1 == 0) && (layer0. check (q1))))
1109 {
1110 // set the appropriate bit in the bit field
1111 if (bits)
1112 bits -> set (number);
1113 }
1114 // otherwise the correct intersection of the cubes
1115 // must be determined at the boundary between the layers
1116 else if (!intersection2l (q0, q1, bits))
1117 continue;
1118
1119 // add the cube to the set of neighbors
1120 if (neighbors)
1121 neighbors -> add (q1l);
1122
1123 // increase the counter
1124 ++ count;
1125
1126 // if this is enough then finish
1127 if (limit && (count >= limit))
1128 return count;
1129 }
1130
1131 return count;
1132} /* getneighbors_generate */
A (hyper)cube with additional information about the layer number.
Definition: twolayer.h:80
tCube2l< tCube > bit2neighbor(const tCube2l< tCube > &q, int_t number, bool unconditional=false)
Specialization of the "bit2neighbor" function for two-layer cubes.
Definition: twolayer.h:945
Cube cube
A lower-case name of a cube [deprecated].
Definition: cube.h:77
bool intersection2l(const tCube &q0, const tCube &q1, BitField *bits)
Computes the intersection between two cubes at different layers.
Definition: twolayer.h:968

References bit2neighbor(), getmaxneighbors(), intersection2l(), chomp::homology::tCube2l< tCube >::layer0(), and chomp::homology::tCube2l< tCube >::layer1().

◆ getneighbors_scan() [1/2]

template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t chomp::homology::getneighbors_scan ( const tCube &  q,
BitField bits,
const tCubeSet1 &  theset,
tCubeSet2 *  neighbors,
int_t  limit 
)

Gets neighbors of the given cube from the given set and indicates them in the bit field provided.

Returns the number of neighbors. If the limit is nonzero then quits after having found that many neighbors. Scans through the entire set of cubes.

Definition at line 211 of file neighbor.h.

213{
214 // prepare a counter for the number of neighbors
215 int_t count = 0;
216
217 // go through all the elements in the set
218 for (int_t i = 0; i < theset. size (); ++ i)
219 {
220 // if this is the current cube, ignore it
221 if (theset [i] == q)
222 continue;
223
224 // determine the number of this neighbor
225 int_t number = neighbor2bit (q, theset [i]);
226
227 // if not neighbor, ignore it
228 if (number < 0)
229 continue;
230
231 // set the corresponding bit in the bit field
232 if (bits)
233 bits -> set (number);
234
235 // add the cube to the set of neighbors
236 if (neighbors)
237 neighbors -> add (theset [i]);
238
239 // increase the counter
240 ++ count;
241
242 // if this is enough then finish
243 if (limit && (count >= limit))
244 return count;
245 }
246
247 return count;
248} /* getneighbors_scan */
int_t neighbor2bit(const tCube &q, const typename tCube::CellType &face)
Returns the number of the neighbor bit for the neighbor which intersects the given cube at the face p...
Definition: neighbor.h:129

References neighbor2bit().

Referenced by getneighbors().

◆ getneighbors_scan() [2/2]

template<class tCube , class tCubeSet1 , class tCubeSet2 >
int_t chomp::homology::getneighbors_scan ( const tCube2l< tCube > &  q2l,
BitField bits,
const tCubeSet1 &  theset,
tCubeSet2 *  neighbors,
int_t  limit 
)

Specialization of the function which gets neighbors of the given cube by scanning the entire set of possible neighbors.

Definition at line 1003 of file twolayer.h.

1005{
1006 // decompose the cube into its components
1007 const tCube &q0 = q2l. cube ();
1008 typename tCube2l<tCube>::LayerType l0 (q2l. layer ());
1009
1010 // determine the set of cubes at layer 0
1011 const hashedset<tCube> &layer0 = tCube2l<tCube>::layer0 ();
1012
1013 // prepare a counter for the number of neighbors
1014 int_t count = 0;
1015
1016 // go through all the elements in the set
1017 for (int_t i = 0; i < theset. size (); ++ i)
1018 {
1019 // take the cube from the set
1020 const tCube2l<tCube> &q1l = theset [i];
1021
1022 // if this is the current cube then ignore it
1023 if (q1l == q2l)
1024 continue;
1025
1026 // decompose the cube into its components
1027 const tCube &q1 = q1l. cube ();
1028 typename tCube2l<tCube>::LayerType l1 (q1l. layer ());
1029
1030 // determine the number of this neighbor
1031 int_t number = neighbor2bit (q0, q1);
1032
1033 // if not neighbor then ignore it
1034 if (number < 0)
1035 continue;
1036
1037 // if the cubes fully intersect then this is easy
1038 if ((l0 == l1) ||
1039 ((l0 == 0) && (l1 == 1) && (layer0. check (q0))) ||
1040 ((l0 == 1) && (l1 == 0) && (layer0. check (q1))))
1041 {
1042 // set the appropriate bit in the bit field
1043 if (bits)
1044 bits -> set (number);
1045 }
1046 // otherwise the correct intersection of the cubes
1047 // must be determined at the boundary between the layers
1048 else if (!intersection2l (q0, q1, bits))
1049 continue;
1050
1051 // add the cube to the set of neighbors
1052 if (neighbors)
1053 neighbors -> add (q1l);
1054
1055 // increase the counter
1056 ++ count;
1057
1058 // if this is enough then finish
1059 if (limit && (count >= limit))
1060 return count;
1061 }
1062
1063 return count;
1064} /* getneighbors_scan */
int_t neighbor2bit(const tCube2l< tCube > &q, const tCube2l< tCube > &neighbor)
Specialization of the "neighbor2bit" function for two-layer cubes.
Definition: twolayer.h:956

References intersection2l(), chomp::homology::tCube2l< tCube >::layer0(), and neighbor2bit().

◆ graph2matrix()

template<class wType , class matrix >
void chomp::homology::graph2matrix ( const diGraph< wType > &  g,
matrix &  m 
)
inline

Creates the adjacency matrix of the given graph.

m [i] [j] is set to 1 if the graph g contains the edge i -> j, using the assignment operator.

Definition at line 4318 of file digraph.h.

4319{
4320 int_t nVert = g. countVertices ();
4321 for (int_t v = 0; v < nVert; ++ v)
4322 {
4323 int_t nEdges = g. countEdges (v);
4324 for (int_t e = 0; e < nEdges; ++ e)
4325 {
4326 int_t w = g. getEdge (v, e);
4327 m [v] [w] = 1;
4328 }
4329 }
4330 return;
4331} /* graph2matrix */

Referenced by transitiveReduction().

◆ hashkey1() [1/11]

template<class Number >
int_t chomp::homology::hashkey1 ( const hashNumber< Number > &  n)
inline

The first hashing key.

Definition at line 1029 of file bincube.h.

1030{
1031 return static_cast<int_t> (static_cast<Number> (n));
1032} /* hashkey1 */

Referenced by chomp::homology::hashedset< element, hashkeys >::hashfind(), chomp::homology::tCube2l< tCube >::hashkey1(), chomp::homology::tCell2l< tCell >::hashkey1(), chomp::homology::HashingGlobal< element >::hashkey1(), and hashkey1().

◆ hashkey1() [2/11]

int_t chomp::homology::hashkey1 ( const Simplex s)
inline

Definition at line 271 of file simplex.h.

272{
273 return s. hashkey1 ();
274} /* hashkey1 */
int_t hashkey1(const Simplex &s)
Definition: simplex.h:271

References hashkey1().

◆ hashkey1() [3/11]

template<class tCell >
int_t chomp::homology::hashkey1 ( const tCell2l< tCell > &  c)
inline

Definition at line 740 of file twolayer.h.

741{
742 return c. hashkey1 ();
743} /* hashkey1 */
int_t hashkey1(const tCell2l< tCell > &c)
Definition: twolayer.h:740

References hashkey1().

◆ hashkey1() [4/11]

template<class coordtype >
int_t chomp::homology::hashkey1 ( const tCellBase< coordtype > &  c)
inline

Definition at line 393 of file cellbase.h.

394{
395 return c. hashkey1 ();
396} /* hashkey1 */
int_t hashkey1(const tCellBase< coordtype > &c)
Definition: cellbase.h:393

References hashkey1().

◆ hashkey1() [5/11]

template<int dimfix, class coordtype >
int_t chomp::homology::hashkey1 ( const tCellFix< dimfix, coordtype > &  c)
inline

Definition at line 400 of file cellfix.h.

401{
402 return c. hashkey1 ();
403} /* hashkey1 */
int_t hashkey1(const tCellFix< dimfix, coordtype > &c)
Definition: cellfix.h:400

References hashkey1().

◆ hashkey1() [6/11]

template<class coordtype >
int_t chomp::homology::hashkey1 ( const tCellVar< coordtype > &  c)
inline

Definition at line 350 of file cellvar.h.

351{
352 return c. hashkey1 ();
353} /* hashkey1 */
int_t hashkey1(const tCellVar< coordtype > &c)
Definition: cellvar.h:350

References hashkey1().

◆ hashkey1() [7/11]

template<class tCube >
int_t chomp::homology::hashkey1 ( const tCube2l< tCube > &  c)
inline

Definition at line 270 of file twolayer.h.

271{
272 return c. hashkey1 ();
273} /* hashkey1 */

References hashkey1().

◆ hashkey1() [8/11]

template<class coordtype >
int_t chomp::homology::hashkey1 ( const tCubeBase< coordtype > &  c)
inline

Definition at line 236 of file cubebase.h.

237{
238 return c. hashkey1 ();
239} /* hashkey1 */
int_t hashkey1(const tCubeBase< coordtype > &c)
Definition: cubebase.h:236

References hashkey1().

◆ hashkey1() [9/11]

template<int dimfix, class coordtype >
int_t chomp::homology::hashkey1 ( const tCubeFix< dimfix, coordtype > &  c)
inline

Definition at line 221 of file cubefix.h.

222{
223 return c. hashkey1 ();
224} /* hashkey1 */
int_t hashkey1(const tCubeFix< dimfix, coordtype > &c)
Definition: cubefix.h:221

References hashkey1().

◆ hashkey1() [10/11]

template<class coordtype >
int_t chomp::homology::hashkey1 ( const tCubeVar< coordtype > &  c)
inline

Definition at line 280 of file cubevar.h.

281{
282 return c. hashkey1 ();
283} /* hashkey1 */
int_t hashkey1(const tCubeVar< coordtype > &c)
Definition: cubevar.h:280

References hashkey1().

◆ hashkey1() [11/11]

int_t chomp::homology::hashkey1 ( const word w)
inline

Definition at line 232 of file words.h.

233{
234 int len = w. length ();
235 if (!len)
236 return 13;
237 const char *txt = w. text ();
238 int_t code = (static_cast<int_t> (txt [0]) << 7) ^
239 (static_cast<int_t> (txt [len - 1]));
240 if (len > 3)
241 code ^= static_cast<int_t> (txt [2]) << 15;
242 return code;
243} /* word::hashkey1 */

◆ hashkey2() [1/11]

template<class Number >
int_t chomp::homology::hashkey2 ( const hashNumber< Number > &  n)
inline

The second hashing key.

Definition at line 1036 of file bincube.h.

1037{
1038 return static_cast<int_t> (static_cast<Number> (n) ^
1039 0xFA5A75A7ul) << 5;
1040} /* hashkey2 */

Referenced by chomp::homology::hashedset< element, hashkeys >::hashfind(), chomp::homology::tCube2l< tCube >::hashkey2(), chomp::homology::tCell2l< tCell >::hashkey2(), chomp::homology::HashingGlobal< element >::hashkey2(), and hashkey2().

◆ hashkey2() [2/11]

int_t chomp::homology::hashkey2 ( const Simplex s)
inline

Definition at line 301 of file simplex.h.

302{
303 return s. hashkey2 ();
304} /* hashkey2 */
int_t hashkey2(const Simplex &s)
Definition: simplex.h:301

References hashkey2().

◆ hashkey2() [3/11]

template<class tCell >
int_t chomp::homology::hashkey2 ( const tCell2l< tCell > &  c)
inline

Definition at line 752 of file twolayer.h.

753{
754 return c. hashkey2 ();
755} /* hashkey2 */
int_t hashkey2(const tCell2l< tCell > &c)
Definition: twolayer.h:752

References hashkey2().

◆ hashkey2() [4/11]

template<class coordtype >
int_t chomp::homology::hashkey2 ( const tCellBase< coordtype > &  c)
inline

Definition at line 406 of file cellbase.h.

407{
408 return c. hashkey2 ();
409} /* hashkey2 */
int_t hashkey2(const tCellBase< coordtype > &c)
Definition: cellbase.h:406

References hashkey2().

◆ hashkey2() [5/11]

template<int dimfix, class coordtype >
int_t chomp::homology::hashkey2 ( const tCellFix< dimfix, coordtype > &  c)
inline

Definition at line 424 of file cellfix.h.

425{
426 return c. hashkey2 ();
427} /* hashkey2 */
int_t hashkey2(const tCellFix< dimfix, coordtype > &c)
Definition: cellfix.h:424

References hashkey2().

◆ hashkey2() [6/11]

template<class coordtype >
int_t chomp::homology::hashkey2 ( const tCellVar< coordtype > &  c)
inline

Definition at line 377 of file cellvar.h.

378{
379 return c. hashkey2 ();
380} /* hashkey2 */
int_t hashkey2(const tCellVar< coordtype > &c)
Definition: cellvar.h:377

References hashkey2().

◆ hashkey2() [7/11]

template<class tCube >
int_t chomp::homology::hashkey2 ( const tCube2l< tCube > &  c)
inline

Definition at line 282 of file twolayer.h.

283{
284 return c. hashkey2 ();
285} /* hashkey2 */

References hashkey2().

◆ hashkey2() [8/11]

template<class coordtype >
int_t chomp::homology::hashkey2 ( const tCubeBase< coordtype > &  c)
inline

Definition at line 250 of file cubebase.h.

251{
252 return c. hashkey2 ();
253} /* hashkey2 */
int_t hashkey2(const tCubeBase< coordtype > &c)
Definition: cubebase.h:250

References hashkey2().

◆ hashkey2() [9/11]

template<int dimfix, class coordtype >
int_t chomp::homology::hashkey2 ( const tCubeFix< dimfix, coordtype > &  c)
inline

Definition at line 244 of file cubefix.h.

245{
246 return c. hashkey2 ();
247} /* hashkey2 */
int_t hashkey2(const tCubeFix< dimfix, coordtype > &c)
Definition: cubefix.h:244

References hashkey2().

◆ hashkey2() [10/11]

template<class coordtype >
int_t chomp::homology::hashkey2 ( const tCubeVar< coordtype > &  c)
inline

Definition at line 306 of file cubevar.h.

307{
308 return c. hashkey2 ();
309} /* hashkey2 */
int_t hashkey2(const tCubeVar< coordtype > &c)
Definition: cubevar.h:306

References hashkey2().

◆ hashkey2() [11/11]

int_t chomp::homology::hashkey2 ( const word w)
inline

Definition at line 245 of file words.h.

246{
247 int len = w. length ();
248 if (!len)
249 return 7;
250 const char *txt = w. text ();
251 int_t code = (static_cast<int_t> (txt [0])) ^
252 (static_cast<int_t> (txt [len - 1] << 17));
253 if (len > 4)
254 code ^= static_cast<int_t> (txt [3]) << 8;
255 return code;
256} /* word::hashkey2 */

◆ Homology() [1/9]

template<class euclidom >
int chomp::homology::Homology ( chaincomplex< euclidom > &  cx,
const char *  Xname,
chain< euclidom > *&  hom 
)

Transforms the chain complex into a simple form and compute its homology.

The changes of bases are reflected in all the chain maps whose domain or codomain this chain complex is. If the generators of the chain complex are to be retrieved, the input chain complex must be created with a suitable option, and the function ExtractGenerators can be used to extract them. The table 'hom' is allocated or set to 0 in case of trivial homology. Returns the number of the highest nontrivial homology level or -1 if none.

Definition at line 379 of file homology.h.

383{
384 // initialize the empty table
385 hom = 0;
386
387 // determine the dimension of the chain complex
388 int Xdim = cx. dim ();
389 if (Xdim < 0)
390 return -1;
391
392 // compute the homology of the chain complex of X
393 sout << "Computing the homology of " << Xname << " over " <<
394 euclidom::ringname () << "...\n";
395 cx. simple_form ((int *) 0, false);
396 cx. simple_homology (hom);
397
398 // determine the highest non-trivial homology level
399 int maxlevel = Xdim;
400 while ((maxlevel >= 0) && (hom [maxlevel]. size () <= 0))
401 -- maxlevel;
402
403 // if the homology is trivial, delete the allocated table (if any)
404 if (hom && (maxlevel < 0))
405 {
406 delete [] hom;
407 hom = 0;
408 }
409
410 return maxlevel;
411} /* Homology */

References sout.

Referenced by ComputeBettiNumbers(), Homology(), and Homology2l().

◆ Homology() [2/9]

template<class cell , class euclidom >
int chomp::homology::Homology ( gcomplex< cell, euclidom > &  Xcompl,
const char *  Xname,
chain< euclidom > *&  hom,
chain< euclidom > ***  gen = 0 
)

Computes the homology of a given cubical complex.

All the boundary cells must be present (use the function for pairs with an empty set A or "X. addboundaries ()" to add boundaries if necessary), because missing cells give rise to missing generators of the corresponding chain complex which indicates a relative cubical complex. Destroy the contents of X before running the algebraic computations. If 'gen' is given, the contents of X is not destroyed, and *gen is set to point to a newly allocated table of tables of chains each of which defines one generator of the homology module at a specified level. Returns the number of the highest nontrivial homology level or -1 if none.

Definition at line 425 of file homology.h.

429{
430 // initialize the empty table
431 hom = 0;
432
433 // determine the dimension of the cubical complex
434 int Xdim = Xcompl. dim ();
435 if (Xdim < 0)
436 return -1;
437
438 // create a chain complex from the cubical complex X without adding
439 // boundaries, as this might be a relative complex with A removed
440 chaincomplex<euclidom> cx (Xdim, !!gen);
441 sout << "Creating the chain complex of " << Xname << "... ";
442 createchaincomplex (cx, Xcompl);
443 sout << "Done.\n";
444
445 // forget the geometric cubical complex to release memory
446 if (!gen)
447 {
449 Xcompl = empty;
450 }
451
452 // compute the homology of this chain complex
453 int maxlevel = Homology (cx, Xname, hom);
454
455 // extract the generators of homology ('cx' will be lost on 'return')
456 if (gen)
457 *gen = ExtractGenerators (cx, hom, maxlevel);
458
459 return maxlevel;
460} /* Homology */
chain< euclidom > ** ExtractGenerators(const chaincomplex< euclidom > &cx, chain< euclidom > *hom, int maxlevel)
Extracts homology generators from a chain complex in the simple form.
Definition: homology.h:339
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.
Definition: gcomplex.h:1128

References createchaincomplex(), ExtractGenerators(), Homology(), and sout.

◆ Homology() [3/9]

template<class cell , class euclidom >
int chomp::homology::Homology ( gcomplex< cell, euclidom > &  Xcompl,
const char *  Xname,
gcomplex< cell, euclidom > &  Acompl,
const char *  Aname,
chain< euclidom > *&  hom,
chain< euclidom > ***  gen = 0 
)

Computes the relative homology of the given pair of cubical complexes.

Begins with adding boundaries to the cells in A and in X while removing from X all the cells that appear in A to make X a relative cell complex. Destroys the contents of X and A before running the algebraic computations unless homology generators are to be retrieved. Note that if A is empty then all possible boundaries will be added to X. Returns the number of the highest nontrivial homology level or -1 if none.

Definition at line 544 of file homology.h.

550{
551 // initialize the empty table
552 hom = 0;
553
554 // determine the dimension of the first cubical complex
555 int Xdim = Xcompl. dim ();
556 if (Xdim < 0)
557 return -1;
558
559 // prepare the right name for the pair (to be used later)
560 word pairname;
561 if (!Acompl. empty ())
562 pairname << '(' << Xname << "," << Aname << ')';
563 else
564 pairname << Xname;
565
566 // collapse the pair of sets into a relative cubical complex
567 // and add boundaries of cells where necessary
568 collapse (Xcompl, Acompl, Xname, Aname);
569
570 // forget the remains of the other cubical complex
571 gcomplex<cell,euclidom> emptycompl;
572 Acompl = emptycompl;
573
574 // make a correction to the dimension of X
575 if (Xdim != Xcompl. dim ())
576 {
577 sout << "Note: The dimension of " << Xname <<
578 " decreased from " << Xdim << " to " <<
579 Xcompl. dim () << ".\n";
580 }
581
582 // compute the homology of the relative cubical complex
583 int maxlevel = Homology (Xcompl, pairname, hom, gen);
584
585 // release memory used by the name of the pair and exit
586 return maxlevel;
587} /* Homology */
A word, that is, a string with very few properties.
Definition: words.h:65

References collapse(), Homology(), and sout.

◆ Homology() [4/9]

template<class euclidom , class cubetype >
int chomp::homology::Homology ( hashedset< cubetype > &  Xcubes,
const char *  Xname,
chain< euclidom > *&  hom,
chain< euclidom > ***  gen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gcompl = 0 
)

Computes the homology of a given set of cubes.

The set is destroyed. If the generators are to be retrieved, the table 'gen' is allocated as in the Homology function for geometric complexes, and the pointer pointed to by 'gcompl' is set to the cubical complex arising in the computations. Returns the number of the highest nontrivial homology level or -1 if none.

Definition at line 469 of file homology.h.

474{
475 // define the type of a set of cubes
476 typedef hashedset<cubetype> cubsettype;
477
478 // define the type of a cubical cell
479 typedef typename cubetype::CellType celltype;
480
481 // initialize the empty table
482 hom = 0;
483
484 // if the set X is empty, the answer is obvious
485 if (Xcubes. empty ())
486 return -1;
487
488 // determine the dimension of X (note: X is nonempty!)
489 int Xspacedim = Xcubes [0]. dim ();
490
491 // allocate a suitable bit field set for the reduction and show msg
492 knownbits [Xspacedim];
493
494 // reduce the cubes in X
495 cubsettype emptycubes;
496 reducepair (Xcubes, emptycubes, emptycubes, Xname, 0);
497
498 // transform the set of cubes X into a set of cells and forget Xcubes
501 cubes2cells (Xcubes, *Xcompl, Xname);
502 Xcubes = emptycubes;
503
504 // collapse the set and add boundaries of cells
505 collapse (*Xcompl, Xname);
506
507 // if the complex is empty, the result is trivial
508 if (Xcompl -> empty ())
509 {
510 delete Xcompl;
511 return -1;
512 }
513
514 // make a correction to the dimension of X
515 int Xdim = Xcompl -> dim ();
516 if (Xdim != Xspacedim)
517 {
518 sout << "Note: The dimension of " << Xname <<
519 " decreased from " << Xspacedim <<
520 " to " << Xdim << ".\n";
521 }
522
523 // compute the homology of the cubical complex
524 int maxlevel = Homology (*Xcompl, Xname, hom, gen);
525
526 // deallocate the cubical complex if necessary
527 if (!gcompl)
528 delete Xcompl;
529 else
530 *gcompl = Xcompl;
531
532 return maxlevel;
533} /* Homology */
void reducepair(cubsettype &Xcubes, cubsettype &Acubes, const cubsettype &Xkeepcubes, const char *Xname, const char *Aname)
Reduces the pair of sets of cubes. Keeps the given cubes untouched.
Definition: homtools.h:619
void cubes2cells(tCubes &Xcubes, gcomplex< tCell, tCoef > &Xcompl, const char *Xname, bool deletecubes=true)
Transforms cubes to full-dimensional cells.
Definition: homtools.h:716

References collapse(), cubes2cells(), Homology(), knownbits, reducepair(), and sout.

◆ Homology() [5/9]

template<class euclidom , class cubetype >
int chomp::homology::Homology ( hashedset< cubetype > &  Xcubes,
const char *  Xname,
hashedset< cubetype > &  Acubes,
const char *  Aname,
chain< euclidom > *&  hom,
chain< euclidom > ***  gen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gcompl = 0 
)

Computes the relative homology of a given pair of sets of cubes.

Modifies the sets and then destroys them during the computations. If homology generators are to be retrieved, no expansion of A in X is performed. If the generators are to be retrieved, the table 'gen' is allocated as in the Homology function for geometric complexes, and the pointer pointed to by 'gcompl' is set to the cubical complex arising in the computations. Returns the number of the highest nontrivial homology level or -1 if none.

Definition at line 599 of file homology.h.

606{
607 // define the type of a set of cubes
608 typedef hashedset<cubetype> cubsettype;
609
610 // define the type of a cubical cell
611 typedef typename cubetype::CellType celltype;
612
613 // initialize the empty table
614 hom = 0;
615
616 // if the set A is empty, call the other procedure
617 if (Acubes. empty ())
618 return Homology (Xcubes, Xname, hom, gen, gcompl);
619
620 // remove from X cubes which are in A
621 removeAfromX (Xcubes, Acubes, Xname, Aname);
622
623 // if the set X is empty, the answer is obvious
624 if (Xcubes. empty ())
625 return -1;
626
627 // leave in A only the neighbors of X\\A
628 restrictAtoneighbors (Xcubes, Acubes, Xname, Aname);
629
630 // determine the dimension of X (note: X is nonempty!)
631 int Xspacedim = Xcubes [0]. dim ();
632
633 // allocate a suitable bit field set for the reduction and show msg
634 knownbits [Xspacedim];
635
636 // expand A within X
637 if (!gcompl)
638 expandAinX (Xcubes, Acubes, Xname, Aname);
639
640 // if everything was moved to A, then the result is trivial
641 if (Xcubes. empty ())
642 return -1;
643
644 // restrict A to neighbors
645 restrictAtoneighbors (Xcubes, Acubes, Xname, Aname);
646
647 // reduce the pair (X,A)
648 cubsettype emptycubes;
649 reducepair (Xcubes, Acubes, emptycubes, Xname, Aname);
650
651 // if nothing remains in X, then the result is trivial
652 if (Xcubes. empty ())
653 return -1;
654
655 // prepare the right name for the difference of the two sets
656 word diffname;
657 diffname << Xname << '\\' << Aname;
658
659 // transform the set of cubes X into a set of cells and forget Xcubes
662 cubes2cells (Xcubes, *Xcompl, diffname);
663 Xcubes = emptycubes;
664
665 // transform the set of cubes A into a set of cubical cells
667 cubes2cells (Acubes, Acompl, Aname);
668 Acubes = emptycubes;
669
670 // continue the homology computations
671 int maxlevel = Homology (*Xcompl, Xname, Acompl, Aname, hom, gen);
672
673 // deallocate the cubical complex if necessary
674 if (!gcompl)
675 delete Xcompl;
676 else
677 *gcompl = Xcompl;
678
679 return maxlevel;
680} /* Homology */
void expandAinX(cubsettype &Xcubes, cubsettype &Acubes, const char *Xname, const char *Aname)
Expands the other element of the pair into the main portion of the set.
Definition: homtools.h:580
void restrictAtoneighbors(const cubsettype &Xcubes, cubsettype &Acubes, const char *Xname, const char *Aname, const cubsettype *keepcubes=0)
Restricts the set of cubes 'Acubes' to these cubes which are neighbors of any of the cubes in 'Xcubes...
Definition: homtools.h:503
void removeAfromX(cubsettype &Xcubes, const cubsettype &Acubes, const char *Xname, const char *Aname)
Removes 'Acubes' from 'Xcubes' and shows messages.
Definition: homtools.h:548

References cubes2cells(), expandAinX(), Homology(), knownbits, reducepair(), removeAfromX(), and restrictAtoneighbors().

◆ Homology() [6/9]

template<class euclidom , class cubetype >
int chomp::homology::Homology ( mvmap< cubetype, cubetype > &  Fcubmap,
const char *  Fname,
hashedset< cubetype > &  Xcubes,
const char *  Xname,
hashedset< cubetype > &  Acubes,
const char *  Aname,
chain< euclidom > *&  hom,
int &  maxlevel,
chainmap< euclidom > *&  hom_f,
int  careful = 0x01,
chain< euclidom > ***  gfgen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gfcompl = 0,
chain< euclidom > ***  gygen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gycompl = 0 
)

Computes the endomorphism induced in homology by a combinatorial cubical multivalued map.

See the description of the previous function for details.

Definition at line 1308 of file homology.h.

1317{
1318 hashedset<cubetype> Ycubes = Xcubes, Bcubes = Acubes;
1319 chain<euclidom> *hom_cy = 0;
1320 int maxlevel_cy;
1321 int result = Homology (Fcubmap, Fname, Xcubes, Xname, Acubes, Aname,
1322 Ycubes, Xname, Bcubes, Aname, hom, maxlevel,
1323 hom_cy, maxlevel_cy, hom_f, true, careful,
1324 gfgen, gfcompl, gygen, gycompl);
1325 delete [] hom_cy;
1326 return result;
1327} /* Homology */

References Homology().

◆ Homology() [7/9]

template<class euclidom , class cubetype >
int chomp::homology::Homology ( mvmap< cubetype, cubetype > &  Fcubmap,
const char *  Fname,
hashedset< cubetype > &  Xcubes,
const char *  Xname,
hashedset< cubetype > &  Acubes,
const char *  Aname,
hashedset< cubetype > &  Ycubes,
const char *  Yname,
hashedset< cubetype > &  Bcubes,
const char *  Bname,
chain< euclidom > *&  hom_cx,
int &  maxlevel_cx,
chain< euclidom > *&  hom_cy,
int &  maxlevel_cy,
chainmap< euclidom > *&  hom_f,
bool  inclusion = false,
int  careful = 0x01,
chain< euclidom > ***  gfgen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gfcompl = 0,
chain< euclidom > ***  gygen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gycompl = 0 
)

Computes the homomorphism induced in homology by a combinatorial cubical multivalued map.

Deletes the contents of X, A, Y, B and F when used. Fills in the given data with the computed result. If 'inclusion' is true, then composes the result with the inverse of the homomorphism induced in homology by the inclusion (X,A) -> (Y,B). If the inclusion is not invertible, throws an error message. Note that (X,A) and (Y,B) are modified independently, so you can't just pass the same sets to this procedure; you must clone them first. Set 'careful' bits: 0x01 = basic data verification, 0x02 = preserve the map's acyclicity in reductions (this can be slow!). Displays the computed homology and homomorphisms to the screen. Returns the highest nontrivial homology level for the map or -1 if none.

Definition at line 768 of file homology.h.

781{
782 // define the type of a set of cubes
783 typedef hashedset<cubetype> cubsettype;
784
785 // define the type of a cubical cell
786 typedef typename cubetype::CellType celltype;
787
788 // define the type of a combinatorial cubical multivalued map
789 typedef mvmap<cubetype,cubetype> cubmaptype;
790
791 // transform the 'careful' bits into separate variables
792 bool verify = careful & 0x01;
793 bool checkacyclic = careful & 0x02;
794
795 // prepare the right names for X\A and Y\B
796 word XAname, YBname;
797 if (!Acubes. empty ())
798 XAname << Xname << '\\' << Aname;
799 else
800 XAname << Xname;
801 if (!Bcubes. empty ())
802 YBname << Yname << '\\' << Bname;
803 else
804 YBname << Yname;
805
806 // ----- prepare the sets of cubes -----
807
808 // if the pointers to both sets are the same, then this is an error
809 if (&Xcubes == &Ycubes)
810 throw "You must clone the sets passed to Homology.";
811
812 // remove from X cubes which are in A
813 removeAfromX (Xcubes, Acubes, Xname, Aname);
814
815 // leave in A only the neighbors of X\\A
816 restrictAtoneighbors (Xcubes, Acubes, Xname, Aname);
817
818 // remove from Y cubes which are in B
819 removeAfromX (Ycubes, Bcubes, Yname, Bname);
820
821 // if one of the main sets is empty, the answer is trivial
822 if (Xcubes. empty () || Ycubes. empty ())
823 return -1;
824
825 // remember the original size of the set A and of the set X
826 int_t origAsize = Acubes. size ();
827 int_t origXsize = Xcubes. size ();
828
829 // determine the dimension of X and Y (both sets are non-empty)
830 int Xspacedim = Xcubes [0]. dim ();
831 int Yspacedim = Ycubes [0]. dim ();
832
833 // check if F (X\A) \subset Y
834 if (verify)
835 checkimagecontained (Fcubmap, Xcubes, Ycubes, Bcubes,
836 XAname, Yname);
837
838 // check if F (A) \subset B
839 if (verify && !Acubes. empty ())
840 checkimagecontained (Fcubmap, Acubes, Bcubes, Aname, Bname);
841
842 // check if F (A) is disjoint from Y
843 if (verify && !Acubes. empty ())
844 checkimagedisjoint (Fcubmap, Acubes, Ycubes, Aname, YBname);
845
846 // verify if X\A \subset Y and A \subset B if inclusion is considered
847 if (verify && inclusion)
848 checkinclusion (Xcubes, Ycubes, Bcubes, XAname, Yname);
849 if (verify && inclusion)
850 checkinclusion (Acubes, Bcubes, Aname, Bname);
851
852 // ----- reduce the sets of cubes -----
853
854 // allocate a suitable bit field set for the reduction and show msg
855 knownbits [Xspacedim];
856 knownbits [Yspacedim];
857
858 // reduce the pair of sets of cubes (X,A) without acyclicity check
859 if (!checkacyclic)
860 {
861 // reduce the pair (X,A)
862 cubsettype empty;
863 reducepair (Xcubes, Acubes, empty, Xname, Aname);
864
865 // if nothing remains in X, then the result is trivial
866 if (Xcubes. empty ())
867 return -1;
868 }
869
870 // expand A towards X and modify (Y,B) accordingly
871 if (!Acubes. empty () && !gfgen && !gygen)
872 {
873 expandAinX (Xcubes, Acubes, Ycubes, Bcubes, Fcubmap,
874 Xname, Aname, Bname, inclusion, checkacyclic);
875 }
876
877 // reduce the pair (X,A) or the set X with acyclicity check
878 if (checkacyclic)//[???] && !Acubes. empty ())
879 {
880 // leave in A only the neighbors of X\\A
881 restrictAtoneighbors (Xcubes, Acubes, Xname, Aname);
882
883 // reduce the pair (X,A) with acyclicity check
884 cubsettype emptycubes;
885 reducepair (Xcubes, Acubes, Fcubmap, emptycubes,
886 Xname, Aname);
887
888 // if nothing remains in X, then the result is trivial
889 if (Xcubes. empty ())
890 return -1;
891 }
892
893 // reduce the pair (X,A) even further
894 if (!checkacyclic && !Acubes. empty ())
895 {
896 // leave in A only the neighbors of X\\A
897 restrictAtoneighbors (Xcubes, Acubes, Xname, Aname);
898
899 // continue the reduction of the pair (X,A)
900 cubsettype empty;
901 reducepair (Xcubes, Acubes, empty, Xname, Aname);
902 }
903
904 // indicate that the acyclicity of the map should be verified
905 if (!verify)
906 {
907 if (!checkacyclic && ((origAsize != Acubes. size ()) ||
908 (origXsize != Xcubes. size ())))
909 {
910 sout << "*** Important note: " << Xname << " or " <<
911 Aname << " changed. You must make sure\n"
912 "*** that the restriction of " << Fname <<
913 " to the new sets is acyclic.\n";
914 }
915 else
916 {
917 sout << "*** Note: The program assumes "
918 "that the input map is acyclic.\n";
919 }
920 }
921
922 // create the set of cubes to keep in Y as the image of the domain
923 // and include the domain if the inclusion is considered
924 cubsettype Ykeepcubes;
925 sout << "Computing the image of the map... ";
926 for (int_t i = 0; i < Xcubes. size (); ++ i)
927 Ykeepcubes. add (Fcubmap (Xcubes [i]));
928 for (int_t i = 0; i < Acubes. size (); ++ i)
929 Ykeepcubes. add (Fcubmap (Acubes [i]));
930 if (inclusion)
931 {
932 sout << "and of the inclusion... ";
933 Ykeepcubes. add (Xcubes);
934 Ykeepcubes. add (Acubes);
935 }
936 sout << Ykeepcubes. size () << " cubes.\n";
937
938 // reduce the pair of cubical sets (Y,B) towards the image of F
939 if (Xspacedim == Yspacedim)
940 {
941 if (!gygen)
942 expandAinX (Ycubes, Bcubes, Yname, Bname);
943 restrictAtoneighbors (Ycubes, Bcubes, Yname, Bname,
944 &Ykeepcubes);
945 reducepair (Ycubes, Bcubes, Ykeepcubes, Yname, Bname);
946 }
947
948 // forget the cubes to keep in Y as no longer of any use
949 if (!Ykeepcubes. empty ())
950 {
951 cubsettype empty;
952 Ykeepcubes = empty;
953 }
954
955 // ----- create the cubical complexes -----
956
957 // transform the set of cubes X into a set of cells and forget Xcubes
958 gcomplex<celltype,euclidom> Xcompl;
959 cubes2cells (Xcubes, Xcompl, XAname, false);
960
961 // transform the set of cubes A into a set of cubical cells
962 gcomplex<celltype,euclidom> Acompl;
963 cubes2cells (Acubes, Acompl, Aname, false);
964
965 // transform the cubes in Y into cubical cells and forget the cubes
966 gcomplex<celltype,euclidom> *Ycompl =
967 new gcomplex<celltype,euclidom>;
968 cubes2cells (Ycubes, *Ycompl, YBname);
969
970 // transform the cubes in B into cubical cells and forget the cubes
971 gcomplex<celltype,euclidom> Bcompl;
972 cubes2cells (Bcubes, Bcompl, Bname);
973
974 // determine the dimension of X and Y as cubical complexes
975 int Xdim = Xcompl. dim ();
976 int Ydim = Ycompl -> dim ();
977
978 // ----- collapse the cubical sets (X,A) -----
979
980 // reduce the pair of sets (Xcompl, Acompl) while adding to them
981 // boundaries of all the cells
982 gcomplex<celltype,euclidom> emptycompl;
983 collapse (Xcompl, Acompl, emptycompl, Xname, Aname,
984 true, true, false);
985
986 // if nothing remains in X, then the result is trivial
987 if (Xcompl. empty ())
988 return -1;
989
990 // make a correction to the dimension of X
991 if (Xdim != Xcompl. dim ())
992 {
993 sout << "Note: The dimension of " << Xname << " decreased "
994 "from " << Xdim << " to " << Xcompl. dim () << ".\n";
995
996 Xdim = Xcompl. dim ();
997 }
998
999 // ----- create a reduced graph of F -----
1000
1001 // create the map F defined on the cells in its domain
1002 mvcellmap<celltype,euclidom,cubetype> Fcellcubmap (Xcompl);
1003 sout << "Creating the map " << Fname << " on cells in " <<
1004 Xname << "... ";
1005 int_t countimages = createimages (Fcellcubmap, Fcubmap, Fcubmap,
1006 Xcubes, Acubes);
1007 sout << countimages << " cubes added.\n";
1008
1009 // create the map F defined on the cells in its domain subcomplex A
1010 mvcellmap<celltype,euclidom,cubetype> FcellcubmapA (Acompl);
1011 if (!Acompl. empty ())
1012 {
1013 sout << "Creating the map " << Fname << " on cells in " <<
1014 Aname << "... ";
1015 int_t count = createimages (FcellcubmapA, Fcubmap, Acubes);
1016 sout << count << " cubes added.\n";
1017 }
1018
1019 // get rid of the sets of cubes X and A as no longer needed,
1020 // as well as the cubical map
1021 {
1022 cubsettype emptycubes;
1023 Acubes = emptycubes;
1024 Xcubes = emptycubes;
1025 cubmaptype emptymap;
1026 Fcubmap = emptymap;
1027 }
1028
1029 // create the graph of F as a cubical cell complex
1030 sout << "Creating a cell map for " << Fname << "... ";
1031 mvcellmap<celltype,euclidom,celltype> Fcellmap (Xcompl);
1032 bool acyclic = createcellmap (Fcellcubmap, FcellcubmapA,
1033 Fcellmap, verify);
1034 sout << "Done.\n";
1035 if (verify && !acyclic)
1036 {
1037 sout << "*** SERIOUS PROBLEM: The map is not "
1038 "acyclic. THE RESULT WILL BE WRONG.\n"
1039 "*** You must verify the acyclicity of the "
1040 "initial map with 'chkmvmap'\n"
1041 "*** and, if successful, set the "
1042 "'careful reduction' bit.\n";
1043 }
1044 if (verify && acyclic)
1045 {
1046 sout << "Note: It has been verified successfully "
1047 "that the map is acyclic.\n";
1048 }
1049
1050 sout << "Creating the graph of " << Fname << "... ";
1051 gcomplex<celltype,euclidom> *Fcompl =
1052 new gcomplex<celltype,euclidom>;
1053 creategraph (Fcellmap, *Fcompl, false);
1054 sout << Fcompl -> size () << " cells added.\n";
1055
1056 // forget the cubical maps on the cells and the cubical complex of X
1057 mvcellmap<celltype,euclidom,cubetype> emptycellcubmap;
1058 Fcellcubmap = emptycellcubmap;
1059 FcellcubmapA = emptycellcubmap;
1060 mvcellmap<celltype,euclidom,celltype> emptycellmap (emptycompl);
1061 Fcellmap = emptycellmap;
1062 Xcompl = emptycompl;
1063
1064 // ----- collapse the cubical sets (Y,B) -----
1065
1066 // decrease the dimension of B to the dimension of Y
1067 decreasedimension (Bcompl, Ydim, Bname);
1068
1069 // create a full cubical complex (with all the faces) of Y\B
1070 addboundaries (*Ycompl, Bcompl, 0, false, Yname, Bname);
1071
1072 // forget the cubical complex of B
1073 if (!Bcompl. empty ())
1074 {
1075 sout << "Forgetting " << Bcompl. size () << " cells from " <<
1076 Bname << ".\n";
1077 gcomplex<celltype,euclidom> empty;
1078 Bcompl = empty;
1079 }
1080
1081 // collapse the codomain of the map towards the image of F
1082 gcomplex<celltype,euclidom> Ykeepcompl;
1083 sout << "Computing the image of " << Fname << "... ";
1084 project (*Fcompl, Ykeepcompl, *Ycompl, Xspacedim, Yspacedim,
1085 0, 0, false);
1086 if (inclusion)
1087 {
1088 project (*Fcompl, Ykeepcompl, *Ycompl, 0, Xspacedim,
1089 Yspacedim, 0, false);
1090 }
1091 sout << Ykeepcompl. size () << " cells.\n";
1092
1093 sout << "Collapsing " << Yname << " to img of " << Xname << "... ";
1094 int_t countremoved = Ycompl -> collapse (emptycompl, Ykeepcompl,
1095 0, 0, 0);
1096 sout << 2 * countremoved << " cells removed, " <<
1097 Ycompl -> size () << " left.\n";
1098
1099 // forget the cells to keep in Y
1100 if (!Ykeepcompl. empty ())
1101 {
1102 gcomplex<celltype,euclidom> empty;
1103 Ykeepcompl = empty;
1104 }
1105
1106 // make a correction to the dimension of Y
1107 if (Ydim != Ycompl -> dim ())
1108 {
1109 sout << "Note: The dimension of " << Yname << " decreased "
1110 "from " << Ydim << " to " << Ycompl -> dim () <<
1111 ".\n";
1112
1113 Ydim = Ycompl -> dim ();
1114 }
1115
1116 // ----- create chain complexes from the cubical sets ------
1117
1118 // create a chain complex from the graph of F (it is relative)
1119 chaincomplex<euclidom> cgraph (Fcompl -> dim (), !!gfgen);
1120 sout << "Creating the chain complex of the graph of " << Fname <<
1121 "... ";
1122 createchaincomplex (cgraph, *Fcompl);
1123 sout << "Done.\n";
1124
1125 // create the chain complex from Y (this is a relative complex)
1126 chaincomplex<euclidom> cy (Ydim, !!gygen);
1127 sout << "Creating the chain complex of " << Yname << "... ";
1128 createchaincomplex (cy, *Ycompl);
1129 sout << "Done.\n";
1130
1131 // create the projection map from the graph of the map to Y
1132 chainmap<euclidom> cmap (cgraph, cy);
1133 sout << "Creating the chain map of the projection... ";
1134 createprojection (*Fcompl, *Ycompl, cmap, Xspacedim, Yspacedim, 0);
1135 sout << "Done.\n";
1136
1137 // if this is an index map, create the projection map from the graph
1138 // of the map to X composed with the inclusion into Y
1139 chainmap<euclidom> imap (cgraph, cy);
1140 if (inclusion)
1141 {
1142 sout << "Creating the chain map of the inclusion... ";
1143 createprojection (*Fcompl, *Ycompl, imap, 0, Xspacedim,
1144 Yspacedim);
1145 sout << "Done.\n";
1146 }
1147
1148 // forget the graph of F if it is not going to be used anymore
1149 if (gfcompl)
1150 (*gfcompl) = Fcompl;
1151 else
1152 delete Fcompl;
1153
1154 // forget the cubical complex Y unless requested to keep it
1155 if (gycompl)
1156 (*gycompl) = Ycompl;
1157 else
1158 delete Ycompl;
1159
1160 // ----- compute and show homology, save generators -----
1161
1162 // prepare the name of the graph of F
1163 word gFname;
1164 gFname << "the graph of " << Fname;
1165
1166 // compute the homology of the chain complex of the graph of the map
1167 maxlevel_cx = Homology (cgraph, gFname, hom_cx);
1168
1169 // extract the computed generators of the graph if requested to
1170 if (gfgen)
1171 *gfgen = ExtractGenerators (cgraph, hom_cx, maxlevel_cx);
1172
1173 // compute the homology of the chain complex of Y
1174 maxlevel_cy = Homology (cy, Yname, hom_cy);
1175
1176 // extract the computed generators of Y if requested to
1177 if (gygen)
1178 *gygen = ExtractGenerators (cy, hom_cy, maxlevel_cy);
1179
1180 // ----- show the map(s) -----
1181
1182 // prepare the data structures for the homology
1183 chaincomplex<euclidom> hgraph (maxlevel_cx);
1184 chaincomplex<euclidom> hy (maxlevel_cy);
1185 chainmap<euclidom> *hmap = new chainmap<euclidom> (hgraph, hy);
1186 chainmap<euclidom> hincl (hgraph, hy);
1187// chainmap<euclidom> *hcomp = new chainmap<euclidom> (hgraph, hgraph);
1188 chainmap<euclidom> *hcomp = new chainmap<euclidom> (hy, hy);
1189
1190 // show the map induced in homology by the chain map
1191 sout << "The map induced in homology is as follows:\n";
1192 hgraph. take_homology (hom_cx);
1193 hy. take_homology (hom_cy);
1194 hmap -> take_homology (cmap, hom_cx, hom_cy);
1195 hmap -> show (sout, "\tf", "x", "y");
1196
1197 // show the map induced in homology by the inclusion map
1198 bool invertible = true;
1199 if (inclusion)
1200 {
1201 sout << "The map induced in homology by the inclusion:\n";
1202 hincl. take_homology (imap, hom_cx, hom_cy);
1203 hincl. show (sout, "\ti", "x", "y");
1204
1205 try
1206 {
1207 hincl. invert ();
1208 }
1209 catch (...)
1210 {
1211 sout << "Oh, my goodness! This map is apparently "
1212 "not invertible.\n";
1213 invertible = false;
1214 }
1215
1216 if (invertible)
1217 {
1218 sout << "The inverse of the map "
1219 "induced by the inclusion:\n";
1220 hincl. show (sout, "\tI", "y", "x");
1221
1222 // debug: verify if the map was inverted correctly
1223 chainmap<euclidom> hincl1 (hgraph, hy);
1224 hincl1. take_homology (imap, hom_cx, hom_cy);
1225 chainmap<euclidom> hident (hy, hy);
1226 hident. compose (hincl1, hincl);
1227 sbug << "The composition of the inclusion and "
1228 "its inverse (should be the identity):\n";
1229 hident. show (sbug, "\tid", "y", "y");
1230 for (int i = 0; i <= hident. dim (); ++ i)
1231 {
1232 const mmatrix<euclidom> &m = hident [i];
1233 if (m. getnrows () != m. getncols ())
1234 throw "INV: Inequal rows and cols.";
1235 euclidom zero, one;
1236 zero = 0;
1237 one = 1;
1238 for (int c = 0; c < m. getncols (); ++ c)
1239 {
1240 for (int r = 0; r < m. getnrows ();
1241 ++ r)
1242 {
1243 if ((r == c) && (m. get
1244 (r, c) == one))
1245 {
1246 continue;
1247 }
1248 if (m. get (r, c) == zero)
1249 continue;
1250 throw "INV: Non-identity.";
1251 }
1252 }
1253 }
1254 // debug: end of the verification
1255
1256 sout << "The composition of F and the inverse "
1257 "of the map induced by the inclusion:\n";
1258 // hcomp -> compose (hincl, *hmap);
1259 hcomp -> compose (*hmap, hincl);
1260 // hcomp -> show (sout, "\tF", "x", "x");
1261 hcomp -> show (sout, "\tF", "y", "y");
1262 }
1263 }
1264
1265 // set the appropriate map
1266 if (inclusion && invertible)
1267 {
1268 hom_f = hcomp;
1269 delete hmap;
1270 }
1271 else
1272 {
1273 hom_f = hmap;
1274 delete hcomp;
1275 }
1276
1277 // throw an exception if the map is not invertible
1278 if (inclusion && !invertible)
1279 throw "Unable to invert the inclusion map.";
1280
1281 return ((maxlevel_cx < maxlevel_cy) ? maxlevel_cx : maxlevel_cy);
1282} /* Homology */
bool checkimagecontained(const maptype &Fcubmap, const cubsettype &Xcubes, const cubsettype &Ycubes, const cubsettype &Bcubes, const char *Xname, const char *Yname)
Checks if the image of X by F is contained in the union of Y and B.
Definition: homtools.h:384
bool inclusion(const HSet &X, const HSet &Y)
Verifies if X is a subset of Y. Returns true if yes, false if not.
Definition: indxpalg.h:309
outputstream sbug
An output stream for writing additional debug messages.
void project(const gcomplex< tCell, euclidom > &c, gcomplex< tCell, euclidom > &img, const gcomplex< tCell, euclidom > &only, int offset, int outdim, int discarddim, const int *level, bool watchforimages)
Creates the image of the projection from the set of cubical cells in the given geometric complex to t...
Definition: cubmaps.h:320
void createprojection(const gcomplex< tCell, euclidom > &Fcompl, const gcomplex< tCell, euclidom > &Ycompl, chainmap< euclidom > &cmap, int offset, int outdim, int discarddim, int *level=NULL)
Creates the chain map of the projection from a cell complex of the graph of a map to a cell complex o...
Definition: cubmaps.h:237
bool checkinclusion(const cubsettype &Xcubes, const cubsettype &Ycubes, const cubsettype &Bcubes, const char *Xname, const char *YBname)
Checks if X is a subset of the union of Y and B.
Definition: homtools.h:349
int_t createimages(mvcellmap< tCell, euclidom, tCube > &m, const mvmap< tCube, tCube > &f1, const mvmap< tCube, tCube > &f2, const hashedset< tCube > &dom1, const hashedset< tCube > &dom2)
Creates images of cells in 'm' as unions of cubes determined by f1 and f2.
Definition: cubmaps.h:147
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.
Definition: gcomplex.h:1874
bool checkimagedisjoint(const maptype &Fcubmap, const cubsettype &Acubes, const cubsettype &Ycubes, const char *Aname, const char *Yname)
Checks if the image of A by F is disjoint from Y (actually, from Y\B).
Definition: homtools.h:428
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 ...
Definition: homtools.h:813
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.
Definition: gcomplex.h:1429

References acyclic(), addboundaries(), checkimagecontained(), checkimagedisjoint(), checkinclusion(), collapse(), createcellmap(), createchaincomplex(), creategraph(), createimages(), createprojection(), cubes2cells(), decreasedimension(), expandAinX(), ExtractGenerators(), Homology(), inclusion(), knownbits, project(), reducepair(), removeAfromX(), restrictAtoneighbors(), sbug, and sout.

◆ Homology() [8/9]

template<class euclidom , class cubetype >
int chomp::homology::Homology ( mvmap< cubetype, cubetype > &  Fcubmap,
hashedset< cubetype > &  Xcubes,
hashedset< cubetype > &  Acubes,
chain< euclidom > *&  hom,
int &  maxlevel,
chainmap< euclidom > *&  hom_f,
int  careful = 0x01,
chain< euclidom > ***  gfgen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gfcompl = 0,
chain< euclidom > ***  gygen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gycompl = 0 
)

A version of the above procedure with the default names.

Definition at line 1331 of file homology.h.

1339{
1340 return Homology (Fcubmap, "F", Xcubes, "X", Acubes, "A", hom,
1341 maxlevel, hom_f, careful, gfgen, gfcompl, gygen, gycompl);
1342} /* Homology */

References Homology().

◆ Homology() [9/9]

template<class euclidom , class cubetype >
int chomp::homology::Homology ( mvmap< cubetype, cubetype > &  Fcubmap,
hashedset< cubetype > &  Xcubes,
hashedset< cubetype > &  Acubes,
hashedset< cubetype > &  Ycubes,
hashedset< cubetype > &  Bcubes,
chain< euclidom > *&  hom_cx,
int &  maxlevel_cx,
chain< euclidom > *&  hom_cy,
int &  maxlevel_cy,
chainmap< euclidom > *&  hom_f,
bool  inclusion = false,
int  careful = 0x01,
chain< euclidom > ***  gfgen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gfcompl = 0,
chain< euclidom > ***  gygen = 0,
gcomplex< typename cubetype::CellType, euclidom > **  gycompl = 0 
)

A version of the above procedure with the default names.

Definition at line 1286 of file homology.h.

1297{
1298 return Homology (Fcubmap, "F", Xcubes, "X", Acubes, "A",
1299 Ycubes, "Y", Bcubes, "B", hom_cx, maxlevel_cx,
1300 hom_cy, maxlevel_cy, hom_f, inclusion, careful,
1301 gfgen, gfcompl, gygen, gycompl);
1302} /* Homology */

References Homology(), and inclusion().

◆ Homology2l() [1/2]

template<class euclidom , class cubetype >
int chomp::homology::Homology2l ( mvmap< cubetype, cubetype > &  Fcubmap,
hashedset< cubetype > &  Xcubes,
hashedset< cubetype > &  Acubes,
chain< euclidom > *&  hom,
int &  maxlevel,
chainmap< euclidom > *&  hom_f,
int  careful = 0x01,
chain< euclidom > ***  gfgen = 0,
gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **  gfcompl = 0,
chain< euclidom > ***  gygen = 0,
gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **  gycompl = 0 
)

A version of the above procedure with the default names.

Definition at line 1986 of file homology.h.

1995{
1996 return Homology2l (Fcubmap, "F", Xcubes, "X", Acubes, "A", hom,
1997 maxlevel, hom_f, careful, gfgen, gfcompl, gygen, gycompl);
1998} /* Homology2l */
int Homology2l(mvmap< cubetype, cubetype > &Fcubmap, hashedset< cubetype > &Xcubes, hashedset< cubetype > &Acubes, chain< euclidom > *&hom, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gycompl=0)
A version of the above procedure with the default names.
Definition: homology.h:1986

References Homology2l().

◆ Homology2l() [2/2]

template<class euclidom , class cubetype >
int chomp::homology::Homology2l ( mvmap< cubetype, cubetype > &  Fcubmap0,
const char *  Fname,
hashedset< cubetype > &  Xcubes0,
const char *  Xname,
hashedset< cubetype > &  Acubes0,
const char *  Aname,
chain< euclidom > *&  hom_cx,
int &  maxlevel,
chainmap< euclidom > *&  hom_f,
int  careful = 0x01,
chain< euclidom > ***  gfgen = 0,
gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **  gfcompl = 0,
chain< euclidom > ***  gygen = 0,
gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **  gycompl = 0 
)

Computes the endomorphism induced in homology by a combinatorial cubical multivalued map using the two-layer construction developped by P.

Pilarczyk and K. Stolot.

Definition at line 1353 of file homology.h.

1363{
1364 // define the type of a 2-layer cube and 2-layer cell
1365 typedef tCube2l<cubetype> cube2ltype;
1366 typedef typename cube2ltype::CellType cell2ltype;
1367
1368 // turn off locally the usage of binary decision diagrams
1369 local_var<int> TurnOffMaxBddDim (MaxBddDim, 0);
1370
1371 // transform the 'careful' bits into separate variables
1372 bool verify = careful & 0x01;
1373 bool checkacyclic = careful & 0x02;
1374 bool keepacyclic = careful & 0x04;
1375
1376 // remove from X cubes which are in A
1377 removeAfromX (Xcubes0, Acubes0, "X", "A");
1378
1379 // leave in A only the neighbors of X\\A
1380 restrictAtoneighbors (Xcubes0, Acubes0, "X", "A");
1381
1382 // if the set X is empty, the answer is obvious
1383 if (Xcubes0. empty ())
1384 {
1385 sout << "X is a subset of A. The homology of (X,A) "
1386 "is trivial and the map is 0.";
1387 return -1;
1388 }
1389
1390 // ----- define the layers ------
1391
1392 // define the two-layer structure
1393 sout << "Defining the two-layer structure... ";
1394 cube2ltype::setlayers (Xcubes0, Acubes0);
1395
1396 // transform the cubes in X and in A to the two-layer sets
1397 hashedset<cube2ltype> Xcubes;
1398 for (int_t i = 0; i < Xcubes0. size (); ++ i)
1399 Xcubes. add (cube2ltype (Xcubes0 [i], 1));
1400 hashedset<cube2ltype> Acubes;
1401 for (int_t i = 0; i < Acubes0. size (); ++ i)
1402 Acubes. add (cube2ltype (Acubes0 [i], 0));
1403
1404 // say that defining the two-layer structure is done
1405 sout << cube2ltype::layer1 (). size () << "+" <<
1406 cube2ltype::layer0 (). size () << " cubes, " <<
1407 cell2ltype::identify (). size () << " cells.\n";
1408
1409 // ----- transform the map ------
1410
1411 // determine Y and B
1412 sout << "Creating the sets Y and B... ";
1413 hashedset<cube2ltype> Ycubes (Xcubes);
1414 hashedset<cube2ltype> Bcubes (Acubes);
1415 for (int_t i = 0; i < Xcubes0. size (); ++ i)
1416 {
1417 const hashedset<cubetype> &img = Fcubmap0 (Xcubes0 [i]);
1418 for (int_t j = 0; j < img. size (); ++ j)
1419 {
1420 if (!Xcubes0. check (img [j]))
1421 Bcubes. add (cube2ltype (img [j], 0));
1422 }
1423 }
1424 for (int_t i = 0; i < Acubes0. size (); ++ i)
1425 {
1426 const hashedset<cubetype> &img = Fcubmap0 (Acubes0 [i]);
1427 for (int_t j = 0; j < img. size (); ++ j)
1428 Bcubes. add (cube2ltype (img [j], 0));
1429 }
1430 sout << Ycubes. size () << " cubes in Y\\B, " <<
1431 Bcubes. size () << " in B.\n";
1432
1433 // lift the map to the two-layer structure
1434 mvmap<cube2ltype,cube2ltype> Fcubmap;
1435 for (int_t i = 0; i < Xcubes0. size (); ++ i)
1436 {
1437 // Fcubmap [Xcubes [i]]. size ();
1438 const hashedset<cubetype> &img = Fcubmap0 (Xcubes0 [i]);
1439 if (img. empty ())
1440 throw "Empty image of a box in X.\n";
1441 for (int_t j = 0; j < img. size (); ++ j)
1442 {
1443 int layer = Xcubes0. check (img [j]) ? 1 : 0;
1444 Fcubmap [Xcubes [i]]. add
1445 (cube2ltype (img [j], layer));
1446 }
1447 }
1448 for (int_t i = 0; i < Acubes0. size (); ++ i)
1449 {
1450 // Fcubmap [Acubes [i]]. size ();
1451 const hashedset<cubetype> &img = Fcubmap0 (Acubes0 [i]);
1452 if (img. empty ())
1453 throw "Empty image of a box in A.\n";
1454 for (int_t j = 0; j < img. size (); ++ j)
1455 Fcubmap [Acubes [i]]. add
1456 (cube2ltype (img [j], 0));
1457 }
1458
1459 // forget the initial single-layer sets and the map
1460 {
1461 hashedset<cubetype> empty;
1462 Xcubes0 = empty;
1463 Acubes0 = empty;
1464 }
1465 {
1466 mvmap<cubetype,cubetype> empty;
1467 Fcubmap0 = empty;
1468 }
1469
1470 // remember the original size of the set A and of the set X
1471 int_t origAsize = Acubes. size ();
1472 int_t origXsize = Xcubes. size ();
1473
1474 // determine the dimension of X and Y if possible
1475 int Xspacedim = Xcubes. empty () ? -1 : Xcubes [0]. dim ();
1476 int Yspacedim = Ycubes. empty () ? -1 : Ycubes [0]. dim ();
1477
1478 // ----- reduce the sets of cubes -----
1479
1480 // prepare the set of cubes to keep in X (unused in this program)
1481 hashedset<cube2ltype> Xkeepcubes;
1482
1483 // allocate a suitable bit field set for the reduction and show msg
1484 if (Xspacedim > 0)
1485 knownbits [Xspacedim];
1486
1487 // reduce the pair of sets of cubes (X,A) without acyclicity check
1488 if (!Acubes. empty () && !checkacyclic)
1489 {
1490 // reduce the pair (X,A)
1491 reducepair (Xcubes, Acubes, Xkeepcubes, "X", "A");
1492
1493 // if nothing remains in X, then the result is trivial
1494 if (Xcubes. empty ())
1495 {
1496 sout << "There are no cubes left "
1497 "in X\\A. The homology of (X,A) "
1498 "is trivial and the map is 0.";
1499 return -1;
1500 }
1501 }
1502
1503 // remember which inclusions have been verified
1504 bool inclFABchecked = false;
1505 bool inclFXYchecked = false;
1506
1507 // do the careful or extended reduction
1508 if (checkacyclic)
1509 {
1510 // check if F (X\A) \subset Y
1511 if (verify)
1512 {
1513 checkimagecontained (Fcubmap,
1514 Xcubes, Ycubes, Bcubes,
1515 Acubes. empty () ? "X" : "X\\A", "Y");
1516 inclFXYchecked = true;
1517 }
1518 // check if F (A) \subset B and if F (A) is disjoint from Y
1519 if (verify && !Acubes. empty ())
1520 {
1521 checkimagecontained (Fcubmap, Acubes, Bcubes,
1522 "A", "B");
1523 checkimagedisjoint (Fcubmap, Acubes, Ycubes,
1524 "A", "Y\\B");
1525 inclFABchecked = true;
1526 }
1527 }
1528 else if (!Acubes. empty ())
1529 {
1530 // check if F (X\A) \subset Y
1531 if (verify)
1532 {
1533 checkimagecontained (Fcubmap,
1534 Xcubes, Ycubes, Bcubes,
1535 Acubes. empty () ? "X" : "X\\A", "Y");
1536 inclFXYchecked = true;
1537 }
1538 }
1539
1540 // expand A within X and modify (Y,B)
1541 if (!Acubes. empty ())
1542 {
1543 // expand A towards X and modify (Y,B) accordingly
1544 expandAinX (Xcubes, Acubes, Ycubes, Bcubes, Fcubmap,
1545 "X", "A", "B", true /*indexmap*/, checkacyclic);
1546 }
1547
1548 // reduce the pair (X,A) or the set X with acyclicity check
1549 if (checkacyclic)
1550 {
1551 // leave in A only the neighbors of X\\A
1552 restrictAtoneighbors (Xcubes, Acubes, "X", "A");
1553
1554 // reduce the pair (X,A) with acyclicity check
1555 // NOTE: This doesn't seem to work well, so I have turned
1556 // this off if the additional bit of 'careful' is set,
1557 // until I find out what is going on; sorry! [Dec 18, 2010]
1558 if (!keepacyclic)
1559 {
1560 reducepair (Xcubes, Acubes, Fcubmap,
1561 Xkeepcubes, "X", "A");
1562 }
1563
1564 // if nothing remains in X, then the result is trivial
1565 if (Xcubes. empty ())
1566 {
1567 sout << "There are no cubes left "
1568 "in X\\A. The homology of (X,A) "
1569 "is trivial and the map is 0.";
1570 return -1;
1571 }
1572 }
1573
1574 // reduce the pair (X,A) even further
1575 if (!checkacyclic && !Acubes. empty ())
1576 {
1577 // leave in A only the neighbors of X\\A
1578 restrictAtoneighbors (Xcubes, Acubes, "X", "A");
1579
1580 // continue the reduction of the pair (X,A)
1581 reducepair (Xcubes, Acubes, Xkeepcubes, "X", "A");
1582 }
1583
1584 // indicate that the acyclicity of the map should be verified
1585 if (!verify)
1586 {
1587 if (!checkacyclic && ((origAsize != Acubes. size ()) ||
1588 (origXsize != Xcubes. size ())))
1589 {
1590 sout << "*** Important note: X or A changed. "
1591 "You must make sure\n"
1592 "*** that the restriction of F "
1593 "to the new sets is acyclic.\n";
1594 }
1595 else
1596 {
1597 sout << "*** Note: The program assumes "
1598 "that the input map is acyclic.\n";
1599 }
1600 }
1601
1602 // check if F (X\A) \subset Y
1603 if (verify && !inclFXYchecked)
1604 {
1605 checkimagecontained (Fcubmap, Xcubes, Ycubes, Bcubes,
1606 Acubes. empty () ? "X" : "X\\A", "Y");
1607 inclFXYchecked = true;
1608 }
1609
1610 // check if F (A) \subset B [this should always be satisfied]
1611 if (verify && !inclFABchecked && !Acubes. empty ())
1612 {
1613 checkimagecontained (Fcubmap, Acubes, Bcubes, "A", "B");
1614 checkimagedisjoint (Fcubmap, Acubes, Ycubes, "A", "Y\\B");
1615 inclFABchecked = true;
1616 }
1617
1618 // set the union of the domain of the map of interest
1619 // and the image of the map as the cubes to keep in Y
1620 hashedset<cube2ltype> Ykeepcubes;
1621 addmapimg (Fcubmap, Xcubes, Acubes, Ykeepcubes,
1622 true /*indexmap*/);
1623
1624 // reduce the pair of cubical sets (Y,B) towards the image of F
1625 if (Xspacedim == Yspacedim)
1626 {
1627 expandAinX (Ycubes, Bcubes, "Y", "B");
1628 restrictAtoneighbors (Ycubes, Bcubes, "Y", "B", &Ykeepcubes);
1629 reducepair (Ycubes, Bcubes, Ykeepcubes, "Y", "B");
1630 }
1631
1632 // ----- create the cubical complexes -----
1633
1634 // transform the set of cubes X into a set of cells,
1635 // but do not forget Xcubes yet
1636 gcomplex<cell2ltype,euclidom> Xcompl;
1637 cubes2cells (Xcubes, Xcompl, Acubes. size () ? "X\\A" : "X", false);
1638
1639 // transform the set of cubes A into a set of cubical cells
1640 // but do not forget Acubes yet
1641 gcomplex<cell2ltype,euclidom> Acompl;
1642 cubes2cells (Acubes, Acompl, "A", false);
1643
1644 // if the set X is empty, no computations are necessary
1645 if (Xcompl. empty ())
1646 {
1647 if (!Acompl. empty ())
1648 sout << "The set X is contained in A. "
1649 "The homology of (X,A) is trivial.";
1650 else
1651 sout << "The set X is empty. "
1652 "The homology of X is trivial.";
1653 return -1;
1654 }
1655
1656 // transform the cubes in Y into cubical cells and forget the cubes
1657 gcomplex<cell2ltype,euclidom> *Ycompl =
1658 new gcomplex<cell2ltype,euclidom>;
1659 cubes2cells (Ycubes, *Ycompl, Bcubes. empty () ? "Y" : "Y\\B");
1660 if (!Ycubes. empty ())
1661 {
1662 hashedset<cube2ltype> empty;
1663 Ycubes = empty;
1664 }
1665
1666 // transform the cubes in B into cubical cells and forget the cubes
1667 gcomplex<cell2ltype,euclidom> Bcompl;
1668 cubes2cells (Bcubes, Bcompl, "B");
1669 if (!Bcubes. empty ())
1670 {
1671 hashedset<cube2ltype> empty;
1672 Bcubes = empty;
1673 }
1674
1675 // transform the cubes to keep in Y into cells and forget the cubes
1676 gcomplex<cell2ltype,euclidom> Ykeepcompl;
1677 cubes2cells (Ykeepcubes, Ykeepcompl, "Ykeep");
1678 if (!Ykeepcubes. empty ())
1679 {
1680 hashedset<cube2ltype> empty;
1681 Ykeepcubes = empty;
1682 }
1683
1684 // determine the dimension of X and Y as cubical complexes
1685 int Xdim = Xcompl. dim ();
1686 if ((Xspacedim < 0) && (Xdim >= 0))
1687 Xspacedim = Xcompl [Xdim] [0]. spacedim ();
1688 int Ydim = Ycompl -> dim ();
1689 if ((Yspacedim < 0) && (Ydim >= 0))
1690 Yspacedim = (*Ycompl) [Ydim] [0]. spacedim ();
1691
1692 // ----- collapse the cubical sets (X,A) -----
1693
1694 // create an empty set of cells to keep in X
1695 gcomplex<cell2ltype,euclidom> Xkeepcompl;
1696
1697 // reduce the pair of sets (Xcompl, Acompl) while adding to them
1698 // boundaries of all the cells
1699 collapse (Xcompl, Acompl, Xkeepcompl, "X", "A",
1700 true, true, false);
1701
1702 // if nothing remains in X, then the result is trivial
1703 if (Xcompl. empty ())
1704 {
1705 sout << "Nothing remains in X. "
1706 "The homology of (X,A) is trivial.";
1707 return -1;
1708 }
1709
1710 // forget the cells to keep in X
1711 if (!Xkeepcompl. empty ())
1712 {
1713 gcomplex<cell2ltype,euclidom> empty;
1714 Xkeepcompl = empty;
1715 }
1716
1717 // make a correction to the dimension of X
1718 if (Xdim != Xcompl. dim ())
1719 {
1720 sout << "Note: The dimension of X decreased from " <<
1721 Xdim << " to " << Xcompl. dim () << ".\n";
1722
1723 Xdim = Xcompl. dim ();
1724 }
1725
1726 // ----- create a reduced graph of F -----
1727
1728 // create the map F defined on the cells in its domain
1729 mvcellmap<cell2ltype,euclidom,cube2ltype> Fcellcubmap (Xcompl);
1730 sout << "Creating the map F on cells in X... ";
1731 int_t countimages = createimages (Fcellcubmap, Fcubmap, Fcubmap,
1732 Xcubes, Acubes);
1733 sout << countimages << " cubes added.\n";
1734
1735 // forget the full cubical set X
1736 if (Xcubes. size ())
1737 {
1738 hashedset<cube2ltype> empty;
1739 Xcubes = empty;
1740 }
1741
1742 // create the map F defined on the cells in its domain subcomplex A
1743 mvcellmap<cell2ltype,euclidom,cube2ltype> FcellcubmapA (Acompl);
1744 if (!Acompl. empty ())
1745 {
1746 sout << "Creating the map F on cells in A... ";
1747 int_t count = createimages (FcellcubmapA, Fcubmap, Acubes);
1748 sout << count << " cubes added.\n";
1749 }
1750
1751 // forget the full cubical set A
1752 if (Acubes. size ())
1753 {
1754 hashedset<cube2ltype> empty;
1755 Acubes = empty;
1756 }
1757
1758 // create the graph of F as a cubical cell complex
1759 gcomplex<cell2ltype,euclidom> *Fcompl =
1760 new gcomplex<cell2ltype,euclidom>;
1761 sout << "Creating a cell map for F... ";
1762 mvcellmap<cell2ltype,euclidom,cell2ltype> Fcellmap (Xcompl);
1763 bool acyclic = createcellmap (Fcellcubmap, FcellcubmapA,
1764 Fcellmap, verify);
1765 sout << "Done.\n";
1766 if (checkacyclic && !acyclic)
1767 {
1768 sout << "*** SERIOUS PROBLEM: The map is not "
1769 "acyclic. THE RESULT WILL BE WRONG.\n"
1770 "*** You must verify the acyclicity of the "
1771 "initial map with 'chkmvmap'\n"
1772 "*** and, if successful, run this program "
1773 "with the '-a' switch.\n";
1774 }
1775 if (checkacyclic && acyclic)
1776 {
1777 sout << "Note: It has been verified successfully "
1778 "that the map is acyclic.\n";
1779 }
1780
1781 sout << "Creating the graph of F... ";
1782 creategraph (Fcellmap, *Fcompl, false);
1783 sout << Fcompl -> size () << " cells added.\n";
1784
1785 // forget the cubical map on the cells
1786 {
1787 mvcellmap<cell2ltype,euclidom,cube2ltype> empty;
1788 Fcellcubmap = empty;
1789 FcellcubmapA = empty;
1790 }
1791
1792 // ----- collapse the cubical sets (Y,B) -----
1793
1794 // decrease the dimension of B to the dimension of Y
1795 decreasedimension (Bcompl, Ydim, "B");
1796
1797 // create a full cubical complex (with all the faces) of Y\B
1798 if (!Ycompl -> empty ())
1799 {
1800 addboundaries (*Ycompl, Bcompl, 0, false, "Y", "B");
1801
1802 // forget the cubical complex of B
1803 if (!Bcompl. empty ())
1804 {
1805 sout << "Forgetting " << Bcompl. size () <<
1806 " cells from B.\n";
1807 gcomplex<cell2ltype,euclidom> empty;
1808 Bcompl = empty;
1809 }
1810 }
1811
1812 // collapse the codomain of the map towards the image of F
1813 {
1814 sout << "Computing the image of F... ";
1815 int_t prev = Ykeepcompl. size ();
1816 project (*Fcompl, Ykeepcompl, *Ycompl, Xspacedim, Yspacedim,
1817 0, 0, false);
1818 project (*Fcompl, Ykeepcompl, *Ycompl, 0, Xspacedim,
1819 Yspacedim, 0, false);
1820 sout << (Ykeepcompl. size () - prev) << " cells added.\n";
1821
1822 sout << "Collapsing Y towards F(X)... ";
1823 gcomplex<cell2ltype,euclidom> empty;
1824 int_t count = Ycompl -> collapse (empty, Ykeepcompl,
1825 0, 0, 0, 0);
1826 sout << 2 * count << " cells removed, " <<
1827 Ycompl -> size () << " left.\n";
1828 }
1829
1830 // forget the cells to keep in Y
1831 if (!Ykeepcompl. empty ())
1832 {
1833 gcomplex<cell2ltype,euclidom> empty;
1834 Ykeepcompl = empty;
1835 }
1836
1837 // make a correction to the dimension of Y
1838 if (Ydim != Ycompl -> dim ())
1839 {
1840 sout << "Note: The dimension of Y decreased from " <<
1841 Ydim << " to " << Ycompl -> dim () << ".\n";
1842
1843 Ydim = Ycompl -> dim ();
1844 }
1845
1846 // ----- create chain complexes from the cubical sets ------
1847
1848 // create a chain complex from X (this is a relative chain complex!)
1849// chaincomplex<euclidom> cx (Xcompl. dim (), false /*generators*/);
1850
1851 // create a chain complex from the graph of F (it is relative)
1852 chaincomplex<euclidom> cgraph (Fcompl -> dim (), false);
1853 sout << "Creating the chain complex of the graph of F... ";
1854 createchaincomplex (cgraph, *Fcompl);
1855 sout << "Done.\n";
1856
1857 // create the chain complex from Y (this is a relative complex)
1858 chaincomplex<euclidom> cy (Ydim, false);
1859 sout << "Creating the chain complex of Y... ";
1860 createchaincomplex (cy, *Ycompl);
1861 sout << "Done.\n";
1862
1863 // create the projection map from the graph of the map to Y
1864 chainmap<euclidom> cmap (cgraph, cy);
1865 sout << "Creating the chain map of the projection... ";
1866 createprojection (*Fcompl, *Ycompl, cmap, Xspacedim,
1867 Yspacedim, 0);
1868 sout << "Done.\n";
1869
1870 // if this is an index map, create the projection map from the graph
1871 // of the map to X composed with the inclusion into Y
1872 chainmap<euclidom> imap (cgraph, cy);
1873 sout << "Creating the chain map of the inclusion... ";
1874 createprojection (*Fcompl, *Ycompl, imap, 0, Xspacedim, Yspacedim);
1875 sout << "Done.\n";
1876
1877 // forget the graph of F if it is not going to be used anymore
1878 if (gfcompl)
1879 (*gfcompl) = Fcompl;
1880 else
1881 delete Fcompl;
1882
1883 // forget the cubical complex Y unless requested to keep it
1884 if (gycompl)
1885 (*gycompl) = Ycompl;
1886 else
1887 delete Ycompl;
1888
1889 // ----- compute and show homology, save generators -----
1890
1891 // prepare the name of the graph of F
1892 word gFname;
1893 gFname << "the graph of " << Fname;
1894
1895 // compute the homology of the chain complex of the graph of the map
1896 int maxlevel_cx = Homology (cgraph, gFname, hom_cx);
1897
1898 // extract the computed generators of the graph if requested to
1899 if (gfgen)
1900 *gfgen = ExtractGenerators (cgraph, hom_cx, maxlevel_cx);
1901
1902 // compute the homology of the chain complex of Y
1903 chain<euclidom> *hom_cy = 0;
1904 int maxlevel_cy = Homology (cy, Xname, hom_cy);
1905
1906 // extract the computed generators of Y if requested to
1907 if (gygen)
1908 *gygen = ExtractGenerators (cy, hom_cy, maxlevel_cy);
1909
1910 // ----- show the map(s) -----
1911
1912 // determine the maximal non-trivial homology level for maps
1913 int homdimgraph = maxlevel_cx; // cgraph. dim ();
1914// while ((homdimgraph >= 0) && (!hom_cx [homdimgraph]. size ()))
1915// -- homdimgraph;
1916 int homdimy = maxlevel_cy; // cy. dim ();
1917// while ((homdimy >= 0) && (!hom_cy [homdimy]. size ()))
1918// -- homdimy;
1919// sout << "Maximal homology level considered for the map "
1920// "is " << homdim << ".\n";
1921
1922 // prepare the data structures for the homology
1923 chaincomplex<euclidom> hgraph (homdimgraph);
1924 chaincomplex<euclidom> hy (homdimy);
1925 chainmap<euclidom> *hmap = new chainmap<euclidom> (hgraph, hy);
1926 chainmap<euclidom> hincl (hgraph, hy);
1927 chainmap<euclidom> *hcomp = new chainmap<euclidom> (hgraph, hgraph);
1928
1929 // show the map induced in homology by the chain map
1930 sout << "The map induced in homology is as follows:\n";
1931 hgraph. take_homology (hom_cx);
1932 hy. take_homology (hom_cy);
1933 hmap -> take_homology (cmap, hom_cx, hom_cy);
1934 hmap -> show (sout, "\tf", "x", "y");
1935
1936 // show the map induced in homology by the inclusion map
1937 sout << "The map induced in homology by the inclusion:\n";
1938 hincl. take_homology (imap, hom_cx, hom_cy);
1939 hincl. show (sout, "\ti", "x", "y");
1940
1941 sout << "The inverse of the map induced by the inclusion:\n";
1942 bool invertible = true;
1943 try
1944 {
1945 hincl. invert ();
1946 }
1947 catch (...)
1948 {
1949 sout << "Oh, my goodness! This map is apparently "
1950 "not invertible.\n";
1951 invertible = false;
1952 }
1953
1954 if (invertible)
1955 {
1956 hincl. show (sout, "\tI", "y", "x");
1957
1958 sout << "The composition of F and the inverse "
1959 "of the map induced by the inclusion:\n";
1960 hcomp -> compose (hincl, *hmap);
1961 hcomp -> show (sout, "\tF", "x", "x");
1962 }
1963
1964 // set the appropriate map
1965 if (invertible)
1966 {
1967 hom_f = hcomp;
1968 delete hmap;
1969 }
1970 else
1971 {
1972 hom_f = hmap;
1973 delete hcomp;
1974 }
1975
1976 // throw an exception if the map is not invertible
1977 if (!invertible)
1978 throw "Unable to invert the inclusion map.";
1979
1980 maxlevel = (maxlevel_cx < maxlevel_cy) ? maxlevel_cx : maxlevel_cy;
1981 return maxlevel;
1982} /* Homology2l */
Local variable guardian.
Definition: localvar.h:54
void addmapimg(const maptype &Fcubmap, const maptype &FcubmapA, const cubsettype &Xcubes, const cubsettype &Acubes, cubsettype &Ykeepcubes, bool indexmap)
Adds the images of both maps to the set of cubes to be kept.
Definition: homtools.h:658

References acyclic(), addboundaries(), addmapimg(), checkimagecontained(), checkimagedisjoint(), collapse(), createcellmap(), createchaincomplex(), creategraph(), createimages(), createprojection(), cubes2cells(), decreasedimension(), expandAinX(), ExtractGenerators(), Homology(), knownbits, MaxBddDim, project(), reducepair(), removeAfromX(), restrictAtoneighbors(), and sout.

Referenced by Homology2l().

◆ HomologyMap() [1/2]

template<class euclidom >
chainmap< euclidom > * chomp::homology::HomologyMap ( const chainmap< euclidom > &  cmap,
const chain< euclidom > *  hom_cx,
const chain< euclidom > *  hom_cy,
int  maxlevel 
)

Extracts the homomorphism induced in homology from the chain map on two chain complexes whose homology has just been computed.

Note that 'maxlevel' must be the MINIMUM of the two maximal nontrivial homology levels encoded in "hom_cx" and "hom_cy". Returns a pointer to the extracted homomorphism.

Explanation: In order to compute the homomorphism induced in homology by a chain map, it is enough to define the chain map between two chain complexes (one can also use the same chain complex for its domain and codomain if the map is an endomorphism), and then compute the homology of both chain complexes. One can use one of the functions below to extract the information obtained in this way into a simpler (and smaller) data structure. The extracted map is exactly the homomorphism induced in homology. Since the returned chain map is allocated with the 'new' operator, one should 'delete' it when finished.

Definition at line 706 of file homology.h.

711{
712 // if the maximal level is wrong, return 0
713 if (maxlevel < 0)
714 return 0;
715
716 // allocate chain complexes of appropriate dimension and a chain map
717 chaincomplex<euclidom> hx (maxlevel);
718 chaincomplex<euclidom> hy (maxlevel);
719 chainmap<euclidom> *hmap = new chainmap<euclidom> (hx, hy);
720
721 // create the chain complexes reflecting the homology module(s)
722 hx. take_homology (hom_cx);
723 hy. take_homology (hom_cy);
724
725 // create the chain map accordingly
726 hmap -> take_homology (cmap, hom_cx, hom_cy);
727 return hmap;
728} /* HomologyMap */
This class defines a chain map between two chain complexes.
Definition: chains.h:3243

◆ HomologyMap() [2/2]

template<class euclidom >
chainmap< euclidom > * chomp::homology::HomologyMap ( const chainmap< euclidom > &  cmap,
const chain< euclidom > *  hom_cx,
int  maxlevel 
)

Extracts the endomorphism induced in homology from the chain map on one chain complex whose homology has just been computed.

Returns a pointer to the extracted homomorphism.

Definition at line 734 of file homology.h.

738{
739 // if the maximal level is wrong, return 0
740 if (maxlevel < 0)
741 return 0;
742
743 // allocate chain complexes of appropriate dimension and a chain map
744 chaincomplex<euclidom> hx (maxlevel);
745 chainmap<euclidom> *hmap = new chainmap<euclidom> (hx, hx);
746
747 // create the chain complexes reflecting the homology module(s)
748 hx. take_homology (hom_cx);
749
750 // create the chain map accordingly
751 hmap -> take_homology (cmap, hom_cx, hom_cx);
752 return hmap;
753} /* HomologyMap */

◆ ignorecomments()

void chomp::homology::ignorecomments ( std::istream &  in)
inline

Ignores white characters (spaces, tabulators, CRs and LFs), as well as comments from the input text file.

The comment begins with a semicolon and ends with the end of the line.

Definition at line 385 of file textfile.h.

386{
387 int ch = in. peek ();
388 while (true)
389 {
390 switch (ch)
391 {
392 case ';':
393 ignoreline (in);
394 ch = in. peek ();
395 break;
396 case ' ':
397 case '\t':
398 case '\r':
399 case '\n':
400 in. get ();
401 ch = in. peek ();
402 break;
403 default:
404 return;
405 }
406 }
407} /* ignorecomments */
void ignoreline(std::istream &in)
Ignores the input characters until the end of a line, including this end of the line.
Definition: textfile.h:376

References ignoreline().

Referenced by operator>>(), read(), readcoordinates(), ReadCubeFix(), readcubeorcell(), ReadCubes(), ReadCubicalCell(), ReadCubicalMap(), readdomain(), readimage(), readrestriction(), chomp::multiwork::mwSubCoordinator< dim, coord >::ReadResults(), readselective(), readtheset(), and scancubes().

◆ ignoreline()

void chomp::homology::ignoreline ( std::istream &  in)
inline

Ignores the input characters until the end of a line, including this end of the line.

Definition at line 376 of file textfile.h.

377{
378 in. ignore (0x7FFFFFFFl, '\n');
379 return;
380} /* ignoreline */

Referenced by ignorecomments(), read(), readcubeorcell(), ReadCubicalMap(), readdomain(), readimage(), chomp::multiwork::mwSubCoordinator< dim, coord >::ReadResults(), readselective(), readtheset(), and scancubes().

◆ inclusion()

template<class HSet >
bool chomp::homology::inclusion ( const HSet &  X,
const HSet &  Y 
)

Verifies if X is a subset of Y. Returns true if yes, false if not.

Definition at line 309 of file indxpalg.h.

310{
311 int_t countX = X. size ();
312 if (countX && Y. empty ())
313 return false;
314
315 for (int_t i = 0; i < countX; ++ i)
316 if (!Y. check (X [i]))
317 return false;
318 return true;
319} /* inclusion */

Referenced by Homology(), and IndexPairM().

◆ inclusionGraph() [1/2]

template<class wType >
int_t chomp::homology::inclusionGraph ( const diGraph< wType > &  g,
int_t  nVert,
diGraph< wType > &  result 
)
inline

Computes the graph that represents flow-induced relations on Morse sets.

The vertices of the result graph are the first "nVert" vertices from the source graph. An edge is added to the new graph iff there exists a path from one vertex to another. Edges that come from the transitive closure are not added.

Definition at line 3976 of file digraph.h.

3978{
3979 // remember the number of vertices in the input graph
3980 int_t nVertG = g. countVertices ();
3981 if (!nVertG)
3982 return 0;
3983
3984 // mark each vertex as non-visited
3985 BitField visited;
3986 visited. allocate (nVertG);
3987 visited. clearall (nVertG);
3988
3989 // create the sets of vertices reachable from each vertex
3990 BitSets lists (nVertG, nVert);
3991
3992 // prepare stacks for the DFS algorithm
3993 std::stack<int_t> s_vertex;
3994 std::stack<int_t> s_edge;
3995
3996 // use DFS to propagate the reachable sets
3997 int_t startVertex = 0;
3998 int_t vertex = 0;
3999 int_t edge = 0;
4000 visited. set (vertex);
4001 while (1)
4002 {
4003 // go back with the recursion
4004 // if all the edges have been processed
4005 if (edge >= g. countEdges (vertex))
4006 {
4007 // if this was the top recursion level,
4008 // then find another starting point or quit
4009 if (s_vertex. empty ())
4010 {
4011 while ((startVertex < nVertG) &&
4012 (visited. test (startVertex)))
4013 ++ startVertex;
4014 if (startVertex >= nVertG)
4015 break;
4016 vertex = startVertex;
4017 edge = 0;
4018 visited. set (vertex);
4019 continue;
4020 }
4021
4022 // determine the previous vertex (to trace back to)
4023 int_t prev = s_vertex. top ();
4024
4025 // add the list of the current vertex
4026 // to the list of the previous vertex
4027 // unless that was one of the first 'nVert' vertices
4028 if (vertex >= nVert)
4029 lists. addset (prev, vertex);
4030
4031 // return from the recursion
4032 vertex = prev;
4033 s_vertex. pop ();
4034 edge = s_edge. top ();
4035 s_edge. pop ();
4036 continue;
4037 }
4038
4039 // take the next vertex
4040 int_t next = g. getEdge (vertex, edge ++);
4041
4042 // add the number to the list if appropriate
4043 if (next < nVert)
4044 lists. add (vertex, next);
4045
4046 // go to the deeper recursion level if vertex not visited
4047 if (!visited. test (next))
4048 {
4049 // store the previous variables at the stacks
4050 s_vertex. push (vertex);
4051 s_edge. push (edge);
4052
4053 // take the new vertex and mark as visited
4054 vertex = next;
4055 edge = 0;
4056 visited. set (vertex);
4057 }
4058
4059 // add the list of the next vertex to the current one
4060 // if the vertex has already been visited before
4061 // and the vertex is not one of the first 'nVert' ones
4062 else if (next >= nVert)
4063 {
4064 lists. addset (vertex, next);
4065 }
4066 }
4067
4068 // create the result graph based on the lists of edges
4069 for (int_t vertex = 0; vertex < nVert; ++ vertex)
4070 {
4071 result. addVertex ();
4072 int_t edge = lists. get (vertex);
4073 while (edge >= 0)
4074 {
4075 result. addEdge (edge);
4076 edge = lists. get (vertex, edge + 1);
4077 }
4078 }
4079
4080 // free memory and exit
4081 visited. free ();
4082 return 0;
4083} /* inclusionGraph */
This class uses bit representation to store many small sets.
Definition: bitsets.h:58

◆ inclusionGraph() [2/2]

template<class wType , class TConn >
int_t chomp::homology::inclusionGraph ( const diGraph< wType > &  g,
int_t  nVert,
diGraph< wType > &  result,
TConn &  connections 
)
inline

A more complicated version of the 'inclusionGraph' function.

Computes the graph that represents flow-induced relations on Morse sets. The vertices of the result graph are the first "nVert" vertices from the source graph. An edge is added to the new graph iff there exists a path from one vertex to another. Edges that come from the transitive closure are not added. Records vertices along connecting orbits using operator () with the following arguments: source, target, vertex.

Definition at line 4096 of file digraph.h.

4098{
4099 // remember the number of vertices in the input graph
4100 int_t nVertG = g. countVertices ();
4101 if (!nVertG)
4102 return 0;
4103
4104 // mark each vertex as non-visited
4105 BitField visited;
4106 visited. allocate (nVertG);
4107 visited. clearall (nVertG);
4108
4109 // create the sets of vertices reachable from each vertex
4110 BitSets forwardlists (nVertG, nVert);
4111
4112 // prepare stacks for the DFS algorithm
4113 std::stack<int_t> s_vertex;
4114 std::stack<int_t> s_edge;
4115
4116 // use DFS to propagate the reachable sets
4117 int_t startVertex = 0;
4118 int_t vertex = 0;
4119 int_t edge = 0;
4120 visited. set (vertex);
4121 while (1)
4122 {
4123 // go back with the recursion
4124 // if all the edges have been processed
4125 if (edge >= g. countEdges (vertex))
4126 {
4127 // if this was the top recursion level,
4128 // then find another starting point or quit
4129 if (s_vertex. empty ())
4130 {
4131 while ((startVertex < nVertG) &&
4132 (visited. test (startVertex)))
4133 ++ startVertex;
4134 if (startVertex >= nVertG)
4135 break;
4136 vertex = startVertex;
4137 edge = 0;
4138 visited. set (vertex);
4139 continue;
4140 }
4141
4142 // determine the previous vertex (to trace back to)
4143 int_t prev = s_vertex. top ();
4144
4145 // add the list of the current vertex
4146 // to the list of the previous vertex
4147 // unless that was one of the first 'nVert' vertices
4148 if (vertex >= nVert)
4149 forwardlists. addset (prev, vertex);
4150
4151 // return from the recursion
4152 vertex = prev;
4153 s_vertex. pop ();
4154 edge = s_edge. top ();
4155 s_edge. pop ();
4156 continue;
4157 }
4158
4159 // take the next vertex
4160 int_t next = g. getEdge (vertex, edge ++);
4161
4162 // add the number to the list if appropriate
4163 if (next < nVert)
4164 forwardlists. add (vertex, next);
4165
4166 // go to the deeper recursion level if vertex not visited
4167 if (!visited. test (next))
4168 {
4169 // store the previous variables at the stacks
4170 s_vertex. push (vertex);
4171 s_edge. push (edge);
4172
4173 // take the new vertex and mark as visited
4174 vertex = next;
4175 edge = 0;
4176 visited. set (vertex);
4177 }
4178
4179 // add the list of the next vertex to the current one
4180 // if the vertex has already been visited before
4181 // and the vertex is not one of the first 'nVert' ones
4182 else if (next >= nVert)
4183 {
4184 forwardlists. addset (vertex, next);
4185 }
4186 }
4187
4188 // ------------------------------------------
4189
4190 // create the sets of vertices that can reach each vertex
4191 BitSets backlists (nVertG, nVert);
4192
4193 diGraph<wType> gT;
4194 g. transpose (gT);
4195
4196 // do a simple test for debugging purposes
4197 if (!s_vertex. empty () || !s_edge. empty ())
4198 throw "DEBUG: Nonempty stacks in 'inclusionGraph'.";
4199
4200 // mark all the vertices as unvisited for the backward run
4201 visited. clearall (nVertG);
4202
4203 // use DFS to propagate the reachable sets
4204 startVertex = 0;
4205 vertex = 0;
4206 edge = 0;
4207 visited. set (vertex);
4208 while (1)
4209 {
4210 // go back with the recursion
4211 // if all the edges have been processed
4212 if (edge >= gT. countEdges (vertex))
4213 {
4214 // if this was the top recursion level,
4215 // then find another starting point or quit
4216 if (s_vertex. empty ())
4217 {
4218 while ((startVertex < nVertG) &&
4219 (visited. test (startVertex)))
4220 ++ startVertex;
4221 if (startVertex >= nVertG)
4222 break;
4223 vertex = startVertex;
4224 edge = 0;
4225 visited. set (vertex);
4226 continue;
4227 }
4228
4229 // determine the previous vertex (to trace back to)
4230 int_t prev = s_vertex. top ();
4231
4232 // add the list of the current vertex
4233 // to the list of the previous vertex
4234 // unless that was one of the first 'nVert' vertices
4235 if (vertex >= nVert)
4236 backlists. addset (prev, vertex);
4237
4238 // return from the recursion
4239 vertex = prev;
4240 s_vertex. pop ();
4241 edge = s_edge. top ();
4242 s_edge. pop ();
4243 continue;
4244 }
4245
4246 // take the next vertex
4247 int_t next = gT. getEdge (vertex, edge ++);
4248
4249 // add the number to the list if appropriate
4250 if (next < nVert)
4251 backlists. add (vertex, next);
4252
4253 // go to the deeper recursion level if vertex not visited
4254 if (!visited. test (next))
4255 {
4256 // store the previous variables at the stacks
4257 s_vertex. push (vertex);
4258 s_edge. push (edge);
4259
4260 // take the new vertex and mark as visited
4261 vertex = next;
4262 edge = 0;
4263 visited. set (vertex);
4264 }
4265
4266 // add the list of the next vertex to the current one
4267 // if the vertex has already been visited before
4268 // and the vertex is not one of the first 'nVert' ones
4269 else if (next >= nVert)
4270 {
4271 backlists. addset (vertex, next);
4272 }
4273 }
4274
4275 // ------------------------------------------
4276
4277 // record the connections to the obtained data structure
4278 for (int_t v = nVert; v < nVertG; ++ v)
4279 {
4280 int_t bvertex = backlists. get (v);
4281 while (bvertex >= 0)
4282 {
4283 int_t fvertex = forwardlists. get (v);
4284 while (fvertex >= 0)
4285 {
4286 connections (bvertex, fvertex, v);
4287 fvertex = forwardlists. get (v, fvertex + 1);
4288 }
4289 bvertex = backlists. get (v, bvertex + 1);
4290 }
4291 }
4292
4293 // ------------------------------------------
4294
4295 // create the result graph based on the lists of edges
4296 for (int_t vertex = 0; vertex < nVert; ++ vertex)
4297 {
4298 result. addVertex ();
4299 int_t edge = forwardlists. get (vertex);
4300 while (edge >= 0)
4301 {
4302 result. addEdge (edge);
4303 edge = forwardlists. get (vertex, edge + 1);
4304 }
4305 }
4306
4307 // free memory and exit
4308 visited. free ();
4309 return 0;
4310} /* inclusionGraph */

◆ IndexPairM()

template<class TSetOfCubes , class TMap >
int chomp::homology::IndexPairM ( const TMap &  F,
const TSetOfCubes &  initialS,
TSetOfCubes &  resultQ1,
TSetOfCubes &  resultQ2 
)

Constructs a combinatorial index pair satisfying Mrozek's definition.

The initial set S must be invariant, or otherwise some of its cubes may not be included in the resulting invariant set.

Definition at line 361 of file indxpalg.h.

363{
364 // prepare the initial guess for S and N
365 TSetOfCubes S = initialS;
366 TSetOfCubes N;
367 neighborhood (S, N);
368
369 sout << "Starting with " << S. size () << " cubes in S_0, " <<
370 N. size () << " cubes in N.\n";
371 while (1)
372 {
373
374 // compute S := Inv (N)
375 sout << "S := Inv(N)... ";
376 scon << "(computing)\b\b\b\b\b\b\b\b\b\b\b";
377 TSetOfCubes empty;
378 S = empty;
379 // S = initialS;
380 invariantpart (N, F, S);
381 sout << S. size () << " cubes; o(S) has ";
382
383 // compute N' := o (S)
384 TSetOfCubes newN;
385 neighborhood (S, newN);
386 sout << newN. size () << " cubes.\n";
387
388 // if Int (N) contains Inv (N), then exit
389 if (inclusion (newN, N))
390 break;
391 // otherwise take a larget N and repeat
392 else
393 {
394 sout << "Set N := o(S). ";
395 N = newN;
396 }
397 }
398
399 // compute the index pair (Q1 \cup Q2, Q2)
400 resultQ1 = S;
401 ExitSetM (N, S, F, resultQ2);
402 return 0;
403} /* IndexPairM */
int ExitSetM(const TSetOfCubes &N, const TSetOfCubes &Q1, const TMap &F, TSetOfCubes &resultQ2)
Computes iteratively Q2 := (F (Q1 + Q2) - Q1) * N.
Definition: indxpalg.h:328
int neighborhood(const TSetOfCubes &X, TSetOfCubes &result)
Computes a cubical neighborhood of width 1 around the set.
Definition: indxpalg.h:190
void invariantpart(TSetOfCubes &X, const TMap &F, TSetOfCubes &result)
Computes X := Inv (X).
Definition: indxpalg.h:238

References ExitSetM(), inclusion(), invariantpart(), neighborhood(), scon, and sout.

◆ IndexPairP()

template<class TSetOfCubes , class TMap >
int chomp::homology::IndexPairP ( const TMap &  F,
const TSetOfCubes &  initialS,
TSetOfCubes &  resultQ1,
TSetOfCubes &  resultQ2 
)

Constructs a combinatorial index pair satisfying Pilarczyk's definition.

The initial set S must be an approximation of the invariant set for the map, for example, a rough covering obtained in numerical simulations.

Definition at line 414 of file indxpalg.h.

416{
417 resultQ1 = initialS;
418
419 // compute the initial Q2 = f (Q1) - Q1
420 sout << "Computing the map on Q1 (" << resultQ1. size () <<
421 " cubes)... ";
422 for (int_t i = 0; i < resultQ1. size (); ++ i)
423 {
424 const TSetOfCubes &img = F (resultQ1 [i]);
425 for (int_t j = 0; j < img. size (); ++ j)
426 {
427 if (!resultQ1. check (img [j]))
428 resultQ2. add (img [j]);
429 }
430 }
431 sout << resultQ2. size () << " cubes added to Q2.\n";
432
433// sout << "Starting with " << resultQ1. size () <<
434// " cubes in Q1, " << resultQ2. size () <<
435// " cubes in Q2.\n";
436
437 // compute images of cubes in Q2 and if any of them intersects Q1
438 // then move this cube from Q2 to Q1
439 sout << "Increasing Q1 and Q2 until F(Q2) is disjoint from Q1... ";
440 int_t counter = 0;
441 int_t countimages = 0;
442 int_t cur = 0;
443 TSetOfCubes removed;
444 while (1)
445 {
446 // if there are no cubes in Q2, repeat or finish
447 if (cur >= resultQ2. size ())
448 {
449 if (removed. empty ())
450 break;
451 resultQ2. remove (removed);
452 TSetOfCubes empty;
453 removed = empty;
454 cur = 0;
455 continue;
456 }
457
458 // display a counter
459 ++ counter;
460 if (!(counter % 373))
461 scon << std::setw (12) << counter <<
462 "\b\b\b\b\b\b\b\b\b\b\b\b";
463
464 // verify whether F(q) intersects Q1
465 bool intersects = false;
466 const TSetOfCubes &img = F (resultQ2 [cur]);
467 ++ countimages;
468 for (int_t j = 0; j < img. size (); ++ j)
469 {
470 if (resultQ1. check (img [j]))
471 {
472 intersects = true;
473 break;
474 }
475 }
476
477 if (intersects)
478 {
479 // add F(q)\Q1 to Q2
480 for (int_t j = 0; j < img. size (); ++ j)
481 {
482 if (!resultQ1. check (img [j]))
483 resultQ2. add (img [j]);
484 }
485 // move q from Q2 to Q1
486 resultQ1. add (resultQ2 [cur]);
487 removed. add (resultQ2 [cur]);
488 }
489
490 // take the next cube from Q2
491 ++ cur;
492 }
493 sout << countimages << " analyzed.\n";
494 return 0;
495} /* IndexPairP */

References scon, and sout.

◆ int2bits()

void chomp::homology::int2bits ( int  bits,
int_t  length,
BitField field 
)
inline

The length must not exceed the size of the integer.

Definition at line 201 of file bitfield.h.

202{
203 unsigned char *tab = field. table;
204 if (!tab)
205 throw "Trying to set values to an undefined bitfield.";
206 while (length >= 0)
207 {
208 *(tab ++) = static_cast<unsigned char> (bits & 0xFF);
209 bits >>= 8;
210 length -= 8;
211 }
212 return;
213} /* int2bits */

◆ intersection2l()

template<class tCube >
bool chomp::homology::intersection2l ( const tCube &  q0,
const tCube &  q1,
BitField bits 
)

Computes the intersection between two cubes at different layers.

One cube is at layer 1, and the other is at layer 0, but not in the set on which the identification takes place. The intersection directions are marked in the given bit field. Returns true iff the intersection is nonempty.

Definition at line 968 of file twolayer.h.

969{
970 // determine the set of cells at the intersection of layers
973
974 // compute the intersection of the cubes
975 typename tCube::CellType intersection (q0, q1);
977 faces. add (intersection);
978
979 // check all the faces of the cells
980 int_t current = 0;
981 int_t counter = 0;
982 while (current < faces. size ())
983 {
984 const typename tCube::CellType &face = faces [current ++];
985 if (ident. check (face))
986 {
987 if (bits)
988 bits -> set (neighbor2bit (q0, face));
989 ++ counter;
990 }
991 else
992 {
993 for (int_t i = 0; i < boundarylength (face); ++ i)
994 faces. add (boundarycell (face, i));
995 }
996 }
997 return (counter > 0);
998} /* intersection2l */
int boundarylength(const tCell2l< tCell > &q)
Returns the length of the boundary of a cell.
Definition: twolayer.h:924
tCell2l< tCell > boundarycell(const tCell2l< tCell > &q, int i)
Computes the given boundary element of a cell.
Definition: twolayer.h:914

References boundarycell(), boundarylength(), chomp::homology::tCell2l< tCell >::identify(), and neighbor2bit().

Referenced by getneighbors_generate(), and getneighbors_scan().

◆ invariantpart()

template<class TSetOfCubes , class TMap >
void chomp::homology::invariantpart ( TSetOfCubes &  X,
const TMap &  F,
TSetOfCubes &  result 
)

Computes X := Inv (X).

New algorithm by Bill Kalies and Hyunju Ban. If the graph 'gInv' is given, then the resulting graph is created, otherwise only the set X is modified.

Definition at line 238 of file indxpalg.h.

239{
240 // do nothing if the set X is empty
241 int_t ncount = X. size ();
242 if (!ncount)
243 return;
244
245 // create a digraph of the map
246 diGraph<> g;
247 for (int_t n = 0; n < ncount; ++ n)
248 {
249 g. addVertex ();
250 const TSetOfCubes &img = F (X [n]);
251 int_t icount = img. size ();
252 for (int_t i = 0; i < icount; ++ i)
253 {
254 int_t number = X. getnumber (img [i]);
255 if (number < 0)
256 continue;
257 g. addEdge (number);
258 }
259 }
260
261 // compute the chain recurrent set of the graph
262 // and remember the transposed graph
263 multitable<int_t> compVertices, compEnds;
264 diGraph<> gT;
265 int_t count = SCC (g, compVertices, compEnds,
266 static_cast<diGraph<> *> (0), &gT);
267
268 // retrieve vertices that can be reached from the chain recurrent set
269 int_t nVertices = ncount;
270 char *forward = new char [nVertices];
271 for (int_t i = 0; i < nVertices; ++ i)
272 forward [i] = 0;
273 for (int_t cur = 0; cur < count; ++ cur)
274 {
275 g. DFScolor (forward, '\1',
276 compVertices [cur ? compEnds [cur - 1] :
277 static_cast<int_t> (0)]);
278 }
279
280 // retrieve vertices that can reach the chein recurrent set
281 char *backward = new char [nVertices];
282 for (int_t i = 0; i < nVertices; ++ i)
283 backward [i] = 0;
284 for (int_t cur = 0; cur < count; ++ cur)
285 {
286 gT. DFScolor (backward, '\1',
287 compVertices [cur ? compEnds [cur - 1] :
288 static_cast<int_t> (0)]);
289 }
290
291 // compute the new set of cubes
292 for (int_t i = 0; i < nVertices; ++ i)
293 if (forward [i] && backward [i])
294 result. add (X [i]);
295
296 // clean the memory and return
297 delete [] backward;
298 delete [] forward;
299 return;
300} /* invariantpart */
This class defines a directed graph with very limited number of operations, and a few specific algori...
Definition: digraph.h:143
int_t SCC(const diGraph< wType > &g, Table1 &compVertices, Table2 &compEnds, diGraph< wType > *scc=0, diGraph< wType > *transposed=0, bool copyweights=false)
Computes strongly connected components of the graph 'g'.
Definition: digraph.h:2392

References SCC().

Referenced by IndexPairM().

◆ makesetunion()

template<class set1type , class set2type >
setunion< set1type, set2type > chomp::homology::makesetunion ( const set1type &  set1,
const set2type &  set2 
)
inline

Creates an object which represents the union of two sets.

Definition at line 225 of file setunion.h.

227{
228 return setunion<set1type,set2type> (set1, set2);
229} /* makesetunion */
A union of two hashed sets.
Definition: setunion.h:61

Referenced by acyclic_rel(), chomp::homology::reduction0::cubreducequiet(), and chomp::homology::reduction1::cubreducequiet().

◆ matrix2graph()

template<class wType , class matrix >
void chomp::homology::matrix2graph ( const matrix &  m,
int_t  n,
diGraph< wType > &  g 
)
inline

Creates a graph based on the given adjacency matrix.

If m [i] [j] is nonzero, then the edge i -> j is added to the graph. It is assumed that the graph g is initially empty. The size of the matrix (the number of vertices), n, must be given.

Definition at line 4338 of file digraph.h.

4339{
4340 for (int_t v = 0; v < n; ++ v)
4341 {
4342 g. addVertex ();
4343 for (int_t w = 0; w < n; ++ w)
4344 if (m [v] [w])
4345 g. addEdge (w);
4346 }
4347 return;
4348} /* matrix2graph */

Referenced by transitiveReduction().

◆ neighbor2bit() [1/3]

template<class tCube >
int_t chomp::homology::neighbor2bit ( const tCube &  q,
const tCube &  neighbor 
)

Returns the number of the neighbor bit for the given neighbor of 'q' or -1 if not a neighbor or the same cube as 'q'.

Definition at line 84 of file neighbor.h.

85{
86 // define the type of coordinates
87 typedef typename tCube::CoordType coordType;
88
89 coordType c0 [tCube::MaxDim];
90 q. coord (c0);
91 coordType c1 [tCube::MaxDim];
92 neighbor. coord (c1);
93 int dim = q. dim ();
94
95 int_t number = 0;
96 const coordType *wrap = tCube::PointBase::getwrapping (dim);
97 for (int i = 0; i < dim; ++ i)
98 {
99 if (i)
100 number *= 3;
101 switch (c1 [i] - c0 [i])
102 {
103 case -1:
104 ++ number;
105 case 1:
106 ++ number;
107 break;
108 case 0:
109 break;
110 default:
111 if (!wrap || !wrap [i])
112 return -1;
113 if ((c1 [i] - c0 [i]) == (wrap [i] - 1))
114 number += 2;
115 else if ((c1 [i] - c0 [i]) == (1 - wrap [i]))
116 ++ number;
117 else
118 return -1;
119 break;
120 }
121 }
122
123 return number - 1;
124} /* neighbor2bit */

Referenced by getneighbors_scan(), and intersection2l().

◆ neighbor2bit() [2/3]

template<class tCube >
int_t chomp::homology::neighbor2bit ( const tCube &  q,
const typename tCube::CellType &  face 
)

Returns the number of the neighbor bit for the neighbor which intersects the given cube at the face provided.

Definition at line 129 of file neighbor.h.

130{
131 // define the type of coordinates
132 typedef typename tCube::CoordType coordType;
133
134 // determine the space dimension and the coordinates of the input
135 int dim = q. dim ();
136 coordType coord [tCube::MaxDim];
137 q. coord (coord);
138 coordType cLeft [tCube::MaxDim];
139 face. leftcoord (cLeft);
140 coordType cRight [tCube::MaxDim];
141 face. rightcoord (cRight);
142
143 // compute the number of the neighbor based on the coordinates
144 int_t number = 0;
145 for (int i = 0; i < dim; ++ i)
146 {
147 if (i)
148 number *= 3;
149 // if the neighbor is shifted upwards
150 if (cLeft [i] != coord [i])
151 number += 1;
152 // if the neighbor is shifted downwards
153 else if (cRight [i] == cLeft [i])
154 number += 2;
155 // otherwise the neighbor is at the same level
156 }
157
158 return number - 1;
159} /* neighbor2bit */

◆ neighbor2bit() [3/3]

template<class tCube >
int_t chomp::homology::neighbor2bit ( const tCube2l< tCube > &  q,
const tCube2l< tCube > &  neighbor 
)

Specialization of the "neighbor2bit" function for two-layer cubes.

Throws an exception, because there might be more than one bit which cescribes the intersection.

Definition at line 956 of file twolayer.h.

957{
958 throw "Trying to use 'neighbor2bit' for a 2-layer cube.";
959 return -1;
960} /* neighbor2bit */

◆ neighborhood()

template<class TSetOfCubes >
int chomp::homology::neighborhood ( const TSetOfCubes &  X,
TSetOfCubes &  result 
)

Computes a cubical neighborhood of width 1 around the set.

Definition at line 190 of file indxpalg.h.

191{
192 // extract the necessary types and constants
193 using namespace chomp::homology;
194 typedef typename TSetOfCubes::value_type cubetype;
195 typedef typename cubetype::CoordType coordtype;
197 const int maxdim = cubetype::MaxDim;
198
199 // create arrays for the corners of a rectangle around each cube
200 coordtype mincoord [maxdim], maxcoord [maxdim];
201
202 // for all the cubes in X
203 int_t ncount = X. size ();
204 for (int_t n = 0; n < ncount; ++ n)
205 {
206 // get the coordinates of the cube
207 int dim = X [n]. dim ();
208 X [n]. coord (mincoord);
209
210 // prepare the corners of a rectangle for the cube
211 // and its neighbors
212 for (int i = 0; i < dim; ++ i)
213 {
214 maxcoord [i] = mincoord [i];
215 ++ maxcoord [i];
216 ++ maxcoord [i];
217 -- mincoord [i];
218 }
219
220 // add cubes from the rectangle to the resulting set
221 rectangle r (mincoord, maxcoord, dim);
222 const coordtype *c;
223 while ((c = r. get ()) != 0)
224 result. add (cubetype (c, dim));
225 }
226 return 0;
227} /* neighborhood */
This class can be used for iterating a rectangular set of points, given its left and right bound.
Definition: pointset.h:1627
tRectangle< coordinate > rectangle
The rectangle class with the default type of coordinates.
Definition: pointset.h:87

Referenced by IndexPairM().

◆ numberisprime()

bool chomp::homology::numberisprime ( unsigned  n)
inline

Verifies if the given number is a prime number.

Returns: true = Yes, false = No.

Definition at line 155 of file pointset.h.

156{
157 if (n < 2)
158 return false;
159
160 unsigned i = 2;
161 while (i * i <= n)
162 if (!(n % i ++))
163 return false;
164
165 return true;
166} /* numberisprime */

Referenced by ceilprimenumber().

◆ operator!=() [1/16]

int chomp::homology::operator!= ( const char *  c,
const word w 
)
inline

Compares a C-style string with a word.

Definition at line 295 of file words.h.

296{
297 return (w != c);
298} /* operator != */

◆ operator!=() [2/16]

template<class wType1 , class wType2 >
bool chomp::homology::operator!= ( const diGraph< wType1 > &  g1,
const diGraph< wType2 > &  g2 
)
inline

Definition at line 622 of file digraph.h.

624{
625 return !(g1 == g2);
626} /* operator != */

◆ operator!=() [3/16]

int chomp::homology::operator!= ( const integer n,
const integer m 
)
inline

Definition at line 365 of file integer.h.

366{
367 return (!(n == m));
368} /* operator != */

◆ operator!=() [4/16]

int chomp::homology::operator!= ( const integer n,
int  m 
)
inline

Definition at line 377 of file integer.h.

378{
379 return !(n == m);
380} /* operator != */

◆ operator!=() [5/16]

int chomp::homology::operator!= ( const Simplex s,
const Simplex t 
)
inline

The operator != verifies if the two simplices are different.

Definition at line 323 of file simplex.h.

324{
325 return !(s == t);
326} /* operator != */

◆ operator!=() [6/16]

template<class tCell >
int chomp::homology::operator!= ( const tCell2l< tCell > &  c1,
const tCell2l< tCell > &  c2 
)
inline

The operator != verifies whether two cubes are different.

(Uses the == operator.)

Definition at line 843 of file twolayer.h.

845{
846 return !(c1 == c2);
847} /* operator != */

◆ operator!=() [7/16]

template<class coordtype >
int chomp::homology::operator!= ( const tCellBase< coordtype > &  c1,
const tCellBase< coordtype > &  c2 
)
inline

Checks if the two cells are different.

Definition at line 427 of file cellbase.h.

429{
430 return !(c1 == c2);
431} /* operator != */

◆ operator!=() [8/16]

template<int dimfix, class coordtype >
int chomp::homology::operator!= ( const tCellFix< dimfix, coordtype > &  c1,
const tCellFix< dimfix, coordtype > &  c2 
)
inline

Checks if the two cells are different.

Definition at line 445 of file cellfix.h.

447{
448 return !(c1 == c2);
449} /* operator != */

◆ operator!=() [9/16]

template<class coordtype >
int chomp::homology::operator!= ( const tCellVar< coordtype > &  c1,
const tCellVar< coordtype > &  c2 
)
inline

Checks if the two cells are different.

Definition at line 501 of file cellvar.h.

503{
504 return !(c1 == c2);
505} /* operator != */

◆ operator!=() [10/16]

template<class tCube >
int chomp::homology::operator!= ( const tCube2l< tCube > &  c1,
const tCube2l< tCube > &  c2 
)
inline

The operator != verifies whether two cubes are different.

(Uses the == operator.)

Definition at line 398 of file twolayer.h.

400{
401 return !(c1 == c2);
402} /* operator != */

◆ operator!=() [11/16]

template<class coordtype >
int chomp::homology::operator!= ( const tCubeBase< coordtype > &  c1,
const tCubeBase< coordtype > &  c2 
)
inline

The operator != for comparing full cubes.

Definition at line 271 of file cubebase.h.

273{
274 return !(c1 == c2);
275} /* operator != */

◆ operator!=() [12/16]

template<int dim1, int dim2, class coordtype >
int chomp::homology::operator!= ( const tCubeFix< dim1, coordtype > &  c1,
const tCubeFix< dim2, coordtype > &  c2 
)
inline

The operator != for comparing full cubes.

Definition at line 263 of file cubefix.h.

265{
266 return !(c1 == c2);
267} /* operator != */

◆ operator!=() [13/16]

template<class coordtype >
int chomp::homology::operator!= ( const tCubeVar< coordtype > &  c1,
const tCubeVar< coordtype > &  c2 
)
inline

The operator != for comparing full cubes.

Definition at line 327 of file cubevar.h.

329{
330 return !(c1 == c2);
331} /* operator != */

◆ operator!=() [14/16]

template<int Dim, int twoPower>
bool chomp::homology::operator!= ( const typename bincube< Dim, twoPower >::neighborhood_iterator &  x1,
const typename bincube< Dim, twoPower >::neighborhood_iterator &  x2 
)
inline

Definition at line 793 of file bincube.h.

796{
797// sout << "DEBUG !=\n";
798 return !(x1 == x2);
799} /* bincube::neighborhood_iterator::operator != */

◆ operator!=() [15/16]

int chomp::homology::operator!= ( const word w,
const char *  c 
)
inline

Compares a word with a C-style string.

Definition at line 283 of file words.h.

284{
285 return !(w == c);
286} /* operator != */

◆ operator!=() [16/16]

int chomp::homology::operator!= ( const word w1,
const word w2 
)
inline

Compares two words. Returns 0 if they are the same, 1 otherwise.

Definition at line 269 of file words.h.

270{
271 return !(w1 == w2);
272} /* operator != */

◆ operator*() [1/8]

template<class tCell >
tCell2l< tCell > chomp::homology::operator* ( const tCell2l< tCell > &  c1,
const tCell2l< tCell > &  c2 
)
inline

The operator * computes the Cartesian product of two cells.

Definition at line 851 of file twolayer.h.

853{
854 tCell q (c1. cell () * c2. cell ());
856 l ((c1. layer () << 2) | c2. layer ());
857 return tCell2l<tCell> (q, l);
858} /* operator * */

◆ operator*() [2/8]

template<class coordtype >
tCellBase< coordtype > chomp::homology::operator* ( const tCellBase< coordtype > &  c1,
const tCellBase< coordtype > &  c2 
)
inline

Computes the Cartesian product of two cells.

Definition at line 437 of file cellbase.h.

440{
441 // get the underlying space dimensions for both cells
442 int d1 = c1. spacedim (), d2 = c2. spacedim ();
443 if (d1 + d2 >= tCellBase<coordtype>::MaxDim)
444 throw "Too high dimension of a Cartesian product of cells.";
445
446 // prepare arrays for the coordinates of the cell to create
447 coordtype left [tCellBase<coordtype>::MaxDim];
448 coordtype right [tCellBase<coordtype>::MaxDim];
449
450 // extract the coordinates of the first cell
451 c1. leftcoord (left);
452 c1. rightcoord (right);
453
454 // extract the coordinates of the second cell
455 c2. leftcoord (left + d1);
456 c2. rightcoord (right + d1);
457
458 // create the Cartesian product of the cells
459 return tCellBase<coordtype> (left, right, d1 + d2,
460 c1. dim () + c2. dim ());
461} /* operator * */
This class defines cubical cell in R^n with edges parallel to the axes and with size 0 or 1 in each d...
Definition: cellbase.h:69

◆ operator*() [3/8]

template<int dim1, int dim2, class coordtype >
tCellFix< dim1+dim2, coordtype > chomp::homology::operator* ( const tCellFix< dim1, coordtype > &  c1,
const tCellFix< dim2, coordtype > &  c2 
)
inline

Computes the Cartesian product of two cells.

Definition at line 455 of file cellfix.h.

458{
459 // prepare arrays for the coordinates of the cell to create
460 coordtype left [dim1 + dim2];
461 coordtype right [dim1 + dim2];
462
463 // extract the coordinates of the first cell
464 c1. leftcoord (left);
465 c1. rightcoord (right);
466
467 // extract the coordinates of the second cell
468 c2. leftcoord (left + dim1);
469 c2. rightcoord (right + dim1);
470
471 // create the Cartesian product of the cells
472 return tCellFix<dim1+dim2,coordtype> (left, right,
473 dim1 + dim2, c1. dim () + c2. dim ());
474} /* operator * */
This class defines cubical cell in R^n with edges parallel to the axes and with size 0 or 1 in each d...
Definition: cellfix.h:69

◆ operator*() [4/8]

template<class coordtype >
tCellVar< coordtype > chomp::homology::operator* ( const tCellVar< coordtype > &  c1,
const tCellVar< coordtype > &  c2 
)
inline

Computes the Cartesian product of two cells.

Definition at line 511 of file cellvar.h.

514{
515 // get the underlying space dimensions for both cells
516 int d1 = c1. spacedim (), d2 = c2. spacedim ();
517 if (d1 + d2 >= tCellVar<coordtype>::MaxDim)
518 throw "Too high dimension of a Cartesian product of cells.";
519
520 // prepare arrays for the coordinates of the cell to create
521 coordtype left [tCellVar<coordtype>::MaxDim];
522 coordtype right [tCellVar<coordtype>::MaxDim];
523
524 // extract the coordinates of the first cell
525 c1. leftcoord (left);
526 c1. rightcoord (right);
527
528 // extract the coordinates of the second cell
529 c2. leftcoord (left + d1);
530 c2. rightcoord (right + d1);
531
532 // create the Cartesian product of the cells
533 return tCellVar<coordtype> (left, right, d1 + d2,
534 c1. dim () + c2. dim ());
535} /* operator * */
This class defines cubical cell in R^n with edges parallel to the axes and with size 0 or 1 in each d...
Definition: cellvar.h:68

◆ operator*() [5/8]

template<class tCube >
tCube2l< tCube > chomp::homology::operator* ( const tCube2l< tCube > &  c1,
const tCube2l< tCube > &  c2 
)
inline

The operator * computes the Cartesian product of two cubes.

Definition at line 406 of file twolayer.h.

408{
409 tCube q (c1. cube () * c2. cube ());
411 l ((c1. layer () << 2) | c2. layer ());
412 return tCube2l<tCube> (q, l);
413} /* operator * */

◆ operator*() [6/8]

template<class coordtype >
tCubeBase< coordtype > chomp::homology::operator* ( const tCubeBase< coordtype > &  c1,
const tCubeBase< coordtype > &  c2 
)
inline

Computes the Cartesian product of two cubes.

Definition at line 281 of file cubebase.h.

283{
284 int dim1 = c1. dim (), dim2 = c2. dim ();
285 if (dim1 + dim2 >= tCubeBase<coordtype>::MaxDim)
286 throw "Dimension too high to concatenate coordinates.";
287 coordtype coord [tCubeBase<coordtype>::MaxDim];
288 c1. coord (coord);
289 c2. coord (coord + dim1);
290 return tCubeBase<coordtype> (coord, dim1 + dim2);
291} /* operator * */

◆ operator*() [7/8]

template<int dim1, int dim2, class coordtype >
tCubeFix< dim1+dim2, coordtype > chomp::homology::operator* ( const tCubeFix< dim1, coordtype > &  c1,
const tCubeFix< dim2, coordtype > &  c2 
)
inline

Computes the Cartesian product of two cubes.

Definition at line 273 of file cubefix.h.

276{
277 coordtype coord [dim1 + dim2];
278 c1. coord (coord);
279 c2. coord (coord + dim1);
280 return tCubeFix<dim1+dim2,coordtype> (coord);
281} /* operator * */
This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each directi...
Definition: cubefix.h:72

◆ operator*() [8/8]

template<class coordtype >
tCubeVar< coordtype > chomp::homology::operator* ( const tCubeVar< coordtype > &  c1,
const tCubeVar< coordtype > &  c2 
)
inline

Computes the Cartesian product of two cubes.

Definition at line 337 of file cubevar.h.

339{
340 int dim1 = c1. dim (), dim2 = c2. dim ();
341 if (dim1 + dim2 >= tCubeVar<coordtype>::MaxDim)
342 throw "Dimension too high to concatenate coordinates.";
343 coordtype coord [tCubeVar<coordtype>::MaxDim];
344 c1. coord (coord);
345 c2. coord (coord + dim1);
346 return tCubeVar<coordtype> (coord, dim1 + dim2);
347} /* operator * */
This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each directi...
Definition: cubevar.h:72

◆ operator+=()

template<class element , class hashkeys >
hashedset< element, hashkeys > & chomp::homology::operator+= ( hashedset< element, hashkeys > &  s,
const hashedset< element, hashkeys > &  u 
)
inline

Operator += adds one hashed set to another.

Definition at line 915 of file hashsets.h.

917{
918 s. add (u);
919 return s;
920} /* operator += */

◆ operator-()

integer chomp::homology::operator- ( const integer n,
const integer m 
)
inline

Definition at line 382 of file integer.h.

383{
384 return (n + -m);
385} /* operator - */

◆ operator-=()

template<class element , class hashkeys >
hashedset< element, hashkeys > & chomp::homology::operator-= ( hashedset< element, hashkeys > &  s,
const hashedset< element, hashkeys > &  u 
)
inline

Operator -= removes the contents of one set from another.

Definition at line 924 of file hashsets.h.

926{
927 s. remove (u);
928 return s;
929} /* operator -= */

◆ operator<() [1/2]

bool chomp::homology::operator< ( const integer x,
const integer y 
)
inline

Definition at line 411 of file integer.h.

412{
413 return (x. num < y. num);
414} /* operator < */

◆ operator<() [2/2]

int chomp::homology::operator< ( const word w1,
const word w2 
)
inline

Compares two words in an alphabetical way (by ASCII codes).

Returns 1 if the first word precedes the second one, 0 otherwise.

Definition at line 304 of file words.h.

305{
306 const char *c1 = (const char *) w1;
307 const char *c2 = (const char *) w2;
308
309 while (*c1 && *c2 && ((*c1) == (*c2)))
310 {
311 ++ c1;
312 ++ c2;
313 }
314 return ((*c1) < (*c2));
315} /* operator < */

◆ operator<<() [1/31]

outputstream & chomp::homology::operator<< ( outputstream out,
const char *  object 
)
inline

A specialization of the operator << for writing a C-style string to the output stream.

Definition at line 248 of file textfile.h.

249{
250 if (out. flush)
251 {
252 if (out. show)
253 out. out << object << std::flush;
254 if (out. log && out. getlogstream ())
255 (*(out. getlogstream ())) << object << std::flush;
256 }
257 else
258 {
259 if (out. show)
260 out. out << object;
261 if (out. log && out. getlogstream ())
262 (*(out. getlogstream ())) << object;
263 }
264 return out;
265} /* operator << */

◆ operator<<() [2/31]

template<typename type >
outputstream & chomp::homology::operator<< ( outputstream out,
const type &  object 
)
inline

The operator << for writing any kind of object to the output stream.

This object is written using the operator << of the standard stream.

Definition at line 227 of file textfile.h.

228{
229 if (out. flush)
230 {
231 if (out. show)
232 out. out << object << std::flush;
233 if (out. log && out. getlogstream ())
234 (*(out. getlogstream ())) << object << std::flush;
235 }
236 else
237 {
238 if (out. show)
239 out. out << object;
240 if (out. log && out. getlogstream ())
241 (*(out. getlogstream ())) << object;
242 }
243 return out;
244} /* operator << */

◆ operator<<() [3/31]

outputstream & chomp::homology::operator<< ( outputstream out,
std::ostream &(*)(std::ostream &)  object 
)
inline

A specialization of the operator << for putting manipulators (like std::endl, std::flush) to the output stream.

Definition at line 269 of file textfile.h.

271{
272 if (out. flush)
273 {
274 if (out. show)
275 out. out << object << std::flush;
276 if (out. log && out. getlogstream ())
277 (*(out. getlogstream ())) << object << std::flush;
278 }
279 else
280 {
281 if (out. show)
282 out. out << object;
283 if (out. log && out. getlogstream ())
284 (*(out. getlogstream ())) << object;
285 }
286 return out;
287} /* operator << */

◆ operator<<() [4/31]

std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const argelement p 
)
inline

Definition at line 235 of file arg.h.

236{
237 p. show (out);
238 return out;
239} /* operator << */

◆ operator<<() [5/31]

template<int Dim, int twoPower>
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const bincube< Dim, twoPower > &  b 
)
inline

Definition at line 907 of file bincube.h.

909{
910 return out. write (static_cast<const char *> (b), b. getbufsize ());
911} /* operator << */
int write(std::ostream &out, const coordtype *c, int dim, char parenthesis=40, char closing=0)
Definition: pointset.h:2148

References chomp::homology::bincube< Dim, twoPower >::getbufsize(), and write().

◆ operator<<() [6/31]

template<class TCube >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const BufferedMapClass< TCube > &  map 
)

Definition at line 176 of file indxpalg.h.

178{
179 out << map. F;
180 return out;
181} /* operator << */

◆ operator<<() [7/31]

template<class euclidom >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const chain< euclidom > &  c 
)
inline

Outputs the given chain to a standard output stream in the text mode.

Warning: The operators >> and << are not symmetric for chains.

Definition at line 885 of file chains.h.

886{
887 c. show (out);
888 return out;
889} /* operator << */

◆ operator<<() [8/31]

template<class euclidom >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const chaincomplex< euclidom > &  c 
)
inline

Writes a chain complex to an output stream in the text format.

Definition at line 3211 of file chains.h.

3213{
3214 out << "chain complex" << '\n';
3215 out << "max dimension " << c. dim () << '\n';
3216 out << "dimension 0: " << c. getnumgen (0) << '\n';
3217 for (int i = 1; i <= c. dim (); ++ i)
3218 {
3219 out << "dimension " << i << ": " << c. getnumgen (i) << '\n';
3220 for (int_t j = 0; j < c. getnumgen (i); ++ j)
3221 {
3222 if (c. getboundary (i). getcol (j). size ())
3223 {
3224 out << "\t# " << (j + 1) << " = " <<
3225 c. getboundary (i). getcol (j) <<
3226 '\n';
3227 }
3228 }
3229 }
3230 return out;
3231} /* operator << */

◆ operator<<() [9/31]

template<class euclidom >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const chainmap< euclidom > &  m 
)
inline

Writes a chain map to an output stream in the text format.

Definition at line 3557 of file chains.h.

3559{
3560 out << "chain map" << '\n';
3561 for (int i = 0; i <= m. dim (); ++ i)
3562 {
3563 out << "dimension " << i << '\n';
3564 for (int_t j = 0; j < m [i]. getncols (); ++ j)
3565 {
3566 if (m [i]. getcol (j). size ())
3567 {
3568 out << "\t# " << (j + 1) << " = " <<
3569 m [i]. getcol (j) << '\n';
3570 }
3571 }
3572 }
3573 return out;
3574} /* operator << */

◆ operator<<() [10/31]

template<class wType >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const diGraph< wType > &  g 
)
inline

Writes a graph in the text mode to an output stream.

Definition at line 2377 of file digraph.h.

2378{
2379 return g. show (out, false);
2380} /* operator << */

◆ operator<<() [11/31]

template<class cell , class euclidom >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const gcomplex< cell, euclidom > &  c 
)

Writes a geometric complex to the output stream in the text format.

Definition at line 1496 of file gcomplex.h.

1498{
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];
1503 return out;
1504} /* operator << */

◆ operator<<() [12/31]

template<class element , class hashkeys >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const hashedset< element, hashkeys > &  s 
)

Writes a hashed set to an output stream as a large one (each element is written on a separate line, with some comments at the beginning).

Definition at line 855 of file hashsets.h.

857{
858 return write (out, s, LARGE_SIZE);
859} /* operator << */
#define LARGE_SIZE
This constant passed to the function 'write' makes the hashed set be displayed in a way that is appro...
Definition: hashsets.h:820
stream & write(stream &out, const hashedset< element, hashkeys > &s, bool size)
Writes the entire hashed set to an output stream in the text mode.
Definition: hashsets.h:826

References LARGE_SIZE, and write().

◆ operator<<() [13/31]

std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const hashstat s 
)
inline

Shows hashing statistics in a concise and readable way to the output stream in the text format.

Definition at line 114 of file hashsets.h.

115{
116 if (!s. hashhits)
117 return out;
118 out << "hashing: " << s. hashhits << " hits, avg " <<
119 ((s. hashhits + s. hashmisses) / s. hashhits) << "." <<
120 ((s. hashhits + s. hashmisses) * 10 / s. hashhits) % 10 <<
121 " attempts (" << s. rehashcount << " times rehashed)";
122 return out;
123} /* operator << */

◆ operator<<() [14/31]

std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const integer n 
)
inline

Definition at line 349 of file integer.h.

350{
351 out << (long) n. num;
352 return out;
353} /* operator << */

◆ operator<<() [15/31]

template<class euclidom >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const mmatrix< euclidom > &  m 
)
inline

Writes a matrix to the output stream as a map in terms of columns.

Warning: The operators >> and << are not symmetric for matrices.

Definition at line 2645 of file chains.h.

2647{
2648 return m. showcols (out);
2649} /* operator << */

◆ operator<<() [16/31]

template<class cell , class euclidom , class element >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const mvcellmap< cell, euclidom, element > &  m 
)

Writes a multivalued cellular map to the output stream.

Definition at line 2066 of file gcomplex.h.

2068{
2069 for (int d = 0; d <= m. dim (); ++ d)
2070 {
2071 out << "; Dimension " << d << ':' << '\n';
2072 const hashedset<cell> &cset = m. get (d);
2073 for (int_t i = 0; i < cset. size (); ++ i)
2074 {
2075 out << cset [i] << " -> ";
2076 write (out, m (cset [i]), SMALL_SIZE) << '\n';
2077 }
2078 }
2079 return out;
2080} /* operator << */
#define SMALL_SIZE
This constant passed to the function 'write' makes the hashed set be displayed in a way that is appro...
Definition: hashsets.h:813

References SMALL_SIZE, and write().

◆ operator<<() [17/31]

template<class domelement , class imgelement >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const mvmap< domelement, imgelement > &  m 
)

Writes a multivalued map to the output stream.

Each assignment is written in such a way that the element of the domain is followed by the space, the arrow "->", another space, and then the image set is written in the small style (in braces, with commas between the elements).

Definition at line 1371 of file hashsets.h.

1373{
1374 int_t n = m. getdomain (). size ();
1375 for (int_t i = 0; i < n; ++ i)
1376 {
1377 out << m. get (i) << " -> ";
1378 write (out, m (i), SMALL_SIZE) << '\n';
1379 }
1380 return out;
1381} /* operator << */

References SMALL_SIZE, and write().

◆ operator<<() [18/31]

std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const primeint p 
)
inline

Writes an object of the type "primeint" to an output stream.

Definition at line 99 of file integer.h.

100{
101 out << static_cast<int_t> (p);
102 return out;
103} /* operator << */

◆ operator<<() [19/31]

std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const psethashstat s 
)
inline

Writes the information gathered in a hashing statistics collector object to an output stream.

Definition at line 463 of file pointset.h.

464{
465 if (!s. hashhits)
466 return out;
467 out << "hashing: " << s. hashhits << " hits, avg " <<
468 ((s. hashhits + s. hashmisses) / s. hashhits) << "." <<
469 ((s. hashhits + s. hashmisses) * 10 / s. hashhits) % 10 <<
470 " attempts (" << s. rehashcount << " times rehashed)";
471 return out;
472} /* operator << */

◆ operator<<() [20/31]

std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const Simplex s 
)
inline

Writes a simplex to the output stream in the text format.

Definition at line 361 of file simplex.h.

362{
363 out << '(';
364 if (s. tab)
365 {
366 int d = s. dim ();
367 out << s. tab [1];
368 for (int i = 2; i < d + 2; ++ i)
369 out << ',' << s. tab [i];
370 }
371 out << ')';
372 return out;
373} /* operator << */

◆ operator<<() [21/31]

template<class tCell >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const tCell2l< tCell > &  c 
)
inline

The operator << writes a cubical cell to the text output stream.

Definition at line 862 of file twolayer.h.

863{
864 // write the cubical cell
865 WriteCubicalCell (out, c. cell ());
866
867 // write the layer if any
868 if (c. layer ())
869 out << '^' << c. layer ();
870
871 return out;
872} /* operator << */
std::ostream & WriteCubicalCell(std::ostream &out, const celltype &c)
Writes a cubical cell to the output stream in the text form.
Definition: cellmain.h:173

References WriteCubicalCell().

◆ operator<<() [22/31]

template<class coordtype >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const tCellBase< coordtype > &  c 
)
inline

Writes a cell to an output stream.

Definition at line 465 of file cellbase.h.

467{
468 return WriteCubicalCell (out, c);
469} /* operator << */

References WriteCubicalCell().

◆ operator<<() [23/31]

template<int dimfix, class coordtype >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const tCellFix< dimfix, coordtype > &  c 
)
inline

Writes a cell to an output stream.

Definition at line 478 of file cellfix.h.

480{
481 return WriteCubicalCell (out, c);
482} /* operator << */

References WriteCubicalCell().

◆ operator<<() [24/31]

template<class coordtype >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const tCellVar< coordtype > &  c 
)
inline

Writes a cell to an output stream.

Definition at line 539 of file cellvar.h.

541{
542 return WriteCubicalCell (out, c);
543} /* operator << */

References WriteCubicalCell().

◆ operator<<() [25/31]

template<class tCube >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const tCube2l< tCube > &  c 
)
inline

The operator << writes a cube to the output stream in the text mode.

Definition at line 417 of file twolayer.h.

418{
419 // write the cube
420 WriteCube (out, c. cube ());
421
422 // write the layer if any
423 if (c. layer ())
424 out << '^' << c. layer ();
425
426 return out;
427} /* operator << */
std::ostream & WriteCube(std::ostream &out, const cubetype &c)
Writes a cube to the output stream in the text mode.
Definition: cubemain.h:69

References WriteCube().

◆ operator<<() [26/31]

template<class coordtype >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const tCubeBase< coordtype > &  c 
)
inline

Writes a cube to an output stream in the text mode.

The cube is represented by an n-tuple of integers which are the coordinates of the vertex with minimal coordinates.

Definition at line 299 of file cubebase.h.

301{
302 return WriteCube (out, c);
303} /* operator << */

References WriteCube().

◆ operator<<() [27/31]

template<int dimfix, class coordtype >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const tCubeFix< dimfix, coordtype > &  c 
)
inline

Writes a cube to an output stream in the text mode.

The cube is represented by an n-tuple of integers which are the coordinates of the vertex with minimal coordinates.

Definition at line 289 of file cubefix.h.

291{
292 return WriteCube (out, c);
293} /* operator << */

References WriteCube().

◆ operator<<() [28/31]

template<class coordtype >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const tCubeVar< coordtype > &  c 
)
inline

Writes a cube to an output stream in the text mode.

The cube is represented by an n-tuple of integers which are the coordinates of the vertex with minimal coordinates.

Definition at line 355 of file cubevar.h.

357{
358 return WriteCube (out, c);
359} /* operator << */

References WriteCube().

◆ operator<<() [29/31]

std::ostream & chomp::homology::operator<< ( std::ostream &  out,
const word w 
)
inline

Writes the given word to an output stream.

Definition at line 356 of file words.h.

357{
358 if (w. length ())
359 out << (const char *) w;
360 return out;
361} /* operator << */

◆ operator<<() [30/31]

template<class coordtype >
std::ostream & chomp::homology::operator<< ( std::ostream &  out,
tPointset< coordtype > &  p 
)

Writes a set of points to a file (starting at the point given).

Definition at line 2481 of file pointset.h.

2482{
2483 write (out, p);
2484 return out;
2485} /* operator << */
int_t write(std::ostream &out, tPointset< coordtype > &p, int_t first=0, int_t howmany=-1, int quiet=0)
Writes a set of points to a file (starting at the point given).
Definition: pointset.h:2407

References write().

◆ operator<<() [31/31]

template<class type >
word & chomp::homology::operator<< ( word w,
const type &  elem 
)

Appends the string value of a given element to a word.

The operator << is used to produce this string value.

Definition at line 344 of file words.h.

345{
346 std::ostringstream s;
347 s << elem;
348 w += s. str (). c_str ();
349 return w;
350} /* operator << */

◆ operator<=()

int chomp::homology::operator<= ( const word w1,
const word w2 
)
inline

Compares two words in an alphabetical way (by ASCII codes).

Returns 1 if the second word does not precede the first one, 0 otherwise.

Definition at line 326 of file words.h.

327{
328 return !(w1 > w2);
329} /* operator <= */

◆ operator==() [1/9]

int chomp::homology::operator== ( const char *  c,
const word w 
)
inline

Compares a C-style string with a word.

Definition at line 289 of file words.h.

290{
291 return (w == c);
292} /* operator == */

◆ operator==() [2/9]

template<class wType1 , class wType2 >
bool chomp::homology::operator== ( const diGraph< wType1 > &  g1,
const diGraph< wType2 > &  g2 
)
inline

No isomorphism check, just comparing with the same order of vertices. Ignores weights.

Definition at line 600 of file digraph.h.

602{
603 if (g1. nVertices != g2. nVertices)
604 return false;
605 if (!g1. nVertices)
606 return true;
607 for (int_t i = 0; i < g1. nVertices; ++ i)
608 {
609 if (g1. edgeEnds [i] != g2. edgeEnds [i])
610 return false;
611 }
612 int_t nEdges = g1. edgeEnds [g1. nVertices - 1];
613 for (int_t i = 0; i < nEdges; ++ i)
614 {
615 if (g1. edges [i] != g2. edges [i])
616 return false;
617 }
618 return true;
619} /* operator == */

◆ operator==() [3/9]

int chomp::homology::operator== ( const integer n,
int  m 
)
inline

Definition at line 370 of file integer.h.

371{
372 integer intm;
373 intm = m;
374 return (n == intm);
375} /* operator == */
This class defines integer numbers with overflow control and with some specific properties of an Eucl...
Definition: integer.h:134

◆ operator==() [4/9]

int chomp::homology::operator== ( const Simplex s,
const Simplex t 
)
inline

The operator == that compares whether the two simplices are the same, that is, have the same vertices in the same order.

Definition at line 310 of file simplex.h.

311{
312 int sd = s. dim ();
313 int td = t. dim ();
314 if (sd != td)
315 return 0;
316 for (int i = 1; i < sd + 2; ++ i)
317 if (s. tab [i] != t. tab [i])
318 return 0;
319 return 1;
320} /* operator == */

◆ operator==() [5/9]

template<class tCell >
int chomp::homology::operator== ( const tCell2l< tCell > &  c1,
const tCell2l< tCell > &  c2 
)
inline

The operator == verifies if two cells are equal.

Definition at line 833 of file twolayer.h.

835{
836 return (c1. cell () == c2. cell ()) &&
837 (c1. layer () == c2. layer ());
838} /* operator == */

◆ operator==() [6/9]

template<class tCube >
int chomp::homology::operator== ( const tCube2l< tCube > &  c1,
const tCube2l< tCube > &  c2 
)
inline

The operator == verifies if two cubes are equal.

Definition at line 388 of file twolayer.h.

390{
391 return (c1. cube () == c2. cube ()) &&
392 (c1. layer () == c2. layer ());
393} /* operator == */

◆ operator==() [7/9]

template<int Dim, int twoPower>
bool chomp::homology::operator== ( const typename bincube< Dim, twoPower >::neighborhood_iterator &  x1,
const typename bincube< Dim, twoPower >::neighborhood_iterator &  x2 
)
inline

Definition at line 784 of file bincube.h.

787{
788// sout << "DEBUG ==\n";
789 return ((x1. b == x2. b) && (x1. cur == x2. cur));
790} /* bincube::neighborhood_iterator::operator == */

◆ operator==() [8/9]

int chomp::homology::operator== ( const word w,
const char *  c 
)
inline

Compares a word with a C-style string.

Definition at line 275 of file words.h.

276{
277 if (!w. length ())
278 return (!c || !*c);
279 return !strcmp ((const char *) w, c);
280} /* operator == */

◆ operator==() [9/9]

int chomp::homology::operator== ( const word w1,
const word w2 
)
inline

Compares two words. Returns 1 if they are the same, 0 otherwise.

Definition at line 259 of file words.h.

260{
261 if (w1. length () != w2. length ())
262 return 0;
263 if (!w1. length ())
264 return 1;
265 return !strcmp ((const char *) w1, (const char *) w2);
266} /* operator == */

◆ operator>() [1/2]

bool chomp::homology::operator> ( const integer x,
const integer y 
)
inline

Definition at line 416 of file integer.h.

417{
418 return (x. num > y. num);
419} /* operator > */

◆ operator>() [2/2]

int chomp::homology::operator> ( const word w1,
const word w2 
)
inline

Compares two words in an alphabetical way (by ASCII codes).

Returns 1 if the second word precedes the first one, 0 otherwise.

Definition at line 319 of file words.h.

320{
321 return (w2 < w1);
322} /* operator > */

◆ operator>=()

int chomp::homology::operator>= ( const word w1,
const word w2 
)
inline

Compares two words in an alphabetical way (by ASCII codes).

Returns 1 if the first word does not precede the second one, 0 otherwise.

Definition at line 333 of file words.h.

334{
335 return !(w1 < w2);
336} /* operator >= */

◆ operator>>() [1/27]

template<int Dim, int twoPower>
std::istream & chomp::homology::operator>> ( std::istream &  in,
bincube< Dim, twoPower > &  b 
)
inline

Definition at line 914 of file bincube.h.

916{
917 return b. read (in);
918} /* operator >> */
int read(textfile &f, coordtype *c, int maxdim)
Reads a point from a text file and removes a pair of parentheses, braces or brackets if present.
Definition: pointset.h:1994

References chomp::homology::bincube< Dim, twoPower >::read().

◆ operator>>() [2/27]

template<class euclidom >
std::istream & chomp::homology::operator>> ( std::istream &  in,
chain< euclidom > &  c 
)
inline

Reads a chain from a standard input stream in the text mode.

Warning: The operators >> and << are not symmetric for chains.

Definition at line 894 of file chains.h.

895{
896 ignorecomments (in);
897 int_t closing = readparenthesis (in);
898
899 ignorecomments (in);
900 while (in. peek () != closing)
901 {
902 // read the coefficient
903 euclidom e (1);
904 in >> e;
905
906 // read the multiplication symbol
907 ignorecomments (in);
908 if (in. peek () != '*')
909 throw "The multiplication sign '*' while reading a chain.";
910 in. get ();
911
912 // read the identifier
913 ignorecomments (in);
914 int_t n;
915 in >> n;
916 -- n;
917
918 // if the coefficient is zero, then this is wrong
919 if (e == 0)
920 throw "A zero coefficient in a chain detected.";
921
922 // add this element to the chain
923 c. add (e, n);
924
925 // prepare for the next pair to read
926 ignorecomments (in);
927
928 // read a comma or a plus between two elements of the chain
929 if ((in. peek () == ',') || (in. peek () == '+'))
930 {
931 in. get ();
932 ignorecomments (in);
933 }
934 }
935
936 if (closing != EOF)
937 in. get ();
938
939 return in;
940} /* operator >> */
int readparenthesis(std::istream &in)
Reads an opening parenthesis from the input file.
Definition: textfile.h:432
void ignorecomments(std::istream &in)
Ignores white characters (spaces, tabulators, CRs and LFs), as well as comments from the input text f...
Definition: textfile.h:385

References ignorecomments(), and readparenthesis().

◆ operator>>() [3/27]

template<class cell , class euclidom >
std::istream & chomp::homology::operator>> ( std::istream &  in,
gcomplex< cell, euclidom > &  c 
)

Reads a geometric complex from an input stream in the text format.

Definition at line 1508 of file gcomplex.h.

1509{
1510 ignorecomments (in);
1511 while (closingparenthesis (in. peek ()) != EOF)
1512 {
1513 cell x;
1514 in >> x;
1515 c. add (x);
1516 ignorecomments (in);
1517 }
1518 return in;
1519} /* operator >> */
int closingparenthesis(int ch)
Returns the matching closing parenthesis for the given opening one or EOF if none.
Definition: textfile.h:411

References closingparenthesis(), and ignorecomments().

◆ operator>>() [4/27]

template<class element , class hashkeys >
std::istream & chomp::homology::operator>> ( std::istream &  in,
hashedset< element, hashkeys > &  s 
)

Reads a hashed set from an input stream in a large size style (each element occupies one line, any comments are ignored).

Definition at line 908 of file hashsets.h.

909{
910 return read (in, s, LARGE_SIZE);
911} /* operator >> */
stream & read(stream &in, hashedset< element, hashkeys > &s, bool size)
Reads a hashed set from an input stream, either a small size style or a large one.
Definition: hashsets.h:864

References LARGE_SIZE, and read().

◆ operator>>() [5/27]

template<class tCube >
std::istream & chomp::homology::operator>> ( std::istream &  in,
hashedset< tCube2l< tCube > > &  s 
)
inline

A specialized version of the operator >> for reading a set of cubes and ignores the first line "dimension N".

Definition at line 456 of file twolayer.h.

458{
459 return ReadCubes (in, s);
460} /* operator >> */
std::istream & ReadCubes(std::istream &in, cubsettype &s)
Reads a set of cubes and ignores the line at the beginning of the file which starts with the letter '...
Definition: cubemain.h:193

References ReadCubes().

◆ operator>>() [6/27]

template<class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
hashedset< tCubeBase< coordtype > > &  s 
)
inline

Reads a set of cubes from an input stream in the text mode.

Definition at line 316 of file cubebase.h.

318{
319 return ReadCubes (in, s);
320} /* operator >> */

References ReadCubes().

◆ operator>>() [7/27]

template<int dimfix, class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
hashedset< tCubeFix< dimfix, coordtype > > &  s 
)
inline

Reads a set of cubes from an input stream in the text mode.

Definition at line 307 of file cubefix.h.

309{
310 return ReadCubes (in, s);
311} /* operator >> */

References ReadCubes().

◆ operator>>() [8/27]

template<class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
hashedset< tCubeVar< coordtype > > &  s 
)
inline

Reads a set of cubes from an input stream in the text mode.

Definition at line 372 of file cubevar.h.

374{
375 return ReadCubes (in, s);
376} /* operator >> */

References ReadCubes().

◆ operator>>() [9/27]

std::istream & chomp::homology::operator>> ( std::istream &  in,
integer n 
)
inline

Definition at line 355 of file integer.h.

356{
357 long number;
358 in >> number;
359 if (!in)
360 return in;
361 n = number;
362 return in;
363} /* operator >> */

◆ operator>>() [10/27]

template<class domelement , class imgelement >
std::istream & chomp::homology::operator>> ( std::istream &  in,
mvmap< domelement, imgelement > &  m 
)

Reads a multivalued map from an input stream.

Definition at line 1385 of file hashsets.h.

1386{
1387 ignorecomments (in);
1388 while (in. peek () != EOF)
1389 {
1390 domelement e;
1391 in >> e;
1392 // if (!in)
1393 // throw "Failed to read a domain element of a map.";
1394
1395 // read the map's arrow
1396 ignorecomments (in);
1397 while (in. peek () == '-')
1398 in. get ();
1399 if (in. peek () == '>')
1400 in. get ();
1401
1402 ignorecomments (in);
1403 read (in, m [e], SMALL_SIZE);
1404
1405 ignorecomments (in);
1406 }
1407 return in;
1408} /* operator >> */

References ignorecomments(), read(), and SMALL_SIZE.

◆ operator>>() [11/27]

template<class tCube >
std::istream & chomp::homology::operator>> ( std::istream &  in,
mvmap< tCube2l< tCube >, tCube2l< tCube > > &  m 
)
inline

A specialized version of the operator >> that reads a combinatorial cubical multivalued map.

This version allows one to use two formats which are automatically distinguished. The assignments can be either like in a generic multivalued map, or in Jacek and Marcin's format (see the chmap program).

Definition at line 468 of file twolayer.h.

470{
471 return ReadCubicalMap (in, m);
472} /* operator >> */
std::istream & ReadCubicalMap(std::istream &in, mvmap< tCube, tCube > &m)
Reads a combinatorial cubical multivalued map from an input text stream.
Definition: cubemain.h:211

References ReadCubicalMap().

◆ operator>>() [12/27]

template<class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
mvmap< tCubeBase< coordtype >, tCubeBase< coordtype > > &  m 
)
inline

Reads a cubical map from an input stream in the text mode.

Definition at line 324 of file cubebase.h.

326{
327 return ReadCubicalMap (in, m);
328} /* operator >> */

References ReadCubicalMap().

◆ operator>>() [13/27]

template<int dimfix, class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
mvmap< tCubeFix< dimfix, coordtype >, tCubeFix< dimfix, coordtype > > &  m 
)
inline

Reads a cubical map from an input stream in the text mode.

Definition at line 315 of file cubefix.h.

317{
318 return ReadCubicalMap (in, m);
319} /* operator >> */

References ReadCubicalMap().

◆ operator>>() [14/27]

template<class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
mvmap< tCubeVar< coordtype >, tCubeVar< coordtype > > &  m 
)
inline

Reads a cubical map from an input stream in the text mode.

Definition at line 380 of file cubevar.h.

382{
383 return ReadCubicalMap (in, m);
384} /* operator >> */

References ReadCubicalMap().

◆ operator>>() [15/27]

std::istream & chomp::homology::operator>> ( std::istream &  in,
primeint p 
)
inline

Reads a prime number from an input stream.

If the actual number that is read is not prime then it is increased as much as necessary to obtain a prime number.

Definition at line 108 of file integer.h.

109{
110 int_t n;
111 in >> n;
112 p = n;
113 return in;
114} /* operator >> */

◆ operator>>() [16/27]

std::istream & chomp::homology::operator>> ( std::istream &  in,
Simplex s 
)
inline

Reads a simplex from an imput stream from a text format.

Throws an error message in case of failure.

Definition at line 377 of file simplex.h.

378{
379 // check if an opening parenthesis is waiting at the input
380 ignorecomments (in);
381 int closing = closingparenthesis (in. peek ());
382 if (closing == EOF)
383 throw "Cannot read a simplex: No opening parenthesis.";
384
385 // read the opening parenthesis
386 in. get ();
387 ignorecomments (in);
388
389 // read the vertices of the simplex
390 int v [Simplex::MaxDim];
391 int dim = -1;
392 while (in && (in. peek () != closing))
393 {
394 // read the vertex
395 in >> v [++ dim];
396 if (!in)
397 throw "Unable to read a vertex of a simplex.";
398
399 // read the separating comma if any
400 ignorecomments (in);
401 if (in. peek () == ',')
402 {
403 in. get ();
404 ignorecomments (in);
405 }
406
407 // if there are too many vertices...
408 if (dim >= Simplex::MaxDim)
409 throw "Too many vertices of a simplex.";
410 }
411
412 // sort the numbers of the vertices of the simplex
413 if (sortelements (v, dim + 1) != dim + 1)
414 throw "A repeated vertex in a simplex detected.";
415
416 // read the closing parenthesis and define the simplex
417 in. get ();
418 s = Simplex (v, dim);
419
420 return in;
421} /* operator >> */
int sortelements(type *tab, int n)
A simple template that sorts an array using the bubble sort method, removes repeated elements and ret...
Definition: textfile.h:340

References closingparenthesis(), ignorecomments(), chomp::homology::Simplex::MaxDim, and sortelements().

◆ operator>>() [17/27]

template<class tCell >
std::istream & chomp::homology::operator>> ( std::istream &  in,
tCell2l< tCell > &  c 
)
inline

The operator >> reads a cubical cell from the text input stream.

Definition at line 876 of file twolayer.h.

877{
878 // read the cubical cell
879 tCell q;
880 ReadCubicalCell (in, q);
881
882 // read the layer if any
883 typename tCell2l<tCell>::LayerType l (0);
884 ignorecomments (in);
885 if (in. peek () == '^')
886 {
887 in. get ();
888 ignorecomments (in);
889 in >> l;
890 }
891
892 c = tCell2l<tCell> (q, l);
893 return in;
894} /* operator >> */
std::istream & ReadCubicalCell(std::istream &in, celltype &c)
Reads a cubical cell form the input text stream.
Definition: cellmain.h:235

References ignorecomments(), and ReadCubicalCell().

◆ operator>>() [18/27]

template<class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
tCellBase< coordtype > &  c 
)
inline

Reads a cell from an input stream.

Definition at line 473 of file cellbase.h.

475{
476 return ReadCubicalCell (in, c);
477} /* operator >> */

References ReadCubicalCell().

◆ operator>>() [19/27]

template<int dimfix, class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
tCellFix< dimfix, coordtype > &  c 
)
inline

Reads a cell from an input stream.

Definition at line 486 of file cellfix.h.

488{
489 return ReadCubicalCell (in, c);
490} /* operator >> */

References ReadCubicalCell().

◆ operator>>() [20/27]

template<class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
tCellVar< coordtype > &  c 
)
inline

Reads a cell from an input stream.

Definition at line 547 of file cellvar.h.

549{
550 return ReadCubicalCell (in, c);
551} /* operator >> */

References ReadCubicalCell().

◆ operator>>() [21/27]

template<class tCube >
std::istream & chomp::homology::operator>> ( std::istream &  in,
tCube2l< tCube > &  c 
)
inline

The operator >> reads a cube from the input stream in the text mode.

Definition at line 431 of file twolayer.h.

432{
433 // read the cube
434 tCube q;
435 ReadCube (in, q);
436
437 // read the layer if any
438 typename tCube2l<tCube>::LayerType l (0);
439 ignorecomments (in);
440 if (in. peek () == '^')
441 {
442 in. get ();
443 ignorecomments (in);
444 in >> l;
445 }
446 else if (tCube2l<tCube>::layer1 (). check (q))
447 l = 1;
448
449 c = tCube2l<tCube> (q, l);
450 return in;
451} /* operator >> */
std::istream & ReadCube(std::istream &in, cubetype &c)
Reads a cube from the input text stream.
Definition: cubemain.h:184

References ignorecomments(), and ReadCube().

◆ operator>>() [22/27]

template<class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
tCubeBase< coordtype > &  c 
)
inline

Reads a cube from an input stream in the text mode.

The cube is represented by an n-tuple of integers which are the coordinates of the vertex with minimal coordinates.

Definition at line 309 of file cubebase.h.

310{
311 return ReadCube (in, c);
312} /* operator >> */

References ReadCube().

◆ operator>>() [23/27]

template<int dimfix, class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
tCubeFix< dimfix, coordtype > &  c 
)
inline

Reads a cube from an input stream in the text mode.

The cube is represented by an n-tuple of integers which are the coordinates of the vertex with minimal coordinates.

Definition at line 299 of file cubefix.h.

301{
302 return ReadCubeFix (in, c, dimfix);
303} /* operator >> */
std::istream & ReadCubeFix(std::istream &in, cubetype &c, int dimfix)
Reads a cube from the input text stream.
Definition: cubemain.h:90

References ReadCubeFix().

◆ operator>>() [24/27]

template<class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
tCubeVar< coordtype > &  c 
)
inline

Reads a cube from an input stream in the text mode.

The cube is represented by an n-tuple of integers which are the coordinates of the vertex with minimal coordinates.

Definition at line 365 of file cubevar.h.

366{
367 return ReadCube (in, c);
368} /* operator >> */

References ReadCube().

◆ operator>>() [25/27]

template<class coordtype >
std::istream & chomp::homology::operator>> ( std::istream &  in,
tPointset< coordtype > &  p 
)

Reads a set of points from an input stream (starting at the point given).

Definition at line 2399 of file pointset.h.

2400{
2401 textfile f (in);
2402 read (f, p);
2403 return in;
2404} /* operator >> */
A class for reading text data from a text file.
Definition: textfile.h:553
int_t read(std::istream &in, tPointset< coordtype > &p, coordtype *wrap, int maxdim, int quiet=0, tPointset< coordtype > *notthese=NULL)
Reads a set of points from an input stream (starting at the point given).
Definition: pointset.h:2384

References read().

◆ operator>>() [26/27]

std::istream & chomp::homology::operator>> ( std::istream &  in,
word w 
)
inline

Reads a word from an input stream.

Definition at line 364 of file words.h.

365{
366 char buf [256 + 1];
367 int pos = 0;
368 int ch = in. peek ();
369 while ((ch != ' ') && (ch != '\r') && (ch != '\n') && (ch != '\t') &&
370 (ch != EOF))
371 {
372 buf [pos ++] = in. get ();
373 ch = in. peek ();
374 if (pos >= 256)
375 break;
376 }
377 buf [pos] = '\0';
378 w = word (buf);
379 return in;
380} /* operator >> */

◆ operator>>() [27/27]

template<class coordtype >
textfile & chomp::homology::operator>> ( textfile f,
tPointset< coordtype > &  p 
)

Reads a set of points from an input stream (starting at the point given).

Definition at line 2392 of file pointset.h.

2393{
2394 read (f, p);
2395 return f;
2396} /* operator >> */

References read().

◆ pointhashadd()

template<class coordtype >
int_t chomp::homology::pointhashadd ( const coordtype *  c,
int  dim,
int_t  hashsize 
)

Generates the second hashing key for points.

Definition at line 198 of file pointset.h.

199{
200 int_t add = 1313;
201 for (int i = 0; i < dim; ++ i)
202 add ^= static_cast<int_t> ((c [i] > 0) ? c [i] : -c [i]) <<
203 (((i << 4) + 3) % 21);
204 if (add < 0)
205 add = -(add + 1);
206
207 // return the key reduced to the given size
208 return (add % (hashsize - 1) + 1);
209
210} /* pointhashadd */

Referenced by chomp::homology::tPointset< coordtype >::hashfindpoint().

◆ pointhashkey()

template<class coordtype >
int_t chomp::homology::pointhashkey ( const coordtype *  c,
int  dim,
int_t  hashsize 
)

Generates the main hashing key for points.

Definition at line 180 of file pointset.h.

181{
182 int_t key = 13;
183 for (int i = 0; i < dim; ++ i)
184 {
185 key ^= static_cast<int_t> ((c [i] > 0) ? c [i] : -c [i]) <<
186 ((i << 3) % 19);
187 }
188 if (key < 0)
189 key = -(key + 1);
190
191 // return the key reduced to the given size
192 return (key % hashsize);
193
194} /* pointhashkey */

Referenced by chomp::homology::tPointset< coordtype >::hashfindpoint().

◆ project()

template<class euclidom , class tCell >
void chomp::homology::project ( const gcomplex< tCell, euclidom > &  c,
gcomplex< tCell, euclidom > &  img,
const gcomplex< tCell, euclidom > &  only,
int  offset,
int  outdim,
int  discarddim,
const int *  level,
bool  watchforimages 
)

Creates the image of the projection from the set of cubical cells in the given geometric complex to the subspace of R^n spanned by the 'outdim' subsequent standard vectors with the first number 'offset'.

Only these cells which appear in 'only' are added unless 'only' is empty.

Definition at line 320 of file cubmaps.h.

325{
326 typedef typename tCell::CoordType coordType;
327
328 // go through the list of all the dimensions which are of concern
329 for (int d = 0; d <= c. dim (); ++ d)
330 {
331 if ((!level || level [d]) && (c. dim () >= d))
332 {
333 // take sets of cells of this dimension
334 const hashedset<tCell> &cset = c [d];
335 if (cset. empty ())
336 continue;
337
338 // go through the list of cells in c of dimension d
339 for (int_t i = 0; i < cset. size (); ++ i)
340 {
341 // get this cell and its coordinates
342 const tCell &thecell = cset [i];
343 coordType left [tCell::MaxDim];
344 thecell. leftcoord (left);
345 coordType right [tCell::MaxDim];
346 thecell. rightcoord (right);
347
348 // check if this cell has no width in the
349 // directions that are discarded
350 int j;
351 for (j = 0; j < offset; ++ j)
352 if (left [j] != right [j])
353 {
354 j = offset + 33;
355 break;
356 }
357 if (j > offset)
358 continue;
359 for (j = 0; j < discarddim; ++ j)
360 if (left [offset + outdim + j] !=
361 right [offset + outdim + j])
362 {
363 j = discarddim + 33;
364 break;
365 }
366 if (j > discarddim)
367 continue;
368
369 // add the projected cell to the complex
370 if (!(tCell::PointBase::check
371 (left + offset, outdim))
372 || !(tCell::PointBase::check
373 (right + offset, outdim)))
374 {
375 if (watchforimages)
376 throw "Inclusion undefined!";
377 else
378 continue;
379 }
380 tCell projected (left + offset,
381 right + offset, outdim);
382 if ((only. dim () >= 0) &&
383 !only. check (projected))
384 {
385 if (watchforimages)
386 throw "Inclusion undefined.";
387 else
388 continue;
389 }
390 img. add (projected);
391 }
392 }
393 }
394 return;
395} /* project */

Referenced by Homology(), and Homology2l().

◆ read() [1/7]

template<class coordtype >
int chomp::homology::read ( std::istream &  in,
coordtype *  c,
int  maxdim 
)

Reads a point from a text file and removes a pair of parentheses, braces or brackets if present.

Returns the number of coordinates read. If the maximal dimension is reached, no more coordinates are read. Note: The first input character should be the opening parenthesis. This is an old version, use "readcoordinates" instead.

Definition at line 2059 of file pointset.h.

2060{
2061 textfile f (in);
2062 return read (f, c, maxdim);
2063} /* read */

References read().

◆ read() [2/7]

template<class coordtype >
int_t chomp::homology::read ( std::istream &  in,
tPointset< coordtype > &  p,
coordtype *  wrap,
int  maxdim,
int  quiet = 0,
tPointset< coordtype > *  notthese = NULL 
)

Reads a set of points from an input stream (starting at the point given).

Returns the number of points read or -1 (and show a message) if failed.

Definition at line 2384 of file pointset.h.

2386{
2387 textfile f (in);
2388 return read (f, p, wrap, maxdim, quiet, notthese);
2389} /* read */

References read().

◆ read() [3/7]

template<class coordtype >
int_t chomp::homology::read ( std::istream &  in,
tPointset< coordtype > &  p,
int_t  first = 0,
int_t  howmany = -1,
coordtype *  wrap = NULL,
int  maxdim = 0,
int  quiet = 0,
tPointset< coordtype > *  notthese = NULL 
)

Reads a set of points from an input stream (starting at the point given).

Returns the number of points read or -1 (and show a message) if failed.

Definition at line 2367 of file pointset.h.

2370{
2371 textfile f (in);
2372 return read (f, p, first, howmany, wrap, maxdim, quiet, notthese);
2373} /* read */

References read().

◆ read() [4/7]

template<class stream , class element , class hashkeys >
stream & chomp::homology::read ( stream &  in,
hashedset< element, hashkeys > &  s,
bool  size 
)

Reads a hashed set from an input stream, either a small size style or a large one.

Definition at line 864 of file hashsets.h.

865{
866 // ignore all the comments at the beginning of the input stream
867 ignorecomments (in);
868
869 // determine the closing parenthesis
870 // and read the opening one if applicable
871 int closing = EOF;
872 if (size == SMALL_SIZE)
873 {
874 closing = readparenthesis (in);
875 if (closing == EOF)
876 throw "An opening parenthesis expected in a set.";
877 ignorecomments (in);
878 }
879
880 // read the elements until the closing parenthesis is found
881 while (in. peek () != closing)
882 {
883 element e;
884 in >> e;
885 // if (!in)
886 // throw "Failed to read an element of a set.";
887 s. add (e);
888 ignorecomments (in);
889
890 // read a comma between the elements if it is there
891 if (in. peek () == ',')
892 {
893 in. get ();
894 ignorecomments (in);
895 }
896 }
897
898 // read the closing parenthesis if any
899 if (closing != EOF)
900 in. get ();
901
902 return in;
903} /* read */

References ignorecomments(), readparenthesis(), and SMALL_SIZE.

◆ read() [5/7]

template<class coordtype >
int chomp::homology::read ( textfile f,
coordtype *  c,
int  maxdim 
)

Reads a point from a text file and removes a pair of parentheses, braces or brackets if present.

Returns the number of coordinates read. If the maximal dimension is reached, no more coordinates are read. Note: The first input character should be the opening parenthesis. This is an old version, use "readcoordinates" instead.

Definition at line 1994 of file pointset.h.

1995{
1996 // ignore lines until you can find an opening parenthesis,
1997 // brace or bracket and read this character
1998 int ready = 0;
1999 while (!ready)
2000 {
2001 switch (f. checkchar ())
2002 {
2003 case '(':
2004 case '[':
2005 case '{':
2006 case '"':
2007 case '\'':
2008 f. readchar ();
2009 ready = 1;
2010 break;
2011 case '+':
2012 case '-':
2013 break;
2014 case EOF:
2015 return 0;
2016 default:
2017 f. ignoreline ();
2018 break;
2019 }
2020 }
2021
2022 // read the coordinates
2023 int n = 0;
2024 while (1)
2025 {
2026 // read the current coordinate of the point
2027 c [n ++] = (coordtype) f. readnumber ();
2028
2029 // read a comma between the coordinates
2030 // or the closing parenthesis, brace or bracket if any
2031 switch (f. checkchar ())
2032 {
2033 case ')':
2034 case ']':
2035 case '}':
2036 case '"':
2037 case '\'':
2038 f. readchar ();
2039 return n;
2040 case ',':
2041 f. readchar ();
2042 break;
2043 case '-':
2044 case '+':
2045 break;
2046 default:
2047 if ((f. checkchar () < '0') ||
2048 (f. checkchar () > '9'))
2049 return n;
2050 }
2051
2052 // check if the maximal dimension allowed has been reached
2053 if (n >= maxdim)
2054 return n;
2055 }
2056} /* read */

References ignoreline().

Referenced by operator>>(), read(), ReadCubes(), ReadCubicalMap(), readimage(), readrestriction(), and readselective().

◆ read() [6/7]

template<class coordtype >
int_t chomp::homology::read ( textfile f,
tPointset< coordtype > &  p,
coordtype *  wrap,
int  maxdim,
int  quiet = 0,
tPointset< coordtype > *  notthese = NULL 
)

Reads a set of points from an input stream (starting at the point given).

Returns the number of points read or -1 (and show a message) if failed.

Definition at line 2376 of file pointset.h.

2379{
2380 return read (f, p, 0, -1, wrap, maxdim, quiet, notthese);
2381} /* read */

References read().

◆ read() [7/7]

template<class coordtype >
int_t chomp::homology::read ( textfile f,
tPointset< coordtype > &  p,
int_t  first = 0,
int_t  howmany = -1,
coordtype *  wrap = NULL,
int  maxdim = 0,
int  quiet = 0,
tPointset< coordtype > *  notthese = NULL 
)

Reads a set of points from an input stream (starting at the point given).

Returns the number of points read or -1 (and show a message) if failed.

Definition at line 2267 of file pointset.h.

2271{
2272 // prepare a temporary point of maximal dimension
2273 if (maxdim <= 0)
2274 {
2275 if (wrap)
2276 wrap = NULL;
2277 maxdim = 100;
2278 }
2279 coordtype *temp = allocatepoint<coordtype> (maxdim + 1);
2280
2281 int_t count = 0;
2282 int dim = p. empty () ? 0 : p. dimension ();
2283
2284 if (notthese && !notthese -> empty ())
2285 {
2286 if (!dim)
2287 dim = notthese -> dimension ();
2288 else if (dim != notthese -> dimension ())
2289 {
2290 if (!quiet)
2291 sout << "Error: Dimensions not the same.\n";
2292 return -1;
2293 }
2294 }
2295
2296 while (1)
2297 {
2298 // stop reading if it is already enough
2299 if ((howmany >= 0) && (count >= howmany))
2300 {
2301 delete [] temp;
2302 return count;
2303 }
2304
2305 // ignore all the lines which do not start
2306 // with an opening parenthesis
2307 while ((f. checkchar () != 40) && (f. checkchar () != 91) &&
2308 (f. checkchar () != 123) && (f. checkchar () != EOF))
2309 f. ignoreline ();
2310
2311 // if this is the end of the file, finish successfully
2312 if (f. checkchar () == EOF)
2313 {
2314 delete [] temp;
2315 return count;
2316 }
2317
2318 // read a point
2319 int n = read (f, temp, maxdim + 1);
2320 if (n > maxdim)
2321 {
2322 if (!quiet)
2323 sout << "Line " << f. linenumber () <<
2324 ": The point has too many " <<
2325 "coordinates.\n";
2326 delete [] temp;
2327 return -1;
2328 }
2329
2330 // check if the number of coordinates is the same
2331 // as the dimension of the points in the set
2332 if (!first && dim && n && (n != dim))
2333 {
2334 if (!quiet)
2335 sout << "Line " << f. linenumber () <<
2336 ": Incorrect point dimension.\n";
2337 delete [] temp;
2338 return -1;
2339 }
2340
2341 // set the dimension to be the number of coordinates
2342 if (!first && !dim)
2343 {
2344 dim = n;
2345 if (p. dimension () != dim)
2346 p. dimension (dim);
2347 }
2348
2349 // add the read point to the set
2350 if (first)
2351 -- first;
2352 else
2353 {
2354 if (wrap)
2355 {
2356 p. wrapspace (wrap);
2357 wrap = NULL;
2358 }
2359 if (!notthese || !notthese -> check (temp))
2360 p. add (temp);
2361 ++ count;
2362 }
2363 }
2364} /* read */

References ignoreline(), read(), and sout.

◆ ReadBitmapFile()

template<class tCube >
int chomp::homology::ReadBitmapFile ( const char *  bmpname,
hashedset< tCube > &  cset,
int  mingray = 0,
int  maxgray = 128 
)

Reads the squares from a bitmap file to the set of cubes.

Each pixel whose gray value is within the given range (at least 'mingray', strictly less than 'maxgray') gives raise to one square with the corresponding coordinates. For color bitmaps, a weighted average of RGB is computed as gray. Gray level 0 corresponds to black, gray level 255 is white. Return 0 on success, throw an error message if failed.

Definition at line 891 of file homtools.h.

893{
894 // prepare a bitmap file with the vertical axis like in mathematics
895 bmpfile bmp;
896 bmp. invertedpicture ();
897
898 // open the bitmap file
899 if (bmp. open (bmpname) < 0)
900 fileerror (bmpname);
901
902 // scan the picture and produce the list of hypercubes
903 coordinate c [2];
904 for (c [1] = 0; c [1] < bmp. picture_height (); ++ (c [1]))
905 {
906 for (c [0] = 0; c [0] < bmp. picture_width (); ++ (c [0]))
907 {
908 long color = bmp. getpixel (c [0], c [1]);
909 long gray = (77 * ((color & 0xFF0000) >> 16) +
910 154 * ((color & 0xFF00) >> 8) +
911 25 * (color & 0xFF)) >> 8;
912 if ((gray >= mingray) && (gray <= maxgray))
913 cset. add (tCube (c, 2));
914 }
915 }
916
917 return 0;
918} /* ReadBitmapFile */
The class 'bmpfile' is an elementary interface that can be used to read or create and write images in...
Definition: bitmaps.h:67
void fileerror(const char *filename, const char *what="open")
Throws a message about the inability to do something with a file.
Definition: textfile.h:532

References fileerror().

◆ readbitpoints()

int chomp::homology::readbitpoints ( std::istream &  in,
pointset p,
int *  bitcode_depth = NULL 
)

Reads a set of full cubical sets represented as a set of points from a file encoded in the "bitcode" format used by Bill Kalies.

The depth of bit codes is saved to '*bitcode_depth' unless NULL. Returns 0 on success and -1 on error (and displays a message).

◆ readcells()

template<class cell , class euclidom >
void chomp::homology::readcells ( const char *  name,
gcomplex< cell, euclidom > &  s,
const char *  what 
)
inline

Uses the general procedure "readtheset" to read a geometric complex.

Definition at line 155 of file homtools.h.

157{
158 readtheset (name, s, cell::pluralname (), what);
159 return;
160} /* readcells */
void readtheset(const char *name, settype &s, const char *pluralname, const char *what)
Reads a given set from the file and shows appropriate messages.
Definition: homtools.h:117

References readtheset().

◆ readcoordinates() [1/2]

template<class coordtype >
int chomp::homology::readcoordinates ( std::istream &  in,
coordtype *  coord,
int  maxdim 
)
inline

Definition at line 2142 of file pointset.h.

2143{
2144 return readcoordinates (in, coord, maxdim, EOF);
2145} /* readcoordinates */
int readcoordinates(std::istream &in, coordtype *coord, int maxdim)
Definition: pointset.h:2142

References readcoordinates().

◆ readcoordinates() [2/2]

template<class coordtype >
int chomp::homology::readcoordinates ( std::istream &  in,
coordtype *  coord,
int  maxdim,
int  closing 
)
inline

Reads the coordinates of a point.

The point must begin with an opening parenthesis, brace or bracket (unless a closing parenthesis is different from EOF), then the coordinates must be separated by spaces or commas, and must end with a corresponding closing parenthesis, brace or bracket (or the given one). The closing parenthesis may also be defined as '
'. Interrupts if the number of coordinates reaches the maximal dimension. Returns the number of coordinates read or -1 on error.

Definition at line 2073 of file pointset.h.

2075{
2076 // read the opening parenthesis
2077 if (closing == EOF)
2078 closing = readparenthesis (in);
2079 if (closing == EOF)
2080 return -1;
2081
2082 int cur = 0;
2083
2084 ignorecomments (in);
2085 while ((in. peek () != closing) && (cur < maxdim))
2086 {
2087 // ignore a plus before the number if necessary
2088 if (in. peek () == '+')
2089 in. get ();
2090
2091 // finish if there is no number at the input
2092 if ((in. peek () != '-') && !std::isdigit (in. peek ()))
2093 break;
2094
2095 // read the number as 'long' (just in case)
2096 long number;
2097 in >> number;
2098 // if (!in)
2099 // return -1;
2100
2101 // transform this number to a coordtype
2102 coord [cur] = (coordtype) number;
2103 if (coord [cur] != number)
2104 return -1;
2105
2106 // move to the next coordtype position
2107 ++ cur;
2108 if (closing == '\n')
2109 {
2110 while ((in. peek () == ' ') ||
2111 (in. peek () == '\t') ||
2112 (in. peek () == '\r'))
2113 in. get ();
2114 }
2115 else
2116 ignorecomments (in);
2117
2118 // one more thing: read the following comma if any
2119 if (in. peek () == ',')
2120 {
2121 in. get ();
2122 ignorecomments (in);
2123 }
2124 }
2125
2126 // verify that the coordinates were read successfully
2127// if (!in)
2128// return -1;
2129
2130 // read the closing parenthesis
2131 if (in. peek () == closing)
2132 in. get ();
2133 else if ((closing == '\n') && (in. peek () == EOF))
2134 ;
2135 else
2136 return -1;
2137
2138 return cur;
2139} /* readcoordinates */

References ignorecomments(), and readparenthesis().

Referenced by readcoordinates(), ReadCubeFix(), readcubeorcell(), ReadCubicalCell(), ReadCubicalMap(), and scancubes().

◆ ReadCube()

template<class cubetype >
std::istream & chomp::homology::ReadCube ( std::istream &  in,
cubetype &  c 
)
inline

Reads a cube from the input text stream.

Definition at line 184 of file cubemain.h.

185{
186 return ReadCubeFix (in, c, -1);
187} /* ReadCube */

References ReadCubeFix().

Referenced by operator>>().

◆ ReadCubeFix()

template<class cubetype >
std::istream & chomp::homology::ReadCubeFix ( std::istream &  in,
cubetype &  c,
int  dimfix 
)

Reads a cube from the input text stream.

The fixed dimension is forced, unless set to -1.

Definition at line 90 of file cubemain.h.

91{
92 // retrieve the type of coordinates of the cube to read
93 typedef typename cubetype::CoordType coordtype;
94
95 // ignore any comments, spaces, tabs and new-line characters
96 ignorecomments (in);
97
98 // if there is a number in the input, then there are apparently
99 // no parentheses used for the coords or the cube is defined
100 // by its number (also indicated with '#')
101 if (((in. peek () >= '0') && (in. peek () <= '9')) ||
102 (in. peek () == '-') || (in. peek () == '+') ||
103 (in. peek () == '#'))
104 {
105 bool cubenumber = false;
106 if (in. peek () == '#')
107 {
108 in. get ();
109 ignorecomments (in);
110 cubenumber = true;
111 }
112 if (in. peek () == '+')
113 in. get ();
114 int n = -1;
115 in >> n;
116 while ((in. peek () == ' ') || (in. peek () == '\t'))
117 in. get ();
118
119 // if the next coordinate of the cube follows,
120 // read the coordinates until end-of-line is encountered
121 if (!cubenumber &&
122 (((in. peek () >= '0') && (in. peek () <= '9')) ||
123 (in. peek () == '-') || (in. peek () == '+')))
124 {
125 // read the coords and determine the space dimension
126 coordtype coord [cubetype::MaxDim];
127 coord [0] = n;
128 int dim = -1;
129 if (in. peek () != '\n')
130 {
131 dim = readcoordinates (in, coord + 1,
132 cubetype::MaxDim - 1, '\n');
133 if (dim < 0)
134 throw "Unable to read a cube: "
135 "Dim too high.";
136 }
137 ++ dim;
138
139 // if could not read the cube, throw an error message
140 if ((dimfix >= 0) && (dim != dimfix))
141 throw "Unable to read a cube: Wrong dim.";
142
143 // create a cube with the given coordinates
144 c = cubetype (coord, dim);
145
146 return in;
147 }
148
149 // if the cube is given by its number, read it this way
150 else
151 {
152 int dim = cubetype::PointBase::defaultdimension ();
153 const typename cubetype::CoordType *coord = 0;
154 if ((n > 0) && (dim > 0))
155 {
156 coord = cubetype::PointBase::coord
157 (n - 1, dim);
158 }
159 if (!coord)
160 throw "Cube no. out of range while reading.";
161 c = cubetype (n - 1, dim);
162 return in;
163 }
164 }
165
166 // read the coordinates and determine the space dimension
167 typename cubetype::CoordType coord [cubetype::MaxDim];
168 int dim = readcoordinates (in, coord, cubetype::MaxDim);
169 if (dim < 0)
170 throw "Unable to read a cube: Dimension too high.";
171
172 // if could not read the cube, throw an error message
173 if ((dimfix >= 0) && (dim != dimfix))
174 throw "Unable to read a cube: Wrong dimension.";
175
176 // create the cube with the given coordinates
177 c = cubetype (coord, dim);
178
179 return in;
180} /* ReadCubeFix */
int readcoordinates(std::istream &in, coordtype *coord, int maxdim, int closing)
Reads the coordinates of a point.
Definition: pointset.h:2073

References ignorecomments(), and readcoordinates().

Referenced by operator>>(), and ReadCube().

◆ readcubeorcell()

template<class coordtype >
int chomp::homology::readcubeorcell ( std::istream &  in,
coordtype *  left,
coordtype *  right,
int  maxdim,
int *  type = NULL 
)

Reads a cube or a cell from a text file.

Ignores any preceding text lines. Returns the dimension of the object read and sets the type accordingly. Returns 0 in the case of the end of a file or a file error. Throws an error message on failure.

Definition at line 2180 of file pointset.h.

2182{
2183 // ignore all the texts that appear before the actual cell or cube
2184 int closing;
2185 while ((closing = closingparenthesis (in. peek ())) == EOF)
2186 {
2187 ignoreline (in);
2188 ignorecomments (in);
2189 if (!in)
2190 return 0;
2191 }
2192
2193 // try reading the coordinates of the cube
2194 int dim = readcoordinates (in, left, maxdim);
2195
2196 // if successful, then both parentheses are read
2197 if (dim > 0)
2198 {
2199 // check if this is not a product of intervals
2200 ignorecomments (in);
2201 if (((in. peek () != 'x') && (in. peek () != 'X')) ||
2202 (dim > 2))
2203 {
2204 // set the right coordinates accordingly
2205 for (int i = 0; i < dim; ++ i)
2206 right [i] = (coordtype) (left [i] + 1);
2207 if (type)
2208 *type = CUBE;
2209 return dim;
2210 }
2211
2212 // read the remaining intervals
2213 right [0] = (dim < 2) ? left [0] : left [1];
2214 dim = 1;
2215 coordtype temp [2];
2216 while ((in. peek () == 'x') || (in. peek () == 'X'))
2217 {
2218 if (dim >= maxdim)
2219 throw "Too many intervals in a product.";
2220 in. get ();
2221 ignorecomments (in);
2222 int d = readcoordinates (in, temp, 2);
2223 if ((d <= 0) || !in)
2224 throw "Can't read a product of intervals.";
2225 left [dim] = temp [0];
2226 right [dim] = (d < 2) ? temp [0] : temp [1];
2227 ++ dim;
2228 ignorecomments (in);
2229 }
2230 if (type)
2231 *type = CELL;
2232 return dim;
2233 }
2234
2235 // otherwise, this is a cubical cell
2236 else
2237 {
2238 // if an error is set for the input stream, clear it
2239 in. clear (in. rdstate () & ~std::ios::failbit);
2240 ignorecomments (in);
2241
2242 // read two points for the cell
2243 int leftdim = readcoordinates (in, left, maxdim);
2244 ignorecomments (in);
2245 int rightdim = readcoordinates (in, right, maxdim);
2246 ignorecomments (in);
2247
2248 // compare the dimensions
2249 if (!leftdim || !rightdim)
2250 throw "Can't read a cell.";
2251 else if (leftdim != rightdim)
2252 throw "Different dim of left & right point.";
2253 else
2254 dim = leftdim;
2255
2256 // read the closing bracket of the cell
2257 if (in. get () != closing)
2258 throw "Can't read the closing bracket of a cell.";
2259 ignorecomments (in);
2260 if (type)
2261 *type = CELL;
2262 }
2263 return dim;
2264} /* readcubeorcell */
#define CUBE
Definition: pointset.h:357
#define CELL
Definition: pointset.h:356

References CELL, closingparenthesis(), CUBE, ignorecomments(), ignoreline(), and readcoordinates().

◆ ReadCubes()

template<class cubsettype >
std::istream & chomp::homology::ReadCubes ( std::istream &  in,
cubsettype &  s 
)

Reads a set of cubes and ignores the line at the beginning of the file which starts with the letter 'd' (like "dimension 2").

For compatibility with previous versions of my software.

Definition at line 193 of file cubemain.h.

194{
195 // ignore any comments at the beginning of the file
196 ignorecomments (in);
197
198 // if the word "dimension" found, ignore the entire line
199 if (in. peek () == 'd')
200 {
201 in. ignore (20000, '\n');
202 ignorecomments (in);
203 }
204
205 // read the set of cubes using the standard procedure
206 return read (in, s, LARGE_SIZE);
207} /* ReadCubes */

References ignorecomments(), LARGE_SIZE, and read().

Referenced by operator>>().

◆ ReadCubicalCell()

template<class celltype >
std::istream & chomp::homology::ReadCubicalCell ( std::istream &  in,
celltype &  c 
)
inline

Reads a cubical cell form the input text stream.

Allowed formats are: (1) two opposite vertices: with minimal and maximal coordinates, (2) a Cartesian product of intervals (with degenerated intervals allowed), (3) a full-dimensional cubical cell defined by its minimal vertex. For example: [(1,8,-3) (2,9,-2)] = (1,2) x (8,9) x (-3,-2) = (1,8,-3). Another example: [(-4,5,12) (-4,6,12)] = (-4) x (5,6) x (12). Note that the definition of a cubical cell is interpreted as the definition of a full-dimensional cube only if other interpretations fail. As a result, (3,4) will be treated as a 1-dimensional nondegenerated cubical cell in R^1, and not as (3,4) x (4,5). The same applies to 0-dimensional cells in R^1.

Definition at line 235 of file cellmain.h.

236{
237 typedef typename celltype::CoordType coordtype;
238 // make sure that an opening parenthesis is waiting in the input
239 ignorecomments (in);
240 int closing = closingparenthesis (in. peek ());
241 if (closing == EOF)
242 throw "Opening parenthesis expected while reading a cell.";
243
244 // read the opening parenthesis
245 in. get ();
246 ignorecomments (in);
247
248 // prepare the two vertices of a cubical cell
249 coordtype c1 [celltype::MaxDim], c2 [celltype::MaxDim];
250
251 // if there is another opening parenthesis...
252 if (closingparenthesis (in. peek ()) != EOF)
253 {
254 // read coordinates of both vertices and a comma if any
255 int dim1 = readcoordinates (in, c1, celltype::MaxDim);
256 ignorecomments (in);
257 if (in. peek () == ',')
258 {
259 in. get ();
260 ignorecomments (in);
261 }
262 int dim2 = readcoordinates (in, c2, celltype::MaxDim);
263
264 // read the closing bracket and verify that the data
265 ignorecomments (in);
266 if ((in. get () != closing) || (dim1 <= 0) || (dim1 != dim2))
267 throw "Failed while reading two vertices of a cell.";
268
269 // verify the distance between the vertices of the cell
270 for (int i = 0; i < dim1; ++ i)
271 {
272 if ((c1 [i] != c2 [i]) && (c1 [i] + 1 != c2 [i]))
273 throw "Vertices of a read cell are too far.";
274 }
275
276 // create the cubical cell with the given vertices and quit
277 c = celltype (c1, c2, dim1);
278 return in;
279 }
280
281 // try reading the first set of coordinates in the cell's definition
282 coordtype c0 [celltype::MaxDim];
283 int count = readcoordinates (in, c0, celltype::MaxDim, closing);
284 if (count <= 0)
285 throw "Can't read a cell.";
286 ignorecomments (in);
287
288 // if it looks like an interval, then read the cell as a product
289 if ((count == 1) || (count == 2))
290 {
291 int dim = 0;
292 c1 [dim] = c0 [0];
293 c2 [dim ++] = c0 [count - 1];
294 while ((in. peek () == 'x') || (in. peek () == 'X'))
295 {
296 in. get ();
297 ignorecomments (in);
298 count = readcoordinates (in, c0, celltype::MaxDim);
299 ignorecomments (in);
300 if ((count < 1) || (count > 2) ||
301 (dim >= celltype::MaxDim))
302 throw "Wrong interval while reading a cell.";
303 if ((count == 2) && (c0 [1] != c0 [0]) &&
304 (c0 [1] - c0 [0] != 1))
305 throw "Too big interval defining a cell.";
306 c1 [dim] = c0 [0];
307 c2 [dim ++] = c0 [count - 1];
308 }
309 c = celltype (c1, c2, dim);
310 return in;
311 }
312
313 // if the cell is defined as a full-dim. cube, create it this way
314 for (int i = 0; i < count; ++ i)
315 c1 [i] = c0 [i] + 1;
316 c = celltype (c0, c1, count);
317 return in;
318} /* operator >> */

References closingparenthesis(), ignorecomments(), and readcoordinates().

Referenced by operator>>().

◆ ReadCubicalMap()

template<class tCube >
std::istream & chomp::homology::ReadCubicalMap ( std::istream &  in,
mvmap< tCube, tCube > &  m 
)

Reads a combinatorial cubical multivalued map from an input text stream.

Definition at line 211 of file cubemain.h.

212{
213 // process the entire input file and read the map line-by-line
214 ignorecomments (in);
215 while (in. peek () != EOF)
216 {
217 // ignore all the lines which do not define a map assignment
218 while ((closingparenthesis (in. peek ()) == EOF) &&
219 ((in. peek () < '0') || (in. peek () > '9')) &&
220 (in. peek () != EOF))
221 {
222 ignoreline (in);
223 ignorecomments (in);
224 }
225
226 // if the end of the file has been reached, exit the loop
227 if (in. peek () == EOF)
228 break;
229
230 // determine the closing parenthesis corresp. to this one
231 int closing = closingparenthesis (in. peek ());
232
233 // if the opening parenthesis is valid, read it and
234 // check the next character to determine the assignment type
235 if (closing != EOF)
236 {
237 in. get ();
238 ignorecomments (in);
239 }
240
241 // if the assignment is in the general form, decode the line
242 if ((closing == EOF) ||
243 (closingparenthesis (in. peek ()) == EOF))
244 {
245 // read the domain element
246 tCube e;
247 // if it is given as a number, read it directly
248 if (closing == EOF)
249 {
250 in >> e;
251 if (!in)
252 throw "Can't read cube's number.";
253 }
254 // otherwise read the coordinates of the cube
255 else
256 {
257 typename tCube::CoordType coord
258 [tCube::MaxDim];
259 int dim = readcoordinates (in, coord,
260 tCube::MaxDim, closing);
261 if (!in || (dim <= 0))
262 throw "Unable to read a cube.";
263 e = tCube (coord, dim);
264 }
265 ignorecomments (in);
266
267 // read the assignment arrow
268 while (in. peek () == '-')
269 in. get ();
270 if (in. peek () == '>')
271 in. get ();
272 ignorecomments (in);
273
274 // read the image of the cube
275 read (in, m [e], SMALL_SIZE);
276 ignorecomments (in);
277 }
278
279 // otherwise read the assignment in the Jacek & Marcin format
280 else
281 {
282 // read the argument cell
283 typename tCube::CoordType argleft [tCube::MaxDim];
284 typename tCube::CoordType argright [tCube::MaxDim];
285 int dim = readcoordinates (in, argleft,
286 tCube::MaxDim);
287 ignorecomments (in);
288 int d1 = readcoordinates (in, argright,
289 tCube::MaxDim);
290 ignorecomments (in);
291
292 // read the closing and opening brackets
293 in. get ();
294 ignorecomments (in);
295 in. get ();
296 ignorecomments (in);
297
298 // read the value cell
299 typename tCube::CoordType vleft [tCube::MaxDim];
300 typename tCube::CoordType vright [tCube::MaxDim];
301 int d2 = readcoordinates (in, vleft, tCube::MaxDim);
302 ignorecomments (in);
303 int d3 = readcoordinates (in, vright, tCube::MaxDim);
304 ignorecomments (in);
305
306 // if there was an I/O error, interrupt reading here
307 if (!in || (in. peek () == EOF))
308 throw "Cannot read a map assignment line.";
309
310 // read the closing bracket
311 in. get ();
312 ignorecomments (in);
313
314 // check that all the dimensions are the same
315 if ((d1 != dim) || (d2 != dim) || (d3 != dim))
316 throw "Wrong dimensions of vertices.";
317
318 // verify that the argument cube is of the right size
319 for (int i = 0; i < dim; ++ i)
320 {
321 if (argright [i] - argleft [i] != 1)
322 throw "Wrong size of an argument.";
323 }
324
325 // add the argument cube to the map's domain
326 hashedset<tCube> &v = m [tCube (argleft, dim)];
327
328 // form a rectangle from this value cell
329 tRectangle<typename tCube::CoordType> r
330 (vleft, vright, dim);
331
332 // add all the value cubes to the image of this element
333 const typename tCube::CoordType *c;
334 while ((c = r. get ()) != NULL)
335 v. add (tCube (c, dim));
336 }
337 }
338
339 return in;
340} /* ReadCubicalMap */

References closingparenthesis(), ignorecomments(), ignoreline(), read(), readcoordinates(), and SMALL_SIZE.

Referenced by operator>>().

◆ readdomain() [1/2]

template<class domelement , class imgelement >
std::istream & chomp::homology::readdomain ( std::istream &  in,
hashedset< domelement > &  dom,
const mvmap< domelement, imgelement > &   
)

Reads the domain of a multivalued map.

Definition at line 1159 of file hashsets.h.

1161{
1162 ignorecomments (in);
1163 while (in. peek () != EOF)
1164 {
1165 domelement e;
1166 in >> e;
1167 // if (!in)
1168 // throw "Failed to read a domain element of a map.";
1169 dom. add (e);
1170
1171 // read the map's arrow
1172 ignorecomments (in);
1173 while (in. peek () == '-')
1174 in. get ();
1175 if (in. peek () == '>')
1176 in. get ();
1177
1178 ignorecomments (in);
1179 int closing = readparenthesis (in);
1180
1181 ignorecomments (in);
1182 while (in. peek () != closing)
1183 {
1184 imgelement junk;
1185 in >> junk;
1186 // if (!in)
1187 // throw "Failed to read an image element.";
1188 ignorecomments (in);
1189 if (in. peek () == ',')
1190 {
1191 in. get ();
1192 ignorecomments (in);
1193 }
1194 }
1195
1196 if (closing != EOF)
1197 in. get ();
1198 ignorecomments (in);
1199 }
1200 return in;
1201} /* readdomain */

References ignorecomments(), and readparenthesis().

◆ readdomain() [2/2]

template<class tCube >
std::istream & chomp::homology::readdomain ( std::istream &  in,
hashedset< tCube > &  dom 
)

Reads the domain of a multivalued cubical map.

This is a specialization of the corresponding function for reading the domain of a general multivalued map.

Definition at line 406 of file cubmaps.h.

407{
408 ignorecomments (in);
409 if ((in. peek () != 'S') && (in. peek () != 's'))
410 {
411 mvmap<tCube,tCube> Fdummy;
412 return readdomain (in, dom, Fdummy);
413 }
414
415 while (in. peek () != EOF)
416 {
417 if (in. peek () == '[')
418 {
419 in. get ();
420 tCube q;
421 in >> q;
422 if (!in)
423 throw "Can't read the file.";
424 dom. add (q);
425 }
426 ignoreline (in);
427 ignorecomments (in);
428 }
429
430 return in;
431} /* readdomain */
std::istream & readdomain(std::istream &in, hashedset< tCube > &dom)
Reads the domain of a multivalued cubical map.
Definition: cubmaps.h:406

References ignorecomments(), ignoreline(), and readdomain().

Referenced by readdomain(), and readmapdomain().

◆ readelements() [1/2]

void chomp::homology::readelements ( const char *  name,
cubes cub,
const char *  what 
)
inline

Reads a set of cubes from the given file.

This function is necessary because cubes need special treatment.

Definition at line 173 of file homtools.h.

174{
175 readtheset (name, cub, cube::pluralname (), what);
176 return;
177} /* readelements */

References chomp::homology::tCubeBase< coordtype >::pluralname(), and readtheset().

◆ readelements() [2/2]

template<class element >
void chomp::homology::readelements ( const char *  name,
hashedset< element > &  s,
const char *  what 
)
inline

Uses the general procedure "readtheset" to read a set of elements.

Definition at line 164 of file homtools.h.

166{
167 readtheset (name, s, element::pluralname (), what);
168 return;
169} /* readelements */

References readtheset().

◆ readfromstring() [1/4]

int chomp::homology::readfromstring ( char *  str,
bool &  t 
)
inline

A specialization of the above template for reading a bool type.

Definition at line 388 of file arg.h.

389{
390 switch (*str)
391 {
392 case 'T':
393 case 't':
394 case 'Y':
395 case 'y':
396 case '1':
397 t = true;
398 return 0;
399 case 'F':
400 case 'f':
401 case 'N':
402 case 'n':
403 case '0':
404 t = false;
405 return 0;
406 default:
407 return -1;
408 }
409} /* readfromstring */

◆ readfromstring() [2/4]

int chomp::homology::readfromstring ( char *  str,
char *&  t 
)
inline

A specialization of the above template for interpreting a string as a string (no processing is necessary).

Definition at line 371 of file arg.h.

372{
373 t = str;
374 return 0;
375} /* readfromstring */

◆ readfromstring() [3/4]

int chomp::homology::readfromstring ( char *  str,
const char *&  t 
)
inline

A specialization of the above template for interpreting a string as a const string (no processing is necessary).

Definition at line 381 of file arg.h.

382{
383 t = str;
384 return 0;
385} /* readfromstring */

◆ readfromstring() [4/4]

template<class type >
int chomp::homology::readfromstring ( char *  str,
type &  t 
)
inline

A template for reading a variable from a string.

Returns 0 on success, -1 on failure.

Definition at line 353 of file arg.h.

354{
355 std::istringstream s (str);
356 try
357 {
358 s >> t;
359 if (!s)
360 return -1;
361 }
362 catch (...)
363 {
364 return -1;
365 }
366 return 0;
367} /* readfromstring */

Referenced by chomp::homology::argunit< type >::setvalue().

◆ readimage() [1/3]

template<class tCube >
std::istream & chomp::homology::readimage ( std::istream &  in,
const hashedset< tCube > &  dom,
hashedset< tCube > &  img 
)

Read the image of a set under a multivalued cubical map.

This is a specialization of the corresponding function for reading the image of a general multivalued map.

Definition at line 488 of file cubmaps.h.

490{
491 ignorecomments (in);
492 // the general format: [x,y,z] -> {[a,b,c], [d,e,f]}
493 if ((in. peek () != 'S') && (in. peek () != 's'))
494 {
495 while (in. peek () != EOF)
496 {
497 if ((closingparenthesis (in. peek ()) == EOF) &&
498 !std::isdigit (in. peek ()))
499 {
500 ignoreline (in);
501 ignorecomments (in);
502 continue;
503 }
504 tCube q;
505 in >> q;
506 bool ignore = !dom. check (q);
507 ignorecomments (in);
508 while (in. peek () == '-')
509 in. get ();
510 in. get (); // '>'
511 ignorecomments (in);
512 int opening = in. get ();
513 int closing = closingparenthesis (opening);
514 if (closing == EOF)
515 throw "An opening brace '{' expected.";
516 while ((in. peek () != EOF) &&
517 (in. peek () != closing))
518 {
519 if (ignore)
520 {
521 if (in. get () == opening)
522 {
523 while ((in. peek () != EOF) &&
524 (in. peek () != closing))
525 {
526 in. get ();
527 }
528 in. get (); // '}'
529 }
530 }
531 else
532 {
533 in >> q;
534 img. add (q);
535 ignorecomments (in);
536 if (in. peek () == ',')
537 {
538 in. get ();
539 ignorecomments (in);
540 }
541 }
542 }
543 // in. get (); // '}'
544 ignoreline (in);
545 ignorecomments (in);
546 }
547 }
548
549 typename tCube::CoordType left [tCube::MaxDim];
550 typename tCube::CoordType right [tCube::MaxDim];
551 while (in. peek () != EOF)
552 {
553 if (in. peek () == '[')
554 {
555 in. get ();
556 tCube domcube1, domcube2;
557 in >> domcube1;
558 if (!dom. check (domcube1))
559 {
560 ignoreline (in);
561 ignorecomments (in);
562 continue;
563 }
564 in >> domcube2;
565 ignorecomments (in);
566 in. get ();
567 ignorecomments (in);
568 in. get ();
569 tCube q1, q2;
570 in >> q1 >> q2;
571 if (!in)
572 throw "Can't read the file.";
573 ignorecomments (in);
574 in. get ();
575 ignorecomments (in);
576 if (dom. check (domcube1))
577 {
578 int dim = q1. dim ();
579 q1. coord (left);
580 q2. coord (right);
581 tRectangle<typename tCube::CoordType> r
582 (left, right, dim);
583 const typename tCube::CoordType *c;
584 while ((c = r. get ()) != NULL)
585 img. add (tCube (c, dim));
586 }
587 }
588 else
589 ignoreline (in);
590 ignorecomments (in);
591 }
592
593 return in;
594} /* readimage */

References closingparenthesis(), ignorecomments(), and ignoreline().

◆ readimage() [2/3]

template<class domelement , class imgelement >
std::istream & chomp::homology::readimage ( std::istream &  in,
hashedset< imgelement > &  img,
const mvmap< domelement, imgelement > &   
)

Reads the image of a multivalued map.

Definition at line 1205 of file hashsets.h.

1207{
1208 ignorecomments (in);
1209 while (in. peek () != EOF)
1210 {
1211 domelement e;
1212 in >> e;
1213 // if (!in)
1214 // throw "Failed to read a domain element of a map.";
1215
1216 // read the map's arrow
1217 ignorecomments (in);
1218 while (in. peek () == '-')
1219 in. get ();
1220 if (in. peek () == '>')
1221 in. get ();
1222
1223 ignorecomments (in);
1224 read (in, img, SMALL_SIZE);
1225
1226 ignorecomments (in);
1227 }
1228 return in;
1229} /* readimage */

References ignorecomments(), read(), and SMALL_SIZE.

◆ readimage() [3/3]

template<class tCube >
std::istream & chomp::homology::readimage ( std::istream &  in,
hashedset< tCube > &  img 
)

Reads the image of a multivalued cubical map.

This is a specialization of the corresponding function for reading the image of a general multivalued map.

Definition at line 437 of file cubmaps.h.

438{
439 ignorecomments (in);
440 if ((in. peek () != 'S') && (in. peek () != 's'))
441 {
442 mvmap<tCube,tCube> Fdummy;
443 return readimage (in, img, Fdummy);
444 }
445
446 typename tCube::CoordType left [tCube::MaxDim];
447 typename tCube::CoordType right [tCube::MaxDim];
448 while (in. peek () != EOF)
449 {
450 if (in. peek () == '[')
451 {
452 in. get ();
453 tCube dummy;
454 in >> dummy;
455 in >> dummy;
456 ignorecomments (in);
457 in. get ();
458 ignorecomments (in);
459 in. get ();
460 tCube q1, q2;
461 in >> q1 >> q2;
462 if (!in)
463 throw "Can't read the file.";
464 ignorecomments (in);
465 in. get ();
466 ignorecomments (in);
467 int dim = q1. dim ();
468 q1. coord (left);
469 q2. coord (right);
470 tRectangle<typename tCube::CoordType> r
471 (left, right, dim);
472 const typename tCube::CoordType *c;
473 while ((c = r. get ()) != NULL)
474 img. add (tCube (c, dim));
475 }
476 else
477 ignoreline (in);
478 ignorecomments (in);
479 }
480
481 return in;
482} /* readimage */
std::istream & readimage(std::istream &in, const hashedset< tCube > &dom, hashedset< tCube > &img)
Read the image of a set under a multivalued cubical map.
Definition: cubmaps.h:488

References ignorecomments(), ignoreline(), and readimage().

Referenced by readimage(), and readmapimage().

◆ readmapdomain()

template<class element >
void chomp::homology::readmapdomain ( const char *  name,
hashedset< element > &  cub 
)
inline

Reads the domain of a cubical multivalued map from the given file.

Definition at line 181 of file homtools.h.

182{
183 if (!name)
184 return;
185 sout << "Reading the domain of the map from '" << name << "'... ";
186 std::ifstream in (name);
187 if (!in)
188 fileerror (name);
189 int_t prev = cub. size ();
190 readdomain (in, cub);
191 sout << (cub. size () - prev) << " " << element::pluralname () <<
192 " read.\n";
193 return;
194} /* readmapdomain */

References fileerror(), readdomain(), and sout.

◆ readmapimage() [1/2]

template<class element >
void chomp::homology::readmapimage ( const char *  filename,
const hashedset< element > &  dom,
const char *  domname,
hashedset< element > &  cub 
)
inline

Reads the image of a set by a cubical multivalued map from the given file.

Definition at line 216 of file homtools.h.

219{
220 if (!filename)
221 return;
222 sout << "Reading the image of " << domname << " by the map '" <<
223 filename << "'... ";
224 std::ifstream in (filename);
225 if (!in)
226 fileerror (filename);
227 int_t prev = cub. size ();
228 readimage (in, dom, cub);
229 sout << (cub. size () - prev) << " " << element::pluralname () <<
230 " read.\n";
231 return;
232} /* readmapimage */
std::istream & readimage(std::istream &in, hashedset< tCube > &img)
Reads the image of a multivalued cubical map.
Definition: cubmaps.h:437

References fileerror(), readimage(), and sout.

◆ readmapimage() [2/2]

template<class element >
void chomp::homology::readmapimage ( const char *  name,
hashedset< element > &  cub 
)
inline

Reads the domain of a cubical multivalued map from the given file.

Definition at line 198 of file homtools.h.

199{
200 if (!name)
201 return;
202 sout << "Reading the image of the map from '" << name << "'... ";
203 std::ifstream in (name);
204 if (!in)
205 fileerror (name);
206 int_t prev = cub. size ();
207 readimage (in, cub);
208 sout << (cub. size () - prev) << " " << element::pluralname () <<
209 " read.\n";
210 return;
211} /* readmapimage */

References fileerror(), readimage(), and sout.

◆ readmaprestriction() [1/2]

template<class element >
void chomp::homology::readmaprestriction ( mvmap< element, element > &  Fcubmap,
const char *  mapname,
const hashedset< element > &  Xcubes,
const char *  Xname,
const char *  purpose = NULL 
)
inline

Reads the restriction of a multivalued map to the given set.

Definition at line 265 of file homtools.h.

269{
270 hashedset<element> empty;
271 readmaprestriction (Fcubmap, mapname, Xcubes, empty, Xname, purpose);
272 return;
273} /* readmaprestriction */
void readmaprestriction(mvmap< element, element > &Fcubmap, const char *mapname, const hashedset< element > &Xcubes, const char *Xname, const char *purpose=NULL)
Reads the restriction of a multivalued map to the given set.
Definition: homtools.h:265

References readmaprestriction().

◆ readmaprestriction() [2/2]

template<class element >
void chomp::homology::readmaprestriction ( mvmap< element, element > &  Fcubmap,
const char *  mapname,
const hashedset< element > &  Xcubes,
const hashedset< element > &  Acubes,
const char *  Xname,
const char *  purpose = 0 
)
inline

Reads the restriction of a multivalued map to the union of two sets.

Definition at line 236 of file homtools.h.

240{
241 if (!mapname || (Xcubes. empty () && Acubes. empty ()))
242 return;
243 sout << "Reading the map on " << Xname << " from '" << mapname;
244 if (purpose)
245 sout << "' " << purpose << "... ";
246 else
247 sout << "'... ";
248 std::ifstream in (mapname);
249 if (!in)
250 fileerror (mapname);
251 readselective (in, Xcubes, Acubes, Fcubmap);
252 if (Fcubmap. getdomain (). size () !=
253 Xcubes. size () + Acubes. size ())
254 {
255 sout << "\nWARNING: The map is not defined "
256 "on some cubes in " << Xname << ".\n";
257 }
258 else
259 sout << "Done.\n";
260 return;
261} /* readmaprestriction */
std::istream & readselective(std::istream &in, const hashedset< tCube > &dom1, const hashedset< tCube > &dom2, mvmap< tCube, tCube > &m)
Reads the restriction of a multivalued map to the given pair of sets.
Definition: cubmaps.h:598

References fileerror(), readselective(), and sout.

Referenced by readmaprestriction().

◆ readparenthesis()

int chomp::homology::readparenthesis ( std::istream &  in)
inline

Reads an opening parenthesis from the input file.

Return a corresponding closing parenthesis or EOF if none was found.

Definition at line 432 of file textfile.h.

433{
434 int closing = closingparenthesis (in. peek ());
435 if (closing != EOF)
436 in. get ();
437 return closing;
438} /* readparenthesis */

References closingparenthesis().

Referenced by operator>>(), read(), readcoordinates(), readdomain(), readrestriction(), and readselective().

◆ readrestriction()

template<class domelement , class imgelement >
std::istream & chomp::homology::readrestriction ( std::istream &  in,
mvmap< domelement, imgelement > &  m,
const hashedset< domelement > &  dom,
const hashedset< imgelement > &  img 
)

Reads a restriction of a multivalued map to the two given sets.

Definition at line 1289 of file hashsets.h.

1292{
1293 if (dom. empty ())
1294 {
1295 sout << "Warning: The domain of the map is empty.\n";
1296 return in;
1297 }
1298
1299 ignorecomments (in);
1300 while (in. peek () != EOF)
1301 {
1302 domelement e;
1303 in >> e;
1304 // if (!in)
1305 // throw "Failed to read a domain element of a map.";
1306
1307 // read the map's arrow
1308 ignorecomments (in);
1309 while (in. peek () == '-')
1310 in. get ();
1311 if (in. peek () == '>')
1312 in. get ();
1313
1314 ignorecomments (in);
1315 if (dom. check (e))
1316 {
1317 hashedset<imgelement> &y = m [e];
1318 hashedset<domelement> x;
1319 read (in, x, SMALL_SIZE);
1320 int_t n = x. size ();
1321 for (int_t i = 0; i < n; ++ i)
1322 {
1323 if (img. check (x [i]))
1324 y. add (x [i]);
1325 }
1326 }
1327 else
1328 {
1329 int closing = readparenthesis (in);
1330
1331 ignorecomments (in);
1332 while (in. peek () != closing)
1333 {
1334 imgelement junk;
1335 in >> junk;
1336 // if (!in)
1337 // throw "Failed to read an img elem.";
1338 ignorecomments (in);
1339 if (in. peek () == ',')
1340 {
1341 in. get ();
1342 ignorecomments (in);
1343 }
1344 }
1345
1346 if (closing != EOF)
1347 in. get ();
1348 }
1349 ignorecomments (in);
1350 }
1351 return in;
1352} /* readrestriction */

References ignorecomments(), read(), readparenthesis(), SMALL_SIZE, and sout.

◆ readselective() [1/4]

template<class tCube >
std::istream & chomp::homology::readselective ( std::istream &  in,
const hashedset< tCube > &  dom,
mvmap< tCube, tCube > &  m 
)
inline

Reads a restriction of a multivalued cubical map to the given set.

The order of arguments is reversed to distinguish form the template defined for a general multivalued map.

Definition at line 653 of file cubmaps.h.

655{
656 hashedset<tCube> empty;
657 return readselective (in, dom, empty, m);
658} /* readselective */
std::istream & readselective(std::istream &in, const hashedset< tCube > &dom, mvmap< tCube, tCube > &m)
Reads a restriction of a multivalued cubical map to the given set.
Definition: cubmaps.h:653

References readselective().

◆ readselective() [2/4]

template<class tCube >
std::istream & chomp::homology::readselective ( std::istream &  in,
const hashedset< tCube > &  dom1,
const hashedset< tCube > &  dom2,
mvmap< tCube, tCube > &  m 
)

Reads the restriction of a multivalued map to the given pair of sets.

Definition at line 598 of file cubmaps.h.

600{
601 if (dom1. empty () && dom2. empty ())
602 {
603 sout << "Warning: The domain of the map is empty.\n";
604 return in;
605 }
606
607 ignorecomments (in);
608 if ((in. peek () != 'S') && (in. peek () != 's'))
609 return readselective (in, m, dom1, dom2);
610
611 typename tCube::CoordType left [tCube::MaxDim];
612 typename tCube::CoordType right [tCube::MaxDim];
613 while (in. peek () != EOF)
614 {
615 if (in. peek () == '[')
616 {
617 in. get ();
618 tCube domcube;
619 in >> domcube;
620 int dim = domcube. dim ();
621 if (dom1. check (domcube) || dom2. check (domcube))
622 {
623 tCube q1, q2;
624 in >> q1; // (ignored)
625 ignorecomments (in);
626 in. get ();
627 ignorecomments (in);
628 in. get ();
629 in >> q1 >> q2;
630 if (!in)
631 throw "Can't read the file.";
632 hashedset<tCube> &img = m [domcube];
633 q1. coord (left);
634 q2. coord (right);
635 tRectangle<typename tCube::CoordType> r
636 (left, right, dim);
637 const typename tCube::CoordType *c;
638 while ((c = r. get ()) != NULL)
639 img. add (tCube (c, dim));
640 }
641 }
642 ignoreline (in);
643 ignorecomments (in);
644 }
645
646 return in;
647} /* readselective */

References ignorecomments(), ignoreline(), readselective(), and sout.

Referenced by readmaprestriction(), and readselective().

◆ readselective() [3/4]

template<class domelement , class imgelement >
std::istream & chomp::homology::readselective ( std::istream &  in,
mvmap< domelement, imgelement > &  m,
const hashedset< domelement > &  dom 
)
inline

Reads a restriction of a multivalued map to the given set.

Definition at line 1356 of file hashsets.h.

1358{
1360 return readselective (in, m, dom, empty);
1361} /* readselective */
std::istream & readselective(std::istream &in, mvmap< domelement, imgelement > &m, const hashedset< domelement > &dom)
Reads a restriction of a multivalued map to the given set.
Definition: hashsets.h:1356

References readselective().

◆ readselective() [4/4]

template<class domelement , class imgelement >
std::istream & chomp::homology::readselective ( std::istream &  in,
mvmap< domelement, imgelement > &  m,
const hashedset< domelement > &  dom1,
const hashedset< domelement > &  dom2 
)

Reads a restriction of a multivalued map to the union of the given sets.

Definition at line 1233 of file hashsets.h.

1235{
1236 if (dom1. empty () && dom2. empty ())
1237 {
1238 sout << "Warning: The domain of the map is empty.\n";
1239 return in;
1240 }
1241
1242 ignorecomments (in);
1243 while (in. peek () != EOF)
1244 {
1245 domelement e;
1246 in >> e;
1247 // if (!in)
1248 // throw "Failed to read a domain element of a map.";
1249
1250 // read the map's arrow
1251 ignorecomments (in);
1252 while (in. peek () == '-')
1253 in. get ();
1254 if (in. peek () == '>')
1255 in. get ();
1256
1257 ignorecomments (in);
1258 if (dom1. check (e) || dom2. check (e))
1259 read (in, m [e], SMALL_SIZE);
1260 else
1261 {
1262 int closing = readparenthesis (in);
1263
1264 ignorecomments (in);
1265 while (in. peek () != closing)
1266 {
1267 imgelement junk;
1268 in >> junk;
1269 // if (!in)
1270 // throw "Failed to read an img elem.";
1271 ignorecomments (in);
1272 if (in. peek () == ',')
1273 {
1274 in. get ();
1275 ignorecomments (in);
1276 }
1277 }
1278
1279 if (closing != EOF)
1280 in. get ();
1281 }
1282 ignorecomments (in);
1283 }
1284 return in;
1285} /* readselective */

References ignorecomments(), read(), readparenthesis(), SMALL_SIZE, and sout.

◆ readtheset()

template<class settype >
void chomp::homology::readtheset ( const char *  name,
settype &  s,
const char *  pluralname,
const char *  what 
)

Reads a given set from the file and shows appropriate messages.

Assumes the elements of the set begin with an opening parenthesis-char (or a digit, if "digitOk" == true) and ignores all the preceding data. Uses the given plural name of the elements for the messages. Note: This procedure is suitable for gcomplex<type> or hashedset<type>.

Definition at line 117 of file homtools.h.

119{
120 // if no file name is given, do nothing
121 if (!name)
122 return;
123
124 // show what you are doing
125 sout << "Reading " << pluralname;
126 if (what)
127 sout << " to " << what;
128 sout << " from '" << name << "'... ";
129
130 // open the file
131 std::ifstream in (name);
132 if (!in)
133 fileerror (name);
134
135 // ignore all the introductory data
136 ignorecomments (in);
137 while (!!in && (closingparenthesis (in. peek ()) == EOF) &&
138 ((in. peek () < '0') || (in. peek () > '9')) &&
139 (in. peek () != '-'))
140 {
141 ignoreline (in);
142 ignorecomments (in);
143 }
144
145 // read the set and show how many elements have been read
146 int_t prev = s. size ();
147 in >> s;
148 sout << (s. size () - prev) << " " << pluralname << " read.\n";
149
150 return;
151} /* readtheset */

References closingparenthesis(), fileerror(), ignorecomments(), ignoreline(), and sout.

Referenced by readcells(), and readelements().

◆ reduceFullCubes()

template<class FullCubSet >
int chomp::homology::reduceFullCubes ( FullCubSet &  X,
bool  quiet = false 
)
inline

Reduces the set of full cubes.

Definition at line 1167 of file bincube.h.

1168{
1169 switch (X. dimension ())
1170 {
1171 case 3:
1172 return reduceFullCubesAlg<FullCubSet,
1174 case 2:
1175 return reduceFullCubesAlg<FullCubSet,
1177 case 1:
1178 return reduceFullCubesAlg<FullCubSet,
1180 default:
1181 throw "Binary cube reduction not implemented "
1182 "for dimension > 3.";
1183 }
1184} /* reduceFullCubes */
This class defines a procedure for verifying if a full-cubical neighborhood in a given set of a full ...
Definition: bincube.h:957
This class defines a procedure for verifying if a full-cubical neighborhood in a given set of a full ...
Definition: bincube.h:976
This class defines a procedure for verifying if a full-cubical neighborhood in a given set of a full ...
Definition: bincube.h:995
int reduceFullCubesAlg(SetT &X, bool quiet)
Reduces the set of full cubes.
Definition: bincube.h:1065

References chomp::homology::bincube< Dim, twoPower >::dimension(), and reduceFullCubesAlg().

Referenced by ComputeBettiNumbers().

◆ reduceFullCubesAlg()

template<typename SetT , typename Acyclic , typename QueueT >
int chomp::homology::reduceFullCubesAlg ( SetT &  X,
bool  quiet 
)

Reduces the set of full cubes.

The class 'Acyclic' provides the function for checking if a cube can be removed from a full cubical set (the 'acyclicity' criterion). A queue in which each element should appear only once is used.

Definition at line 1065 of file bincube.h.

1066{
1067 // prepare the set of cubes to consider next time
1068 QueueT Q;
1069
1070 // scan the entire set until very few cubes are removed
1071 int count = 0;
1072 bool exitloop = false;
1073 bool lastrun = false;
1074 while (!exitloop)
1075 {
1076 // remember to exit the loop after the last run
1077 if (lastrun)
1078 exitloop = true;
1079
1080 int countremoved = 0, countleft = 0;
1081 typename SetT::iterator cur = X. begin (), end = X. end ();
1082 while (cur != end)
1083 {
1084 if (Acyclic::check (cur, X))
1085 {
1086 X. remove (cur);
1087 ++ countremoved;
1088 if (lastrun)
1089 addneighbors (cur, X, Q);
1090 }
1091 else
1092 ++ countleft;
1093 ++ cur;
1094
1095 // show progress indicator
1096 if (!quiet && !(count % 5273))
1097 scon << std::setw (10) << count <<
1098 "\b\b\b\b\b\b\b\b\b\b";
1099 ++ count;
1100 }
1101 if (!quiet)
1102 sout << ".";
1103
1104 if (!lastrun && (countremoved - 10 < (countleft >> 2)))
1105 lastrun = true;
1106 }
1107
1108 if (!quiet)
1109 sout << " ";
1110 count = 0;
1111 while (!Q. empty ())
1112 {
1113 typename QueueT::value_type elem = Q. front ();
1114 Q. pop ();
1115 if (Acyclic::check (elem, X))
1116 {
1117 X. remove (elem);
1118 addneighbors (elem, X, Q);
1119 }
1120
1121 // show progress indicator
1122 if (!quiet && !(count % 5273))
1123 scon << std::setw (10) << count <<
1124 "\b\b\b\b\b\b\b\b\b\b";
1125 count ++;
1126 }
1127
1128 return 0;
1129} /* reduceFullCubesAlg */

References addneighbors(), chomp::homology::bincube< Dim, twoPower >::begin(), chomp::homology::bincube< Dim, twoPower >::count(), chomp::homology::bincube< Dim, twoPower >::empty(), chomp::homology::bincube< Dim, twoPower >::end(), chomp::homology::bincube< Dim, twoPower >::remove(), scon, and sout.

Referenced by reduceFullCubes().

◆ reducepair() [1/2]

template<class cubsettype >
void chomp::homology::reducepair ( cubsettype &  Xcubes,
cubsettype &  Acubes,
const cubsettype &  Xkeepcubes,
const char *  Xname,
const char *  Aname 
)

Reduces the pair of sets of cubes. Keeps the given cubes untouched.

Definition at line 619 of file homtools.h.

621{
622 if (Xcubes. empty ())
623 return;
624 sout << "Reducing full-dim cubes from ";
625 if (!Acubes. empty ())
626 sout << '(' << Xname << ',' << Aname << ")... ";
627 else
628 sout << Xname << "... ";
629 int_t count = cubreduce (Xcubes, Acubes, Xkeepcubes);
630 sout << count << " removed, " <<
631 (Xcubes. size () + Acubes. size ()) << " left.\n";
632 return;
633} /* reducepair */
int_t cubreduce(hashedset< tCube > &cset, hashedset< tCube > &other, mvmap< tCube, tCube > &cubmap, const hashedset< tCube > &keep)
Reduces a pair of sets of cubes for relative homology computation.
Definition: cubisets.h:91

References cubreduce(), and sout.

Referenced by Homology(), and Homology2l().

◆ reducepair() [2/2]

template<class maptype , class cubsettype >
void chomp::homology::reducepair ( cubsettype &  Xcubes,
cubsettype &  Acubes,
maptype &  Fcubmap,
const cubsettype &  Xkeepcubes,
const char *  Xname,
const char *  Aname 
)

Reduces the pair of sets of cubes.

Keeps the given cubes untouched. Makes sure that the acyclicity of the given map is not spoiled.

Definition at line 638 of file homtools.h.

640{
641 if (Xcubes. empty ())
642 return;
643 sout << "Reducing cubes from ";
644 if (!Acubes. empty ())
645 sout << '(' << Xname << ',' << Aname << ") [acyclic]... ";
646 else
647 sout << Xname << " [acyclic]... ";
648 int_t count = cubreduce (Xcubes, Acubes, Fcubmap, Xkeepcubes);
649 sout << count << " removed, " <<
650 (Xcubes. size () + Acubes. size ()) << " left.\n";
651 return;
652} /* reducepair */

References cubreduce(), and sout.

◆ remainsacyclic()

template<class tCube , class tSet >
bool chomp::homology::remainsacyclic ( const mvmap< tCube, tCube > &  map,
const tCube &  q,
const tSet &  cset 
)

Verifies if the map remains acyclic after the addition or removal of the given cube to/from the union of the first and the second set.

Assumes that the map is acyclic before the change. Returns 'true' if yes for sure, 'false' if there is some doubt about it.

Definition at line 280 of file cubacycl.h.

282{
283 // if the map is trivial then the answer is obvious
284 if (map. getdomain (). empty ())
285 return true;
286
287 // compute the maximal number of neighbors of a cube
288 int_t maxneighbors = getmaxneighbors (q. dim ());
289
290 // prepare a bitfield and allocate it if necessary
291 static BitField b;
292 static int_t _maxneighbors = 0;
293 static auto_array<unsigned char> buffer;
294 if (maxneighbors != _maxneighbors)
295 {
296 _maxneighbors = maxneighbors;
297 buffer. reset (new unsigned char [(maxneighbors + 7) >> 3]);
298 b. define (buffer. get (), maxneighbors);
299 }
300
301 // clear the neighborbits
302 b. clearall (maxneighbors);
303
304 // get the bitfield representing the set of the neighbors of the cube
305 getneighbors (q, &b, cset, 0);
306
307 // create all the faces of the cube
308 gcomplex<typename tCube::CellType,integer> faces;
309 addneighbors (q, b, faces);
310 faces. addboundaries ();
311
312 // compute the new images of all the faces
313 // and determine if they are acyclic
314 int startdim = faces. dim ();
315 for (int d = startdim; d >= 0; -- d)
316 {
317 for (int_t i = 0; i < faces [d]. size (); ++ i)
318 {
319 // compute the image of the face in the set
320 hashedset<tCube> img;
321 int_t n = computeimage (img, faces [d] [i], map,
322 cset, q);
323
324 // if this is the image of only one cube, it is Ok
325 if (n == 1)
326 continue;
327
328 // verify whether the large image (with 'q')
329 // can be reduced towards the small one (without 'q')
330 hashedset<tCube> imgsurplus = map (q);
331 imgsurplus. remove (img);
332 cubreducequiet (img, imgsurplus);
333 if (!imgsurplus. empty ())
334 return false;
335 }
336 }
337
338 return true;
339} /* remainsacyclic */
An auto_array template that mimics selected behaviors of the std::auto_ptr template,...
Definition: autoarray.h:54
int_t computeimage(hashedset< tCube > &img, const tCell &face, const mvmap< tCube, tCube > &map, const tSet &cset, const tCube &ignore)
Computes the image of the face under the combinatorial cubical multivalued map, but doesn't take the ...
Definition: cubacycl.h:235

References addboundaries(), addneighbors(), computeimage(), cubreducequiet(), getmaxneighbors(), and getneighbors().

Referenced by chomp::homology::MapCanExpand< tCube >::operator()(), and chomp::homology::MapRemainsAcyclic< tCube >::operator()().

◆ removeAfromX() [1/2]

template<class cubsettype >
void chomp::homology::removeAfromX ( cubsettype &  Xcubes,
const cubsettype &  Acubes,
const char *  Xname,
const char *  Aname 
)

Removes 'Acubes' from 'Xcubes' and shows messages.

Definition at line 548 of file homtools.h.

550{
551 if (Xcubes. empty () || Acubes. empty ())
552 return;
553 sout << "Computing " << Xname << "\\" << Aname << "... ";
554 int_t prev = Xcubes. size ();
555 Xcubes. remove (Acubes);
556 sout << (prev - Xcubes. size ()) << " cubes removed from " <<
557 Xname << ", " << Xcubes. size () << " left.\n";
558 return;
559} /* removeAfromX */

References sout.

Referenced by Homology(), and Homology2l().

◆ removeAfromX() [2/2]

template<class cell , class euclidom >
void chomp::homology::removeAfromX ( gcomplex< cell, euclidom > &  X,
const gcomplex< cell, euclidom > &  A,
const char *  Xname,
const char *  Aname 
)

Removes from 'X' all the cells that appear in 'A'.

Definition at line 563 of file homtools.h.

566{
567 if (X. empty () || A. empty ())
568 return;
569 sout << "Computing " << Xname << "\\" << Aname << "... ";
570 int_t prev = X. size ();
571 X. remove (A);
572 sout << (prev - X. size ()) << ' ' << cell::pluralname () <<
573 " removed from " << Xname << ", " << X. size () <<
574 " left.\n";
575 return;
576} /* removeAfromX */

References sout.

◆ restrictAtoneighbors()

template<class cubsettype >
void chomp::homology::restrictAtoneighbors ( const cubsettype &  Xcubes,
cubsettype &  Acubes,
const char *  Xname,
const char *  Aname,
const cubsettype *  keepcubes = 0 
)

Restricts the set of cubes 'Acubes' to these cubes which are neighbors of any of the cubes in 'Xcubes' and displays appropriate messages.

Definition at line 503 of file homtools.h.

506{
507 // if the set 'A' is empty, there is no point in doing anything
508 if (Acubes. empty ())
509 return;
510
511 // display the message what is being done now
512 sout << "Restricting " << Aname << " to the neighbors of " <<
513 Xname << "\\" << Aname << "... ";
514
515 // remember the previous number of cubes in 'A'
516 int_t prev = Acubes. size ();
517
518 // if the set 'X' is empty, the result is obvious
519 if (Xcubes. empty ())
520 {
521 cubsettype empty;
522 Acubes = empty;
523 }
524
525 // remove from 'A' these cubes which are not neighbors of 'X'
526 sseq << "D 0\n";
527 for (int_t i = 0; i < Acubes. size (); ++ i)
528 {
529 if (keepcubes && keepcubes -> check (Acubes [i]))
530 continue;
531 if (getneighbors (Acubes [i], 0, Xcubes, 1))
532 continue;
533 sseq << '0' << Acubes [i] << '\n';
534 Acubes. removenum (i);
535 -- i;
536 }
537 sseq << "D 100\n";
538
539 // display the result
540 sout << (prev - Acubes. size ()) << " cubes removed, " <<
541 Acubes. size () << " left.\n";
542
543 return;
544} /* restrictAtoneighbors */
outputstream sseq
An auxiliary stream which captures sequences of processed data.

References getneighbors(), sout, and sseq.

Referenced by Homology(), and Homology2l().

◆ retrieveimage()

template<class domelement , class imgelement >
hashedset< imgelement > & chomp::homology::retrieveimage ( const mvmap< domelement, imgelement > &  m,
hashedset< imgelement > &  img 
)

Adds images of all the elements from the domain of the map to 'img'.

Definition at line 1128 of file hashsets.h.

1130{
1131 int_t n = m. getdomain (). size ();
1132 for (int_t i = 0; i < n; ++ i)
1133 img. add (m (i));
1134 return img;
1135} /* retrieveimage */

Referenced by addmapimg().

◆ rounddown()

template<class coordtype >
coordtype chomp::homology::rounddown ( double  x)
inline

Rounds down the given real number to an integral type.

Definition at line 214 of file pointset.h.

215{
216 if ((x >= 0) || ((double) (coordtype) x == x))
217 return (coordtype) x;
218 else
219 return -(coordtype) (-x) - 1;
220} /* rounddown */

◆ roundpoint()

template<class coordtype >
void chomp::homology::roundpoint ( const double *  p,
coordtype *  c,
const double *  grid,
int  dim 
)
inline

Rounds down the double coordinates of a point to integer ones.

If the grid is provided (not NULL), then uses this grid instead of the integral lattice.

Definition at line 226 of file pointset.h.

228{
229 if (grid)
230 {
231 for (int i = 0; i < dim; ++ i)
232 c [i] = rounddown<coordtype> (p [i] / grid [i]);
233 }
234 else
235 {
236 for (int i = 0; i < dim; ++ i)
237 c [i] = rounddown<coordtype> (p [i]);
238 }
239 return;
240} /* roundpoint */

Referenced by chomp::homology::tPointset< coordtype >::addRounded(), and chomp::homology::tPointset< coordtype >::getnumberRounded().

◆ savecells()

template<class cell , class euclidom >
void chomp::homology::savecells ( const char *  name,
const gcomplex< cell, euclidom > &  s,
const char *  what,
const char *  filecomment = 0 
)
inline

Uses the general procedure "savetheset" to save a geometric complex.

Definition at line 316 of file homtools.h.

318{
319 savetheset (name, s, cell::pluralname (), what, filecomment);
320 return;
321} /* savecells */
void savetheset(const char *name, const settype &s, const char *pluralname, const char *what, const char *filecomment=0)
Saves a given set to a file and shows appropriate messages.
Definition: homtools.h:283

References savetheset().

◆ saveelements() [1/2]

void chomp::homology::saveelements ( const char *  name,
const cubes cub,
const char *  what,
const char *  filecomment = 0 
)
inline

Saves a set of cubes to the given file.

This function is necessary because cubes need special treatment.

Definition at line 334 of file homtools.h.

336{
337 savetheset (name, cub, cube::pluralname (), what, filecomment);
338 return;
339} /* saveelements */

References chomp::homology::tCubeBase< coordtype >::pluralname(), and savetheset().

◆ saveelements() [2/2]

template<class element >
void chomp::homology::saveelements ( const char *  name,
const hashedset< element > &  s,
const char *  what,
const char *  filecomment = 0 
)
inline

Uses the general procedure "savetheset" to save a set of elements.

Definition at line 325 of file homtools.h.

327{
328 savetheset (name, s, element::pluralname (), what, filecomment);
329 return;
330} /* saveelements */

References savetheset().

◆ savetheset() [1/2]

template<class settype >
void chomp::homology::savetheset ( const char *  name,
const settype &  s,
const char *  pluralname,
const char *  what,
const char *  filecomment = 0 
)

Saves a given set to a file and shows appropriate messages.

Note: This procedure is suitable for gcomplex<type> or hashedset<type>.

Definition at line 283 of file homtools.h.

285{
286 // if no file name is given, do nothing
287 if (!name)
288 return;
289
290 // show what you are doing
291 sout << "Saving " << pluralname;
292 if (what)
293 sout << " in " << what;
294 sout << " to '" << name << "'... ";
295
296 // open the file
297 std::ofstream out (name);
298 if (!out)
299 fileerror (name, "create");
300
301 // save the data
302 if (filecomment)
303 out << filecomment;
304 out << s;
305 if (!out)
306 fileerror (name, "save");
307
308 // show how many elements have been written
309 sout << s. size () << " " << pluralname << " written.\n";
310
311 return;
312} /* writetheset */

References fileerror(), and sout.

Referenced by savecells(), and saveelements().

◆ savetheset() [2/2]

template<class settype >
static void chomp::homology::savetheset ( const settype &  c,
const char *  prefix,
const char *  filename,
const char *  name 
)
static

Writes the given object to a file whose name is a concatenation of the prefix and the given file name.

If the prefix is 0 thenthe prefix is treated as an empty string. Displays a warning if unsuccessful, does not throw any exception. This procedure can be applied to any data type which has the operator << for writing it to a text output stream (std::ostream) defined.

Definition at line 468 of file textfile.h.

470{
471 // if there is no prefix given, do not save the file
472 if (!prefix)
473 return;
474
475 // prepare the full file name
476 std::string str;
477 if (prefix)
478 str = std::string (prefix) + std::string (filename);
479 else
480 str = filename;
481 const char *s = str. c_str ();
482
483 // create the output file
484 std::ofstream out (s);
485 if (!out)
486 {
487 sout << "WARNING: Cannot save the file '" << s << "'.\n";
488 return;
489 }
490
491 // write the cubes to the output file
492 sout << "Saving " << name << " to '" << s << "'... ";
493 out << "; This is " << name << ".\n";
494 out << c;
495 sout << "Done.\n";
496
497 return;
498} /* savetheset */

References sout.

◆ scancubes()

template<class tCube >
void chomp::homology::scancubes ( const char *  name)
inline

Reads all the cubes from the given file and ignores them.

In this way the numbers of cubes are established.

Definition at line 55 of file homtools.h.

56{
57 if (!name || !*name)
58 return;
59 std::ifstream in (name);
60 if (!in)
61 fileerror (name);
62
63 // read all the cubes contained in the file,
64 // but ignore lines not starting with a parenthesis
65 sout << "Scanning the file '" << name << "' for cubes... ";
66 int_t count = 0;
67 int dim = -19;
68 bool warned = false;
69 ignorecomments (in);
70 while (in)
71 {
72 typename tCube::CoordType c [tCube::MaxDim];
73 if (closingparenthesis (in. peek ()) == EOF)
74 ignoreline (in);
75 else
76 {
77 // read the point from the file
78 int d = readcoordinates (in, c, tCube::MaxDim);
79
80 // verify the dimension of the point
81 if (dim < 0)
82 dim = d;
83 else if ((dim != d) && !warned)
84 {
85 sout << "\nWARNING: Not all the cubes have "
86 "the same dimension.\n";
87 warned = true;
88 }
89
90 // add the point to the point base
91 // and verify its number
92 int_t n = tCube::PointBase::number (c, d);
93 if ((n != count) && !warned)
94 {
95 cube q (c, d);
96 sout << "\nWARNING: Some cubes are "
97 "repeated - " << q <<
98 " for example.\n";
99 warned = true;
100 }
101
102 // count the point
103 ++ count;
104 }
105 ignorecomments (in);
106 }
107 sout << count << " cubes analyzed.\n";
108 return;
109} /* scancubes */

References closingparenthesis(), fileerror(), ignorecomments(), ignoreline(), readcoordinates(), and sout.

◆ SCC()

template<class wType , class Table1 , class Table2 >
int_t chomp::homology::SCC ( const diGraph< wType > &  g,
Table1 &  compVertices,
Table2 &  compEnds,
diGraph< wType > *  scc = 0,
diGraph< wType > *  transposed = 0,
bool  copyweights = false 
)
inline

Computes strongly connected components of the graph 'g'.

Creates the graph 'scc' in which each vertex corresponds to one component. The graph 'scc' given as an argument must be initially empty. The table 'compVertices' is filled with the numbers of vertices in 'g' which form the components, and the indices that end the listing for each component are stored in the table 'compEnds'. Returns the number of strongly connected components found.

Definition at line 2392 of file digraph.h.

2395{
2396 // prepare two tables
2397 int_t nVert = g. countVertices ();
2398 int_t *ordered = new int_t [nVert];
2399 int_t *tab = new int_t [nVert];
2400
2401 // compute the list of vertices in the descending finishing time
2402 g. DFSfinishTime (tab);
2403 for (int_t i = 0; i < nVert; ++ i)
2404 ordered [nVert - tab [i]] = i;
2405 delete [] tab;
2406
2407 // create the transposed graph
2408 diGraph<wType> gT;
2409 if (!transposed)
2410 transposed = &gT;
2411 g. transpose (*transposed, copyweights);
2412
2413 // extract the DFS forest of gT in the given order of vertices
2414 int_t n = transposed -> DFSforest (ordered, compVertices, compEnds,
2415 true, scc);
2416
2417 // cleanup memory and return the number of components
2418 delete [] ordered;
2419 return n;
2420} /* SCC */

Referenced by invariantpart(), chomp::homology::diGraph< wType >::minMeanCycleWeight(), and chomp::homology::diGraph< wType >::minMeanCycleWeightMem().

◆ SCC_Tarjan()

template<class wType , class Table1 , class Table2 >
int_t chomp::homology::SCC_Tarjan ( const diGraph< wType > &  g,
Table1 &  compVertices,
Table2 &  compEnds 
)
inline

Computes strongly connected components of the graph 'g' using Tarjan's algorithm (as described in the Wikipedia).

Tha advantage of this approach over the one described in Cormen's textbook is that the transposed graph need not be computed. However, this algorithm might be slightly slower than the other one. The table 'compVertices' is filled with the numbers of vertices in 'g' which form the components, and the indices that end the listing for each component are stored in the table 'compEnds'. Returns the number of strongly connected components found.

Definition at line 2434 of file digraph.h.

2436{
2437 // return the obvious result if the graph is empty
2438 int_t nVertices = g. countVertices ();
2439 if (!nVertices)
2440 return 0;
2441
2442 // prepare an array of discovery times for all the vertices
2443 // (zero == not yet discovered)
2444 std::vector<int_t> dfsIndex (nVertices, 0);
2445
2446 // prepare an array of the minimal index of a node reachable
2447 // from each of the vertices
2448 std::vector<int_t> lowLink (nVertices, 0);
2449
2450 // prepare an empty stack of nodes
2451 std::stack<int_t> s_nodes;
2452
2453 // prepare an array of bits indicating whether the vertices are
2454 // in the stack of nodes or not
2455 BitField inTheStack;
2456 inTheStack. allocate (nVertices);
2457 inTheStack. clearall (nVertices);
2458
2459 // prepare the number of strongly connected components
2460 int_t nComponents = 0;
2461
2462 // prepare the current position in the array 'compVertices'
2463 int_t posVertices = 0;
2464
2465 // remember the next vertex number in the graph to scan
2466 // whether this vertex has already been visited or not
2467 int_t vertexToScan = 0;
2468
2469 // prepare a variable for storing the discovery time in the DFS
2470 int_t discoveryTime = 0;
2471
2472 // prepare stacks for the DFS recursion
2473 std::stack<int_t> s_vertex;
2474 std::stack<int_t> s_edge;
2475 std::stack<int_t> s_maxedge;
2476
2477 // initialize the number of the currently processed vertex
2478 int_t vertex = -1;
2479
2480 // initialize the range of edges to be visited
2481 int_t edge = 0;
2482 int_t maxedge = 0;
2483
2484 while (1)
2485 {
2486 // return to the previous recursion level
2487 // if all the edges have been checked
2488 if (edge >= maxedge)
2489 {
2490 // extract a strongly connected component
2491 if ((vertex >= 0) && (lowLink [vertex] ==
2492 dfsIndex [vertex]))
2493 {
2494 int_t v = 0;
2495 do
2496 {
2497 v = s_nodes. top ();
2498 s_nodes. pop ();
2499 inTheStack. clear (v);
2500 compVertices [posVertices ++] = v;
2501 } while (v != vertex);
2502 compEnds [nComponents ++] = posVertices;
2503 }
2504
2505 // if this is the top level of the recursion
2506 // then find another unvisited vertex or return
2507 if (s_vertex. empty ())
2508 {
2509 // find an unvisited vertex in the graph
2510 while ((vertexToScan < nVertices) &&
2511 (dfsIndex [vertexToScan] != 0))
2512 {
2513 ++ vertexToScan;
2514 }
2515
2516 // return the result if all visited
2517 if (vertexToScan == nVertices)
2518 {
2519 inTheStack. free ();
2520 return nComponents;
2521 }
2522
2523 // set the new vertex
2524 vertex = vertexToScan ++;
2525
2526 // mark the current vertex as visited
2527 // and initialize its low link
2528 dfsIndex [vertex] = ++ discoveryTime;
2529 lowLink [vertex] = discoveryTime;
2530
2531 // push this vertex on the stack
2532 s_nodes. push (vertex);
2533 inTheStack. set (vertex);
2534
2535 // determine the edges to be visited
2536 edge = 0;
2537 maxedge = g. countEdges (vertex);
2538 }
2539
2540 // otherwise trace back to the previous level
2541 else
2542 {
2543 // remember the current low link index
2544 int_t lowLink2 = lowLink [vertex];
2545
2546 // restore the variables
2547 vertex = s_vertex. top ();
2548 s_vertex. pop ();
2549 edge = s_edge. top ();
2550 s_edge. pop ();
2551 maxedge = s_maxedge. top ();
2552 s_maxedge. pop ();
2553
2554 // update the current low link index
2555 if (lowLink [vertex] > lowLink2)
2556 lowLink [vertex] = lowLink2;
2557 }
2558 }
2559
2560 // analyse the next edge coming out from the current vertex
2561 else
2562 {
2563 // determine the next vertex
2564 int_t next = g. getEdge (vertex, edge ++);
2565
2566 // go to a deeper recursion level if unvisited
2567 if (dfsIndex [next] == 0)
2568 {
2569 // store the variables at the stacks
2570 s_vertex. push (vertex);
2571 s_edge. push (edge);
2572 s_maxedge. push (maxedge);
2573
2574 // set the new vertex
2575 vertex = next;
2576
2577 // mark the new vertex as visited
2578 dfsIndex [vertex] = ++ discoveryTime;
2579 lowLink [vertex] = discoveryTime;
2580
2581 // push this vertex on the stack
2582 s_nodes. push (vertex);
2583 inTheStack. set (vertex);
2584
2585 // determine the edges to be visited
2586 edge = 0;
2587 maxedge = g. countEdges (vertex);
2588 }
2589
2590 // update the low link index if the vertex has been
2591 // visited and is currently in the stack of nodes
2592 else if (inTheStack. test (next))
2593 {
2594 if (lowLink [vertex] > dfsIndex [next])
2595 lowLink [vertex] = dfsIndex [next];
2596 }
2597 }
2598 }
2599
2600 // finalize and return the number of strongly connected components
2601 inTheStack. free ();
2602 return nComponents;
2603} /* SCC_Tarjan */

◆ SetSpaceWrapping()

template<class coordtype >
void chomp::homology::SetSpaceWrapping ( int  dim,
const coordtype *  wrap 
)
inline

Sets space wrapping in each direction separately.

Parameters
dim- the dimension of cubes for which the space wrapping is defined
wrap- space wrapping: a nonzero entry indicates a periodic boundary condition in the corresponding direction

Definition at line 2237 of file homology.h.

2238{
2239 if ((dim < 0) || (dim >= Cube::MaxDim))
2240 return;
2241
2242 // set space wrapping if requested to
2243 coordinate wrapcoord [Cube::MaxDim];
2244 for (int j = 0; j < dim; ++ j)
2245 wrapcoord [j] = static_cast <coordtype>
2246 ((wrap [j] >= 0) ? wrap [j] : -wrap [j]);
2248 return;
2249} /* SetSpaceWrapping */
void wrapcoord(coordtype *destination, const coordtype *source, const coordtype *wrap, int dim)
Wraps coordinates stored in 'c' accordint to the wrap table 'wrap' and store the result in the table ...
Definition: pointset.h:119

References chomp::homology::tCubeBase< coordtype >::MaxDim, chomp::homology::tPointBase< coordtype >::setwrapping(), and wrapcoord().

◆ setstreams()

void chomp::homology::setstreams ( const char *  logfilename,
char *  seqfilename,
bool  quiet,
bool  debug 
)
inline

Sets the parameters of the output streams depending on the file names acquired from the command line.

This is an internal function used by the macro "algstreamset".

Definition at line 806 of file arg.h.

808{
809 if (debug)
810 sbug. show = true;
811 if (quiet)
812 {
813 sout. show = false;
814 scon. show = false;
815 sbug. show = false;
816 }
817 if (logfilename)
818 {
819 slog. logfile (logfilename);
820 slog. keepforever ();
821 sout. logfile (slog);
822 serr. logfile (slog);
823 if (debug)
824 sbug. logfile (slog);
825 }
826 if (seqfilename)
827 sseq. logfile (seqfilename);
828#ifdef TIMEUSED
830#endif
831 return;
832} /* setstreams */
outputstream serr
A wrapper for the standard error stream.
timeused program_time
The external variable which measures the time used by the program from its start.
outputstream slog
The output stream to which one can send messages for logging only.

References program_time, sbug, scon, serr, slog, sout, and sseq.

◆ show_homology() [1/2]

template<class euclidom >
outputstream & chomp::homology::show_homology ( outputstream out,
const chain< euclidom > &  c 
)
inline

Shows a chain as a list of generators of one level of a homology module.

Definition at line 3584 of file chains.h.

3586{
3587 int_t countfree = 0;
3588 bool writeplus = false;
3589 for (int_t i = 0; i < c. size (); ++ i)
3590 {
3591 if (c. coef (i). delta () == 1)
3592 ++ countfree;
3593 else
3594 {
3595 out << (writeplus ? " + " : "") <<
3596 euclidom::ringsymbol () << "_" <<
3597 c. coef (i);
3598 writeplus = true;
3599 }
3600
3601 if (countfree && ((i == c. size () - 1) ||
3602 (c. coef (i + 1). delta () != 1)))
3603 {
3604 out << (writeplus ? " + " : "") <<
3606 if (countfree > 1)
3607 out << "^" << countfree;
3608 countfree = 0;
3609 writeplus = true;
3610 }
3611 }
3612
3613 // if there was nothing to show, then just show zero
3614 if (!c. size ())
3615 out << "0";
3616
3617 return out;
3618} /* show_homology */
const char * ringsymbol()
Definition: algstruct.h:216

References chomp::homengin::ringsymbol().

Referenced by chomp::homology::chaincomplex< euclidom >::compute_and_show_homology(), chomp::homology::chaincomplex< euclidom >::show_homology(), show_homology(), and chomp::homology::chainmap< euclidom >::show_homology().

◆ show_homology() [2/2]

template<class euclidom >
std::ostream & chomp::homology::show_homology ( std::ostream &  out,
const chain< euclidom > &  c 
)
inline

Shows a chain as a list of generators of one level of a homology module.

Definition at line 3623 of file chains.h.

3625{
3626 outputstream tout (out);
3627 show_homology (tout, c);
3628 return out;
3629} /* show_homology */
This class defines an output stream for replacing the standard 'cout'.
Definition: textfile.h:64
std::ostream & show_homology(std::ostream &out, const chain< euclidom > &c)
Shows a chain as a list of generators of one level of a homology module.
Definition: chains.h:3623

References show_homology().

◆ ShowGenerator() [1/2]

template<class euclidom >
void chomp::homology::ShowGenerator ( const chain< euclidom > &  c)
inline

Shows (that is, writes to 'sout') one generator of the homology module of a chain complex.

The generator is encoded in the given chain. Note: The numbers of generators of the original chain complex are displayed increased by 1 (that is, the first generator is "1", not "0").

Definition at line 208 of file homology.h.

209{
210 c. show (sout, "c");
211 return;
212} /* ShowGenerator */

References sout.

Referenced by ShowGenerators().

◆ ShowGenerator() [2/2]

template<class cell , class euclidom >
void chomp::homology::ShowGenerator ( const chain< euclidom > &  c,
const hashedset< cell > &  s 
)

Shows (that is, writes to 'sout') one generator of the homology module of a geometric complex.

The generator is encoded in the given chain.

Definition at line 272 of file homology.h.

273{
274 if (!c. size ())
275 sout << '0';
276 for (int i = 0; i < c. size (); ++ i)
277 {
278 euclidom e = c. coef (i);
279 if (e == 1)
280 sout << (i ? " + " : "") << s [c. num (i)];
281 else if (-e == 1)
282 sout << (i ? " - " : "-") << s [c. num (i)];
283 else
284 {
285 sout << (i ? " + " : "") << e << " * " <<
286 s [c. num (i)];
287 }
288 }
289 return;
290} /* ShowGenerator */

References sout.

◆ ShowGenerators() [1/5]

template<class euclidom , class cell >
void chomp::homology::ShowGenerators ( chain< euclidom > *const *  gen,
const chain< euclidom > *  hom,
int  maxlevel,
const gcomplex< cell, euclidom > &  gcompl 
)

Shows all the generators of the entire homology module of a geometric complex.

Each level of generators is encoded in one array of chains.

Definition at line 311 of file homology.h.

314{
315 for (int q = 0; q <= maxlevel; ++ q)
316 {
317 if (!hom [q]. size ())
318 continue;
319 sout << "[H_" << q << "]\n";
320 ShowGenerators (gen [q], hom [q]. size (), gcompl [q]);
321 sout << '\n';
322 }
323 return;
324} /* ShowGenerators */
void ShowGenerators(chain< euclidom > *const *gen, const chain< euclidom > *hom, int maxlevel, const gcomplex< cell, euclidom > &gcompl)
Shows all the generators of the entire homology module of a geometric complex.
Definition: homology.h:311

References ShowGenerators(), and sout.

◆ ShowGenerators() [2/5]

template<class euclidom >
void chomp::homology::ShowGenerators ( chain< euclidom > const *const *const  gen,
const chain< euclidom > *  hom,
int  maxlevel 
)

Shows (that is, writes to 'sout') all the generators of the entire homology module of a chain complex.

Each level of generators is encoded in one array of chains.

Definition at line 233 of file homology.h.

235{
236 for (int q = 0; q <= maxlevel; ++ q)
237 {
238 if (!hom [q]. size ())
239 continue;
240 sout << "[H_" << q << "]\n";
241 ShowGenerators (gen [q], hom [q]. size ());
242 sout << '\n';
243 }
244 return;
245} /* ShowGenerators */

References ShowGenerators(), and sout.

◆ ShowGenerators() [3/5]

template<class euclidom >
void chomp::homology::ShowGenerators ( const chain< euclidom > *  c,
int  count 
)

Shows (that is, writes to 'sout') all the generators of one level of the homology module of a chain complex.

Each generator is encoded in one chain in the given array.

Definition at line 218 of file homology.h.

219{
220 for (int i = 0; i < count; ++ i)
221 {
222 sout << 'g' << (i + 1) << " = ";
223 ShowGenerator (c [i]);
224 sout << '\n';
225 }
226 return;
227} /* ShowGenerators */
void ShowGenerator(const chain< euclidom > &c, const hashedset< cell > &s)
Shows (that is, writes to 'sout') one generator of the homology module of a geometric complex.
Definition: homology.h:272

References ShowGenerator(), and sout.

Referenced by ShowGenerators().

◆ ShowGenerators() [4/5]

template<class cell , class euclidom >
void chomp::homology::ShowGenerators ( const chain< euclidom > *  c,
int  count,
const hashedset< cell > &  s 
)

Shows (that is, writes to 'sout') all the generators of one level of the homology module of a geometric complex.

Each generator is encoded in one chain in the given array.

Definition at line 296 of file homology.h.

298{
299 for (int i = 0; i < count; ++ i)
300 {
301 sout << 'g' << (i + 1) << " = ";
302 ShowGenerator (c [i], s);
303 sout << '\n';
304 }
305 return;
306} /* ShowGenerators */

References ShowGenerator(), and sout.

◆ ShowGenerators() [5/5]

template<class euclidom >
void chomp::homology::ShowGenerators ( const chaincomplex< euclidom > &  c,
const chain< euclidom > *  hom,
int  maxlevel 
)

Shows (that is, writes to 'sout') all the generators of the entire homology module of a chain complex.

The generators are retrieved from the chain complex itself.

Definition at line 251 of file homology.h.

253{
254 for (int q = 0; q <= maxlevel; ++ q)
255 {
256 if (!hom [q]. size ())
257 continue;
258 sout << "[H_" << q << "]\n";
259 for (int i = 0; i < hom [q]. size (); ++ i)
260 {
261 ShowGenerator (c. gethomgen (q, hom [q]. num (i)));
262 sout << '\n';
263 }
264 sout << '\n';
265 }
266 return;
267} /* ShowGenerators */

References ShowGenerator(), and sout.

◆ ShowHomology() [1/3]

template<class euclidom >
void chomp::homology::ShowHomology ( const chain< euclidom > &  c)
inline

Shows (that is, writes to 'sout') one level of the homology module encoded in the given chain.

Definition at line 137 of file homology.h.

138{
139 int countfree = 0;
140 bool writeplus = false;
141
142 // write the homology module exactly in the order it appears in 'c'
143 for (int i = 0; i < c. size (); ++ i)
144 {
145 // if the coefficient is invertible, it will be shown later
146 if (c. coef (i). delta () == 1)
147 ++ countfree;
148 // otherwise show the corresponding torsion part now
149 else
150 {
151 sout << (writeplus ? " + " : "") <<
152 euclidom::ringsymbol () << "_" <<
153 c. coef (i);
154 writeplus = true;
155 }
156
157 // if there were some free ingredients show them if necessary
158 if (countfree && ((i == c. size () - 1) ||
159 (c. coef (i + 1). delta () != 1)))
160 {
161 sout << (writeplus ? " + " : "") <<
163 if (countfree > 1)
164 sout << "^" << countfree;
165 countfree = 0;
166 writeplus = true;
167 }
168 }
169
170 // if there was nothing to show, then just show zero
171 if (!c. size ())
172 sout << "0";
173
174 return;
175} /* ShowHomology */

References chomp::homengin::ringsymbol(), and sout.

Referenced by ComputeBettiNumbers(), and ShowHomology().

◆ ShowHomology() [2/3]

template<class euclidom >
void chomp::homology::ShowHomology ( const chain< euclidom > *  hom,
int  maxlevel 
)

Shows (that is, writes to 'sout') the entire homology module encoded in an array of chains.

Definition at line 180 of file homology.h.

181{
182 if (!hom)
183 return;
184
185 for (int q = 0; q <= maxlevel; ++ q)
186 {
187 sout << "H_" << q << " = ";
188 ShowHomology (hom [q]);
189 sout << '\n';
190 }
191 return;
192} /* ShowHomology */

References ShowHomology(), and sout.

◆ ShowHomology() [3/3]

template<class euclidom >
void chomp::homology::ShowHomology ( const chainmap< euclidom > &  hmap)
inline

Show (that is, writes to 'sout') the homology map encoded in terms of a chain map.

Definition at line 197 of file homology.h.

198{
199 hmap. show (sout, "\tf", "x", "y");
200 return;
201} /* ShowHomology */

References sout.

◆ sortelements()

template<class type >
int chomp::homology::sortelements ( type *  tab,
int  n 
)
inline

A simple template that sorts an array using the bubble sort method, removes repeated elements and returns the new number of the elements.

Definition at line 340 of file textfile.h.

341{
342 switch (n)
343 {
344 case 0:
345 return 0;
346 case 1:
347 return 1;
348 case 2:
349 if (tab [0] == tab [1])
350 return 1;
351 else if (tab [0] > tab [1])
352 swapelements (tab [0], tab [1]);
353 return 2;
354 default:
355 for (int i = 0; i < n - 1; ++ i)
356 {
357 for (int j = i + 1; j < n; ++ j)
358 if (tab [i] > tab [j])
359 swapelements (tab [i],
360 tab [j]);
361
362 if (tab [i] == tab [i + 1])
363 {
364 -- n;
365 for (int j = i + 1; j < n; ++ j)
366 tab [j] = tab [j + 1];
367 }
368 }
369 break;
370 }
371 return n;
372} /* sortelements */
void swapelements(type &x, type &y)
A simple template for swapping two elements with the use of a temporary variable of the same type and...
Definition: textfile.h:329

References swapelements().

Referenced by operator>>().

◆ swapelements()

template<class type >
void chomp::homology::swapelements ( type &  x,
type &  y 
)
inline

A simple template for swapping two elements with the use of a temporary variable of the same type and the assignment operator.

Definition at line 329 of file textfile.h.

330{
331 type z (x);
332 x = y;
333 y = z;
334 return;
335} /* swapelements */

Referenced by sortelements(), chomp::homology::chain< euclidom >::swap(), and chomp::homology::chain< euclidom >::swapnumbers().

◆ thesame()

template<class coordtype >
int chomp::homology::thesame ( const coordtype *  c1,
const coordtype *  c2,
int  dim 
)
inline

Compare two points. Returns true iff they have the same coordinates.

Definition at line 98 of file pointset.h.

99{
100 for (int i = 0; i < dim; ++ i)
101 if (c1 [i] != c2 [i])
102 return 0;
103 return 1;
104} /* thesame */

Referenced by chomp::homology::tPointset< coordtype >::hashfindpoint().

◆ TorsionCoefficient()

template<class euclidom >
int chomp::homology::TorsionCoefficient ( const chain< euclidom > &  c,
int  start = 0 
)

Returns the next position in the chain containing a torsion coefficient.

Starts the search at the given position. Returns -1 if not found or the position 'p' of the coefficient. This coefficient can be retrieved as "c. coef (p)".

Definition at line 120 of file homology.h.

121{
122 if (start < 0)
123 return -1;
124 while (start < c. size ())
125 {
126 if (c. coef (start). delta () != 1)
127 return start;
128 else
129 ++ start;
130 }
131 return -1;
132} /* TorsionCoefficient */

◆ transitiveClosure()

template<class matrix >
void chomp::homology::transitiveClosure ( matrix &  m,
int_t  n 
)
inline

Computes the transitive closure of an acyclic graph defined by its adjacency matrix, using the Warshall's algorithm: S.

Warshall, A theorem on Boolean matrices, J. ACM 9 (1962) 11-12.

Definition at line 4356 of file digraph.h.

4357{
4358 for (int_t k = 0; k < n; ++ k)
4359 {
4360 for (int_t i = 0; i < n; ++ i)
4361 {
4362 for (int_t j = 0; j < n; ++ j)
4363 {
4364 if (m [i] [k] && m [k] [j])
4365 m [i] [j] = 1;
4366 }
4367 }
4368 }
4369 return;
4370} /* transitiveClosure */

Referenced by transitiveReduction().

◆ transitiveReduction() [1/2]

template<class wType >
void chomp::homology::transitiveReduction ( const diGraph< wType > &  g,
diGraph< wType > &  gRed 
)
inline

Computes the transitive reduction of an arbitrary acyclic graph.

The output graph must be initially empty.

Definition at line 4399 of file digraph.h.

4401{
4402 int_t nVert = g. countVertices ();
4403 if (nVert <= 0)
4404 return;
4405 flatMatrix<char> m (nVert);
4406 m. clear (0);
4407 graph2matrix (g, m);
4408 transitiveClosure (m, nVert);
4409 transitiveReduction (m, nVert);
4410 matrix2graph (m, nVert, gRed);
4411 return;
4412} /* transitiveReduction */
This class defines a simple data structure for a flat 2-dim square matrix whose entries are stored in...
Definition: flatmatr.h:55
void transitiveReduction(const diGraph< wType > &g, diGraph< wType > &gRed)
Computes the transitive reduction of an arbitrary acyclic graph.
Definition: digraph.h:4399
void graph2matrix(const diGraph< wType > &g, matrix &m)
Creates the adjacency matrix of the given graph.
Definition: digraph.h:4318
void matrix2graph(const matrix &m, int_t n, diGraph< wType > &g)
Creates a graph based on the given adjacency matrix.
Definition: digraph.h:4338
void transitiveClosure(matrix &m, int_t n)
Computes the transitive closure of an acyclic graph defined by its adjacency matrix,...
Definition: digraph.h:4356

References graph2matrix(), matrix2graph(), transitiveClosure(), and transitiveReduction().

◆ transitiveReduction() [2/2]

template<class matrix >
void chomp::homology::transitiveReduction ( matrix &  m,
int_t  n 
)
inline

Computes the transitive reduction of a CLOSED acyclic graph defined by its adjacency matrix, using the algorithm by D.

Gries, A.J. Martin, J.L.A. van de Snepscheut and J.T. Udding, An algorithm for transitive reduction of an acyclic graph, Science of Computer Programming 12 (1989), 151-155. WARNING: The input graph MUST BE CLOSED, use the "transitiveClosure" algorithm first if this is not the case.

Definition at line 4380 of file digraph.h.

4381{
4382 for (int_t k = n - 1; k >= 0; -- k)
4383 {
4384 for (int_t i = 0; i < n; ++ i)
4385 {
4386 for (int_t j = 0; j < n; ++ j)
4387 {
4388 if (m [i] [k] && m [k] [j])
4389 m [i] [j] = 0;
4390 }
4391 }
4392 }
4393 return;
4394} /* transitiveReduction */

Referenced by transitiveReduction().

◆ wrapcoord()

template<class coordtype >
void chomp::homology::wrapcoord ( coordtype *  destination,
const coordtype *  source,
const coordtype *  wrap,
int  dim 
)
inline

Wraps coordinates stored in 'c' accordint to the wrap table 'wrap' and store the result in the table called 'result'.

Definition at line 119 of file pointset.h.

121{
122 if (!destination || !source)
123 throw "Trying to wrap NULL coordinates.";
124
125 for (int i = 0; i < dim; ++ i)
126 if (wrap [i])
127 {
128 destination [i] =
129 (coordtype) (source [i] % wrap [i]);
130 if (destination [i] < 0)
131 destination [i] += wrap [i];
132 }
133 else
134 destination [i] = source [i];
135
136 return;
137} /* wrapcoord */

Referenced by chomp::homology::tPointset< coordtype >::add(), chomp::homology::tNeighbors< coordtype >::get(), chomp::homology::tPointset< coordtype >::hashfindpoint(), SetSpaceWrapping(), chomp::homology::tPointBase< coordtype >::wrapcoord(), and chomp::homology::tPointBase< coordtype >::wrapcopy().

◆ wrapcoord< double >()

template<>
void chomp::homology::wrapcoord< double > ( double *  destination,
const double *  source,
const double *  wrap,
int  dim 
)
inline

Wraps coordinates stored in 'c' accordint to the wrap table 'wrap' and store the result in the table called 'result'.

Definition at line 142 of file pointset.h.

144{
145 if (!destination || !source)
146 throw "Trying to wrap NULL coordinates.";
147
148 throw "Wrapping 'double' coordinates not implemented yet!";
149
150 return;
151} /* wrapcoord */

◆ write() [1/3]

template<class coordtype >
int chomp::homology::write ( std::ostream &  out,
const coordtype *  c,
int  dim,
char  parenthesis = 40,
char  closing = 0 
)

Definition at line 2148 of file pointset.h.

2150{
2151 // write the opening parenthesis, brace or bracket
2152 if (parenthesis != 0)
2153 out << parenthesis;
2154
2155 // output the point's coordinates
2156 for (int i = 0; i < dim; ++ i)
2157 {
2158 if (i)
2159 out << ",";
2160 out << c [i];
2161 }
2162
2163 // write an appropriate closing parenthesis, brace or bracket
2164 if (closing)
2165 out << closing;
2166 else if (parenthesis)
2167 {
2168 int ch = closingparenthesis (parenthesis);
2169 if (ch == EOF)
2170 closing = parenthesis;
2171 else
2172 closing = (char) ch;
2173 out << closing;
2174 }
2175
2176 return dim;
2177} /* write */

References closingparenthesis().

Referenced by operator<<(), and write().

◆ write() [2/3]

template<class coordtype >
int_t chomp::homology::write ( std::ostream &  out,
tPointset< coordtype > &  p,
int_t  first = 0,
int_t  howmany = -1,
int  quiet = 0 
)

Writes a set of points to a file (starting at the point given).

Returns the number of points written or -1 (and show a message) in case of failure.

Definition at line 2407 of file pointset.h.

2409{
2410 int_t count = 0;
2411 int dim = p. dimension ();
2412
2413 // write the number of points in the set
2414 out << "; The set contains " << p. size () << " points.\n";
2415 if (first)
2416 out << "; Not writing first " << first << " points.\n";
2417 if (howmany >= 0)
2418 out << "; Writing at most " << howmany << " points.\n";
2419
2420 // write the size of the grid
2421 if (dim && p. gridsize ())
2422 {
2423 for (int i = 0; i < dim; ++ i)
2424 out << (i ? ", " : "; Grid size: ") <<
2425 p. gridsize () [i];
2426 out << '\n';
2427 }
2428
2429 // write statistical information if it has been gathered
2430 if (p. gethashsize ())
2431 out << "; Hashing table size: " <<
2432 p. gethashsize () << " entries.\n";
2433
2434 if (p. stat -> hashhits)
2435 out << "; Hashing statistics: " <<
2436 ((p. stat -> hashhits + p. stat -> hashmisses) /
2437 p. stat -> hashhits) << '.' <<
2438 ((p. stat -> hashhits + p. stat -> hashmisses) * 10 /
2439 p. stat -> hashhits) % 10 << " trials per point, " <<
2440 p. stat -> rehashcount << " times rehashed.\n";
2441
2442 if (p. minimal && p. maximal)
2443 {
2444 out << "; The coordinates " <<
2445 (p. wereremoved ? "varied" : "vary") << " from ";
2446 write (out, p. minimal, dim);
2447 out << " to ";
2448 write (out, p. maximal, dim);
2449 out << ".\n";
2450 }
2451
2452 std::time_t tm;
2453 std::time (&tm);
2454 out << "; Work time: " << (tm - p. stat -> creationtime) <<
2455 " seconds.\n";
2456
2457 // add a warning if any points were removed
2458 if (p. wereremoved)
2459 out << "; Warning: Points were removed, " <<
2460 "so their original order may be distorted.\n";
2461
2462 // write out the dimension of the points (for compatibility
2463 // with the older versions of 'pointset')
2464 out << "dimension " << p. dimension () << '\n';
2465
2466 // output all the points
2467 int_t size = p. size ();
2468 for (int_t i = first; i < size; ++ i)
2469 {
2470 if ((howmany >= 0) && (count >= howmany))
2471 return count;
2472 write (out, p [i], dim);
2473 out << '\n';
2474 ++ count;
2475 }
2476
2477 return count;
2478} /* write */

References write().

◆ write() [3/3]

template<class stream , class element , class hashkeys >
stream & chomp::homology::write ( stream &  out,
const hashedset< element, hashkeys > &  s,
bool  size 
)

Writes the entire hashed set to an output stream in the text mode.

The operator << is used to write each element of the set. The parameter 'size' should be set either to SMALL_SIZE or LARGE_SIZE.

Definition at line 826 of file hashsets.h.

827{
828 if (size == SMALL_SIZE)
829 {
830 out << '{';
831 int_t n = s. size ();
832 for (int_t i = 0; i < n; ++ i)
833 out << (i ? " " : "") << s [i];
834 out << '}';
835 }
836 else
837 {
838 int_t n = s. size ();
839 if (!s. empty ())
840 {
841 out << "; " << n << ((n == 1) ? " element." :
842 " elements.") << '\n';
843 }
844 if (s. stat && s. stat -> hashhits)
845 out << ';' << *(s. stat) << '\n';
846 for (int_t i = 0; i < n; ++ i)
847 out << s [i] << '\n';
848 }
849 return out;
850} /* write */

References SMALL_SIZE.

◆ writebitpoints()

int chomp::homology::writebitpoints ( std::ostream &  out,
pointset p,
bool  sorted = true,
int  fixed_depth = 0,
coordinate fixed_corner = NULL 
)

Writes a full cubical set represented by a set of points to a file in the "bitcode" format.

If 'sorted', bit codes are sorted as the software by Bill Kalies needs. Otherwise they are saved in the same order as the points in 'p'. The depth of bit fields is determined automatically to the minimal necessary value unless 'fixed_depth' is positive. As the lower left corner, the minimal coordinates of the points are selected unless 'fixed_corner' is NULL. Returns 0 on success and -1 on error (and displays a message).

◆ writechaincomplex()

template<class cell , class euclidom >
std::ostream & chomp::homology::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.

Boundary formulas are restricted to cells which are in the geom. complex. If symbolic names requested, the cells are written directly as generators. This procedure is a slightly modified version of "createchaincomplex".

Definition at line 1180 of file gcomplex.h.

1183{
1184 if (g. dim () < 0)
1185 return out;
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)
1190 {
1191 out << "dimension " << d << ": " << g [d]. size () << "\n";
1192 for (int_t i = 0; i < g [d]. size (); ++ i)
1193 {
1194 bool cellwritten = false;
1195 int len = boundarylength (g [d] [i]);
1196 for (int j = 0; j < len; ++ j)
1197 {
1198 // take the j-th boundary cell
1199 cell thecell = boundarycell (g [d] [i], j);
1200
1201 // add it to the chain complex
1202 if (g. check (thecell))
1203 {
1204 int icoef = boundarycoef
1205 (g [d] [i], j);
1206 euclidom coef;
1207 if (icoef < 0)
1208 {
1209 coef = -icoef;
1210 coef = -coef;
1211 }
1212 else
1213 coef = icoef;
1214 if (!cellwritten)
1215 {
1216 out << "\t# ";
1217 if (symbolicnames)
1218 out << g [d] [i];
1219 else
1220 out << (i + 1);
1221 out << " = ";
1222 if (-coef == 1)
1223 out << "- ";
1224 }
1225 else if (coef == 1)
1226 out << " + ";
1227 else if (-coef == 1)
1228 out << " - ";
1229 else
1230 out << " + " << coef <<
1231 " * ";
1232 if (symbolicnames)
1233 out << thecell;
1234 else
1235 out << (1 + g [d - 1].
1236 getnumber (thecell));
1237 cellwritten = true;
1238 }
1239 }
1240 if (cellwritten)
1241 out << '\n';
1242 }
1243 if (!quiet)
1244 {
1245 if (d < g. dim ())
1246 scon << '.';
1247 else
1248 scon << ". ";
1249 }
1250 out << '\n';
1251 }
1252 return out;
1253} /* writechaincomplex */

References boundarycell(), boundarycoef(), boundarylength(), and scon.

◆ WriteCube()

template<class cubetype >
std::ostream & chomp::homology::WriteCube ( std::ostream &  out,
const cubetype &  c 
)
inline

Writes a cube to the output stream in the text mode.

Definition at line 69 of file cubemain.h.

70{
71 typename cubetype::CoordType coord [cubetype::MaxDim];
72 c. coord (coord);
73 int dim = c. dim ();
74 out << "(";
75 for (int i = 0; i < dim; ++ i)
76 {
77 if (i)
78 out << ",";
79 out << coord [i];
80 }
81 out << ")";
82 return out;
83} /* WriteCube */

Referenced by operator<<().

◆ WriteCubicalCell()

template<class celltype >
std::ostream & chomp::homology::WriteCubicalCell ( std::ostream &  out,
const celltype &  c 
)
inline

Writes a cubical cell to the output stream in the text form.

The actual format depends on which OutputBits are set.

Definition at line 173 of file cellmain.h.

174{
175 // determine the data to be written
176 typedef typename celltype::CoordType coordtype;
177 coordtype lcoord [celltype::MaxDim];
178 c. leftcoord (lcoord);
179 int dim = c. spacedim ();
180 coordtype rcoord [celltype::MaxDim];
181 c. rightcoord (rcoord);
182
183 if (celltype::OutputBits & celltype::BitProduct)
184 {
185 for (int i = 0; i < dim; ++ i)
186 {
187 out << '(';
188 out << lcoord [i];
189 if (rcoord [i] != lcoord [i])
190 out << ',' << rcoord [i];
191 out << ')';
192 if (i < dim - 1)
193 out << 'x';
194 }
195 }
196 else
197 {
198 out << '[' << '(';
199 int i;
200 for (i = 0; i < dim; ++ i)
201 {
202 out << lcoord [i];
203 if (i < dim - 1)
204 out << ',';
205 }
206 out << ')';
207 if (celltype::OutputBits & celltype::BitSpace)
208 out << ' ';
209 out << '(';
210 for (i = 0; i < dim; ++ i)
211 {
212 out << rcoord [i];
213 if (i < dim - 1)
214 out << ',';
215 }
216 out << ')' << ']';
217 }
218 return out;
219} /* operator << */

Referenced by operator<<().

◆ writegenerators() [1/2]

template<class cell , class euclidom >
std::ostream & chomp::homology::writegenerators ( std::ostream &  out,
const chain< euclidom > *  hom,
const chaincomplex< euclidom > &  c,
const gcomplex< cell, euclidom > &  g,
const int *  level = NULL 
)

Writes the homology generators of the geometric complex to a file.

Definition at line 1390 of file gcomplex.h.

1393{
1394 bool firstlist = true;
1395 for (int d = 0; d <= c. dim (); ++ d)
1396 {
1397 if ((!level || level [d]) && !hom [d]. empty ())
1398 {
1399 if (firstlist)
1400 firstlist = false;
1401 else
1402 out << '\n';
1403 if (hom [d]. size () == 1)
1404 out << "The generator of H_" << d <<
1405 " follows:" << '\n';
1406 else
1407 out << "The " << hom [d]. size () <<
1408 " generators of H_" << d <<
1409 " follow:" << '\n';
1410 const hashedset<cell> &cset = g [d];
1411 for (int_t i = 0; i < hom [d]. size (); ++ i)
1412 {
1413 if (hom [d]. size () > 1)
1414 out << "generator " << (i + 1) <<
1415 '\n';
1416 const chain<euclidom> &lst =
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';
1421 }
1422 }
1423 }
1424 return out;
1425} /* writegenerators */

◆ writegenerators() [2/2]

template<class euclidom , class tCell >
std::ostream & chomp::homology::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.

Format: 0 = text format, 1 = chl format.

Definition at line 64 of file cubmaps.h.

67{
68 typedef typename tCell::CoordType coordType;
69 bool firstlist = true;
70 for (int d = 0; d <= c. dim (); ++ d)
71 {
72 if ((level && !level [d]) || hom [d]. empty ())
73 continue;
74 if (firstlist)
75 firstlist = false;
76 else if (format == 0)
77 out << '\n';
78 if (format == 0)
79 {
80 if (hom [d]. size () == 1)
81 {
82 out << "The generator of H_" << d <<
83 " follows:" << '\n';
84 }
85 else
86 {
87 out << "The " << hom [d]. size () <<
88 " generators of H_" << d <<
89 " follow:" << '\n';
90 }
91 }
92 const hashedset<tCell> &cset = g [d];
93 for (int_t i = 0; i < hom [d]. size (); ++ i)
94 {
95 if (format == 0)
96 {
97 if (hom [d]. size () > 1)
98 out << "generator " <<
99 (i + 1) << '\n';
100 }
101 const chain<euclidom> &lst =
102 c. gethomgen (d, hom [d]. num (i));
103 for (int_t j = 0; j < lst. size (); ++ j)
104 {
105 coordType left [tCell::MaxDim];
106 cset [lst. num (j)]. leftcoord (left);
107 coordType right [tCell::MaxDim];
108 cset [lst. num (j)]. rightcoord (right);
109 int projdim = 0;
110 for (int k = 0; k < xdim; ++ k)
111 {
112 if (left [k] != right [k])
113 ++ projdim;
114 }
115 if (projdim != d)
116 continue;
117 if (format == 0)
118 {
119 out << lst. coef (j) << " * " <<
120 tCell (left, right, xdim) <<
121 '\n';
122 }
123 else
124 {
125 for (int k = 0; k < xdim; ++ k)
126 out << left [k] << " ";
127 for (int k = 0; k < xdim; ++ k)
128 out << right [k] << " ";
129 out << lst. coef (j) << " " <<
130 (i + 1) << " " << d << '\n';
131 }
132 }
133 }
134 }
135 return out;
136} /* writegenerators */

Variable Documentation

◆ bitcounttable

unsigned char chomp::homology::bitcounttable[]
extern

Referenced by bitcountbyte().

◆ DimBits

const int chomp::homology::DimBits = (sizeof (int_t) > 4) ? 7 : 6

The number of signed bits to store the dimension (i.e., 6: max 31).

The maximal allowed dimension in the program is less than what follows from the number of bits (i.e., max 30 for 6 bits).

Definition at line 67 of file pointbas.h.

◆ knownbits

BitFields chomp::homology::knownbits
extern

The global table of BitFields which store the acyclicity information for reducing full cubical sets.

Referenced by acyclic(), Homology(), and Homology2l().

◆ MaxBasDim

const int chomp::homology::MaxBasDim = (MaxBasDim1 < MaxBasDim2) ? MaxBasDim1 : MaxBasDim2

The maximal dimension that can be used if the high bits of an integer store the value of the dimension, and the number of remaining bits is at least as large as the dimension.

Definition at line 89 of file pointbas.h.

Referenced by chomp::homology::tPointBase< coordtype >::number(), and chomp::homology::tPointBase< coordtype >::setwrapping().

◆ MaxBasDim1

const int chomp::homology::MaxBasDim1 = static_cast<int> (1u << (DimBits - 1))

The maximal dimension that can be represented using 'DimBits' bits.

Definition at line 80 of file pointbas.h.

◆ MaxBasDim2

const int chomp::homology::MaxBasDim2 = static_cast<int> ((sizeof (int_t) << 3) - DimBits)

The maximal dimension which still leaves enough bits in the integer to have one bit for each direction.

Definition at line 84 of file pointbas.h.

◆ MaxBddDim

int chomp::homology::MaxBddDim
extern

The maximal dimension for which binary decision diagrams are used.

This can be decreased by a program if no binary decision diagrams should be used. However, the value of MaxBddDim cannot exceed the value of MaxBddDimPossible.

Referenced by acyclic(), acyclic_rel(), chomp::homology::reduction1::addcubeneighbors(), and Homology2l().

◆ MaxBddDimPossible

const int chomp::homology::MaxBddDimPossible = 3

The maximal dimension for which binary decision diagrams are programmed.

Definition at line 1177 of file bddacycl.h.

◆ NumBits

const int chomp::homology::NumBits = (sizeof (int_t) << 3) - DimBits

◆ NumMask

const int_t chomp::homology::NumMask = (~(static_cast<int_t> (0) ^ SignBit)) >> (DimBits - 1)

◆ program_time

timeused chomp::homology::program_time
extern

The external variable which measures the time used by the program from its start.

Note that in the destructor of this variable, a message is displayed to std::cout indicating how much time was used by the program in its entire run.

Referenced by chomp::multiwork::mwSubdivMain(), and setstreams().

◆ sbug

outputstream chomp::homology::sbug
extern

◆ scon

outputstream chomp::homology::scon
extern

◆ serr

outputstream chomp::homology::serr
extern

A wrapper for the standard error stream.

Referenced by setstreams().

◆ SignBit

const int_t chomp::homology::SignBit = static_cast<int_t> (1) << ((sizeof (int_t) << 3) - 1)

The sign bit of the int_t number.

Definition at line 74 of file pointbas.h.

◆ slog

outputstream chomp::homology::slog
extern

The output stream to which one can send messages for logging only.

Those messages are not shown to the standard output and are ignored if the log file is not in use.

Referenced by setstreams().

◆ sout

outputstream chomp::homology::sout
extern

◆ sseq

outputstream chomp::homology::sseq
extern

◆ tabulated

Tabulated chomp::homology::tabulated
extern

The global instance of this class which stores tabulated configurations to use in the full cube reduction procedures.

Referenced by acyclic().

◆ UseMalandainCode

bool chomp::homology::UseMalandainCode
extern

The variable which controls which binary decision diagrams should be used in dimension 3, either programmed by P.

Pilarczyk (if set to false) or received from G. Malandain (if set to true).

Referenced by bddacyclic().