/
lophat.pyi
85 lines (67 loc) · 3.7 KB
/
lophat.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from typing import Iterator, List, Set, Tuple
def compute_pairings(
matrix: List[Tuple[int, List[int]]] | Iterator[Tuple[int, List[int]]],
anti_transpose: bool = True,
options: LoPhatOptions | None = None,
) -> PersistenceDiagram:
"""
Decomposes the input matrix, using the lockfree algorithm.
:param matrix: The boundary matrix, provided in sparse column format. Each column is a tuple of (dimension, boundary) where boundary is the list of non-zero indices.
:param anti_transpose: Whether to anti-transpose the matrix first. Best left True with clearing on. Set to False if input matrix non-square.
:param options: Options to control the R=DV decomposition algorithm.
:returns: The persistence pairings read off from the R=DV decomposition.
"""
def compute_pairings_with_reps(
matrix: List[Tuple[int, List[int]]] | Iterator[Tuple[int, List[int]]],
options: LoPhatOptions | None = None,
) -> PersistenceDiagramWithReps:
"""
Decomposes the input matrix, using the lockfree algorithm.
Additionally returns representatives of the pairings found.
Note that options will be overwritten to ensure that V is maintained in the decomposition.
:param matrix: The boundary matrix, provided in sparse column format. Each column is a tuple of (dimension, boundary) where boundary is the list of non-zero indices.
:param options: Options to control the R=DV decomposition algorithm.
:returns: The persistence pairings read off from the R=DV decomposition.
"""
class LoPhatOptions:
"""
A class representing the persistence diagram computed by LoPHAT.
Each column index in the input matrix appears exactly once, either in a pairing or as unpaired.
:param maintain_v: Whether to maintain_v during decompositon, usually best left False.
:param num_threads: Max number of threads to use. Set at 0 to use all threads.
:param column_height: Optional hint to height of columns. If None, assumed that matrix is square.
:param min_chunk_len: When splitting work, don't reduce chunks to smaller than this size.
:param clearing: Whether to employ the clearing optimisation. Cannot use if input non-square.
"""
def __init__(
self,
maintain_v: bool = False,
num_threads: int = 0,
column_height: int | None = None,
min_chunk_len: int = 1,
clearing: bool = True,
) -> None:
...
class PersistenceDiagram:
"""
A class representing the persistence diagram computed by LoPHAT.
Each column index in the input matrix appears exactly once, either in a pairing or as unpaired.
:param unpaired: The set of input column indices that were not paired in the R=DV decomposition.
:param paired: The set of (birth, death) pairs of column indices that were paired in the R=DV decomposition.
"""
unpaired: Set[int]
paired: Set[Tuple[int, int]]
class PersistenceDiagramWithReps:
"""
A class representing the persistence diagram computed by LoPHAT.
Each column index in the input matrix appears exactly once, either in a pairing or as unpaired.
For each (paired or unpaired) feature, a representative is stored in the same index in the corresponding list of representatives.
:param unpaired: The list of input column indices that were not paired in the R=DV decomposition.
:param unpaired_reps: A list of representatives for each of the unpaired features.
:param paired: The list of (birth, death) pairs of column indices that were paired in the R=DV decomposition.
:param paired_reps: A list of representatives for each of the paired features.
"""
unpaired: List[int]
unpaired_reps: List[List[int]]
paired: List[Tuple[int, int]]
paired_reps: List[List[int]]