Abstract 1 Introduction 2 Preliminaries 3 Matrix Preliminaries 4 Column Algorithms 5 Row Algorithm 6 Discussion References

Persistent (Co)Homology in Matrix Multiplication Time

Dmitriy Morozov ORCID Lawrence Berkeley National Laboratory, Berkeley, CA, USA Primoz Skraba ORCID Queen Mary University of London, UK
Abstract

Most algorithms for computing persistent homology do so by tracking cycles that represent homology classes. There are many choices of such cycles, and specific choices have found different uses in applications. Although it is known that persistence diagrams can be computed in matrix multiplication time for the more general case of zigzag persistent homology [21], it is not clear how to extract cycle representatives, especially if specific representatives are desired. In this paper, we provide the same matrix multiplication bound for computing representatives for the two choices common in applications in the case of ordinary persistent (co)homology. We first provide a fast version of the reduction algorithm, which is simpler than the algorithm in [21], but returns a different set of representatives than the standard algorithm [15]. We then give a fast version of a variant called the row algorithm [10], which returns the same representatives as the standard algorithm.

Keywords and phrases:
persistent homology, matrix multiplication, cycle representatives
Funding:
Dmitriy Morozov: supported by the Director, Office of Science, Office of Advanced Scientific Computing Research, of the U.S. Department of Energy under Contract No. DE-AC02-05CH11231.
Primoz Skraba: supported by the EPSRC AI Hub on Mathematical Foundations of Intelligence: An “Erlangen Programme” for AI No. EP/Y028872/1.
Copyright and License:
[Uncaptioned image] © Dmitriy Morozov and Primoz Skraba; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Computing methodologies Algebraic algorithms
; Mathematics of computing Algebraic topology ; Computing methodologies Linear algebra algorithms ; Theory of computation Computational geometry
Related Version:
Full Version: https://arxiv.org/abs/2412.02591 [23]
Editors:
Oswin Aichholzer and Haitao Wang

1 Introduction

Persistent homology [15] is one of the core techniques in topological data analysis. Because of its theoretical importance as well as its wide use in applications, a lot of work has been dedicated to its efficient computation both in theory [21, 10, 7, 4, 20] and in practice [2, 3, 1, 18, 17, 26]. On the theoretical side, the connection between persistent homology and Gaussian elimination was established early on [27], and as a result it has been long accepted that persistence can be computed in matrix multiplication time. Milosavljevic et al. [21] gave an explicit algorithm for the more general case of zigzag persistence [5, 6]. The main difficulty in applying standard linear algebra techniques is the strict constraint on the row and column ordering of the boundary matrix.

As persistent homology has evolved as a field, the significance of its formulation as an 𝐑=𝐃𝐕 decomposition [8] of the input boundary matrix 𝐃 has become clear. The cycles and chains recovered from this decomposition found many uses in attributing topological features to the input data [11, 9, 24]. However, it is not immediately clear from the algorithm in [21] how to recover the matrices 𝐑 and 𝐕 necessary in applications. Rather than deconstructing the algorithm of Milosavljevic et al. [21], we simplify it for the case of ordinary persistence. We describe how to compute two different forms of the 𝐑=𝐃𝐕 decomposition that come up in applications – lazy and exhaustive reductions. This allows us to recover specific cycle representatives in matrix multiplication time. As a benefit, due to its simpler setting, the algorithms in this paper are greatly simplified compared to [21]. Finally, using Dey and Hou’s fast zigzag construction [13], which reduces computation of zigzag persistence to ordinary persistence; the algorithms in this paper give another way to compute zigzag persistence in matrix multiplication time.

2 Preliminaries

We are concerned with the persistent homology of a filtration, an increasing sequence of simplicial complexes indexed by the natural numbers :

=K0K1KN=K

While persistent homology can be defined more generally, from an algorithmic perspective this is sufficiently general as nearly all considered cases may be reduced to this setting. We further assume that |KiKi1|=1, or equivalently that the filtration is a total order, i.e., each step in the filtration adds a single cell. If the initial filtration does not satisfy this requirement, and defines only a partial order, we may always extend it to an arbitrary compatible total order, e.g., breaking ties by lexicographical ordering and dimension.

Notation.

Throughout, we use the following notation:

  • Matrices are denoted by bold capital letters, e.g., 𝐌, with sub-matrices indexed by square brackets, e.g., the j-th column is 𝐌[,j], the i-th row is 𝐌[i,].

  • Indexing starts at 1 and indices may be indexed by sets, e.g., A={1,,k}, 𝐌[,A] refers to the first k columns. Note that the set may not refer to contiguous columns/rows.

  • We consider permutations implicitly, so (𝐏𝐌)[A,] refers to the rows indexed after the permutation 𝐏 is applied to matrix 𝐌. For all the algorithms, performing an explicit permutation, then undoing it, does not affect the asymptotic running time.

2.1 Persistence Algorithm

