@topolab/tda 0.0.0-stage → 0.3.0

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 (90) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/CITATION.cff +72 -0
  3. package/LICENSE +21 -0
  4. package/README.md +100 -2
  5. package/SECURITY.md +34 -0
  6. package/THIRD_PARTY_LICENSES.md +696 -0
  7. package/dist/build_info.json +12 -0
  8. package/dist/check.d.ts +118 -0
  9. package/dist/check.d.ts.map +1 -0
  10. package/dist/check.js +298 -0
  11. package/dist/check.js.map +1 -0
  12. package/dist/complex.d.ts +543 -0
  13. package/dist/complex.d.ts.map +1 -0
  14. package/dist/complex.js +712 -0
  15. package/dist/complex.js.map +1 -0
  16. package/dist/diagram.d.ts +116 -0
  17. package/dist/diagram.d.ts.map +1 -0
  18. package/dist/diagram.js +238 -0
  19. package/dist/diagram.js.map +1 -0
  20. package/dist/diagram_of.d.ts +17 -0
  21. package/dist/diagram_of.d.ts.map +1 -0
  22. package/dist/diagram_of.js +40 -0
  23. package/dist/diagram_of.js.map +1 -0
  24. package/dist/experimental.d.ts +14 -0
  25. package/dist/experimental.d.ts.map +1 -0
  26. package/dist/experimental.js +13 -0
  27. package/dist/experimental.js.map +1 -0
  28. package/dist/flat.d.ts +64 -0
  29. package/dist/flat.d.ts.map +1 -0
  30. package/dist/flat.js +158 -0
  31. package/dist/flat.js.map +1 -0
  32. package/dist/index.d.ts +38 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +29 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/ladder/tda_ladder.d.ts +223 -0
  37. package/dist/ladder/tda_ladder.js +1360 -0
  38. package/dist/ladder/tda_ladder_bg.wasm +0 -0
  39. package/dist/ladder/tda_ladder_bg.wasm.d.ts +43 -0
  40. package/dist/ladder.d.ts +306 -0
  41. package/dist/ladder.d.ts.map +1 -0
  42. package/dist/ladder.js +607 -0
  43. package/dist/ladder.js.map +1 -0
  44. package/dist/load.d.ts +53 -0
  45. package/dist/load.d.ts.map +1 -0
  46. package/dist/load.js +173 -0
  47. package/dist/load.js.map +1 -0
  48. package/dist/memory.d.ts +58 -0
  49. package/dist/memory.d.ts.map +1 -0
  50. package/dist/memory.js +2 -0
  51. package/dist/memory.js.map +1 -0
  52. package/dist/persistence.d.ts +349 -0
  53. package/dist/persistence.d.ts.map +1 -0
  54. package/dist/persistence.js +478 -0
  55. package/dist/persistence.js.map +1 -0
  56. package/dist/pkg/tda_wasm.d.ts +13 -0
  57. package/dist/pkg/tda_wasm.js +1900 -0
  58. package/dist/prepared.d.ts +62 -0
  59. package/dist/prepared.d.ts.map +1 -0
  60. package/dist/prepared.js +81 -0
  61. package/dist/prepared.js.map +1 -0
  62. package/dist/source.d.ts +43 -0
  63. package/dist/source.d.ts.map +1 -0
  64. package/dist/source.js +99 -0
  65. package/dist/source.js.map +1 -0
  66. package/dist/tda.wasm +0 -0
  67. package/dist/types.d.ts +146 -0
  68. package/dist/types.d.ts.map +1 -0
  69. package/dist/types.js +2 -0
  70. package/dist/types.js.map +1 -0
  71. package/dist/vineyard.d.ts +278 -0
  72. package/dist/vineyard.d.ts.map +1 -0
  73. package/dist/vineyard.js +236 -0
  74. package/dist/vineyard.js.map +1 -0
  75. package/package.json +77 -4
  76. package/src/check.ts +338 -0
  77. package/src/complex.ts +1179 -0
  78. package/src/diagram.ts +299 -0
  79. package/src/diagram_of.ts +40 -0
  80. package/src/experimental.ts +13 -0
  81. package/src/flat.ts +204 -0
  82. package/src/index.ts +155 -0
  83. package/src/ladder.ts +903 -0
  84. package/src/load.ts +201 -0
  85. package/src/memory.ts +58 -0
  86. package/src/persistence.ts +752 -0
  87. package/src/prepared.ts +111 -0
  88. package/src/source.ts +132 -0
  89. package/src/types.ts +163 -0
  90. package/src/vineyard.ts +463 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,82 @@
