<Chapter><Heading>Cubical Complexes</Heading>

<Table Align="|l|" >

<Row>
<Item>
<Index>ArrayToPureCubicalComplex</Index>
<C>ArrayToPureCubicalComplexA,n)</C>

<P/>
Inputs an integer array <M>A</M> of dimension <M>d</M> 
and an integer <M>n</M>.
It returns a d-dimensional pure cubical complex corresponding to the
 black/white "image" determined by the threshold <M>n</M> and the values of the entries in <M>A</M>. (Integers below the threshold correspond to a black pixel, and higher integers  correspond to a white pixel.)
 </Item>
 </Row>

<Row>
<Item>
<Index>PureCubicalComplex</Index>
<C>PureCubicalComplexA,n)</C>

<P/>
Inputs a binary array <M>A</M> of dimension <M>d</M>.
It returns the corresponding d-dimensional pure cubical complex. 
 </Item>
 </Row>

<Row>
<Item>
<Index>FramedPureCubicalComplex</Index>
<C>FramedPureCubicalComplex(M)</C>

<P/>
Inputs a pure cubical complex <M>M</M> 
and  returns the pure cubical complex with  a border of zeros attached the each face of the boundary array M!.boundaryArray. This function just adds a bit of space for performing operations such as thickenings to <M>M</M>.
 </Item>
 </Row>


<Row>
<Item>
<Index>RandomCubeOfPureCubicalComplex</Index>
<C>RandomCubeOfPureCubicalComplex(M)</C>

<P/>
Inputs a pure cubical complex <M>M</M> 
and  returns a pure cubical complex <M>R</M> with precisely the same dimensions as <M>M</M>. The complex <M>R</M> consist of one  cube selected at random
from <M>M</M>. 
 

 </Item>
 </Row>


<Row>
<Item>
<Index>PureCubicalComplexIntersection</Index>
<C>PureCubicalComplexIntersection(S,T)</C>

<P/>
Inputs two pure cubical complexes with common dimension and array size. It returns the intersection of the two complexes. (An entry in the binary array of the intersection  has value 1 if and only if the corresponding entries in the binary arrays of S and T both have value 1.)
 </Item>
 </Row>

<Row>
<Item>
<Index>PureCubicalComplexUnion</Index>
<C>PureCubicalComplexUnion(S,T)</C>

<P/>
Inputs two pure cubical complexes with common dimension and array size. It returns the union of the two complexes. (An entry in the binary array of the union  has value 1 if and only if at least one of the corresponding entries in the binary arrays of S and T  has value 1.)

 </Item>
 </Row>


<Row>
<Item>
<Index>PureCubicalComplexDifference</Index>
<C>PureCubicalComplexDifference(S,T)</C>

<P/>
Inputs two pure cubical complexes with common dimension and array size. It returns the difference S-T. (An entry in the binary array of the  difference
has value 1 if and only if  the corresponding entry in the binary array of S is 1 and the corresponding entry in the binary array of T is 0.)

 </Item>
 </Row>

 
<Row>
<Item>
<Index>ReadImageAsPureCubicalComplex</Index>
<C> ReadImageAsPureCubicalComplex("file.png",n)</C>


<P/>
Reads an image file ("file.png", "file.eps", "file.bmp" etc)  
and an integer <M>n</M>  
between 0 and 765. 
It returns a 2-dimensional pure cubical complex based on the
 black/white version of the image determined by the threshold <M>n</M>. 
</Item>
</Row>

<Row>
<Item>
<Index>ReadLinkImageAsPureCubicalComplex</Index>
<C> ReadLinkImageAsPureCubicalComplex("file.png")</C>
<C> ReadLinkImageAsPureCubicalComplex("file.png",n)</C>


<P/>
Reads an image file ("file.png", "file.eps", "file.bmp" etc) containing a knot or
 link diagram, 
and optionally a positive integer <M>n</M>. The integer <M>n</M> should be a little larger than the line thickness in the link diagram, and if not provided then <M>n</M> is set equal to 10.

The function  tries to output the corresponding knot or link as a 3-dimensional pure cubical complex. Ideally the link diagram should be produced with line thickness 6 in Xfig, and the  under-crossing spaces should not be too large or too small or too near one another. The function does not always succeed: it applies several checks, and if one of these checks fails then the function returns "fail".
</Item>
</Row>