For completeness, we recount the standard persistence algorithm, see [15], [27], and [16] for a more complete description. Let 𝐃 denote the boundary operator, which we represent as an n×n-matrix over some fixed (finite) field 𝔽. The rows (top-down) and columns (left-right) are ordered by appearance in the filtration. Hence, the i-th row and column represents the simplex σ=KiKi1 and 𝐃[,i] represents the boundary of σ respectively. The goal is to compute the 𝐑𝐕-decomposition [8]. That is, find matrices 𝐑 and 𝐕 such that

𝐑=𝐃𝐕,

where 𝐑 is a matrix in reduced column echelon form and 𝐕 is a full-rank upper-triangular matrix; we let 𝐔=𝐕1. We introduce the helper function

𝐥𝐨𝐰(j)=argmaxi𝐑[i,j]0,

which is defined whenever 𝐑[,j]𝟎. When defined, it returns the largest row index i where the column is non-zero; we refer to these lowest non-zero elements as pivots. Throughout this paper, 𝐥𝐨𝐰 always applies to 𝐑. The persistence diagram is then given by:

dgm={(i,j)i=𝐥𝐨𝐰(j)}{(i,)𝐑[,i]=𝟎andi𝐥𝐨𝐰(j)j}. (1)
Algorithm 1 Standard Persistence Algorithm (Lazy reduction).

The standard algorithm is a variant of Gaussian elimination. Algorithm 1, which we call the lazy reduction, reduces each column by considering pivots in the columns to the left. In each step of the loop, it removes the lowest non-zero entry until a new pivot is found or the entire column is zeroed out. A straightforward analysis gives a running time bound of O(n3). In [22], a filtration where this algorithm takes cubic time was given, showing that the bound is tight. The updates of matrix 𝐕 follow those of matrix 𝐑. The updates in matrix 𝐔 undo the updates in 𝐕 to maintain 𝐔𝐕=𝐈. Because the columns of 𝐑 are processed from left to right, during the update of matrix 𝐔, the row 𝐔[j,] has a single (diagonal) element. Therefore, the update in 𝐔 is equivalent to just setting the entry 𝐔[j,j] to α.

Algorithm 2 “Look-ahead” Variant of Standard Persistence (Exhaustive reduction).

We introduce another variant of persistence computation used in applications. This one “looks ahead” and eliminates as many elements from the matrix as it can; so we call it the exhaustive reduction. In Algorithm 2, by the time a column is considered, it is already reduced. It is then applied to all columns to the right, zeroing out the entire row. In this way, when a column is processed, all previous pivots have already been applied. Because column 𝐑[,j] may have already been used to reduce another column 𝐑[,j′′], when an update is applied to it, the row 𝐔[j,] need not consist of a single diagonal element. Hence, the row update in matrix 𝐔 is not equivalent to just setting 𝐔[j,j] to α, like in the lazy version of the algorithm.

Lazy vs. Exhaustive.

The algorithms based on the two reductions are in a sense the extreme cases: lazy reduction reduces columns only when necessary; and the exhaustive reduction reduces them as much as possible. To illustrate the difference, in the exhaustive reduction, the entire row to the right of a pivot will be zeroed out, whereas in the case of the lazy reduction, only those columns will be zeroed out which have a conflicting pivot in the same row. There are, of course, any number of possible other reductions between these – but we do not know of any applications that rely on them.

 Remark 1.

As noted in [10, Section 3.4], persistent cohomology can be computed by performing the same algorithm on the anti-transpose of 𝐃. As such all the algorithms in this paper can compute persistent cohomology.

2.2 Cycle Representatives

Given an 𝐑=𝐃𝐕 decomposition, we distinguish between two types of simplices in the filtration: positive simplices create new homology classes; negative simplices destroy them. From the matrix decomposition, one can recover a set of cycle representatives of persistent homology. There are two sources of this information, although with different content.

  1. 1.

    𝐕 matrix: The columns of positive simplices in 𝐕 correspond to zero columns in the reduced matrix 𝐑. These columns in 𝐕 are cycles, by definition.

  2. 2.

    𝐑 matrix: The columns of negative simplices in 𝐑 are non-zero. They store linear combinations of boundaries, which are cycles (at the time of their birth) that eventually die in the filtration.

The cycles one recovers from matrix 𝐑 differ between the lazy and exhaustive reductions. Exhaustive reduction was called total reduction by Cohen-Steiner et al. [9]. They show that these cycles form a lexicographically optimal basis, which can be used to triangulate point cloud data. Nigmetov and Morozov [24] use the lazy reduction – specifically, the columns and rows from matrices 𝐕 and 𝐔 – to recover “critical sets,” subsets of simplicial complexes affected by optimization with the loss formulated in terms of a persistence diagram.

Minimum Spanning Acycle Basis.

The negative simplices in the filtration represent a minimal spanning acycle (MSA)  [19, 25]. The columns in 𝐕 obtained from either lazy or exhaustive reduction – or any reduction that never adds columns of positive simplices to other columns – have the form τMSAλττ+λσσ. The support of the chain is one (positive) simplex σ plus a linear combination of simplices in the minimum spanning acycle.

Lemma 2.

The representatives from 𝐕 are the same for lazy and exhaustive reduction.