1
+ # Changelog
2
+
3
+ Every user-visible change to `@topolab/tda` is listed here. The format
4
+ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions
5
+ follow [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ### Added
10
+
11
+ - **Vineyards over `Z/p`.** `vineyard`, `cubicalVineyard` and `ripsVineyard`
12
+ now take `coeff` (any prime `p` from 2 to 2^31 − 1, default 2), matching
13
+ `persistence`. The result's `coeff` field reports the prime used (type
14
+ `number`).
15
+ - **Vineyard representative cycles.** `vineyard`, `cubicalVineyard` and
16
+ `ripsVineyard` now take `representatives: { times, dims? }` to extract one
17
+ representative cycle per persisting vine at each requested time in
18
+ `[0, frames − 1]` over `Z/coeff`, returned as flat typed arrays in
19
+ `representatives` (`times`, `vines`, `dims`, `births`, `deaths`, `offsets`,
20
+ `cells`, `coefficients` in `(−coeff/2, coeff/2]`; types
21
+ `VineyardRepresentatives` and `VineyardRepresentativesOptions`).
22
+
23
+ ### Changed
24
+
25
+ - **Vineyards are Stable.** `vineyard`, `cubicalVineyard` and `ripsVineyard`
26
+ are now marked Stable, checked against GUDHI 3.12 (`SimplexTree`,
27
+ `CubicalComplex` and `RipsComplex`) on 30 seeded inputs over `Z/2` and
28
+ `Z/3` at every frame and at interpolated times between frames
29
+ (`test/vineyard_gudhi.test.mjs`, live via `scripts/check_python_oracles.py`).
30
+
31
+ ## [0.3.0] — first public release
32
+
33
+ ### Added
34
+
35
+ - **Entry points.** `@topolab/tda` (the root), `@topolab/tda/ladder`
36
+ (commutative ladders, a WebAssembly module of its own, experimental as a
37
+ whole) and `@topolab/tda/experimental` (`prepareComplex`), plus the
38
+ binaries `@topolab/tda/tda.wasm` and `@topolab/tda/ladder.wasm`
39
+ for `load(source)`, and `@topolab/tda/package.json`.
40
+ - **Loading.** `load`, `unload`, `isLoaded` and `version` on the root and on
41
+ `./ladder`; the functions that need the module throw until `load()` resolves.
42
+ - **Complexes.** Rips, Čech, Delaunay–Čech, alpha (weighted or unweighted),
43
+ coupled alpha (2D), weak witness, k-fold cover, ellipsoid (Rips-type and
44
+ Čech), wing, box and cubical complexes. `cechPersistence`,
45
+ `alphaPersistence`, `kFoldCoverPersistence`, `ellipsoidRipsPersistence`,
46
+ `ellipsoidCechPersistence`, `wingPersistence` and
47
+ `boxFiltrationPersistence` build the complex and reduce it in one call.
48
+ - **Persistence.** `persistence` of any explicit complex, `ripsPersistence`
49
+ (with cycle or cocycle representatives), `cubicalPersistence`,
50
+ `zigzagPersistence` with `insertOp` and `removeOp`, and
51
+ `volumeOptimalCycles`. The `coeff` option takes any prime `p` up to
52
+ 2^31 − 1 (`Z/p`); zigzag persistence is over Z/2.
53
+ - **Vineyards.** `vineyard(complex, frames)` follows persistence classes
54
+ through a straight-line homotopy of values on a single complex over Z/2,
55
+ using the transposition update of Cohen-Steiner, Edelsbrunner, and Morozov
56
+ (SoCG 2006), and returns vines as typed arrays of knots. `cubicalVineyard`
57
+ follows the cubical diagrams of a sequence of images or volumes of the
58
+ same shape, and `ripsVineyard` follows the Rips diagrams of a moving point
59
+ cloud, each building one shared complex and assigning its values at every
60
+ frame. Experimental.
61
+ - **Diagrams.** `bettiNumbers`, `bettiCurve`, `persistenceLandscape`,
62
+ `persistenceImage`, and the exact `diagramBottleneck` and
63
+ `diagramWasserstein`.
64
+ - **Data.** Point clouds `{ coords, d }` (`pointCloud` converts nested
65
+ arrays), images `{ values, shape }` in NumPy's axis order, complexes as
66
+ typed arrays (`flatten`, `materialize`). Every result is plain data with no
67
+ memory inside WebAssembly, except the handle of the experimental
68
+ `prepareComplex`.
69
+ - **Errors.** `TypeError` or `RangeError` naming the parameter for a bad
70
+ argument, and a `TypeError` naming the function and the key for an option
71
+ the function does not take; `RangeError` with the engine's message for an
72
+ input an engine refuses, and with a message that starts with
73
+ `input too large:` for an input over a fixed size limit; `Error` for a
74
+ failure inside an engine or a call before `load()`. Every entry of an array
75
+ of numbers must be a number; typed arrays made in another realm are
76
+ accepted. An input too large for the module's memory is a `RangeError` with
77
+ `code: 'TOO_LARGE'` and a `details` object (types `CapacityError`,
78
+ `CapacityDetails`); the instance is replaced before the error is thrown, so
79
+ the next call needs no `load()`.
80
+ - **Runtimes.** ES modules only, no runtime dependencies. Node.js 22 or later,
81
+ or a browser with WebAssembly SIMD, bulk memory and reference types.
82
+ - **Licence.** MIT (LICENSE); third-party notices in THIRD_PARTY_LICENSES.md.
package/CITATION.cff ADDED
@@ -0,0 +1,72 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below. For the algorithms it implements and the software it vendors, see https://topolab.ai/tda/docs/references/."
3
+ type: software
4
+ title: "topolab TDA"
5
+ abstract: "Topological data analysis for the browser and Node.js, in Rust compiled to WebAssembly, as the package @topolab/tda."
6
+ version: "0.3.0"
7
+ license: MIT
8
+ url: "https://topolab.ai/tda/docs/"
9
+ authors:
10
+ - name: "topolab"
11
+ email: "dev@topolab.ai"
12
+ website: "https://topolab.ai"
13
+ references:
14
+ - type: article
15
+ title: "Ripser: efficient computation of Vietoris–Rips persistence barcodes"
16
+ authors:
17
+ - family-names: "Bauer"
18
+ given-names: "Ulrich"
19
+ journal: "Journal of Applied and Computational Topology"
20
+ volume: 5
21
+ start: "391"
22
+ end: "423"
23
+ year: 2021
24
+ url: "https://github.com/Ripser/ripser"
25
+ notes: "The Rust core's Rips persistence is written from this paper."
26
+ - type: article
27
+ title: "Geometry Helps to Compare Persistence Diagrams"
28
+ authors:
29
+ - family-names: "Kerber"
30
+ given-names: "Michael"
31
+ - family-names: "Morozov"
32
+ given-names: "Dmitriy"
33
+ - family-names: "Nigmetov"
34
+ given-names: "Arnur"
35
+ journal: "ACM Journal of Experimental Algorithmics"
36
+ volume: 22
37
+ year: 2017
38
+ url: "https://github.com/anigmetov/hera"
39
+ notes: "The bottleneck distance follows this paper."
40
+ - type: software
41
+ title: "LEMON"
42
+ authors:
43
+ - name: "Egerváry Research Group on Combinatorial Optimization (EGRES)"
44
+ license: "BSL-1.0"
45
+ version: "1.3.1"
46
+ url: "https://lemon.cs.elte.hu/"
47
+ notes: "The network simplex pivot of the exact Wasserstein distance is a Rust translation of parts of lemon/network_simplex.h (class NetworkSimplex), Copyright (C) 2003-2013 EGRES; the notice and licence text are in THIRD_PARTY_LICENSES.md."
48
+ - type: software
49
+ title: "Geogram (Delaunay PSM)"
50
+ authors:
51
+ - family-names: "Lévy"
52
+ given-names: "Bruno"
53
+ license: "BSD-3-Clause"
54
+ url: "https://github.com/BrunoLevy/geogram.psm.Delaunay"
55
+ notes: "The Rust triangulations behind the weighted alpha, Delaunay–Čech and k-fold cover builders follow its conventions (insertion semantics and the 3D symbolic perturbation). The PSM sources carry Copyright (c) 2000-2022 Inria; the repository's LICENSE reads Copyright (c) 2022, Bruno Levy."
56
+ - type: conference-paper
57
+ title: "The Gudhi Library: Simplicial Complexes and Persistent Homology"
58
+ authors:
59
+ - family-names: "Maria"
60
+ given-names: "Clément"
61
+ - family-names: "Boissonnat"
62
+ given-names: "Jean-Daniel"
63
+ - family-names: "Glisse"
64
+ given-names: "Marc"
65
+ - family-names: "Yvinec"
66
+ given-names: "Mariette"
67
+ collection-title: "Mathematical Software – ICMS 2014"
68
+ publisher:
69
+ name: "Springer"
70
+ year: 2014
71
+ url: "https://gudhi.inria.fr/"
72
+ notes: "MIT. The farthest-point subsampling of the witness complex is an edited port of GUDHI 3.11.0's choose_n_farthest_points (Copyright (C) 2016 Inria; notice in THIRD_PARTY_LICENSES.md), and the enclosing-ball value rule of the Čech builders is the rule of its MEB_filtration.h."
package/LICENSE ADDED
@@ -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.
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # @topolab/tda
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ topolab TDA is topological data analysis for the browser and Node.js, in Rust compiled to WebAssembly. It builds a filtered complex from points or from an image, computes its persistent homology, and compares or summarises the diagrams. Everything runs on the caller's machine, with no runtime dependency and nothing native to install.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @topolab/tda
9
+ ```
10
+
11
+ The package is ES-module only and has no runtime dependencies. It needs Node.js 22 or later, or a browser with WebAssembly SIMD, bulk memory and reference types. The WebAssembly module, `tda.wasm`, about 1.8 MB (about 0.7 MB gzipped), is part of the package.
12
+
13
+ | | Needs | Tested |
14
+ |---|---|---|
15
+ | Node.js | 22 or later | 22 and 24 |
16
+ | Browsers | WebAssembly SIMD, bulk memory and reference types: Chrome 96, Firefox 89, Safari 16.4 or later by the feature list | current Chrome, Edge, Firefox and WebKit (Playwright), macOS Safari and Safari in the iOS 27.1 Simulator, direct and bundled by Vite, esbuild and webpack |
17
+ | Operating systems | none beyond the above | macOS (arm64) and a Linux container; **not** Windows, native Linux x86-64, Android or a physical iPhone or iPad |
18
+
19
+ The minimum browser versions come from the WebAssembly features the module uses, not from running those versions. Compiling WebAssembly needs `wasm-unsafe-eval` in `script-src`.
20
+
21
+ ### Loading the WebAssembly module
22
+
23
+ Call `await load()` once per thread before the functions that need the module; until it resolves they throw `Error('@topolab/tda is not loaded: await load() first')`. `unload()` drops the module so that its memory can be reclaimed, `isLoaded()` says whether it is loaded, and `version()` gives the version it was built as. `load()` without an argument reads the binary next to the package's code, `new URL('./tda.wasm', import.meta.url)`:
24
+
25
+ - **Node** reads the file with `fs`.
26
+ - **A bundler** that understands `new URL(…, import.meta.url)` emits `tda.wasm` as an asset and rewrites the URL; the browser then fetches it. Vite 8 and webpack 5 do. esbuild does not: it leaves the expression as it is, and `import.meta.url` is then the bundle's own URL, so copy the package's `dist/tda.wasm` next to the bundle (and, if you use `./ladder`, its `dist/ladder/tda_ladder_bg.wasm` into a `ladder` folder there), or pass `load` a URL.
27
+ - **Otherwise** serve `@topolab/tda/tda.wasm` yourself and pass its URL, or pass the bytes, a `Response` (or a promise of one) or a compiled `WebAssembly.Module`: `await load('/assets/tda.wasm')`, `await load(fetch(url))`, `await load(bytes)`.
28
+
29
+ Every call is synchronous and the module is single-threaded, so a long computation on the main thread freezes the page. In a Web Worker, await `load()` in the worker inside the `try` of its message handler, so that a failed load is posted back too, and post results back: they are plain data. See [Threads and workers](https://topolab.ai/tda/docs/concepts/threads-and-workers/).
30
+
31
+ ## First computation
32
+
33
+ Save as `quickstart.mjs` in a project that has the package installed and run `node quickstart.mjs`.
34
+
35
+ ```js
36
+ import { load, pointCloud, ripsPersistence } from '@topolab/tda';
37
+
38
+ await load(); // once, before the first call
39
+
40
+ // The corners of a unit square. The four components merge as the edges
41
+ // appear at distance 1; the loop they close is created then and is filled at
42
+ // the diagonal, 2^(1/2).
43
+ const points = pointCloud([[0, 0], [1, 0], [1, 1], [0, 1]]);
44
+ const diagram = ripsPersistence(points, { maxDim: 1 });
45
+
46
+ console.log(diagram.scale); // 'edgeLength'
47
+ console.log(Array.from(diagram.pairs[0])); // [0, 1, 0, 1, 0, 1, 0, Infinity]
48
+ console.log(Array.from(diagram.pairs[1])); // [1, 1.4142135623730951]
49
+ ```
50
+
51
+ `pairs[k]` is a flat array `[birth, death, birth, death, …]` for the homology of dimension `k`. A death of `Infinity` 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 `console.log` is the value it prints, written as JavaScript. Rips values are edge lengths, twice the radius of the balls (see [Filtrations and scales](https://topolab.ai/tda/docs/concepts/filtrations-and-scales/)).
52
+
53
+ ## What it computes
54
+
55
+ | Feature | Functions | Status |
56
+ |---|---|---|
57
+ | Alpha complex, unweighted or weighted (points in 3D) | `alphaComplex`, `alphaPersistence` | Stable |
58
+ | Rips complex, persistence and representatives | `ripsComplex`, `ripsPersistence` | Experimental |
59
+ | Čech and Delaunay–Čech complexes | `cechComplex`, `cechPersistence`, `delaunayCechComplex` | Stable |
60
+ | Euclidean (weak) witness complex | `witnessComplex` | Experimental |
61
+ | Cubical complexes of images and volumes, T- and V-constructions | `cubicalComplex`, `cubicalPersistence` | Stable (V-construction experimental) |
62
+ | Ellipsoid complex (Rips-type, a flag complex) | `ellipsoids`, `ellipsoidRipsComplex`, `ellipsoidRipsPersistence` | Experimental |
63
+ | Ellipsoidal Čech complex (a nerve) | `ellipsoidCechComplex`, `ellipsoidCechPersistence` | Experimental |
64
+ | Wing complex (2D, a flag complex) | `wings`, `wingComplex`, `wingPersistence` | Experimental |
65
+ | Box filtration (2D and 3D) | `boxFiltration`, `boxFiltrationPersistence` | Experimental |
66
+ | k-fold cover complex (multicover, fixed k) | `kFoldCoverComplex`, `kFoldCoverPersistence` | Stable |
67
+ | Coupled alpha complex (2D) | `coupledAlphaComplex` | Experimental |
68
+ | Persistent homology of any explicit complex | `persistence` | Stable |
69
+ | Zigzag persistence | `zigzagPersistence`, `insertOp`, `removeOp` | Stable |
70
+ | Vineyards: the classes of a diagram followed through a homotopy of the values, of images and of moving point clouds | `vineyard`, `cubicalVineyard`, `ripsVineyard` | Stable |
71
+ | Commutative ladders CL(n): decomposition for n ≤ 4, interval approximation for any n | `@topolab/tda/ladder` | Experimental |
72
+ | Bottleneck and Wasserstein distances, exact, with the matching | `diagramBottleneck`, `diagramWasserstein` | Stable |
73
+ | Betti numbers and curves, persistence landscapes, persistence images | `bettiNumbers`, `bettiCurve`, `persistenceLandscape`, `persistenceImage` | Experimental |
74
+ | Volume-optimal cycles ((n−1)-homology in Rⁿ) | `volumeOptimalCycles` | Experimental |
75
+ | Prepared complexes | `prepareComplex` (`@topolab/tda/experimental`) | Experimental |
76
+
77
+ Persistence takes coefficients in Z/p for every prime p up to 2^31 − 1 (default 2); zigzag persistence is over Z/2.
78
+
79
+ Each feature carries one of two labels, shown in the table above.
80
+
81
+ - **Stable**: the function is documented in the [API reference](https://topolab.ai/tda/docs/api/js/), tested against the independent references named in [Numerical contracts](https://topolab.ai/tda/docs/concepts/numerical-contracts/) (which says what each comparison covers and what it does not), and kept. Where a change alters the output of a stable function, the changelog says so.
82
+ - **Experimental**: the function works and is tested, but it promises less. Its options, defaults or result shape can change in any release, it can be removed, and its numerical contract says how far its values are checked (several are not claimed to match a reference bit for bit).
83
+
84
+ A 0.x version promises no compatibility under semantic versioning; every change that affects a caller is listed in the changelog.
85
+
86
+ ## Documentation
87
+
88
+ - [Documentation](https://topolab.ai/tda/docs/)
89
+ - [Getting started](https://topolab.ai/tda/docs/getting-started/)
90
+ - [API reference](https://topolab.ai/tda/docs/api/js/)
91
+ - [Benchmarks](https://topolab.ai/tda/docs/benchmarks/)
92
+ - [Playground](https://topolab.ai/tda/play)
93
+ - [Licences](https://topolab.ai/licenses/)
94
+
95
+ ## Security
96
+
97
+ Please report security issues privately, not in a public issue, by email to security@topolab.ai.
98
+
99
+ ## Licence
100
+
101
+ MIT, "Copyright (c) 2026 topolab". The full text is the `LICENSE` file in the package. Third-party notices are on [Licences](https://topolab.ai/tda/docs/licences/); the papers each method follows are on [References](https://topolab.ai/tda/docs/references/). The full notices and licence texts are in `THIRD_PARTY_LICENSES.md` in the package and at [topolab.ai/licenses/](https://topolab.ai/licenses/).
package/SECURITY.md ADDED
@@ -0,0 +1,34 @@
1
+ # Security
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Please report security issues privately, not in a public issue, by email to
6
+ security@topolab.ai.
7
+
8
+ Include what you ran (the input, or a script that builds it), what happened,
9
+ and the version of `@topolab/tda`. We will acknowledge the report and keep you
10
+ informed while we work on it.
11
+
12
+ ## Supported versions
13
+
14
+ The latest published version of `@topolab/tda`.
15
+
16
+ ## What counts
17
+
18
+ The package runs on the caller's machine, in the browser, a worker or Node.
19
+ Reports we treat as security issues include memory-safety faults in the
20
+ WebAssembly modules (the main module and the ladder engine, both Rust)
21
+ reachable from the public API, input that makes the wrapper or module read or write outside the data it was given, and
22
+ anything in the build that could put code into `dist/` that is not built
23
+ from the package's sources.
24
+
25
+ Inputs above the documented limits are refused with a `RangeError` (for
26
+ example a Rips complex above 2^25 simplices, refused as `input too large: …`;
27
+ see [Fixed limits](https://topolab.ai/tda/docs/concepts/limits-errors-memory/#fixed-limits));
28
+ an input that exhausts memory or time below those limits is
29
+ a bug, and a public issue is fine for it. The exact Wasserstein distance
30
+ (`diagramWasserstein`) builds a dense (n + 1) × (m + 1) transport problem of
31
+ n and m finite points; above 16,777,216 entries it is refused with a
32
+ `RangeError`, and below that it can still exhaust the memory of a small
33
+ device, which is reported as `TOO_LARGE` (see
34
+ [Errors](https://topolab.ai/tda/docs/concepts/limits-errors-memory/#errors)).