<Row>
<Item>
<Index>ReadImageSequenceAsPureCubicalComplex</Index>
<C>ReadImageSequenceAsPureCubicalComplex("directory",n)</C>


<P/>
Reads the name of a directory containing a sequence of image files (ordered alphanumerically), and
 an integer <M>n</M>
between 0 and 765.
It returns a 3-dimensional pure cubical complex based on the
 black/white version of the images determined by the threshold <M>n</M>.
</Item>
</Row>



<Row>
<Item>
<C>Size(T)</C>

<P/>
This returns the number of non-zero entries in the binary array of the  cubical complex, or pure cubical complex T.

 </Item>
 </Row>

<Row>
<Item>
<C>Dimension(T)</C>

<P/>
This returns the dimension of the  cubical complex, or pure cubical complex T.

 </Item>
 </Row>


<Row>
<Item>
<Index>WritePureCubicalComplexAsImage</Index>
<C>WritePureCubicalComplexAsImage(T,"filename","ext")</C>


<P/>
Inputs a 2-dimensional pure cubical complex T, and a filename followed by its extension 
(e.g. "myfile" followed by "png"). A black/white image is saved to the file.

</Item>
</Row>

<Row>
<Item>
<Index>ViewPureCubicalComplex</Index>
<C>ViewPureCubicalComplex(T)</C>
<C>ViewPureCubicalComplex(T,"mozilla")</C>


<P/>
Inputs a 2-dimensional pure cubical complex T, and optionally a command such as "mozilla" for viewing image files.
A black/white image is displayed. 
</Item>
</Row>

<Row>
<Item>
<Index>Homology</Index>
<C>Homology(T,n)</C>
<C>Homology(T)</C>

<P/>
Inputs a pure cubical complex, or cubical complex, or simplicial complex <M>T</M> 
and a non-negative integer <M>n</M>. It returns the n-th integral homology of <M>T</M> as a list of torsion integers. 
 If no value of <M>n</M> is input then the list of all homologies of <M>T</M>
in dimensions 0 to Dimension(T)  is returned .
</Item>
</Row>

<Row>
<Item>
<Index>Bettinumbers</Index>
<C>Bettinumbers(T,n)</C>
<C>Bettinumbers(T)</C>

<P/>
Inputs a pure cubical complex, or cubical complex,  simplicial complex or chain complex <M>T</M> and a non-negative integer <M>n</M>.
 The   rank of the  n-th rational homology group  <M>H_n(T,\mathbb Q)</M> is returned. If no value for n is input then the list of Betti numbers
in dimensions 0 to Dimension(T)  is returned .
</Item>
</Row>

<Row>
<Item>
<Index>DirectProductOfPureCubicalComplexes</Index>
<C>DirectProductOfPureCubicalComplexes(M,N)</C>

<P/>
Inputs two pure cubical complexes <M>M,N</M> and returns their direct product <M>D</M> as a pure cubical complex. The dimension of <M>D</M> is the sum of the dimensions of <M>M</M> and <M>N</M>.
</Item>
</Row>

<Row>
<Item>
<Index>SuspensionOfPureCubicalComplex</Index>
<C>SuspensionOfPureCubicalComplex(M)</C>

<P/>
Inputs a pure cubical complex <M>M</M> and returns a pure cubical complex with the homotopy type of the suspension of <M>M</M>.
</Item>
</Row>



<Row>
<Item>
<C>EulerCharacteristic(T)</C>

<P/>
Inputs a  pure cubical complex, or cubical complex, or simplicial complex
 <M>T</M>
and returns its Euler characteristic.
</Item>
</Row>

<Row>
<Item>
<Index>PathComponentOfPureCubicalComplex</Index>
<C>PathComponentOfPureCubicalComplex(T,n)</C>

<P/>
Inputs a pure cubical complex <M>T</M>
and an integer <M>n</M> in the rane 1, ..., Bettinumbers(T)[1] . It returns the n-th path component of
 <M>T</M> as a pure cubical complex. The value <M>n=0</M> is also allowed, in which case the number of path components is returned.
</Item>
</Row>

<Row>
<Item>

<C>ChainComplex(T)</C>