Proof.

Which columns of 𝐑 are non-zero does not depend on the algorithm used; the set of negative simplices only depends on the order of the filtration. We observe that the boundaries of the negative simplices form a basis (since their pivots are in distinct rows). By definition, the boundary of a positive simplex may be expressed as a linear combination of boundaries of negative simplices. Since the boundaries of the negative simplices form a basis, this linear combination is unique.

Death Basis.

An alternative is to get cycle representatives directly from the 𝐑 matrix. Its non-zero columns represent cycles because multiplying 𝐃𝐑=0. This follows directly since 𝐑=𝐃𝐕, so 𝐃𝐑=𝐃𝐃𝐕=0, since 𝐃𝐃=0. These columns give cycle representatives for all finite classes, i.e., those homology classes that eventually die.

 Remark 3.

Following [10], this may be used for cohomology – applying the algorithms to 𝐃, the anti-transpose of 𝐃 to obtain the decomposition 𝐑=𝐃𝐕. The cocycle representatives are then given by columns in 𝐕. To see that these are cocycles, observe that by construction, they map to zero via the coboundary operator 𝐃 before the corresponding death time, i.e., below the pivot in the corresponding column of 𝐑, as we have reversed the indexing with the anti-transpose. Likewise, the cocycle representatives of essential cocycles are given by the columns of 𝐕 whose: corresponding columns in 𝐑 are zero and they must not be coboundaries, i.e., the corresponding rows in 𝐑 must not contain pivots.

3 Matrix Preliminaries

We recount a few classical results on matrix multiplication. We assume the matrices are over some field 𝔽.

Lemma 4.

Let 𝐁 be an n×k matrix and 𝐂 be a k×k matrix. The product 𝐁𝐂 can be computed in O(nkω1)-time.

Proof.

Divide 𝐁 into nk sub-matrices 𝐁i of size k×k:

𝐁𝐂=[𝐁1𝐁n/k]𝐂=[𝐁1𝐂𝐁2𝐂𝐁n/k𝐂]

Each 𝐁i𝐂 is a product of two k×k matrices, which by definition takes O(kω) time. There are nk products to compute yielding a running time of O(n+1kkω)=O(nkω1).

Column Operations via Matrix Multiplication.

Here we relate matrix multiplication with the reduction steps used in the persistence algorithms, i.e., representing column operations via matrix multiplication. Assume that we have the following block matrix,

[𝐁𝐂]=[b(1)b(n)c(1)c(m)]

where b(i) and c(j) are (column) vectors. Reducing c(j) which we denote c(j), using the vectors b(i), is expressed as a linear combination

c(j)=c(j)+iλi(j)b(i),

where λi(j) are the coefficients. Reducing only the j-th column of 𝐂 may be written as

[𝐁c(j)]=[𝐁c(j)][𝐈λ(j)0𝟏j],

where 𝟏j is a column vector where the j-th entry is 1 and zero everywhere else. If we consider 𝚲[i,j]:=λi(j), we can rewrite the reduction of 𝐂 by

[𝐁𝐂]=[𝐁𝐂][𝐈𝚲0𝐈],

or equivalently, the reduced matrix is 𝐂=𝐂𝐁𝚲.

Lemma 5.

Multiplying a permutation matrix with an n×m matrix, takes O(nm) time.

Proof.

As a permutation matrix rewrites each element once, the total number of elements gives the bound.

4 Column Algorithms

Here we describe the algorithm in [21] for the special case of classical persistent homology. To aid in exposition, we first recall the Schur complement. Given a block matrix

[𝐁1𝐂1𝐁2𝐂2],

assuming 𝐁2 is non-singular, we can compute an updated matrix where the rows corresponding to 𝐁2 are zeroed out by the following transformation:

[𝐁1𝐂1𝐁2𝐂2][𝐈𝐁21𝐂20𝐈]=[𝐁1𝐂1𝐁1𝐁21𝐂2𝐁20] (2)

where 𝐂1𝐁1𝐁21𝐂2 is referred to as the Schur complement.

Observation 6.

The matrix 𝐁21𝐂2 encodes the column operations required to zero out 𝐂𝟐, that is, 𝐁21𝐂2=𝚲.

A key fact we will use in the algorithm is that matrix inversion has the same algorithmic complexity as matrix multiplication.

Theorem 7.

Inverting a (square) non-singular (upper or lower) triangular matrix can be done in matrix multiplication time.

Proof.

See [23, Appendix] for a simplified proof for the special case of triangular matrices.

4.1 Fast Exhaustive Algorithm

Algorithm 3 Column Algorithm(A=[i,j]).

We present a fast version of exhaustive reduction in Algorithm 3. The general structure follows Algorithm 2. However, rather than apply the pivots when we find them, we apply them in batches via the Schur complement through a standard recursion. We first augment the boundary matrix with an identity matrix, which is of size at least n, for reasons we shall describe below. To simplify notation, we assume n is a power of 2. If it is not, we can set the size of the identity matrix to m+n with m<n such that m+2n=2x. Therefore, our initial matrices are:

