open class CellularCohomologyEngine[CellT, CoefficientT, FiltrationT](val packSimplices: Boolean = ..., val useUnionFind: Boolean = ...)(using evidence$1: OrderedCell { type Self = CellT; }, evidence$2: Field { type Self = CoefficientT; }, evidence$3: Ordering[FiltrationT])
Persistent cohomology for any cell type (simplices, cubes, simplicial-set generators): the reduction of the coboundary matrix, following Bauer's Ripser (arXiv:1908.02518) without its Vietoris-Rips-specific shortcuts. Over a field the barcode is the same as the homology barcode; what this engine adds is cocycle representatives, and it works where the Ripser engines do not (Cech, alpha, cubical, simplicial sets, non-flag complexes).
The coboundary is built by inverting the boundaries of the stream's cells, so the stream is read in full first. There is no maxDim: the stream decides the top degree. For degrees 0 .. k, pass a stream with cells up to dimension k + 1 (LimitedCofaceSimplexStream(stream, k + 1) for a coface stream) and ignore the degree-(k + 1) bars.
Representatives: every bar carries its V-column. For an essential bar it is a cocycle of the whole complex; for a finite bar its coboundary is the bar's reduced column, which is born at or after the bar's death, so it is a cocycle on the subcomplex before the death. coboundaryOfChain checks either.
Simplices with Int vertices (every complex the library builds: alpha, Čech, witness, Dowker, explicit streams) are reduced on flat arrays: each dimension's vertex tuples, a table from a tuple to its cell (the vertices side by side in one Long when they fit, else a hash of them), and each coboundary block as compressed columns of signs. Only a column that needs an addition becomes a Chain, and only the cells of the representatives returned are looked up again. The bars and representatives are exactly those of reducing the cells themselves.
Degree 0 is paired by union-find over the edges (the elder rule) when every edge is c·(v - u) between two cells of the stream, or has a boundary that vanishes (a loop): no vertex's coboundary is reduced then, and a bar's cocycle is the indicator of the component that dies. A complex with any other edge (a Morse complex can have one) reduces degree 0 like every other degree. The pairs and representatives are the same either way.
Value parameters
packSimplices
reduce simplices with Int vertices on flat arrays (see above). false reduces the cells themselves, with the same results, more slowly; reducesPacked tells which a stream gets.
useUnionFind
pair degree 0 by union-find where the complex allows (see above). false reduces the vertices' coboundaries, with the same results (for benchmarking and for checking the two against each other).
The coboundary of chain, a chain of dimension-d cells, computed against cofacets, the dimension-(d + 1) cells to consider. For checking representatives: coboundaryOfChain(rep, cellsOfDimension(d + 1)).isZero(). Requires every cell of chain to have the same dimension d and every cofacet dimension d + 1.
The coboundary of chain, a chain of dimension-d cells, computed against cofacets, the dimension-(d + 1) cells to consider. For checking representatives: coboundaryOfChain(rep, cellsOfDimension(d + 1)).isZero(). Requires every cell of chain to have the same dimension d and every cofacet dimension d + 1.
The largest filtration value among the cells of the stream the last run read, None before any run: what a caller needs of the whole stream without iterating it again.
The largest filtration value among the cells of the stream the last run read, None before any run: what a caller needs of the whole stream without iterating it again.
Every bar, zero-length ones included, with the cells that open and close it, and the order (oldest first within a dimension) the pairing was computed under.
Every bar, zero-length ones included, with the cells that open and close it, and the order (oldest first within a dimension) the pairing was computed under.
Every bar of stream's persistent cohomology with its representative (see the class doc); zero-length bars only if includeZeroLength. Works one degree at a time, so memory is bounded by the largest coboundary block. For a stream built for degrees 0..k (its homologyDegreeLimit), bars of higher degree are left out, as in persistentHomology: the cells of degree k + 1 are all there to kill degree-k classes, and the ones that kill none would each become a bar and a representative of their own.
Every bar of stream's persistent cohomology with its representative (see the class doc); zero-length bars only if includeZeroLength. Works one degree at a time, so memory is bounded by the largest coboundary block. For a stream built for degrees 0..k (its homologyDegreeLimit), bars of higher degree are left out, as in persistentHomology: the cells of degree k + 1 are all there to kill degree-k classes, and the ones that kill none would each become a bar and a representative of their own.
The same bars with '''cycles''' as representatives: the pairing is computed by cohomology, then only the boundary columns of the death cells are reduced (Involution). A finite bar's cycle is the reduced boundary of its death cell; an essential bar's is a cycle whose youngest cell is its birth cell. For a stream built for degrees 0..k (its homologyDegreeLimit), bars of higher degree are left out: they are not the complex's homology.
The same bars with '''cycles''' as representatives: the pairing is computed by cohomology, then only the boundary columns of the death cells are reduced (Involution). A finite bar's cycle is the reduced boundary of its death cell; an essential bar's is a cycle whose youngest cell is its birth cell. For a stream built for degrees 0..k (its homologyDegreeLimit), bars of higher degree are left out: they are not the complex's homology.
Whether stream is reduced on flat arrays (simplices with Int vertices, ascending under the vertex order, under the library's own cell instance; see the class doc) rather than as cells. Reads the whole stream.
Whether stream is reduced on flat arrays (simplices with Int vertices, ascending under the vertex order, under the library's own cell instance; see the class doc) rather than as cells. Reads the whole stream.