@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
@@ -0,0 +1,278 @@
1
+ import type { PointCloud, Vec } from './check.js';
2
+ import type { Complex, ComplexLike, Grid, Scale } from './types.js';
3
+ /** Which representative cycles a vineyard function returns. */
4
+ export interface VineyardRepresentativesOptions {
5
+ /**
6
+ * Times at which to extract representative cycles, each a finite number in
7
+ * `[0, number of frames − 1]`. Representatives are returned in this order.
8
+ * Every transposition with crossing time `<= t` is applied before the
9
+ * snapshot at `t` is taken (in particular, at `t = 0` on a multi-frame
10
+ * input, tied cells whose order reverses in frame 1 transpose before the
11
+ * `t = 0` snapshot, whereas a 1-frame input has no transpositions).
12
+ */
13
+ times: Vec;
14
+ /**
15
+ * Homology dimensions to return representatives for. Default: all
16
+ * dimensions present in the vineyard; `[]` returns none.
17
+ */
18
+ dims?: number[];
19
+ }
20
+ /**
21
+ * Representative cycles of a vineyard at requested times, as typed arrays.
22
+ * Representative `r` stands for vine `vines[r]` at time `times[r]` (with
23
+ * homology dimension `dims[r]`, birth `births[r]` and death `deaths[r]` at
24
+ * that time); its cycle is the linear combination of
25
+ * `cells[offsets[r] .. offsets[r + 1]]` with coefficients
26
+ * `coefficients[offsets[r] .. offsets[r + 1]]` in `(−coeff/2, coeff/2]`
27
+ * (all 1 over `Z/2`).
28
+ *
29
+ * Ordered by requested time, then by vine index.
30
+ */
31
+ export interface VineyardRepresentatives {
32
+ /** Requested time of each representative. */
33
+ times: Float64Array;
34
+ /** Vine index (`0 .. dims.length − 1` of the enclosing vineyard) of each representative. */
35
+ vines: Uint32Array;
36
+ /** Homology dimension of each representative. */
37
+ dims: Uint8Array;
38
+ /** Birth of the vine at `times[r]`. */
39
+ births: Float64Array;
40
+ /** Death of the vine at `times[r]`, `Infinity` for an essential class. */
41
+ deaths: Float64Array;
42
+ /** Length `count + 1`: representative `r` owns `offsets[r] .. offsets[r + 1]` of `cells` and `coefficients`. */
43
+ offsets: Uint32Array;
44
+ /**
45
+ * Cell indices of each cycle: simplex indices into the input complex for
46
+ * {@link vineyard}, bitmap positions for {@link cubicalVineyard}, simplex
47
+ * indices into the returned `complex` for {@link ripsVineyard}.
48
+ */
49
+ cells: Uint32Array;
50
+ /** Coefficient of each cell in `(−coeff/2, coeff/2]`; all 1 over `Z/2`. */
51
+ coefficients: Int32Array;
52
+ }
53
+ /** Options of {@link vineyard} and {@link cubicalVineyard}. */
54
+ export interface VineyardOptions {
55
+ /** The prime `p` of the coefficient field `Z/p`, from 2 to `2^31 − 1`. Default 2. */
56
+ coeff?: number;
57
+ /**
58
+ * Leave out the vines whose `death − birth` is at most `minPersistence` at
59
+ * every knot; essential vines are always kept. A finite number `>= 0`.
60
+ * Default 0: only the vines that never leave the diagonal are left out.
61
+ */
62
+ minPersistence?: number;
63
+ /**
64
+ * Also return one representative cycle per kept vine persisting at each
65
+ * requested time (`death > birth` at that time, or essential) in the
66
+ * requested dimensions. Every transposition at crossing time `<= t` is
67
+ * applied before the snapshot at `t` is taken.
68
+ */
69
+ representatives?: VineyardRepresentativesOptions;
70
+ }
71
+ /**
72
+ * The vines of a homotopy, as typed arrays. Vine `v` is one class followed
73
+ * through time: its knots are the entries `offsets[v] .. offsets[v + 1]` of
74
+ * `times`, `births`, `deaths`, `birthSimplices` and `deathSimplices`, in
75
+ * time order: its state at time 0, at every switch of the pairing that
76
+ * involves it, and at every frame. Between two consecutive knots its birth
77
+ * and death are linear in time, so the knots are the whole vine. The times
78
+ * of a vine's knots are non-decreasing, not strictly increasing: two knots
79
+ * share a time when a switch happens at time 0 or at a frame (where values
80
+ * are tied), and when two crossings are equal within rounding.
81
+ *
82
+ * The vines come by dimension, and within a dimension in the order of
83
+ * `persistence(complex)` at time 0 (the classes with a death by their death
84
+ * simplex, then the essential classes by their birth simplex).
85
+ */
86
+ export interface Vineyard {
87
+ /** The homology dimension of each vine (constant along it). */
88
+ dims: Uint8Array;
89
+ /** Length `count + 1`; vine `v` owns the knots `offsets[v] .. offsets[v + 1]`. */
90
+ offsets: Uint32Array;
91
+ /** The time of each knot: frame `m` is at time `m`. Non-decreasing along a vine; two knots may share a time. */
92
+ times: Float64Array;
93
+ /** The birth at each knot. */
94
+ births: Float64Array;
95
+ /** The death at each knot, `Infinity` for an essential class. */
96
+ deaths: Float64Array;
97
+ /** The simplex (an index into the input complex) that creates the class from each knot to the next. */
98
+ birthSimplices: Uint32Array;
99
+ /** The simplex that destroys it from each knot to the next, `-1` for an essential class. */
100
+ deathSimplices: Int32Array;
101
+ /** The number of transpositions of adjacent simplices the homotopy made. */
102
+ transpositions: number;
103
+ /** How many of them switched the pairing (each adds a knot to two vines). */
104
+ switches: number;
105
+ /** The quantity the values measure (the complex's `scale`, `'value'` when it has none). */
106
+ scale: Scale;
107
+ /** The prime `p` of the coefficient field `Z/p`. */
108
+ coeff: number;
109
+ /** Present only when `representatives` was requested. */
110
+ representatives?: VineyardRepresentatives;
111
+ }
112
+ /**
113
+ * The persistence vineyard of a filtered simplicial complex whose values
114
+ * change: `complex.filtrations` are the values at time 0, and `frames[m]`
115
+ * (one value per simplex, in the complex's order) those at time `m + 1`.
116
+ * Between two frames every value moves on a straight line, and the result
117
+ * follows every class of the persistence diagram through that homotopy over
118
+ * `Z/coeff`.
119
+ *
120
+ * The algorithm is the linear-time transposition update ([reference](https://topolab.ai/tda/docs/references/#cohen-steiner-edelsbrunner-and-morozov-2006)): the
121
+ * matrix decomposition behind `persistence` is computed once, at time 0,
122
+ * and repaired in time linear in the number of simplices each time two
123
+ * simplices adjacent in the filtration order exchange their places, instead
124
+ * of being recomputed.
125
+ *
126
+ * The complex must be closed, and monotone at time 0 and at every frame (no
127
+ * face valued above a coface); every value must be finite. Anything else is
128
+ * a `RangeError` naming the simplex. Simplices of equal value keep their
129
+ * order, which at time 0 is the documented order of {@link Complex}: at a
130
+ * frame the vines' points with `death > birth` are the pairs of
131
+ * `persistence` of the complex with that frame's values (over the same
132
+ * `coeff`), and at any time in between those of the interpolated values.
133
+ *
134
+ * Memory bounds a vineyard before its size limits do: the decomposition
135
+ * keeps U, every column addition of the reduction at time 0 (on tied or
136
+ * evenly spread values many times the number of simplices), and
137
+ * transpositions fill it in further. A vineyard that does not fit throws
138
+ * `TOO_LARGE` (phase `'boundary matrix'`). The same holds for
139
+ * {@link cubicalVineyard} and {@link ripsVineyard}.
140
+ */
141
+ export declare function vineyard(complex: ComplexLike, frames: ArrayLike<Vec>, opts?: VineyardOptions): Vineyard;
142
+ /**
143
+ * Persistence vineyard of a sequence of images or volumes
144
+ * ({@link cubicalVineyard}), stored as typed arrays. Has the fields of
145
+ * {@link Vineyard}, with cubical complex cells in place of simplices.
146
+ */
147
+ export interface CubicalVineyard {
148
+ /** Homology dimension of each vine (constant along the vine). */
149
+ dims: Uint8Array;
150
+ /**
151
+ * Offsets into the knot arrays, of length `count + 1`; vine `v` owns knots
152
+ * `offsets[v] .. offsets[v + 1]`.
153
+ */
154
+ offsets: Uint32Array;
155
+ /** Time coordinate of each knot; image `m` is at time `m`. Non-decreasing along a vine; two knots may share a time (see {@link Vineyard}). */
156
+ times: Float64Array;
157
+ /** The `birth` coordinate at each knot. */
158
+ births: Float64Array;
159
+ /**
160
+ * The `death` coordinate at each knot, or `Infinity` for an essential
161
+ * class.
162
+ */
163
+ deaths: Float64Array;
164
+ /**
165
+ * Cell that creates the class from each knot to the next, given as a
166
+ * bitmap position (numbered as in {@link CubicalComplex}`.cells`:
167
+ * `2 · shape[i] + 1` positions along axis `i`, row-major, so the pixel at
168
+ * `(p0, p1, …)` is the cell at `(2 p0 + 1, 2 p1 + 1, …)`).
169
+ */
170
+ birthCells: Uint32Array;
171
+ /**
172
+ * Cell that destroys the class from each knot to the next, given as a
173
+ * bitmap position, or `-1` for an essential class.
174
+ */
175
+ deathCells: Int32Array;
176
+ /** Number of adjacent-cell transpositions performed along the homotopy. */
177
+ transpositions: number;
178
+ /**
179
+ * Number of transpositions that switched the persistence pairing (each
180
+ * switch adds a knot to two vines).
181
+ */
182
+ switches: number;
183
+ /** Common shape of the input images, slowest axis first. */
184
+ shape: number[];
185
+ /** Filtration scale; always `'value'` (the images' own values). */
186
+ scale: 'value';
187
+ /** The prime `p` of the coefficient field `Z/p`. */
188
+ coeff: number;
189
+ /** Present only when `representatives` was requested. */
190
+ representatives?: VineyardRepresentatives;
191
+ }
192
+ /**
193
+ * Compute the persistence vineyard of a sequence of images or volumes of the
194
+ * same shape, following the classes of the sublevel-set persistence diagram
195
+ * (T-construction, as in {@link cubicalPersistence}) across frames over
196
+ * `Z/coeff`.
197
+ *
198
+ * Each image assigns values to the cells of one shared cubical complex, the
199
+ * T-construction complex of the grid: each top-dimensional cell (pixel or
200
+ * voxel) takes its own value, and each lower-dimensional cell takes the
201
+ * minimum value among the top-dimensional cells containing it. Between
202
+ * consecutive images, each cell's value moves linearly, and the vines follow
203
+ * that homotopy using the transposition updates of {@link vineyard}. At
204
+ * image `m`, the vine points with `death > birth` are the pairs of
205
+ * `cubicalPersistence(images[m], { coeff })`. Cell values are interpolated
206
+ * between images rather than pixel values: a lower-dimensional cell takes the
207
+ * linear interpolation of its two cell values, which can lie below the
208
+ * T-construction value of the interpolated image.
209
+ *
210
+ * Every image must be a {@link Grid} with the same shape as `images[0]` and
211
+ * finite values.
212
+ */
213
+ export declare function cubicalVineyard(images: ArrayLike<Grid>, opts?: VineyardOptions): CubicalVineyard;
214
+ /** Options for {@link ripsVineyard}. */
215
+ export interface RipsVineyardOptions {
216
+ /** Maximum homology dimension, an integer from 0 to 9. Default 1. */
217
+ maxDim?: number;
218
+ /**
219
+ * Non-negative edge-length threshold. Keep only simplices whose edges each
220
+ * have length at most `maxEdgeLength` in at least one cloud (the cloud may
221
+ * differ from edge to edge). Default `Infinity`: include every simplex up
222
+ * to dimension `maxDim + 1`, so every vine is exact.
223
+ */
224
+ maxEdgeLength?: number;
225
+ /** The prime `p` of the coefficient field `Z/p`, from 2 to `2^31 − 1`. Default 2. */
226
+ coeff?: number;
227
+ /**
228
+ * Minimum persistence threshold, a finite number `>= 0`. Omit vines whose
229
+ * `death − birth` is at most `minPersistence` at every knot; essential
230
+ * vines are always kept. Default 0: omit only vines that never leave the
231
+ * diagonal.
232
+ */
233
+ minPersistence?: number;
234
+ /**
235
+ * Also return one representative cycle per kept vine persisting at each
236
+ * requested time (`death > birth` at that time, or essential) in the
237
+ * requested dimensions (up to `maxDim`). Every transposition at crossing
238
+ * time `<= t` is applied before the snapshot at `t` is taken.
239
+ */
240
+ representatives?: VineyardRepresentativesOptions;
241
+ }
242
+ /** Result of {@link ripsVineyard}: the vineyard and its shared complex. */
243
+ export interface RipsVineyard extends Vineyard {
244
+ /**
245
+ * Shared complex across all clouds, carrying its values from `clouds[0]`
246
+ * in the documented order of a {@link Complex}. Indexed by `birthSimplices`
247
+ * and `deathSimplices`; its vertices are point indices.
248
+ */
249
+ complex: Complex;
250
+ }
251
+ /**
252
+ * Compute the persistence vineyard of a moving point cloud, following the
253
+ * classes of the Vietoris–Rips persistence diagram across frames over
254
+ * `Z/coeff`. `clouds[m]` holds the same points in the same order at time `m`.
255
+ *
256
+ * One shared complex serves all clouds: every simplex up to dimension
257
+ * `maxDim + 1` whose edges each have length at most `maxEdgeLength` in at
258
+ * least one cloud (all such simplices by default). Cloud `m` assigns each
259
+ * simplex the length of its longest edge there, as {@link ripsComplex} does,
260
+ * and between consecutive clouds each simplex's value moves linearly; the
261
+ * vines follow that homotopy using the transposition updates of
262
+ * {@link vineyard}. Simplex values are interpolated rather than point
263
+ * coordinates: between two clouds, a simplex takes the linear interpolation
264
+ * of its two lengths, not its length in the interpolated cloud.
265
+ *
266
+ * At cloud `m`, the vine points with `death > birth` are the pairs of
267
+ * `ripsPersistence(clouds[m], { maxDim, coeff })`. With a finite
268
+ * `maxEdgeLength`, every vine is exact while `death` is below
269
+ * `maxEdgeLength`: at each cloud and at every time between consecutive
270
+ * clouds, the complex contains every simplex of value at most
271
+ * `maxEdgeLength` at its exact value. A death at or above `maxEdgeLength`
272
+ * indicates only that the class persists until at least `maxEdgeLength`.
273
+ *
274
+ * Every cloud must have the same number of points and `d` as `clouds[0]`,
275
+ * with finite coordinates.
276
+ */
277
+ export declare function ripsVineyard(clouds: ArrayLike<PointCloud>, opts?: RipsVineyardOptions): RipsVineyard;
278
+ //# source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;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,eAAe,CA2BhG;AAMD,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,8BAA8B,CAAC;CAClD;AAUD,2EAA2E;AAC3E,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,YAAY,CA8BpG"}
@@ -0,0 +1,236 @@
1
+ /**
2
+ * Persistence vineyards: the classes of a filtered complex followed through
3
+ * a homotopy of its values (internal module; the package root re-exports
4
+ * the API).
5
+ */
6
+ import { call, module } from './load.js';
7
+ import { coeff as checkCoeff, f64, int, kind, minPersistence as checkMinPersistence, nonNegative, options, points } from './check.js';
8
+ import { gridArgs } from './complex.js';
9
+ import { complexArgs } from './persistence.js';
10
+ const VINEYARD_REPRESENTATIVES_KEYS = { times: true, dims: true };
11
+ const EMPTY_F64 = new Float64Array(0);
12
+ const EMPTY_U32 = new Uint32Array(0);
13
+ /** Checks a vineyard `representatives` option against `[0, maxTime]` and `0 .. maxDim`. */
14
+ function repRequest(v, fn, maxTime, maxDim) {
15
+ if (v === undefined)
16
+ return { withReps: false, times: EMPTY_F64, filterDims: false, dims: EMPTY_U32 };
17
+ const o = options(v, fn, VINEYARD_REPRESENTATIVES_KEYS, 'representatives', 'representatives.');
18
+ const times = f64(o.times, 'representatives.times');
19
+ for (let i = 0; i < times.length; i++) {
20
+ const t = times[i];
21
+ if (!Number.isFinite(t) || t < 0 || t > maxTime) {
22
+ throw new RangeError(`representatives.times[${i}] must be between 0 and ${maxTime}, got ${t}`);
23
+ }
24
+ }
25
+ if (o.dims === undefined)
26
+ return { withReps: true, times, filterDims: false, dims: EMPTY_U32 };
27
+ if (!Array.isArray(o.dims))
28
+ throw new TypeError(`representatives.dims must be an array of integers, got ${kind(o.dims)}`);
29
+ const dims = new Uint32Array(o.dims.length);
30
+ for (let i = 0; i < o.dims.length; i++)
31
+ dims[i] = int(o.dims[i], `representatives.dims[${i}]`, 0, maxDim);
32
+ return { withReps: true, times, filterDims: true, dims };
33
+ }
34
+ const VINEYARD_KEYS = { coeff: true, minPersistence: true, representatives: true };
35
+ /**
36
+ * The persistence vineyard of a filtered simplicial complex whose values
37
+ * change: `complex.filtrations` are the values at time 0, and `frames[m]`
38
+ * (one value per simplex, in the complex's order) those at time `m + 1`.
39
+ * Between two frames every value moves on a straight line, and the result
40
+ * follows every class of the persistence diagram through that homotopy over
41
+ * `Z/coeff`.
42
+ *
43
+ * The algorithm is the linear-time transposition update ([reference](https://topolab.ai/tda/docs/references/#cohen-steiner-edelsbrunner-and-morozov-2006)): the
44
+ * matrix decomposition behind `persistence` is computed once, at time 0,
45
+ * and repaired in time linear in the number of simplices each time two
46
+ * simplices adjacent in the filtration order exchange their places, instead
47
+ * of being recomputed.
48
+ *
49
+ * The complex must be closed, and monotone at time 0 and at every frame (no
50
+ * face valued above a coface); every value must be finite. Anything else is
51
+ * a `RangeError` naming the simplex. Simplices of equal value keep their
52
+ * order, which at time 0 is the documented order of {@link Complex}: at a
53
+ * frame the vines' points with `death > birth` are the pairs of
54
+ * `persistence` of the complex with that frame's values (over the same
55
+ * `coeff`), and at any time in between those of the interpolated values.
56
+ *
57
+ * Memory bounds a vineyard before its size limits do: the decomposition
58
+ * keeps U, every column addition of the reduction at time 0 (on tied or
59
+ * evenly spread values many times the number of simplices), and
60
+ * transpositions fill it in further. A vineyard that does not fit throws
61
+ * `TOO_LARGE` (phase `'boundary matrix'`). The same holds for
62
+ * {@link cubicalVineyard} and {@link ripsVineyard}.
63
+ */
64
+ export function vineyard(complex, frames, opts) {
65
+ module();
66
+ const o = options(opts, 'vineyard', VINEYARD_KEYS);
67
+ const c = complexArgs(complex, 'complex');
68
+ const coeff = checkCoeff(o.coeff);
69
+ const minPersistence = checkMinPersistence(o.minPersistence);
70
+ if (!isList(frames)) {
71
+ throw new TypeError(`frames must be an array of value arrays (Float64Array or arrays of numbers), got ${kind(frames)}`);
72
+ }
73
+ const n = c.filtrations.length;
74
+ const count = frames.length + 1;
75
+ const rep = repRequest(o.representatives, 'vineyard', count - 1, 255);
76
+ const all = new Float64Array(n * count);
77
+ all.set(c.filtrations);
78
+ for (let m = 0; m < frames.length; m++) {
79
+ const frame = f64(frames[m], `frames[${m}]`);
80
+ if (frame.length !== n) {
81
+ throw new RangeError(`frames[${m}] must have one value per simplex (${n}), got ${frame.length}`);
82
+ }
83
+ all.set(frame, n * (m + 1));
84
+ }
85
+ return call('vineyard', (m) => vinesOf(m.vineyardFlat(c.vertices, c.offsets, all, count, minPersistence, coeff, rep.times, rep.withReps, rep.dims, rep.filterDims), c.scale, coeff));
86
+ }
87
+ /** The vines of a module result. */
88
+ function vinesOf(raw, scale, coeff) {
89
+ const out = {
90
+ dims: raw.dims,
91
+ offsets: raw.offsets,
92
+ times: raw.times,
93
+ births: raw.births,
94
+ deaths: raw.deaths,
95
+ birthSimplices: raw.birthSimplices,
96
+ deathSimplices: raw.deathSimplices,
97
+ transpositions: raw.transpositions,
98
+ switches: raw.switches,
99
+ scale,
100
+ coeff
101
+ };
102
+ if (raw.representatives !== undefined)
103
+ out.representatives = raw.representatives;
104
+ return out;
105
+ }
106
+ /** An array or array-like object (not a typed array) whose length is a non-negative integer. */
107
+ function isList(v) {
108
+ if (v === null || typeof v !== 'object' || ArrayBuffer.isView(v))
109
+ return false;
110
+ const length = v.length;
111
+ return Number.isSafeInteger(length) && length >= 0;
112
+ }
113
+ /** An array of inputs (not a typed array), at least one; returns its length. */
114
+ function frameList(v, name, plural, one) {
115
+ if (!isList(v)) {
116
+ throw new TypeError(`${name} must be an array of ${plural}, got ${kind(v)}`);
117
+ }
118
+ const count = v.length;
119
+ if (count === 0)
120
+ throw new RangeError(`${name} must hold at least one ${one}, got none`);
121
+ return count;
122
+ }
123
+ /**
124
+ * Compute the persistence vineyard of a sequence of images or volumes of the
125
+ * same shape, following the classes of the sublevel-set persistence diagram
126
+ * (T-construction, as in {@link cubicalPersistence}) across frames over
127
+ * `Z/coeff`.
128
+ *
129
+ * Each image assigns values to the cells of one shared cubical complex, the
130
+ * T-construction complex of the grid: each top-dimensional cell (pixel or
131
+ * voxel) takes its own value, and each lower-dimensional cell takes the
132
+ * minimum value among the top-dimensional cells containing it. Between
133
+ * consecutive images, each cell's value moves linearly, and the vines follow
134
+ * that homotopy using the transposition updates of {@link vineyard}. At
135
+ * image `m`, the vine points with `death > birth` are the pairs of
136
+ * `cubicalPersistence(images[m], { coeff })`. Cell values are interpolated
137
+ * between images rather than pixel values: a lower-dimensional cell takes the
138
+ * linear interpolation of its two cell values, which can lie below the
139
+ * T-construction value of the interpolated image.
140
+ *
141
+ * Every image must be a {@link Grid} with the same shape as `images[0]` and
142
+ * finite values.
143
+ */
144
+ export function cubicalVineyard(images, opts) {
145
+ module();
146
+ const o = options(opts, 'cubicalVineyard', VINEYARD_KEYS);
147
+ const coeff = checkCoeff(o.coeff);
148
+ const minPersistence = checkMinPersistence(o.minPersistence);
149
+ const count = frameList(images, 'images', 'images { values: Float64Array, shape: number[] }', 'image');
150
+ const rep = repRequest(o.representatives, 'cubicalVineyard', count - 1, 255);
151
+ const extents = gridArgs(images[0], 'images[0]');
152
+ const size = images[0].values.length;
153
+ const shape = [...images[0].shape];
154
+ const all = new Float64Array(size * count);
155
+ for (let m = 0; m < count; m++) {
156
+ const image = images[m];
157
+ if (m > 0) {
158
+ gridArgs(image, `images[${m}]`);
159
+ const other = image.shape;
160
+ if (other.length !== shape.length || other.some((x, i) => x !== shape[i])) {
161
+ throw new RangeError(`images[${m}].shape must be the shape of images[0] ([${shape.join(', ')}]), got [${other.join(', ')}]`);
162
+ }
163
+ }
164
+ all.set(image.values, size * m);
165
+ }
166
+ return call('cubicalVineyard', (m) => {
167
+ const raw = m.cubicalVineyardFlat(extents, all, count, minPersistence, coeff, rep.times, rep.withReps, rep.dims, rep.filterDims);
168
+ const { birthSimplices, deathSimplices, ...rest } = vinesOf(raw, 'value', coeff);
169
+ return { ...rest, birthCells: birthSimplices, deathCells: deathSimplices, shape, scale: 'value' };
170
+ });
171
+ }
172
+ const RIPS_VINEYARD_KEYS = {
173
+ maxDim: true,
174
+ maxEdgeLength: true,
175
+ coeff: true,
176
+ minPersistence: true,
177
+ representatives: true
178
+ };
179
+ /**
180
+ * Compute the persistence vineyard of a moving point cloud, following the
181
+ * classes of the Vietoris–Rips persistence diagram across frames over
182
+ * `Z/coeff`. `clouds[m]` holds the same points in the same order at time `m`.
183
+ *
184
+ * One shared complex serves all clouds: every simplex up to dimension
185
+ * `maxDim + 1` whose edges each have length at most `maxEdgeLength` in at
186
+ * least one cloud (all such simplices by default). Cloud `m` assigns each
187
+ * simplex the length of its longest edge there, as {@link ripsComplex} does,
188
+ * and between consecutive clouds each simplex's value moves linearly; the
189
+ * vines follow that homotopy using the transposition updates of
190
+ * {@link vineyard}. Simplex values are interpolated rather than point
191
+ * coordinates: between two clouds, a simplex takes the linear interpolation
192
+ * of its two lengths, not its length in the interpolated cloud.
193
+ *
194
+ * At cloud `m`, the vine points with `death > birth` are the pairs of
195
+ * `ripsPersistence(clouds[m], { maxDim, coeff })`. With a finite
196
+ * `maxEdgeLength`, every vine is exact while `death` is below
197
+ * `maxEdgeLength`: at each cloud and at every time between consecutive
198
+ * clouds, the complex contains every simplex of value at most
199
+ * `maxEdgeLength` at its exact value. A death at or above `maxEdgeLength`
200
+ * indicates only that the class persists until at least `maxEdgeLength`.
201
+ *
202
+ * Every cloud must have the same number of points and `d` as `clouds[0]`,
203
+ * with finite coordinates.
204
+ */
205
+ export function ripsVineyard(clouds, opts) {
206
+ module();
207
+ const o = options(opts, 'ripsVineyard', RIPS_VINEYARD_KEYS);
208
+ const maxDim = o.maxDim === undefined ? 1 : int(o.maxDim, 'maxDim', 0, 9);
209
+ const maxEdgeLength = o.maxEdgeLength === undefined ? Infinity : nonNegative(o.maxEdgeLength, 'maxEdgeLength');
210
+ const coeff = checkCoeff(o.coeff);
211
+ const minPersistence = checkMinPersistence(o.minPersistence);
212
+ const count = frameList(clouds, 'clouds', 'point clouds { coords: Float64Array, d: number }', 'point cloud');
213
+ const rep = repRequest(o.representatives, 'ripsVineyard', count - 1, maxDim);
214
+ const n = points(clouds[0], 'clouds[0]', { squaredDistances: true });
215
+ const d = clouds[0].d;
216
+ const size = clouds[0].coords.length;
217
+ const all = new Float64Array(size * count);
218
+ for (let m = 0; m < count; m++) {
219
+ const c = clouds[m];
220
+ if (m > 0) {
221
+ const k = points(c, `clouds[${m}]`, { squaredDistances: true });
222
+ if (c.d !== d || k !== n) {
223
+ throw new RangeError(`clouds[${m}] must have the ${n} points of ${d} coordinates of clouds[0], got ${k} points of ${c.d}`);
224
+ }
225
+ }
226
+ all.set(c.coords, size * m);
227
+ }
228
+ return call('ripsVineyard', (m) => {
229
+ const raw = m.ripsVineyardFlat(all, d, count, maxEdgeLength, maxDim, minPersistence, coeff, rep.times, rep.withReps, rep.dims, rep.filterDims);
230
+ return {
231
+ ...vinesOf(raw, 'edgeLength', coeff),
232
+ complex: { vertices: raw.vertices, offsets: raw.complexOffsets, filtrations: raw.filtrations, scale: 'edgeLength' }
233
+ };
234
+ });
235
+ }
236
+ //# sourceMappingURL=vineyard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vineyard.js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AAG,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,CAAC;YACpC,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,cAAc,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,YAAqB,EAAE;SAC7H,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,79 @@
1
1
  {
2
2
  "name": "@topolab/tda",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.0",
4
+ "description": "topolab TDA, the WebAssembly build of its Rust core: alpha, Čech, Delaunay–Čech, Rips, witness, k-fold cover, ellipsoid, wing, box and cubical complexes, persistent homology and zigzag persistence, exact diagram distances and persistence representations.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./ladder": {
14
+ "types": "./dist/ladder.d.ts",
15
+ "import": "./dist/ladder.js",
16
+ "default": "./dist/ladder.js"
17
+ },
18
+ "./experimental": {
19
+ "types": "./dist/experimental.d.ts",
20
+ "import": "./dist/experimental.js",
21
+ "default": "./dist/experimental.js"
22
+ },
23
+ "./tda.wasm": "./dist/tda.wasm",
24
+ "./ladder.wasm": "./dist/ladder/tda_ladder_bg.wasm",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "type": "module",
28
+ "keywords": [
29
+ "topological-data-analysis",
30
+ "tda",
31
+ "persistent-homology",
32
+ "persistence-diagrams",
33
+ "alpha-complex",
34
+ "vietoris-rips",
35
+ "cech-complex",
36
+ "ellipsoid-cech-complex",
37
+ "wing-complex",
38
+ "cubical-complex",
39
+ "bottleneck-distance",
40
+ "wasserstein-distance",
41
+ "optimal-transport",
42
+ "betti-numbers",
43
+ "persistence-landscapes",
44
+ "persistence-images",
45
+ "webassembly",
46
+ "wasm",
47
+ "computational-topology",
48
+ "computational-geometry",
49
+ "typescript",
50
+ "commutative-ladder",
51
+ "multiparameter-persistence",
52
+ "zigzag-persistence",
53
+ "vineyards",
54
+ "interval-approximation"
55
+ ],
56
+ "author": "topolab <dev@topolab.ai>",
57
+ "license": "MIT",
58
+ "bugs": {
59
+ "url": "https://topolab.ai/contact/"
60
+ },
61
+ "homepage": "https://topolab.ai/tda/docs/",
62
+ "sideEffects": false,
63
+ "engines": {
64
+ "node": ">=22"
65
+ },
66
+ "files": [
67
+ "dist/",
68
+ "src/",
69
+ "README.md",
70
+ "CHANGELOG.md",
71
+ "LICENSE",
72
+ "THIRD_PARTY_LICENSES.md",
73
+ "SECURITY.md",
74
+ "CITATION.cff"
75
+ ],
76
+ "publishConfig": {
77
+ "access": "public"
78
+ }
79
+ }