𝐑=[𝐃00𝐈m+n],𝐕=𝐈m+2n.

Throughout the algorithm, we implicitly perform two types of permutations by taking appropriate subsets of rows and columns. The first are column permutations. To ensure that the appropriate submatrices are invertible, we require that after processing k columns of 𝐑, there are k pivots, or, equivalently, that the matrix corresponding to the processed columns is full (column) rank. Because cycles reduce to zero columns, the if-statement in Algorithm 3 permutes a zero column from 𝐑 with a non-zero column from the identity matrix 𝐈m+n, and records the indices of such columns in list Z, to eventually undo the permutation.

Figure 1: An example of the column permutation in the exhaustive algorithm. (a) Initially, we append an identity matrix to the boundary matrix. (b) Assume we have processed the first k columns. The blue entries represent non-zero entries, and the dark blue boxes represent the pivots. To apply these pivots to next k columns (shown in gray), the first k columns must contain k pivots. (c-d) If there is a a zero column (shown in orange), we transpose it with the first non-zero entry in the appended identity matrix, ensuring the processed k columns all have pivots.

We must also consider row permutations. To apply Theorem 7, we must find the inverse 𝐑1[L,B] in Algorithm 3, which is used in the Schur complement. We construct a sequence L=𝐥𝐨𝐰():B of the pivot rows in columns B. Denoting by L¯ the sequence of rows outside of L, we denote a permutation that places rows L below L¯ as 𝐏L:

(𝐏L𝐑)=[𝐑[L¯,]𝐑[L,]]. (3)

See Figure 2(b-c). The permutation is explicitly given by,

PL:𝐥𝐨𝐰(B(i))m+n|B|+ifori=1,,|B|

where B(i) is the i-th entry of the indices in B.

Figure 2: An example of the row permutations. (a) A submatrix consisting of 8 columns where the 4 columns on the left have been reduced, and we need to apply the pivots to the following 4 columns (in gray). (b-c) Each row which has a pivot gets permuted to the bottom of the matrix in the same order as the columns – resulting in a lower triangular matrix. (d) Applying the Schur complement zeros out the gray entries on the bottom right and we update the entries in the upper right (dark gray). (e) With the pivot rows zeroed out on the right, we reverse the permutation.
Lemma 8.

After permuting the rows by 𝐏L, the bottom-left k×k matrix is lower triangular, where k=|L|.

We delay the proof until after the description of the algorithm. We now follow a recursion: we split matrix 𝐑 into the first half of the columns denoted by B and the second half denoted by C. We proceed to call the algorithm on the first half of the matrix. Once we reach a leaf in the recursion tree (shown in Figure 3), the matrix consists of a single column. The key invariant is that whenever we reach a leaf, the corresponding column is reduced with respect to all the columns which come prior to it in the filtration. For the first column, this is tautologically true and we delay the proof for the general case until later.

Figure 3: The standard binary recursion tree in how we split the matrix by column. Observe that |B|=|C|=|L| in Algorithm 3 and that 𝐑[L,B]=(𝐏L𝐑)[{n|B|+1,,n},B], the bottom |B| rows in the permuted matrix.

If we are not in the base case (a single column), we must apply the pivots in the columns indexed by B (left half of the submatrix) to the the columns indexed by C (right half of the submatrix). As described in Equation 3, we construct the permutation 𝐏L such that

(𝐏L𝐑)[,BC])=[𝐑[L¯,B]𝐑[L¯,C]𝐑[L,B]𝐑[L,C]]

By construction of 𝐏L, 𝐑[L,B] is lower-triangular with non-zero diagonal entries and so is full-rank. We can then apply the Schur complement to zero out all the corresponding rows in the columns C, 𝐑[L,C]0 and update the rest of the rows:

𝐑[L¯,C]𝐂1𝐑[L¯,C]𝐂1𝐑[L¯,B]𝐁1𝐑[L,B]1𝐁21𝐑[L,C]𝐂2=𝐑[L¯,C]𝐑[L¯,B]𝚲

To update matrix 𝐕, we perform the same operations 𝚲=𝐑[L,B]1𝐑[L,C] on 𝐕:

𝐕[L¯,C]𝐕[L¯,C]𝐕[L¯,C]𝚲

Once the left half of the matrix has been applied to the right half, we recurse on the second half, i.e., C. Here again, because 𝐑[L,B] is lower-triangular full-rank and 𝐑[L,C]=0, the first column of 𝐑[,C] is reduced. We now prove correctness.

Lemma 9.

When the recursion base case is reached for column k, 𝐑[𝐥𝐨𝐰(j),k]=0 for all j<k.

Proof.

For k=1, this is tautological since 𝐥𝐨𝐰(j) is empty. For k>1, we observe that entry 𝐑[𝐥𝐨𝐰(i),k] was made zero when iB and kC. As the recursion always splits the column range in half, this condition must be satisfied somewhere in the recursion before the base case of k is reached.

Proof of Lemma 8.