<P/>
Inputs a  pure cubical complex, or cubical complex, or simplicial complex
 <M>T</M>
and returns the (often very large) cellular chain complex of <M>T</M>. 
</Item>
</Row>

<Row>
<Item>
<C>ChainComplexOfPair(T,S)</C>
<P/>
Inputs a  pure cubical complex or cubical complex  <M>T</M> and  subcomplex <M>S</M>.
It returns the quotient <M>C(T)/C(S)</M> of cellular chain complexes.
</Item>
</Row>

<Row>
<Item>
<C>ExcisedPureCubicalPair(T,S)</C>
<P/>
Inputs a  pure cubical complex   <M>T</M> and  subcomplex <M>S</M>.
It returns the pair
 <M>[T\setminus intS, S\setminus intS])</M> of pure cubical complexes
where <M>intS</M> is the pure cubical complex obtained from <M>S</M> by removing its boundary.
</Item>
</Row>


<Row>
<Item>
<Index>ChainInclusionOfPureCubicalPair</Index>
<C>ChainInclusionOfPureCubicalPair(S,T)</C>


<P/>
Inputs a  pure cubical complex  <M>T</M> and  subcomplex <M>S</M>.
It returns the chain inclusion <M>C(S) \rightarrow C(T)</M> of cellular chain complexes.
</Item>
</Row>

<Row>
<Item>
<Index>ChainMapOfPureCubicalPairs</Index>
<C>ChainMapOfPureCubicalPairs(M,S,N,T)</C>


<P/>
Inputs a  pure cubical complex  <M>N</M> and  subcomplexes <M>M</M>, <M>T</M>
and <M>S</M> in <M>T</M>.
It returns the chain map <M>C(M/S) \rightarrow C(N/T)</M> of quotient cellular chain complexes.
</Item>
</Row>


<Row>
<Item>
<Index>ContractPureCubicalComplex</Index>
<C>ContractPureCubicalComplex(T)</C>


<P/>
Inputs a  pure cubical complex <M>T</M> of dimension <M>d</M> and removes <M>d</M>-dimensional cells from <M>T</M>
without changing the  homotopy type of <M>T</M>. 
When the function has been applied, no further <M>d</M>-cells can be removed 
from <M>T</M> without changing its homotopy type. This function modifies <M>T</M>. 

</Item>
</Row>

<Row>
<Item>
<Index>ContractedComplex</Index>
<C>ContractedComplex(T)</C>


<P/>
Inputs a  pure cubical complex <M>T</M> and returns a structural copy of the complex obtained from <M>T</M> by applying the function ContractPureCubicalComplex(T).

</Item>
</Row>

<Row>
<Item>
<Index>ZigZagContractedPureCubicalComplex</Index>
<C>ZigZagContractedPureCubicalComplex(T)</C>


<P/>
Inputs a  pure cubical complex <M>T</M> and returns a homotopy equivalent pure cubical complex <M>S</M>. The aim is for <M>S</M> to involve fewer cells than <M>T</M> and certainly to involve no more cells than <M>T</M>. 

</Item>
</Row>


<Row>
<Item>
<Index>ContractCubicalComplex</Index>
<C>ContractCubicalComplex(T)</C>


<P/>
Inputs a  cubical complex <M>T</M> and removes cells without changing the homotopy type of <M>T</M>. It changes <M>T</M>. In particular, it adds the components T.vectors and T.rewrite of a discrete vector field.

<P/> At present this function only works for cubical complexes of dimension 2 or 3.
</Item>
</Row>

<Row>
<Item>
<Index>DVFReducedCubicalComplex</Index>
<C>DVFReducedCubicalComplex(T)</C>


<P/>
Inputs a  cubical complex <M>T</M> and returns a non-regular cubical complex <M>R</M>  by constructing  a discrete vector field. The vector field is designed to minimize the number of critical cells in <M>R</M>
at the cost of allowing cell attaching maps that are not homeomorphisms on  boundaries.

<P/>
At present this function works only for 2- and 3-dimensional cubical complexes.

<P/>
The function ChainComplex(R) can be used to obtain the cellular chain complex of <M>R</M>.

</Item>
</Row>


<Row>
<Item>
<Index>SkeletonOfCubicalComplex</Index>
<C>SkeletonOfCubicalComplex(T,n)</C>


