topolab-tda 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. topolab_tda-0.1.0/LICENSE +21 -0
  2. topolab_tda-0.1.0/PKG-INFO +198 -0
  3. topolab_tda-0.1.0/README.md +168 -0
  4. topolab_tda-0.1.0/THIRD_PARTY_LICENSES.md +715 -0
  5. topolab_tda-0.1.0/pyproject.toml +54 -0
  6. topolab_tda-0.1.0/python/Cargo.lock +253 -0
  7. topolab_tda-0.1.0/python/Cargo.toml +34 -0
  8. topolab_tda-0.1.0/python/LICENSE +21 -0
  9. topolab_tda-0.1.0/python/README.md +168 -0
  10. topolab_tda-0.1.0/python/THIRD_PARTY_LICENSES.md +715 -0
  11. topolab_tda-0.1.0/python/ci.sh +86 -0
  12. topolab_tda-0.1.0/python/src/ladder_wasm/api.rs +349 -0
  13. topolab_tda-0.1.0/python/src/lib.rs +1812 -0
  14. topolab_tda-0.1.0/python/src/wasm/api/alpha.rs +147 -0
  15. topolab_tda-0.1.0/python/src/wasm/api/boxes.rs +170 -0
  16. topolab_tda-0.1.0/python/src/wasm/api/coupled_alpha.rs +49 -0
  17. topolab_tda-0.1.0/python/src/wasm/api/ellipsoid.rs +162 -0
  18. topolab_tda-0.1.0/python/src/wasm/api/geometry.rs +170 -0
  19. topolab_tda-0.1.0/python/src/wasm/api/kfold.rs +120 -0
  20. topolab_tda-0.1.0/python/src/wasm/api/pairs.rs +122 -0
  21. topolab_tda-0.1.0/python/src/wasm/api/two_parameter.rs +711 -0
  22. topolab_tda-0.1.0/python/src/wasm/api/wing.rs +94 -0
  23. topolab_tda-0.1.0/python/src/wasm/api.rs +1435 -0
  24. topolab_tda-0.1.0/python/topolab_tda/__init__.py +229 -0
  25. topolab_tda-0.1.0/python/topolab_tda/_args.py +265 -0
  26. topolab_tda-0.1.0/python/topolab_tda/_check.py +383 -0
  27. topolab_tda-0.1.0/python/topolab_tda/_complex.py +1324 -0
  28. topolab_tda-0.1.0/python/topolab_tda/_diagram.py +371 -0
  29. topolab_tda-0.1.0/python/topolab_tda/_flat.py +260 -0
  30. topolab_tda-0.1.0/python/topolab_tda/_native.pyi +90 -0
  31. topolab_tda-0.1.0/python/topolab_tda/_persistence.py +586 -0
  32. topolab_tda-0.1.0/python/topolab_tda/_rivet.py +220 -0
  33. topolab_tda-0.1.0/python/topolab_tda/_two_parameter.py +596 -0
  34. topolab_tda-0.1.0/python/topolab_tda/_types.py +652 -0
  35. topolab_tda-0.1.0/python/topolab_tda/_vineyard.py +358 -0
  36. topolab_tda-0.1.0/python/topolab_tda/experimental.py +236 -0
  37. topolab_tda-0.1.0/python/topolab_tda/ladder.py +813 -0
  38. topolab_tda-0.1.0/python/topolab_tda/py.typed +0 -0
  39. topolab_tda-0.1.0/rust/Cargo.toml +29 -0
  40. topolab_tda-0.1.0/rust/memory-phase/Cargo.toml +14 -0
  41. topolab_tda-0.1.0/rust/memory-phase/LICENSE +21 -0
  42. topolab_tda-0.1.0/rust/memory-phase/README.md +12 -0
  43. topolab_tda-0.1.0/rust/memory-phase/src/lib.rs +278 -0
  44. topolab_tda-0.1.0/rust/musl-math/Cargo.toml +19 -0
  45. topolab_tda-0.1.0/rust/musl-math/LICENSE +21 -0
  46. topolab_tda-0.1.0/rust/musl-math/README.md +20 -0
  47. topolab_tda-0.1.0/rust/musl-math/THIRD_PARTY_LICENSES.md +42 -0
  48. topolab_tda-0.1.0/rust/musl-math/src/data.rs +1236 -0
  49. topolab_tda-0.1.0/rust/musl-math/src/exp.rs +190 -0
  50. topolab_tda-0.1.0/rust/musl-math/src/hypot.rs +89 -0
  51. topolab_tda-0.1.0/rust/musl-math/src/lib.rs +107 -0
  52. topolab_tda-0.1.0/rust/musl-math/src/log.rs +125 -0
  53. topolab_tda-0.1.0/rust/musl-math/src/pow.rs +310 -0
  54. topolab_tda-0.1.0/rust/tda-core/Cargo.toml +38 -0
  55. topolab_tda-0.1.0/rust/tda-core/LICENSE +21 -0
  56. topolab_tda-0.1.0/rust/tda-core/README.md +95 -0
  57. topolab_tda-0.1.0/rust/tda-core/THIRD_PARTY_LICENSES.md +465 -0
  58. topolab_tda-0.1.0/rust/tda-core/src/alpha/delaunay_cech.rs +253 -0
  59. topolab_tda-0.1.0/rust/tda-core/src/alpha/faces.rs +194 -0
  60. topolab_tda-0.1.0/rust/tda-core/src/alpha/flatten.rs +242 -0
  61. topolab_tda-0.1.0/rust/tda-core/src/alpha/frame.rs +470 -0
  62. topolab_tda-0.1.0/rust/tda-core/src/alpha/mod.rs +443 -0
  63. topolab_tda-0.1.0/rust/tda-core/src/alpha/order.rs +223 -0
  64. topolab_tda-0.1.0/rust/tda-core/src/alpha/tests.rs +771 -0
  65. topolab_tda-0.1.0/rust/tda-core/src/alpha/weighted.rs +544 -0
  66. topolab_tda-0.1.0/rust/tda-core/src/boxes/native_oracles.rs +344 -0
  67. topolab_tda-0.1.0/rust/tda-core/src/boxes.rs +836 -0
  68. topolab_tda-0.1.0/rust/tda-core/src/complex/close.rs +153 -0
  69. topolab_tda-0.1.0/rust/tda-core/src/complex/cubical.rs +176 -0
  70. topolab_tda-0.1.0/rust/tda-core/src/complex/explicit.rs +400 -0
  71. topolab_tda-0.1.0/rust/tda-core/src/complex/flag.rs +501 -0
  72. topolab_tda-0.1.0/rust/tda-core/src/complex/mod.rs +738 -0
  73. topolab_tda-0.1.0/rust/tda-core/src/complex/tests.rs +882 -0
  74. topolab_tda-0.1.0/rust/tda-core/src/coupled_alpha/binary128.rs +800 -0
  75. topolab_tda-0.1.0/rust/tda-core/src/coupled_alpha/mod.rs +449 -0
  76. topolab_tda-0.1.0/rust/tda-core/src/cubical/cells3d.rs +593 -0
  77. topolab_tda-0.1.0/rust/tda-core/src/cubical/mod.rs +527 -0
  78. topolab_tda-0.1.0/rust/tda-core/src/distances/emd/assignment.rs +1253 -0
  79. topolab_tda-0.1.0/rust/tda-core/src/distances/emd.rs +2064 -0
  80. topolab_tda-0.1.0/rust/tda-core/src/distances/error.rs +267 -0
  81. topolab_tda-0.1.0/rust/tda-core/src/distances/persistence.rs +906 -0
  82. topolab_tda-0.1.0/rust/tda-core/src/distances/util.rs +202 -0
  83. topolab_tda-0.1.0/rust/tda-core/src/distances.rs +73 -0
  84. topolab_tda-0.1.0/rust/tda-core/src/ellipsoid/cech/tests.rs +270 -0
  85. topolab_tda-0.1.0/rust/tda-core/src/ellipsoid/cech.rs +992 -0
  86. topolab_tda-0.1.0/rust/tda-core/src/ellipsoid/linalg.rs +246 -0
  87. topolab_tda-0.1.0/rust/tda-core/src/ellipsoid/linalg_recorded_tests.rs +150 -0
  88. topolab_tda-0.1.0/rust/tda-core/src/ellipsoid/mod.rs +1102 -0
  89. topolab_tda-0.1.0/rust/tda-core/src/field.rs +352 -0
  90. topolab_tda-0.1.0/rust/tda-core/src/geometry/ball.rs +685 -0
  91. topolab_tda-0.1.0/rust/tda-core/src/geometry/cech.rs +890 -0
  92. topolab_tda-0.1.0/rust/tda-core/src/geometry/circumball/tests.rs +272 -0
  93. topolab_tda-0.1.0/rust/tda-core/src/geometry/circumball.rs +1982 -0
  94. topolab_tda-0.1.0/rust/tda-core/src/geometry/exact_int.rs +484 -0
  95. topolab_tda-0.1.0/rust/tda-core/src/geometry/kdtree.rs +449 -0
  96. topolab_tda-0.1.0/rust/tda-core/src/geometry/mod.rs +115 -0
  97. topolab_tda-0.1.0/rust/tda-core/src/geometry/nerve.rs +774 -0
  98. topolab_tda-0.1.0/rust/tda-core/src/geometry/power_sphere.rs +1990 -0
  99. topolab_tda-0.1.0/rust/tda-core/src/geometry/sampling.rs +252 -0
  100. topolab_tda-0.1.0/rust/tda-core/src/geometry/witness.rs +980 -0
  101. topolab_tda-0.1.0/rust/tda-core/src/grow.rs +69 -0
  102. topolab_tda-0.1.0/rust/tda-core/src/heap.rs +379 -0
  103. topolab_tda-0.1.0/rust/tda-core/src/kfold/build.rs +555 -0
  104. topolab_tda-0.1.0/rust/tda-core/src/kfold/insphere.rs +220 -0
  105. topolab_tda-0.1.0/rust/tda-core/src/kfold/mod.rs +678 -0
  106. topolab_tda-0.1.0/rust/tda-core/src/kfold/sides.rs +98 -0
  107. topolab_tda-0.1.0/rust/tda-core/src/kfold/sweep.rs +378 -0
  108. topolab_tda-0.1.0/rust/tda-core/src/kfold/table.rs +215 -0
  109. topolab_tda-0.1.0/rust/tda-core/src/kfold/tests.rs +1175 -0
  110. topolab_tda-0.1.0/rust/tda-core/src/ladder/approx.rs +648 -0
  111. topolab_tda-0.1.0/rust/tda-core/src/ladder/brick_search.rs +403 -0
  112. topolab_tda-0.1.0/rust/tda-core/src/ladder/cl4.rs +1081 -0
  113. topolab_tda-0.1.0/rust/tda-core/src/ladder/cl4_data.rs +231 -0
  114. topolab_tda-0.1.0/rust/tda-core/src/ladder/cl4_universal.rs +135 -0
  115. topolab_tda-0.1.0/rust/tda-core/src/ladder/complex.rs +431 -0
  116. topolab_tda-0.1.0/rust/tda-core/src/ladder/courses.rs +258 -0
  117. topolab_tda-0.1.0/rust/tda-core/src/ladder/error.rs +37 -0
  118. topolab_tda-0.1.0/rust/tda-core/src/ladder/exact.rs +182 -0
  119. topolab_tda-0.1.0/rust/tda-core/src/ladder/field.rs +151 -0
  120. topolab_tda-0.1.0/rust/tda-core/src/ladder/homology.rs +180 -0
  121. topolab_tda-0.1.0/rust/tda-core/src/ladder/linalg.rs +299 -0
  122. topolab_tda-0.1.0/rust/tda-core/src/ladder/mod.rs +209 -0
  123. topolab_tda-0.1.0/rust/tda-core/src/ladder/models.rs +437 -0
  124. topolab_tda-0.1.0/rust/tda-core/src/ladder/quiver.rs +579 -0
  125. topolab_tda-0.1.0/rust/tda-core/src/ladder/repr.rs +625 -0
  126. topolab_tda-0.1.0/rust/tda-core/src/ladder/rng.rs +49 -0
  127. topolab_tda-0.1.0/rust/tda-core/src/ladder/zigzag.rs +851 -0
  128. topolab_tda-0.1.0/rust/tda-core/src/lib.rs +197 -0
  129. topolab_tda-0.1.0/rust/tda-core/src/min_persistence.rs +134 -0
  130. topolab_tda-0.1.0/rust/tda-core/src/persistence/cubical.rs +169 -0
  131. topolab_tda-0.1.0/rust/tda-core/src/persistence/diagram.rs +94 -0
  132. topolab_tda-0.1.0/rust/tda-core/src/persistence/flat.rs +165 -0
  133. topolab_tda-0.1.0/rust/tda-core/src/persistence/mod.rs +186 -0
  134. topolab_tda-0.1.0/rust/tda-core/src/persistence/reduce.rs +1003 -0
  135. topolab_tda-0.1.0/rust/tda-core/src/persistence/simplicial.rs +267 -0
  136. topolab_tda-0.1.0/rust/tda-core/src/pivots.rs +110 -0
  137. topolab_tda-0.1.0/rust/tda-core/src/representations/betti.rs +180 -0
  138. topolab_tda-0.1.0/rust/tda-core/src/representations/image.rs +328 -0
  139. topolab_tda-0.1.0/rust/tda-core/src/representations/landscape.rs +426 -0
  140. topolab_tda-0.1.0/rust/tda-core/src/representations/mod.rs +47 -0
  141. topolab_tda-0.1.0/rust/tda-core/src/rips/adj.rs +224 -0
  142. topolab_tda-0.1.0/rust/tda-core/src/rips/collapse.rs +244 -0
  143. topolab_tda-0.1.0/rust/tda-core/src/rips/graph.rs +395 -0
  144. topolab_tda-0.1.0/rust/tda-core/src/rips/mod.rs +567 -0
  145. topolab_tda-0.1.0/rust/tda-core/src/rips/reduce.rs +593 -0
  146. topolab_tda-0.1.0/rust/tda-core/src/rips/reps.rs +852 -0
  147. topolab_tda-0.1.0/rust/tda-core/src/rips/simplex.rs +123 -0
  148. topolab_tda-0.1.0/rust/tda-core/src/rips/sweep.rs +353 -0
  149. topolab_tda-0.1.0/rust/tda-core/src/slices.rs +44 -0
  150. topolab_tda-0.1.0/rust/tda-core/src/sort.rs +153 -0
  151. topolab_tda-0.1.0/rust/tda-core/src/triangulation/delaunay2.rs +520 -0
  152. topolab_tda-0.1.0/rust/tda-core/src/triangulation/delaunay3.rs +692 -0
  153. topolab_tda-0.1.0/rust/tda-core/src/triangulation/exact.rs +612 -0
  154. topolab_tda-0.1.0/rust/tda-core/src/triangulation/expansion.rs +576 -0
  155. topolab_tda-0.1.0/rust/tda-core/src/triangulation/glue.rs +161 -0
  156. topolab_tda-0.1.0/rust/tda-core/src/triangulation/insertion_tests.rs +186 -0
  157. topolab_tda-0.1.0/rust/tda-core/src/triangulation/mod.rs +794 -0
  158. topolab_tda-0.1.0/rust/tda-core/src/triangulation/order.rs +237 -0
  159. topolab_tda-0.1.0/rust/tda-core/src/triangulation/predicates.rs +1539 -0
  160. topolab_tda-0.1.0/rust/tda-core/src/triangulation/predicates2.rs +823 -0
  161. topolab_tda-0.1.0/rust/tda-core/src/triangulation/subset.rs +409 -0
  162. topolab_tda-0.1.0/rust/tda-core/src/triangulation/tests.rs +844 -0
  163. topolab_tda-0.1.0/rust/tda-core/src/triangulation/tests2.rs +527 -0
  164. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/arrangement.rs +957 -0
  165. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/bit_tree.rs +121 -0
  166. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/coarsen.rs +422 -0
  167. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/cross.rs +333 -0
  168. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/functions.rs +291 -0
  169. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/grid.rs +266 -0
  170. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/mod.rs +498 -0
  171. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/multicritical.rs +365 -0
  172. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/presentation.rs +748 -0
  173. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/rips.rs +782 -0
  174. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/rivet.rs +2480 -0
  175. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/slice.rs +180 -0
  176. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/tests.rs +1004 -0
  177. topolab_tda-0.1.0/rust/tda-core/src/two_parameter/vine.rs +407 -0
  178. topolab_tda-0.1.0/rust/tda-core/src/vineyard/cubical.rs +103 -0
  179. topolab_tda-0.1.0/rust/tda-core/src/vineyard/decomposition.rs +2020 -0
  180. topolab_tda-0.1.0/rust/tda-core/src/vineyard/mod.rs +1133 -0
  181. topolab_tda-0.1.0/rust/tda-core/src/vineyard/rips.rs +249 -0
  182. topolab_tda-0.1.0/rust/tda-core/src/voc/mod.rs +798 -0
  183. topolab_tda-0.1.0/rust/tda-core/src/voc/tests.rs +592 -0
  184. topolab_tda-0.1.0/rust/tda-core/src/wing/mod.rs +838 -0
  185. topolab_tda-0.1.0/rust/tda-core/src/wing/tests.rs +224 -0
  186. topolab_tda-0.1.0/rust/tda-core/src/zigzag.rs +795 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 topolab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.4