We observe that when 𝐏L is applied, the columns corresponding to L have a pivot. By construction, 𝐏L places the pivots onto the diagonal in the bottom |L| rows. For any of these rows above the diagonal, the entries are 0 by Lemma 9, implying the bottom k×k matrix is lower triangular.

Theorem 10.

Algorithm 3 computes the persistence diagram correctly.

Proof.

By Equation 1, it suffices to show that for all i, 𝐥𝐨𝐰(i) is computed correctly. For i=1, this is trivially true. For i>1, observe that at any step of the algorithm, we maintain

𝐑=𝐃𝐕,

as any operations on 𝐑 are applied to 𝐕. Assuming the pivots are correct for j<i, by the above and Lemma 9, 𝐕 gives a transformation depending only on columns j<i, such that all elements in 𝐑[𝐥𝐨𝐰(j),i]=0. If 𝐥𝐨𝐰(i) does not exist, D[,i] was in the span of the previous columns and hence a cycle. If 𝐥𝐨𝐰(i) exists, it is distinct from {𝐥𝐨𝐰(j)}j<i and so we have a new pairing. The correctness of this pairing follows from the Pairing Uniqueness Lemma [8].

Running Time Analysis.

The base case takes O(1) time. For a general step where |B|=|C|=k, applying the update requires a row permutation of a 2n×2k matrix which takes O(nk) time. We must compute 𝐑[L,B]1 which is inverting a k×k matrix. Multiplying it with 𝐑[L,C] takes O(kω) time as both are k×k matrices. Finally, we multiply this product with the n×k matrix 𝐑[L¯,C], which by Lemma 4, takes O(nkω1) time. Solving the recursion, we find that the total running time is O(nω) for ω>2 or O(n2logn) if ω=2. For completeness, we include the derivation in the full version [23].

5 Row Algorithm

While Algorithm 3 produces the exhaustive reduction in matrix multiplication time, a natural question is whether the same can be done for computing the lazy reduction (and its representatives). In this section, we present an algorithm which achieves this. We first give the iterative version before describing how it can be computed in O(nω).

Algorithm 4 Incremental Row Algorithm.

The idea behind this reduction is to consider rows from the bottom up. Observe that a pivot in the bottom row can be directly identified in 𝐃 as the earliest (leftmost) non-zero entry, similarly as the pivot in the first column can be directly identified. To formalize the notion of the earliest eligible pivot in a given row, we define

𝐥𝐟𝐭(i)=argminj{𝐑[i,j]0:𝐥𝐨𝐰(j)=i}

As in the case of 𝐥𝐨𝐰, we only apply this function to 𝐑. The function 𝐥𝐟𝐭 returns the earliest column j which is non-zero and is the lowest such non-zero entry in its column. This condition is important as the earliest (left-most) non-zero entry may have pivots below it. This column is used to zero out the i-th row in columns to the right provided they do not already contain a pivot, i.e., if 𝐥𝐨𝐰(j)=i, then the column is applied. This condition is why we obtain equivalence with the lazy reduction – we do not apply the pivot column to later columns which already contain a pivot.

Lemma 11.

Algorithm 4 produces the same decomposition as the lazy reduction.

Proof.

This is equivalent to [10, Theorem 3.1].

5.1 Fast Row Algorithm

The fast version of Algorithm 4 is given in Algorithm 5. As above, it reduces the matrix row by row from the bottom up. This variant does not require matrix inversion and requires less padding. The trade-off is that it requires a more complex sequence of updates. Assuming 𝐃 is an n×n matrix, we set m<n such that m+n=2x. We initialize our matrices as:

𝐑=[𝐃𝐈m+n𝟎m],𝚲=𝐈m+n.

To simplify notation, from this point on, we assume n is a power of 2 (as m+n<2n), so the resulting matrix is [𝐃𝐈n]. This ensures that 𝐥𝐟𝐭(i) is defined for all i in 𝐑, i.e., the identity matrix ensures there are no zero rows.

Algorithm 5 Row Algorithm(A=[i,j]).

It will be convenient to again consider permutations, but here they will be column permutations. We build up the permutation incrementally. In the i-th step, we update the permutation with the column transposition

π(i):𝐥𝐟𝐭(ni+1)i.

which we use a shorthand for the two mappings 𝐥𝐟𝐭(ni+1)i and i𝐥𝐟𝐭(ni+1). As 𝐥𝐟𝐭 is always defined, two columns are permuted in each step. The permutation after i steps is then given by

𝐏i=jiπ(j).

Note that we apply the permutations in order, i.e., for i=1,2, While the columns corresponding to 𝐥𝐟𝐭(ni+1) are fixed at i for all permutations, the original column at i may be permuted several times. In the algorithm, we omit the subscript; 𝐏 refers to the accumulated permutation. As in the case of the column algorithm, we perform the permutations implicitly. We observe that in the permuted order, we arrange pivots on the left along the anti-diagonal, see Figure 4.

Figure 4: The permutation of the columns so that the pivots in the bottom k rows are on the right. An important observation is that despite this reshuffling of columns, because of the definition of 𝐥𝐟𝐭(), we never “accidentally” reduce columns which occur earlier in the filtration order.

