FastCubicalHomologyEngine
Persistent homology of a cubical grid by union-find instead of matrix reduction (after Le Breton, Szustakowski and Piraud, arXiv:2606.04801, extended here to any coefficient field and to representatives): degree 0 by union-find on the vertices and edges, the top degree d - 1 (d the grid's dimension) by union-find on the dual graph. In 2-D those cover everything; in dimension 3 and up the degrees in between are computed by the cohomology engine on the grid without its top cells. Requires d >= 2. A NaN (masked) pixel is not in the complex (see CubicalGridStream).
The dual graph: the top cells (pixels) are vertices, the codimension-1 cells (facets) edges between the one or two top cells containing them, with one extra vertex ∞, at value +Infinity, on the far side of every facet on the boundary of the grid. By Alexander duality, degree d - 1 of the sublevel filtration is degree 0 of the dual graph's superlevel filtration: union-find in decreasing value with the elder rule, each merge giving the primal bar with birth and death swapped. ∞'s component never dies. A masked pixel is in the complement from the start, as ∞ is, and so is a facet between two masked pixels or a masked pixel and the outside: a component holding one is elder to every other but ∞'s, and when it dies at a facet of value v the primal class is born at v and never dies.
Representatives: each top cell carries a sign in its dual component, kept consistent as components merge (the sign flip is solved from the merging facet's two boundary coefficients, both ±1) so that interior facets cancel; when a component dies, its representative is the boundary of its signed sum of top cells. A merge costs nearly constant time; a representative costs time proportional to its region, and only reported bars get one. Of two components born at the same value either may die, with the same bars: the smaller one does, so that a tiling's many equal maxima do not make one large region die after another.
Attributes
- Experimental
- true
- Source
- FastCubicalHomology.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any