2
+ Name: topolab-tda
3
+ Version: 0.1.0
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: Operating System :: OS Independent
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3 :: Only
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Programming Language :: Python :: Implementation :: CPython
15
+ Classifier: Programming Language :: Rust
16
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
17
+ Classifier: Typing :: Typed
18
+ Requires-Dist: numpy>=1.23
19
+ License-File: LICENSE
20
+ License-File: THIRD_PARTY_LICENSES.md
21
+ Summary: Topological data analysis in Rust: persistent homology of Rips, alpha, Čech, Delaunay–Čech, witness, k-fold cover, ellipsoid, wing, box and cubical complexes, zigzag persistence, vineyards, two-parameter persistence (RIVET's invariants), commutative ladders, exact diagram distances and persistence representations.
22
+ Keywords: topological-data-analysis,tda,persistent-homology,persistence-diagrams,vietoris-rips,alpha-complex,cubical-complex,zigzag-persistence,multiparameter-persistence,rivet
23
+ Author-email: topolab <dev@topolab.ai>
24
+ License-Expression: MIT AND BSL-1.0
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
27
+ Project-URL: Documentation, https://topolab.ai/tda/docs/
28
+ Project-URL: Homepage, https://topolab.ai/tda/
29
+
30
+ # topolab-tda
31
+
32
+ topolab TDA is topological data analysis in Rust. It builds a filtered complex from points or from an image, computes its persistent homology, and compares or summarises the diagrams. This package calls the Rust engine directly; it is the same code, the same functions and the same options as the npm package `@topolab/tda`, with NumPy arrays in and out.
33
+
34
+ ## Install
35
+
36
+ ```bash
37
+ pip install topolab-tda
38
+ ```
39
+
40
+ It needs Python 3.10 or later and NumPy 1.23 or later, its only dependency. One wheel per platform serves every CPython from 3.10 on. Where no wheel fits, pip builds the package from its source distribution, which needs a Rust toolchain (1.85 or later).
41
+
42
+ | | Needs | Tested |
43
+ |---|---|---|
44
+ | Python | 3.10 or later | 3.10 (NumPy 1.23.5) and 3.14 (NumPy 2.5.5) |
45
+ | Operating systems | none beyond the above | macOS (arm64); **not** Linux, Windows or macOS x86-64 |
46
+
47
+ ## First computation
48
+
49
+ ```python
50
+ import topolab_tda as tda
51
+
52
+ # The corners of a unit square. The four components merge as the edges
53
+ # appear at distance 1; the loop they close is created then and is filled at
54
+ # the diagonal, 2^(1/2).
55
+ points = [[0, 0], [1, 0], [1, 1], [0, 1]]
56
+ diagram = tda.rips_persistence(points, max_dim=1)
57
+
58
+ print(diagram.scale) # edge_length
59
+ print(diagram.pairs[0].tolist()) # [[0.0, 1.0], [0.0, 1.0], [0.0, 1.0], [0.0, inf]]
60
+ print(diagram.pairs[1].tolist()) # [[1.0, 1.4142135623730951]]
61
+ ```
62
+
63
+ `pairs[k]` is an `(n, 2)` float64 array of `(birth, death)` rows for the homology of dimension `k`. A death of `inf` means the class still persists at the end of the computed filtration; with a finite cutoff, it may be destroyed at a larger scale. The comment after each `print` is what it prints. Rips values are edge lengths, twice the radius of the balls (see [Filtrations and scales](https://topolab.ai/tda/docs/concepts/filtrations-and-scales/)).
64
+
65
+ ## Conventions
66
+
67
+ - A point cloud is an `(n, d)` array, or anything `numpy.asarray` reads as one, or a `PointCloud`; a distance matrix is a `DistanceMatrix`. An image or a volume is an array in NumPy's order. Input is converted to float64 once.
68
+ - Options are keyword-only arguments with the npm package's defaults: `rips_persistence(points, max_dim=2, coeff=3)`.
69
+ - Results are frozen dataclasses of NumPy arrays, numbers and strings, with the npm package's fields in snake_case. A complex is `Complex` (`vertices`, `offsets`, `filtrations`, `scale`), a diagram `Diagram` (`pairs`, `scale`, `coeff`).
70
+ - Errors:
71
+ - a wrong type is a `TypeError`;
72
+ - a value out of range, NaN where none is accepted, or an input over one of the documented size limits is a `ValueError` whose message names the parameter (a size limit's message starts with `input too large:`);
73
+ - a request the package can tell is too large before it allocates is a `MemoryError`: a size that overflows a buffer's capacity, and a list of zigzag operation objects whose packed copy would pass the 1 GiB conversion budget (pass a `PackedZigzag` instead); these are the npm package's `TOO_LARGE` refusals;
74
+ - a failure inside an engine is a `RuntimeError`;
75
+ - only an allocation that the operating system refuses in the middle of a computation ends the Python process: native Rust code cannot turn that into an exception.
76
+ - The engines release the GIL: calls in several threads run at once.
77
+
78
+ ## What it computes
79
+
80
+ | Feature | Functions | Status |
81
+ |---|---|---|
82
+ | Alpha complex, unweighted or weighted (points in 3D) | `alpha_complex`, `alpha_persistence` | Stable |
83
+ | Rips complex, persistence and representatives | `rips_complex`, `rips_persistence` | Experimental |
84
+ | Čech and Delaunay–Čech complexes | `cech_complex`, `cech_persistence`, `delaunay_cech_complex` | Stable |
85
+ | Euclidean (weak) witness complex | `witness_complex` | Experimental |
86
+ | Cubical complexes of images and volumes, T- and V-constructions | `cubical_complex`, `cubical_persistence` | Stable (V-construction experimental) |
87
+ | Ellipsoid complex (Rips-type, a flag complex) | `ellipsoids`, `ellipsoid_rips_complex`, `ellipsoid_rips_persistence` | Experimental |
88
+ | Ellipsoidal Čech complex (a nerve) | `ellipsoid_cech_complex`, `ellipsoid_cech_persistence` | Experimental |
89
+ | Wing complex (2D, a flag complex) | `wings`, `wing_complex`, `wing_persistence` | Experimental |
90
+ | Box filtration (2D and 3D) | `box_filtration`, `box_filtration_persistence` | Experimental |
91
+ | k-fold cover complex (multicover, fixed k) | `k_fold_cover_complex`, `k_fold_cover_persistence` | Stable |
92
+ | Coupled alpha complex (2D) | `coupled_alpha_complex` | Experimental |
93
+ | Persistent homology of any explicit complex | `persistence` | Stable |
94
+ | Zigzag persistence | `zigzag_persistence`, `insert_op`, `remove_op` | Stable |
95
+ | Vineyards: the classes of a diagram followed through a homotopy of the values, of images and of moving point clouds | `vineyard`, `cubical_vineyard`, `rips_vineyard` | Stable |
96
+ | Commutative ladders CL(n): decomposition for n ≤ 4, interval approximation for any n | `topolab_tda.ladder` | Experimental |
97
+ | Bottleneck and Wasserstein distances, exact, with the matching | `diagram_bottleneck`, `diagram_wasserstein` | Stable |
98
+ | Betti numbers and curves, persistence landscapes, persistence images | `betti_numbers`, `betti_curve`, `persistence_landscape`, `persistence_image` | Experimental |
99
+ | Volume-optimal cycles ((n−1)-homology in Rⁿ) | `volume_optimal_cycles` | Experimental |
100
+ | Two-parameter persistence over Z/2: minimal presentations of function-Rips, degree-Rips and any bifiltration (one grade a cell or several) or FIRep, bigraded Betti numbers and the Hilbert function, barcodes along lines, coarsening onto RIVET's grid, RIVET's input files | `function_rips_presentation`, `degree_rips_presentation`, `bifiltration_presentation`, `firep_presentation`, `bigraded_betti`, `fibered_barcode`, `coarsen_presentation`, `parse_rivet_input`, `rivet_presentation` | Experimental |
101
+ | Prepared complexes | `prepare_complex` (`topolab_tda.experimental`) | Experimental |
102
+ | Augmented arrangement (barcodes along many lines of a two-parameter module) | `augmented_arrangement` (`topolab_tda.experimental`) | Experimental |
103
+
104
+ Persistence takes coefficients in Z/p for every prime p up to 2^31 − 1 (default 2); zigzag and two-parameter persistence are over Z/2. The labels are the npm package's: a stable function is tested against the independent references named in [Numerical contracts](https://topolab.ai/tda/docs/concepts/numerical-contracts/) and kept; an experimental one can change its options, defaults or result shape in any release. A 0.x version promises no compatibility under semantic versioning.
105
+
106
+ ## Two-parameter persistence
107
+
108
+ A two-parameter module is carried by its minimal presentation. `function_rips_presentation`, `degree_rips_presentation`, `bifiltration_presentation` and `firep_presentation` compute one (in `degree=1` by default), `bigraded_betti` and `fibered_barcode` read it:
109
+
110
+ ```python
111
+ import topolab_tda as tda
112
+
113
+ # Four corners of a unit square, and its centre with a larger function value.
114
+ points = [[0, 0], [1, 0], [1, 1], [0, 1], [0.5, 0.5]]
115
+ values = [0, 0, 0, 0, 1]
116
+ p = tda.function_rips_presentation(points, values)
117
+
118
+ print(p.degree) # 1
119
+ print(p.xs.tolist(), p.ys.tolist()) # [0.0, 1.0] [1.0, 1.4142135623730951]
120
+ print(p.generators.tolist()) # [[0, 0]]
121
+ print(p.relations.tolist()) # [[1, 0], [0, 1]]
122
+
123
+ # H1: the square's loop is created at (value 0, distance 1), and filled in
124
+ # at (1, 1) through the centre and at (0, 2^(1/2)) by the diagonals.
125
+ b = tda.bigraded_betti(p)
126
+ print(b.b0.tolist()) # [[0.0, 1.0]]
127
+ print(b.b1.tolist()) # [[1.0, 1.0], [0.0, 1.4142135623730951]]
128
+ print(b.hilbert.tolist()) # [[1, 0], [0, 0]]
129
+
130
+ # Up the line at value 0, the loop persists from distance 1 until 2^(1/2).
131
+ bar = tda.fibered_barcode(p, {"point": (0, 0), "angle": 90})
132
+ print(bar.pairs.tolist()) # [[1.0, 1.4142135623730951]]
133
+ print(bar.point, bar.direction) # (0.0, 0.0) (0.0, 1.0)
134
+ ```
135
+
136
+ - A `Presentation` holds `xs` and `ys`, the distinct coordinates of the grades, increasing; `generators` and `relations`, `(n, 2)` arrays of `(x index, y index)` into them; `offsets` and `rows` (relation `j` is the sum of the generators `rows[offsets[j]:offsets[j + 1]]`); and `degree`.
137
+ - `bigraded_betti` gives `b0`, `b1` and `b2`, the grades of the generators, of the relations and of the relations among relations, as `(n, 2)` float64 arrays with multiplicity, and `hilbert`, a `(len(ys), len(xs))` array: `hilbert[iy, ix]` is the dimension of the module at `(xs[ix], ys[iy])`, and up to the next grid line on either axis.
138
+ - `fibered_barcode` takes a line as a dict or a `SliceLine` with `point` and either `direction` (non-negative, not zero) or `angle` (degrees from the first axis, 0 to 90), or a list of lines, and gives a `FiberedBarcode` (a list for a list): `pairs`, an `(n, 2)` array of `(birth, death)` in the line's parameter `t`, the point of the line at `t` being `point + t * direction`; `point` and `direction`, the line the engine built, `direction` a unit vector. The Rust crate builds the line, so the barcode is the npm package's, bit for bit.
139
+
140
+ `rivet_presentation` takes the text of a RIVET input file and gives the module RIVET builds from it. Its `degree` defaults to the file's `--homology`, and to 0 without it, as in RIVET, where the other presentation functions default to 1; a `degree` given overrides the file, as RIVET's `-H` does. `--xbins` and `--ybins` in the file coarsen the module as RIVET does. `parse_rivet_input` gives the file's data, as a `RivetInput`; a file that does not follow RIVET's documentation is refused with a `TypeError` (a value of the wrong kind) or a `ValueError` (a wrong count, an index out of range), the message naming the line:
141
+
142
+ ```python
143
+ # RIVET's FIRep example: the boundary of a triangle present from (0, 0),
144
+ # filled in at (1, 0) and at (0, 1).
145
+ text = """--datatype firep
146
+ 2 3 3
147
+ 1 0 ; 0 1 2
148
+ 0 1 ; 0 1 2
149
+ 0 0 ; 1 2
150
+ 0 0 ; 0 2
151
+ 0 0 ; 0 1
152
+ """
153
+ r = tda.parse_rivet_input(text)
154
+ print(r.datatype, r.firep.low_rank) # firep 3
155
+
156
+ q = tda.rivet_presentation(text, degree=1)
157
+ print(tda.bigraded_betti(q).b1.tolist()) # [[1.0, 0.0], [0.0, 1.0]]
158
+ print(tda.bigraded_betti(q).b2.tolist()) # [[1.0, 1.0]]
159
+ print(tda.rivet_presentation(text).degree) # 0
160
+ print(tda.rivet_presentation("--homology 1\n" + text).degree) # 1
161
+ ```
162
+
163
+ For barcodes along many lines, `topolab_tda.experimental.augmented_arrangement` builds RIVET's augmented arrangement once; its `fibered_barcode` gives the same arrays as `fibered_barcode(presentation, lines)`. It holds native memory until the `with` block ends (or `dispose()`); the barcodes it gives are copies:
164
+
165
+ ```python
166
+ from topolab_tda import experimental
167
+
168
+ # Twelve points on a ring, with function values 0, 1, 2 in turn.
169
+ ring = [[0, 2], [1, 1.7], [1.7, 1], [2, 0], [1.7, -1], [1, -1.7],
170
+ [0, -2], [-1, -1.7], [-1.7, -1], [-2, 0], [-1.7, 1], [-1, 1.7]]
171
+ p = tda.function_rips_presentation(ring, [i % 3 for i in range(12)])
172
+ lines = [{"point": (0, 0), "angle": 30}, {"point": (1, 0), "angle": 90}, {"point": (0, 2), "angle": 0}]
173
+ with experimental.augmented_arrangement(p) as a:
174
+ print(a.anchors.shape, a.cells, a.templates) # (6, 2) 9 6
175
+ from_cells = [b.pairs.tolist() for b in a.fibered_barcode(lines)]
176
+ print(from_cells == [b.pairs.tolist() for b in tda.fibered_barcode(p, lines)]) # True
177
+ ```
178
+
179
+ `anchors` is a `(k, 2)` array of grades, the least upper bounds of two incomparable grades whose order along a line decides the barcode. The number of cells grows with the square of the number of anchors: coarsen a large module first (`coarsen_presentation`).
180
+
181
+ ## Documentation
182
+
183
+ - [Documentation](https://topolab.ai/tda/docs/)
184
+ - [Getting started](https://topolab.ai/tda/docs/getting-started/?lang=python), in Python
185
+ - [API reference](https://topolab.ai/tda/docs/api/?lang=python), in Python
186
+ - [Guides](https://topolab.ai/tda/docs/guides/alpha-complex/), each example in JavaScript and in Python
187
+ - [References](https://topolab.ai/tda/docs/references/)
188
+
189
+ Each function's docstring gives its parameters, its result, its refusals and the papers it follows.
190
+
191
+ ## Security
192
+
193
+ Please report security issues privately, not in a public issue, by email to security@topolab.ai.
194
+
195
+ ## Licence
196
+
197
+ `MIT AND BSL-1.0`. topolab's code is MIT, "Copyright (c) 2026 topolab", and the full text is the `LICENSE` file in the package. The network simplex behind `diagram_wasserstein` and `diagram_bottleneck` is derived from LEMON, under the Boost Software License 1.0. The notices of the third-party code the compiled module contains are in `THIRD_PARTY_LICENSES.md` in the package and at [topolab.ai/licenses/](https://topolab.ai/licenses/).
198
+
@@ -0,0 +1,168 @@
1
+ # topolab-tda
2
+
3
+ topolab TDA is topological data analysis in Rust. It builds a filtered complex from points or from an image, computes its persistent homology, and compares or summarises the diagrams. This package calls the Rust engine directly; it is the same code, the same functions and the same options as the npm package `@topolab/tda`, with NumPy arrays in and out.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install topolab-tda
9
+ ```
10
+
11
+ It needs Python 3.10 or later and NumPy 1.23 or later, its only dependency. One wheel per platform serves every CPython from 3.10 on. Where no wheel fits, pip builds the package from its source distribution, which needs a Rust toolchain (1.85 or later).
12
+
13
+ | | Needs | Tested |
14
+ |---|---|---|
15
+ | Python | 3.10 or later | 3.10 (NumPy 1.23.5) and 3.14 (NumPy 2.5.5) |
16
+ | Operating systems | none beyond the above | macOS (arm64); **not** Linux, Windows or macOS x86-64 |
17
+
18
+ ## First computation
19
+
20
+ ```python
21
+ import topolab_tda as tda
22
+
23
+ # The corners of a unit square. The four components merge as the edges
24
+ # appear at distance 1; the loop they close is created then and is filled at
25
+ # the diagonal, 2^(1/2).
26
+ points = [[0, 0], [1, 0], [1, 1], [0, 1]]
27
+ diagram = tda.rips_persistence(points, max_dim=1)
28
+
29
+ print(diagram.scale) # edge_length
30
+ print(diagram.pairs[0].tolist()) # [[0.0, 1.0], [0.0, 1.0], [0.0, 1.0], [0.0, inf]]
31
+ print(diagram.pairs[1].tolist()) # [[1.0, 1.4142135623730951]]
32
+ ```
33
+
34
+ `pairs[k]` is an `(n, 2)` float64 array of `(birth, death)` rows for the homology of dimension `k`. A death of `inf` means the class still persists at the end of the computed filtration; with a finite cutoff, it may be destroyed at a larger scale. The comment after each `print` is what it prints. Rips values are edge lengths, twice the radius of the balls (see [Filtrations and scales](https://topolab.ai/tda/docs/concepts/filtrations-and-scales/)).
35
+
36
+ ## Conventions
37
+
38
+ - A point cloud is an `(n, d)` array, or anything `numpy.asarray` reads as one, or a `PointCloud`; a distance matrix is a `DistanceMatrix`. An image or a volume is an array in NumPy's order. Input is converted to float64 once.
39
+ - Options are keyword-only arguments with the npm package's defaults: `rips_persistence(points, max_dim=2, coeff=3)`.
40
+ - Results are frozen dataclasses of NumPy arrays, numbers and strings, with the npm package's fields in snake_case. A complex is `Complex` (`vertices`, `offsets`, `filtrations`, `scale`), a diagram `Diagram` (`pairs`, `scale`, `coeff`).
41
+ - Errors:
42
+ - a wrong type is a `TypeError`;
43
+ - a value out of range, NaN where none is accepted, or an input over one of the documented size limits is a `ValueError` whose message names the parameter (a size limit's message starts with `input too large:`);
44
+ - a request the package can tell is too large before it allocates is a `MemoryError`: a size that overflows a buffer's capacity, and a list of zigzag operation objects whose packed copy would pass the 1 GiB conversion budget (pass a `PackedZigzag` instead); these are the npm package's `TOO_LARGE` refusals;
45
+ - a failure inside an engine is a `RuntimeError`;
46
+ - only an allocation that the operating system refuses in the middle of a computation ends the Python process: native Rust code cannot turn that into an exception.
47
+ - The engines release the GIL: calls in several threads run at once.
48
+
49
+ ## What it computes
50
+
51
+ | Feature | Functions | Status |
52
+ |---|---|---|
53
+ | Alpha complex, unweighted or weighted (points in 3D) | `alpha_complex`, `alpha_persistence` | Stable |
54
+ | Rips complex, persistence and representatives | `rips_complex`, `rips_persistence` | Experimental |
55
+ | Čech and Delaunay–Čech complexes | `cech_complex`, `cech_persistence`, `delaunay_cech_complex` | Stable |
56
+ | Euclidean (weak) witness complex | `witness_complex` | Experimental |
57
+ | Cubical complexes of images and volumes, T- and V-constructions | `cubical_complex`, `cubical_persistence` | Stable (V-construction experimental) |
58
+ | Ellipsoid complex (Rips-type, a flag complex) | `ellipsoids`, `ellipsoid_rips_complex`, `ellipsoid_rips_persistence` | Experimental |
59
+ | Ellipsoidal Čech complex (a nerve) | `ellipsoid_cech_complex`, `ellipsoid_cech_persistence` | Experimental |
60
+ | Wing complex (2D, a flag complex) | `wings`, `wing_complex`, `wing_persistence` | Experimental |
61
+ | Box filtration (2D and 3D) | `box_filtration`, `box_filtration_persistence` | Experimental |
62
+ | k-fold cover complex (multicover, fixed k) | `k_fold_cover_complex`, `k_fold_cover_persistence` | Stable |
63
+ | Coupled alpha complex (2D) | `coupled_alpha_complex` | Experimental |
64
+ | Persistent homology of any explicit complex | `persistence` | Stable |
65
+ | Zigzag persistence | `zigzag_persistence`, `insert_op`, `remove_op` | Stable |
66
+ | Vineyards: the classes of a diagram followed through a homotopy of the values, of images and of moving point clouds | `vineyard`, `cubical_vineyard`, `rips_vineyard` | Stable |
67
+ | Commutative ladders CL(n): decomposition for n ≤ 4, interval approximation for any n | `topolab_tda.ladder` | Experimental |
68
+ | Bottleneck and Wasserstein distances, exact, with the matching | `diagram_bottleneck`, `diagram_wasserstein` | Stable |
69
+ | Betti numbers and curves, persistence landscapes, persistence images | `betti_numbers`, `betti_curve`, `persistence_landscape`, `persistence_image` | Experimental |
70
+ | Volume-optimal cycles ((n−1)-homology in Rⁿ) | `volume_optimal_cycles` | Experimental |
71
+ | Two-parameter persistence over Z/2: minimal presentations of function-Rips, degree-Rips and any bifiltration (one grade a cell or several) or FIRep, bigraded Betti numbers and the Hilbert function, barcodes along lines, coarsening onto RIVET's grid, RIVET's input files | `function_rips_presentation`, `degree_rips_presentation`, `bifiltration_presentation`, `firep_presentation`, `bigraded_betti`, `fibered_barcode`, `coarsen_presentation`, `parse_rivet_input`, `rivet_presentation` | Experimental |
72
+ | Prepared complexes | `prepare_complex` (`topolab_tda.experimental`) | Experimental |
73
+ | Augmented arrangement (barcodes along many lines of a two-parameter module) | `augmented_arrangement` (`topolab_tda.experimental`) | Experimental |
74
+
75
+ Persistence takes coefficients in Z/p for every prime p up to 2^31 − 1 (default 2); zigzag and two-parameter persistence are over Z/2. The labels are the npm package's: a stable function is tested against the independent references named in [Numerical contracts](https://topolab.ai/tda/docs/concepts/numerical-contracts/) and kept; an experimental one can change its options, defaults or result shape in any release. A 0.x version promises no compatibility under semantic versioning.
76
+
77
+ ## Two-parameter persistence
78
+
79
+ A two-parameter module is carried by its minimal presentation. `function_rips_presentation`, `degree_rips_presentation`, `bifiltration_presentation` and `firep_presentation` compute one (in `degree=1` by default), `bigraded_betti` and `fibered_barcode` read it:
80
+
81
+ ```python
82
+ import topolab_tda as tda
83
+
84
+ # Four corners of a unit square, and its centre with a larger function value.
85
+ points = [[0, 0], [1, 0], [1, 1], [0, 1], [0.5, 0.5]]
86
+ values = [0, 0, 0, 0, 1]
87
+ p = tda.function_rips_presentation(points, values)
88
+
89
+ print(p.degree) # 1
90
+ print(p.xs.tolist(), p.ys.tolist()) # [0.0, 1.0] [1.0, 1.4142135623730951]
91
+ print(p.generators.tolist()) # [[0, 0]]
92
+ print(p.relations.tolist()) # [[1, 0], [0, 1]]
93
+
94
+ # H1: the square's loop is created at (value 0, distance 1), and filled in
95
+ # at (1, 1) through the centre and at (0, 2^(1/2)) by the diagonals.
96
+ b = tda.bigraded_betti(p)
97
+ print(b.b0.tolist()) # [[0.0, 1.0]]
98
+ print(b.b1.tolist()) # [[1.0, 1.0], [0.0, 1.4142135623730951]]
99
+ print(b.hilbert.tolist()) # [[1, 0], [0, 0]]
100
+
101
+ # Up the line at value 0, the loop persists from distance 1 until 2^(1/2).
102
+ bar = tda.fibered_barcode(p, {"point": (0, 0), "angle": 90})
103
+ print(bar.pairs.tolist()) # [[1.0, 1.4142135623730951]]
104
+ print(bar.point, bar.direction) # (0.0, 0.0) (0.0, 1.0)
105
+ ```
106
+
107
+ - A `Presentation` holds `xs` and `ys`, the distinct coordinates of the grades, increasing; `generators` and `relations`, `(n, 2)` arrays of `(x index, y index)` into them; `offsets` and `rows` (relation `j` is the sum of the generators `rows[offsets[j]:offsets[j + 1]]`); and `degree`.
108
+ - `bigraded_betti` gives `b0`, `b1` and `b2`, the grades of the generators, of the relations and of the relations among relations, as `(n, 2)` float64 arrays with multiplicity, and `hilbert`, a `(len(ys), len(xs))` array: `hilbert[iy, ix]` is the dimension of the module at `(xs[ix], ys[iy])`, and up to the next grid line on either axis.
109
+ - `fibered_barcode` takes a line as a dict or a `SliceLine` with `point` and either `direction` (non-negative, not zero) or `angle` (degrees from the first axis, 0 to 90), or a list of lines, and gives a `FiberedBarcode` (a list for a list): `pairs`, an `(n, 2)` array of `(birth, death)` in the line's parameter `t`, the point of the line at `t` being `point + t * direction`; `point` and `direction`, the line the engine built, `direction` a unit vector. The Rust crate builds the line, so the barcode is the npm package's, bit for bit.
110
+
111
+ `rivet_presentation` takes the text of a RIVET input file and gives the module RIVET builds from it. Its `degree` defaults to the file's `--homology`, and to 0 without it, as in RIVET, where the other presentation functions default to 1; a `degree` given overrides the file, as RIVET's `-H` does. `--xbins` and `--ybins` in the file coarsen the module as RIVET does. `parse_rivet_input` gives the file's data, as a `RivetInput`; a file that does not follow RIVET's documentation is refused with a `TypeError` (a value of the wrong kind) or a `ValueError` (a wrong count, an index out of range), the message naming the line:
112
+
113
+ ```python
114
+ # RIVET's FIRep example: the boundary of a triangle present from (0, 0),
115
+ # filled in at (1, 0) and at (0, 1).
116
+ text = """--datatype firep
117
+ 2 3 3
118
+ 1 0 ; 0 1 2
119
+ 0 1 ; 0 1 2
120
+ 0 0 ; 1 2
121
+ 0 0 ; 0 2
122
+ 0 0 ; 0 1
123
+ """
124
+ r = tda.parse_rivet_input(text)
125
+ print(r.datatype, r.firep.low_rank) # firep 3
126
+
127
+ q = tda.rivet_presentation(text, degree=1)
128
+ print(tda.bigraded_betti(q).b1.tolist()) # [[1.0, 0.0], [0.0, 1.0]]
129
+ print(tda.bigraded_betti(q).b2.tolist()) # [[1.0, 1.0]]
130
+ print(tda.rivet_presentation(text).degree) # 0
131
+ print(tda.rivet_presentation("--homology 1\n" + text).degree) # 1
132
+ ```
133
+
134
+ For barcodes along many lines, `topolab_tda.experimental.augmented_arrangement` builds RIVET's augmented arrangement once; its `fibered_barcode` gives the same arrays as `fibered_barcode(presentation, lines)`. It holds native memory until the `with` block ends (or `dispose()`); the barcodes it gives are copies:
135
+
136
+ ```python
137
+ from topolab_tda import experimental
138
+
139
+ # Twelve points on a ring, with function values 0, 1, 2 in turn.
140
+ ring = [[0, 2], [1, 1.7], [1.7, 1], [2, 0], [1.7, -1], [1, -1.7],
141
+ [0, -2], [-1, -1.7], [-1.7, -1], [-2, 0], [-1.7, 1], [-1, 1.7]]
142
+ p = tda.function_rips_presentation(ring, [i % 3 for i in range(12)])
143
+ lines = [{"point": (0, 0), "angle": 30}, {"point": (1, 0), "angle": 90}, {"point": (0, 2), "angle": 0}]
144
+ with experimental.augmented_arrangement(p) as a:
145
+ print(a.anchors.shape, a.cells, a.templates) # (6, 2) 9 6
146
+ from_cells = [b.pairs.tolist() for b in a.fibered_barcode(lines)]
147
+ print(from_cells == [b.pairs.tolist() for b in tda.fibered_barcode(p, lines)]) # True
148
+ ```
149
+
150
+ `anchors` is a `(k, 2)` array of grades, the least upper bounds of two incomparable grades whose order along a line decides the barcode. The number of cells grows with the square of the number of anchors: coarsen a large module first (`coarsen_presentation`).
151
+
152
+ ## Documentation
153
+
154
+ - [Documentation](https://topolab.ai/tda/docs/)
155
+ - [Getting started](https://topolab.ai/tda/docs/getting-started/?lang=python), in Python
156
+ - [API reference](https://topolab.ai/tda/docs/api/?lang=python), in Python
157
+ - [Guides](https://topolab.ai/tda/docs/guides/alpha-complex/), each example in JavaScript and in Python
158
+ - [References](https://topolab.ai/tda/docs/references/)
159
+
160
+ Each function's docstring gives its parameters, its result, its refusals and the papers it follows.
161
+
162
+ ## Security
163
+
164
+ Please report security issues privately, not in a public issue, by email to security@topolab.ai.
165
+
166
+ ## Licence
167
+
168
+ `MIT AND BSL-1.0`. topolab's code is MIT, "Copyright (c) 2026 topolab", and the full text is the `LICENSE` file in the package. The network simplex behind `diagram_wasserstein` and `diagram_bottleneck` is derived from LEMON, under the Boost Software License 1.0. The notices of the third-party code the compiled module contains are in `THIRD_PARTY_LICENSES.md` in the package and at [topolab.ai/licenses/](https://topolab.ai/licenses/).