We keep track of the operations directly in the matrix 𝚲 which is initialized as the identity matrix. Before delving into the details of the algorithm, assume that the all rows below the i-th row have been reduced. The updates in the i-th row are given by

(𝐏𝚲𝐏)[i,j]={(𝐑𝐏)[ni+1,j](𝐑𝐏)[ni+1,i]j>i1ni+1=j0else

We digress here to explain why this works. As mentioned above, if we consider the column-permuted matrix 𝐑𝐏, it has the pivots in the bottom-left along the anti-diagonal (Figure 4). The i-th column corresponds to the column given by 𝐥𝐟𝐭(ni+1) (in the original filtration order). Hence, it is the earliest column with a non-zero entry in the i-th row from the bottom such that there is no pivot below. For any non-zero entry to the right of i, it must occur to the right of i in the original filtration order (before permuting), or it would have been returned by 𝐥𝐟𝐭(ni+1) rather than the current i-th column in the permuted order.

 Remark 12.

Hence in Algorithm 5, all non-zeros in the row to the right of i are pivots (lowest entries), because every column with a pivot below ni+1 has been moved to the left of i in the permuted order and so no reduction will be applied, i.e., coefficient will be 0.

Finally, as we permute the columns we must also permute the rows of the 𝚲 matrix so that the recorded column operations match. This represents the base case of the recursion. As 𝚲 is initialized as the identity matrix, the case ni+1=j is taken care of implicitly.

Returning to the algorithm, we proceed by recursing as in the column algorithm, but on the rows rather than on the columns. We divide the rows of the sub-matrix into the top and bottom halves. We recurse first on the bottom half. Because the pivots are determined by rows below the current one, we can directly identify the pivot with 𝐥𝐟𝐭.

The base case is a single row. By assumption, rows below the current row have been updated. At row ni+1, we first find the left-most non-zero entry and perform a column permutation setting the column 𝐥𝐟𝐭(ni+1) to the i-th column, making 𝐑[ni,i] a pivot as required. By the reasoning above, we may zero out the row, recording the operations in 𝚲 and we can update (𝐑𝐏)[ni,{i+1,,n}]0.

Though the recursion proceeds as in Algorithm 3, splitting the matrix into the indices in the “first half” and “second half,” a complication is that the columns are processed left to right (same as the indexing), while the rows are processed bottom-up while being indexed top-down. Hence, we introduce:

Cr=nC+1,

by which we mean for any iC, ini+1. This indexes the rows from the bottom of the matrix as required by the algorithm. Returning to the recursion, once we processed the columns for B, we first apply the updates to the rows Cr,

(𝐑𝐏)[Cr,](𝐑𝐏)[Cr,]+(𝐑𝐏)[Cr,B](𝐏𝚲𝐏)[B,],

shown in orange in Figure 5. Note that though Br is shown in Figure 5, it is not used explicitly in the algorithm as all the operations in those rows have already been performed. On the other hand, B in (𝐏𝚲𝐏)[B,] and in (𝐑𝐏)[Cr,B] do not need to be reversed, as they both represent column operations which are in the standard order. After this, the first row in Cr is now up-to-date with all operations from rows below it. This allows us to correctly identify 𝐥𝐟𝐭 for this row and perform the column transposition accordingly. Hence, when we recurse on C, the base case can be carried out.

Returning from C, we complete the recursion by performing the update operations on the remaining parts of the columns in C, shown in green in Figure 5. Note, the columns are indexed by C not Cr. Let A¯r={1,,min(Cr)1}. The column update is given as

(𝐑𝐏)[A¯r,C](𝐑𝐏)[A¯r,C]+(𝐑𝐏)[A¯r,B](𝐏𝚲𝐏)[B,C]

Now all columns prior to and including C and all rows below and including Cr are up to date. We show the update sequence in Figure 5 (omitting the permutations). Note that in the column update, the rows in A¯r are correctly indexed, so no reversal is necessary.

Figure 5: The updating steps in Algorithm 5. On the right we have the recursion tree for the rows, as opposed to the columns which is the same as in Figure 3 – as rows proceed bottom-up and columns proceed left to right. When we return from the recursion on B (or Br), we have zeroed out all the entries to the right of columns B in rows Br. We then first need to apply these to the rows in Cr (line 11 in Algorithm 5), shown in orange. We can then identify the correct pivot columns for rows Cr (after recursing), and complete the step by applying the operations from columns B to C above. This is shown in green – and corresponding to the right of Ar=BrCr in the recursion tree (the rows above Ar – denoted A¯r) to the right of the dashed line. This makes columns BC and rows Ar completely processed/reduced.
Theorem 13.

Algorithm 5 computes the lazy reduction.

Proof.

The algorithm is equivalent to Algorithm 4, but it performs the operations by batches. Observe that in the base case for row ni+1, the column operations recorded in 𝚲 are equal to α in the i-th step of Algorithm 4. If we performed the operations on the entire column, we would, in fact, obtain exactly Algorithm 4 (since there would be no need for any further updates in the recursion).

Hence, to show correctness, we need to ensure that we can correctly compute 𝐥𝐟𝐭(i) in each base case. This is trivially true in the first step. In further steps, we need to ensure that all the column operations have been applied to (𝐑𝐏)[C,]. We can directly verify that any column operations coming from row j<i, fall in exactly one B (with i in C) in the recursion and hence are applied before the base case for i. It only remains to show that the columns (𝐑𝐏)[,C] are up to date before the columns operations from rows in Cr are applied in the appropriate rows of (𝐑𝐏)[A¯r,], which is done in line 14.

Theorem 14.

Matrix 𝐔=2𝐈𝚲 satisfies 𝐃=𝐑𝐔, or equivalently, 𝐕=𝐔1.

Proof.

During a regular reduction, Algorithm 4, updates in matrix 𝐔 use row operations to “undo” the column operations in matrices 𝐑 and 𝐕. When a column j in 𝐑 is subtracted from column j, which itself has not been used to reduce any other column, its corresponding row 𝐔[j,] contains a single diagonal element – compare the situations in Algorithms 1 and 2. In this case, the update in matrix 𝐔 is equivalent to setting entry 𝐔[j,j] to the coefficient that is the negation of the coefficient used for the column update. When a column j in 𝐑 is subtracted from column j, which itself has not been used to reduce any other column, its corresponding row 𝐔[j,] contains a single diagonal element.

Algorithm 5 satisfies this property (which is why it produces a lazy reduction): when an update is recorded in matrix 𝚲, the column that is being updated has not yet been used to reduce any other column. Therefore, off the diagonal, the corresponding matrix 𝐔 is the negation of matrix 𝚲 – compare the coefficients in Algorithm 5 with α in Algorithm 4. On the diagonal, both 𝚲 and 𝐔 are all ones. So adding 2𝐈 to 𝚲 recovers 𝐔.

 Remark 15.

As 𝐔 is an upper triangular matrix, by Theorem 7, it can be inverted in O(nω)-time as required.

Running Time Analysis.

The base case takes O(n) time as recording the permutation and zeroing out operations each take linear time. Hence the base case takes O(n) time. For the general case, we need to first apply the column permutations. Since we are permuting at most an n×k (or k×n) matrix, applying the permutation (and undoing it) takes O(nk) time by Lemma 5. Next, applying the row updates from Br to Cr, assuming |B|=|C|=k, requires multiplying (𝐏𝚲𝐏)[B,], a k×n matrix, with (𝐑𝐏)[Cr,B], a k×k matrix – taking O(nkω1) time by Lemma 4. To complete the update, the subtractions take O(nk) time. To compute the column updates, we must multiply (𝐑𝐏)[A¯r,B], an n×k matrix with (𝐏𝚲𝐏)[B,C], a k×k matrix, which again takes O(nkω1) time. Putting these together, we find that the full step can be completed in O(nkω1) time and as in the column algorithm case, solving the recursion gives an O(nω) running time for ω>2 and a O(n2logn) running time for ω=2.

6 Discussion

In this paper, we have shown that in the case of persistent (co)homology, the standard bases returned by the exhaustive and lazy reductions can be computed in matrix multiplication time. It is worth noting that while both the columns and row algorithms utilize batch updates, they are qualitatively different: (1) Only the column algorithm critically relies on fast matrix inversion; (2) The row algorithm update sequence is substantially more complex but requires only column permutations. While one can use the column algorithm to compute the lazy basis and the row algorithm for the exhaustive basis in the same asymptotic running time, the resulting algorithms are both complex and not particularly illuminating. There are also numerous technical complications to deal with, so we omit them from this paper. Another outstanding issue is whether it is possible to transform the exhaustive representatives to lazy representatives and vice versa without redoing the reduction. Again, we believe this possible, but omit the details due to space and because the resulting asymptotic running time is the same. Finally, we conclude with an open question: what is the optimal running time for computing representatives in zigzag persistence. Recently, this has been partially addressed in [12, 14] but optimality in full generality remains open.

References

  • [1] Ulrich Bauer. Ripser: efficient computation of vietoris–rips persistence barcodes. Journal of Applied and Computational Topology, 5(3):391–423, 2021. doi:10.1007/S41468-021-00071-5.
  • [2] Ulrich Bauer, Michael Kerber, and Jan Reininghaus. Clear and compress: Computing persistent homology in chunks. In Topological Methods in Data Analysis and Visualization III: Theory, Algorithms, and Applications, pages 103–117. Springer, 2014. doi:10.1007/978-3-319-04099-8_7.
  • [3] Ulrich Bauer, Michael Kerber, Jan Reininghaus, and Hubert Wagner. Phat–persistent homology algorithms toolbox. Journal of symbolic computation, 78:76–90, 2017. doi:10.1016/J.JSC.2016.03.008.
  • [4] Oleksiy Busaryev, Sergio Cabello, Chao Chen, Tamal K Dey, and Yusu Wang. Annotating simplices with a homology basis and its applications. In Scandinavian workshop on algorithm theory, pages 189–200. Springer, 2012. doi:10.1007/978-3-642-31155-0_17.
  • [5] Gunnar Carlsson and Vin de Silva. Zigzag persistence. Foundations of computational mathematics, 10(4):367–405, August 2010. doi:10.1007/s10208-010-9066-0.
  • [6] Gunnar Carlsson, Vin de Silva, and Dmitriy Morozov. Zigzag persistent homology and real-valued functions. In Proceedings of the Twenty-fifth Annual Symposium on Computational Geometry, SCG ’09, pages 247–256, New York, NY, USA, 2009. ACM. doi:10.1145/1542362.1542408.
  • [7] Chao Chen and Michael Kerber. An output-sensitive algorithm for persistent homology. In Proceedings of the twenty-seventh annual symposium on Computational geometry, pages 207–216, 2011. doi:10.1145/1998196.1998228.
  • [8] David Cohen-Steiner, Herbert Edelsbrunner, and Dmitriy Morozov. Vines and vineyards by updating persistence in linear time. In Proceedings of the twenty-second annual symposium on Computational geometry, pages 119–126, 2006. doi:10.1145/1137856.1137877.
  • [9] David Cohen-Steiner, André Lieutier, and Julien Vuillamy. Lexicographic optimal homologous chains and applications to point cloud triangulations. Discrete & computational geometry, 68(4):1155–1174, December 2022. doi:10.1007/s00454-022-00432-6.
  • [10] Vin De Silva, Dmitriy Morozov, and Mikael Vejdemo-Johansson. Dualities in persistent (co) homology. Inverse Problems, 27(12):124003, 2011.
  • [11] Vin de Silva, Dmitriy Morozov, and Mikael Vejdemo-Johansson. Persistent cohomology and circular coordinates. Discrete & computational geometry, 45(4):737–759, June 2011. doi:10.1007/s00454-011-9344-x.
  • [12] Tamal K Dey and Tao Hou. Updating barcodes and representatives for zigzag persistence. arXiv preprint arXiv:2112.02352, 2021.
  • [13] Tamal K Dey and Tao Hou. Fast computation of zigzag persistence. In 30th Annual European Symposium on Algorithms (ESA 2022). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022.
  • [14] Tamal K Dey, Tao Hou, and Dmitriy Morozov. A fast algorithm for computing zigzag representatives. arXiv preprint arXiv:2410.20565, 2024. doi:10.48550/arXiv.2410.20565.
  • [15] H. Edelsbrunner, D. Letscher, and A. Zomorodian. Topological persistence and simplification. Discrete & computational geometry, 28:511–533, 2002. doi:10.1007/S00454-002-2885-2.
  • [16] Herbert Edelsbrunner and John L Harer. Computational topology: an introduction. American Mathematical Society, 2022.
  • [17] G. Henselman and R. Ghrist. Matroid Filtrations and Computational Persistent Homology. ArXiv e-prints, June 2016. arXiv:1606.00199.
  • [18] Alan Hylton, Greg Henselman-Petrusek, Janche Sang, and Robert Short. Performance enhancement of a computational persistent homology package. In 2017 IEEE 36th international performance computing and communications conference (IPCCC), pages 1–8. IEEE, 2017. doi:10.1109/PCCC.2017.8280468.
  • [19] Gil Kalai. Enumeration of q-acyclic simplicial complexes. Israel Journal of Mathematics, 45:337–351, 1983.
  • [20] Michael Kerber, Donald R Sheehy, and Primoz Skraba. Persistent homology and nested dissection. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1234–1245. SIAM, 2016. doi:10.1137/1.9781611974331.CH86.
  • [21] Nikola Milosavljević, Dmitriy Morozov, and Primoz Skraba. Zigzag persistent homology in matrix multiplication time. In Proceedings of the twenty-seventh Annual Symposium on Computational Geometry, pages 216–225, 2011. doi:10.1145/1998196.1998229.
  • [22] Dmitriy Morozov. Persistence algorithm takes cubic time in worst case. BioGeometry News, Dept. Comput. Sci., Duke Univ, 2, 2005.
  • [23] Dmitriy Morozov and Primoz Skraba. Persistent (co)homology in matrix multiplication time, 2024. doi:10.48550/arXiv.2412.02591.
  • [24] Arnur Nigmetov and Dmitriy Morozov. Topological optimization with big steps. Discrete & computational geometry, 72(1):310–344, July 2024. doi:10.1007/s00454-023-00613-x.
  • [25] Primoz Skraba, Gugan Thoppe, and D Yogeshwaran. Randomly weighted d-complexes: Minimal spanning acycles and persistence diagrams. The Electronic Journal of Combinatorics, pages P2–11, 2020.
  • [26] Hubert Wagner, Chao Chen, and Erald Vuçini. Efficient computation of persistent homology for cubical data. In Topological methods in data analysis and visualization II: theory, algorithms, and applications, pages 91–106. Springer, 2011.
  • [27] Afra Zomorodian and Gunnar Carlsson. Computing persistent homology. In Proceedings of the twentieth annual symposium on Computational geometry, pages 347–356, 2004. doi:10.1145/997817.997870.