<P/>
Inputs a  cubical complex, or pure cubical complex <M>T</M> and positive integer <M>n</M>. It
returns the <M>n</M>-skeleton of <M>T</M> as a cubical complex.

</Item>
</Row>


<Row>
<Item>
<Index>ContractibleSubomplexOfPureCubicalComplex</Index>
<C>ContractibleSubomplexOfPureCubicalComplex(T)</C>

<P/>
Inputs a  pure cubical complex <M>T</M>  and 
returns a maximal contractible pure cubical subcomplex.
</Item>
</Row>

<Row>
<Item>
<Index>AcyclicSubomplexOfPureCubicalComplex</Index>
<C>AcyclicSubomplexOfPureCubicalComplex(T)</C>

<P/>
Inputs a  pure cubical complex <M>T</M>  and
returns a (not necessarily connected) pure cubical subcomplex having trivial homology in all degrees greater than <M>0</M>.
</Item>
</Row>

<Row>
<Item>
<Index>HomotopyEquivalentMaximalPureCubicalSubcomplex</Index>
<C>HomotopyEquivalentMaximalPureCubicalSubcomplex(T,S)</C>

<P/>
Inputs a  pure cubical complex <M>T</M> together with  a pure cubical subcomplex <M>S</M>.
It returns a  pure cubical subcomplex <M>H</M> of <M>T</M> which contains <M>S</M> and  is maximal with respect to the property that it is homotopy equivalent to <M>S</M>.
</Item>
</Row>

<Row>
<Item>
<Index>HomotopyEquivalentMinimalPureCubicalSubcomplex</Index>
<C>HomotopyEquivalentMinimalPureCubicalSubcomplex(T,S)</C>

<P/>
Inputs a  pure cubical complex <M>T</M> together with  a pure cubical
subcomplex <M>S</M>.
It returns a  pure cubical subcomplex <M>H</M> of <M>T</M> which contains <M>S</M> and  is minimal with respect to the property that it is homotopy equivalent to <M>T</M>.
</Item>
</Row>


<Row>
<Item>
<Index>BoundaryOfPureCubicalComplex</Index>
<C>BoundaryOfPureCubicalComplex(T)</C>

<P/>
Inputs a  pure cubical complex <M>T</M> and  returns its boundary as a 
pure cubical complex. The boundary consists of all cubes which have one or more facets that lie in just the one cube. 

</Item>
</Row>

<Row>
<Item>
<Index>SingularitiesOfPureCubicalComplex</Index>
<C>SingularitiesOfPureCubicalComplex(T,radius,tolerance)</C>


<P/>
Inputs a  pure cubical complex <M>T</M> together with a positive integer "radius" and an integer "tolerance" in the range 1..100.
It returns the pure cubical subcomplex of those cells in the boundary where the boundary
is not differentiable. (The method for deciding differentiability at a point is crude/discrete, prone to errors and depends on the radius and tolerance.)  
 </Item>
 </Row>

<Row>
<Item>
<Index>ThickenedPureCubicalComplex</Index>
<C>ThickenedPureCubicalComplex(T)</C>

<P/>
Inputs a  pure cubical complex <M>T</M> 
 and returns a pure cubical complex  <M>S</M>. If a euclidean cube is
 in <M>T</M> then this cube and all its  neighbouring cubes  
 are included in <M>S</M>.

</Item>
</Row>

<Row>
<Item>
<Index>CropPureCubicalComplex</Index>
<C>CropPureCubicalComplex(T)</C>

<P/>
Inputs a  pure cubical complex <M>T</M>
 and returns a pure cubical complex  <M>S</M> obtained from <M>T</M> by removing any "zero boundary sheets" of the binary array. Thus <M>S</M> and
<M>T</M> are isometric as euclidean spaces but there may be fewer zero entries in the binary array for <M>S</M>.
</Item>
</Row>


<Row>
<Item>
<Index>BoundingPureCubicalComplex</Index>
<C>BoundingPureCubicalComplex(T)</C>

<P/>
Inputs a  pure cubical complex <M>T</M>
 and returns a contractible pure cubical complex  <M>S</M> containing <M>T</M>. 
</Item>
</Row>


<Row>
<Item>
<Index>MorseFiltration</Index>
<C>MorseFiltration(M,i,t,bool)</C>
<C>MorseFiltration(M,i,t)</C>

<P/>
Inputs a  pure cubical complex <M>M</M> of dimension <M>d</M>, an integer 
<M>i</M> between <M>1</M> and <M>d</M>, a positive integer <M>t</M> and a boolean value True or False. The function returns a list 
<M>[M_1, M_2, ..., M_t]</M> of pure cubical complexes with <M>M_k</M> a subcomplex of <M>M_{k+1}</M>. The list is constructed by setting all slices of <M>M</M> perpendicular to the <M>i</M>-th axis equal to zero if they meet the <M>i</M>th axis at a sufficiently high coordinate (if bool=True) or sufficiently 
low coordinate (if bool=False).

<P/> If the variable bool is not specified then it is assumed to have the value True. 
</Item>
</Row>

<Row>
<Item>
<Index>ComplementOfPureCubicalComplex</Index>
<C>ComplementOfPureCubicalComplex(T)</C>


<P/>
Inputs a  pure cubical complex <M>T</M>
 and returns a pure cubical complex <M>S</M>. A euclidean cube is in <M>S</M>  precisely when  the cube is not in <M>T</M>.

 </Item>
 </Row>

<Row>
<Item>
<Index>PureCubicalComplexToTextFile</Index>
<C>PureCubicalComplexToTextFile(file,M)</C>
<P/>
Inputs a pure cubical complex <M>M</M> and a string  containing the address of a file.  A
representation of this complex is written to the file in a format that
can be read by the CAPD (Computer Assisted Proofs in Dynamics) software developed by  Marian Mrozek and others.

</Item> </Row>

<Row>
<Item>
<Index>ThickeningFiltration</Index>
<C>ThickeningFiltration(M,n)</C>
<C>ThickeningFiltration(M,n,k)</C>
<P/>
Inputs a pure cubical complex <M>M</M> and a positive integer <M>n</M>. It returns a filtered pure cubical complex constructed frim <M>n</M> thickenings of <M>M</M>. 
 If a positive integer <M>k</M> is supplied as an  optional third argument, then each step of the filtration is obtained from a <M>k</M>-fold thickening.
</Item> </Row>

<Row>
<Item>
<Index>Dendrogram</Index>
<C>Dendrogram(M)</C>
<P/>
Inputs a filtered pure cubical complex <M>M</M> and returns data that specifies the dendrogram (or phylogenetic tree) describing how path components are born and then merge during the filtration.

</Item> </Row>

<Row>
<Item>
<Index>DendrogramDisplay</Index>
<C>DendrogramDisplay(M)</C>
<P/>
Inputs a filtered pure cubical complex <M>M</M>, or alternatively inputs the out from the command Dendrogram(M),  and then uses GraphViz software to display the path component dendrogram of <M>M</M>.  </Item> </Row>

<Row>
<Item>
<Index>DendrogramToPersistenceMat</Index>
<C>DendrogramToPersistenceMat(D)</C>
<P/>
Inputs the output of the function Dendrogram(M) and returns the corresponding degree 0 Betti bar code.  </Item> </Row> 

<Row>
<Item>
<Index>ReadImageAsFilteredCubicalComplex</Index>
<C>ReadImageAsFilteredCubicalComplex(file,n)</C>
<P/>
Inputs a string containing the path to an image file, together with a positive integer n. It returns a filtered pure cubical complex of filtration length <M>n</M>.  </Item> </Row>

<Row>
<Item>
<Index>ComplementOfFilteredCubicalComplex</Index>
<C>ComplementOfFilteredCubicalComplex(M)</C>
<P/>
Inputs a filtered pure cubical complex <M>M</M> and returns the complement as a filtered pure cubical complex.   </Item> </Row>

<Row>
<Item>
<Index>PersistentHomologyOfFilteredCubicalComplex </Index>
<C>PersistentHomologyOfFilteredCubicalComplex(M,n)</C>
<P/>
Inputs a filtered pure cubical complex <M>M</M> and a 
non-negative integer <M>n</M>. It returns the degree <M>n</M> persistent 
homology of <M> M</M> with rational coefficients.
  </Item> </Row>




</Table>
</Chapter>


