@topolab/tda 0.0.0-stage → 0.4.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 (105) hide show
  1. package/CHANGELOG.md +106 -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 +697 -0
  7. package/dist/arrangement.d.ts +50 -0
  8. package/dist/arrangement.d.ts.map +1 -0
  9. package/dist/arrangement.js +63 -0
  10. package/dist/arrangement.js.map +1 -0
  11. package/dist/build_info.json +12 -0
  12. package/dist/check.d.ts +118 -0
  13. package/dist/check.d.ts.map +1 -0
  14. package/dist/check.js +298 -0
  15. package/dist/check.js.map +1 -0
  16. package/dist/complex.d.ts +543 -0
  17. package/dist/complex.d.ts.map +1 -0
  18. package/dist/complex.js +712 -0
  19. package/dist/complex.js.map +1 -0
  20. package/dist/diagram.d.ts +116 -0
  21. package/dist/diagram.d.ts.map +1 -0
  22. package/dist/diagram.js +238 -0
  23. package/dist/diagram.js.map +1 -0
  24. package/dist/diagram_of.d.ts +17 -0
  25. package/dist/diagram_of.d.ts.map +1 -0
  26. package/dist/diagram_of.js +40 -0
  27. package/dist/diagram_of.js.map +1 -0
  28. package/dist/experimental.d.ts +18 -0
  29. package/dist/experimental.d.ts.map +1 -0
  30. package/dist/experimental.js +16 -0
  31. package/dist/experimental.js.map +1 -0
  32. package/dist/flat.d.ts +64 -0
  33. package/dist/flat.d.ts.map +1 -0
  34. package/dist/flat.js +158 -0
  35. package/dist/flat.js.map +1 -0
  36. package/dist/index.d.ts +42 -0
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/index.js +31 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/ladder/tda_ladder.d.ts +223 -0
  41. package/dist/ladder/tda_ladder.js +1360 -0
  42. package/dist/ladder/tda_ladder_bg.wasm +0 -0
  43. package/dist/ladder/tda_ladder_bg.wasm.d.ts +43 -0
  44. package/dist/ladder.d.ts +306 -0
  45. package/dist/ladder.d.ts.map +1 -0
  46. package/dist/ladder.js +607 -0
  47. package/dist/ladder.js.map +1 -0
  48. package/dist/load.d.ts +53 -0
  49. package/dist/load.d.ts.map +1 -0
  50. package/dist/load.js +173 -0
  51. package/dist/load.js.map +1 -0
  52. package/dist/memory.d.ts +58 -0
  53. package/dist/memory.d.ts.map +1 -0
  54. package/dist/memory.js +2 -0
  55. package/dist/memory.js.map +1 -0
  56. package/dist/persistence.d.ts +349 -0
  57. package/dist/persistence.d.ts.map +1 -0
  58. package/dist/persistence.js +478 -0
  59. package/dist/persistence.js.map +1 -0
  60. package/dist/pkg/tda_wasm.d.ts +13 -0
  61. package/dist/pkg/tda_wasm.js +2528 -0
  62. package/dist/prepared.d.ts +62 -0
  63. package/dist/prepared.d.ts.map +1 -0
  64. package/dist/prepared.js +81 -0
  65. package/dist/prepared.js.map +1 -0
  66. package/dist/rivet_input.d.ts +93 -0
  67. package/dist/rivet_input.d.ts.map +1 -0
  68. package/dist/rivet_input.js +132 -0
  69. package/dist/rivet_input.js.map +1 -0
  70. package/dist/source.d.ts +43 -0
  71. package/dist/source.d.ts.map +1 -0
  72. package/dist/source.js +99 -0
  73. package/dist/source.js.map +1 -0
  74. package/dist/tda.wasm +0 -0
  75. package/dist/two_parameter.d.ts +243 -0
  76. package/dist/two_parameter.d.ts.map +1 -0
  77. package/dist/two_parameter.js +275 -0
  78. package/dist/two_parameter.js.map +1 -0
  79. package/dist/types.d.ts +146 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/types.js +2 -0
  82. package/dist/types.js.map +1 -0
  83. package/dist/vineyard.d.ts +278 -0
  84. package/dist/vineyard.d.ts.map +1 -0
  85. package/dist/vineyard.js +236 -0
  86. package/dist/vineyard.js.map +1 -0
  87. package/package.json +77 -4
  88. package/src/arrangement.ts +96 -0
  89. package/src/check.ts +338 -0
  90. package/src/complex.ts +1179 -0
  91. package/src/diagram.ts +299 -0
  92. package/src/diagram_of.ts +40 -0
  93. package/src/experimental.ts +17 -0
  94. package/src/flat.ts +204 -0
  95. package/src/index.ts +181 -0
  96. package/src/ladder.ts +903 -0
  97. package/src/load.ts +201 -0
  98. package/src/memory.ts +58 -0
  99. package/src/persistence.ts +752 -0
  100. package/src/prepared.ts +111 -0
  101. package/src/rivet_input.ts +195 -0
  102. package/src/source.ts +132 -0
  103. package/src/two_parameter.ts +480 -0
  104. package/src/types.ts +163 -0
  105. package/src/vineyard.ts +463 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../src/persistence.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAkCpF;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,CAAC,EAAE,OAAO,EACV,IAAI,EAAE,MAAM,GACX;IAAE,QAAQ,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAkDtG;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,CAAC,EAAE;IAAE,QAAQ,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,YAAY,CAAA;CAAE,GAAG,OAAO,CAEpH;AAED,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,EAAE,IAAI,CAAC,kBAAkB,CAAyC,CAA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;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA0BD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,0BAA0B,GAAG,mBAAmB,CAqB/G"}
@@ -0,0 +1,478 @@
1
+ /**
2
+ * Persistence of a complex the caller holds, of Rips filtrations, of images,
3
+ * of zigzags, and the volume-optimal cycles of a complex (internal module;
4
+ * the package root re-exports the API).
5
+ */
6
+ import { call, module } from './load.js';
7
+ import { coeff as checkCoeff, finite, int, isTyped, kind, minPersistence as checkMinPersistence, nonNegative, num, oneOf, options, points as checkPoints, viewKind } from './check.js';
8
+ import { distanceMatrix, gridArgs, isMatrix } from './complex.js';
9
+ import { diagramOf } from './diagram_of.js';
10
+ const SCALES = ['edgeLength', 'radius', 'squaredRadius', 'squaredRelaxation', 'epsilon', 'growthRadius', 'value'];
11
+ const INT32_MIN = -2147483648;
12
+ const INT32_MAX = 2147483647;
13
+ // The object form already holds an operation object and often a boundary
14
+ // array per record. Limit its additional packed copy to a conservative 1 GiB.
15
+ // PackedZigzag accepts the same records without this second JS structure.
16
+ const ZIGZAG_OBJECT_CONVERSION_BUDGET = 1_073_741_824;
17
+ function refuseZigzagObjectConversion(operations) {
18
+ const status = module().__oom_status();
19
+ const memoryBytes = status.memory.buffer.byteLength;
20
+ const declaredMaxBytes = status.limitBytes;
21
+ const requestedBytes = operations * 5 * Float64Array.BYTES_PER_ELEMENT;
22
+ const details = {
23
+ function: 'zigzagPersistence', phase: 'input-conversion', requestedBytes,
24
+ inUseBytes: null, memoryBytes, committedBytes: memoryBytes,
25
+ limitBytes: ZIGZAG_OBJECT_CONVERSION_BUDGET, declaredMaxBytes,
26
+ allocationLimitBytes: Math.min(declaredMaxBytes, 2_147_483_647),
27
+ hostConversionBudgetBytes: ZIGZAG_OBJECT_CONVERSION_BUDGET,
28
+ input: { operations }, parameters: {},
29
+ estimateMethod: 'The request is a lower bound of five Float64 fields per operation. Boundaries add fields. The 1 GiB conversion budget is a conservative policy, not a measured JavaScript heap ceiling or a whole-input fit estimate.'
30
+ };
31
+ const error = new RangeError(`zigzagPersistence: input too large while building JavaScript records; at least ${requestedBytes} bytes requested by ${operations} operations, above the ${ZIGZAG_OBJECT_CONVERSION_BUDGET} byte object-conversion budget. Pass packed Float64Array records to avoid the extra copy.`);
32
+ Object.assign(error, { code: 'TOO_LARGE', details });
33
+ throw error;
34
+ }
35
+ /**
36
+ * A complex argument as the typed arrays the engine reads: typed arrays of
37
+ * the right kind pass through, plain arrays (or other typed arrays) are
38
+ * checked (32-bit integer vertex ids, non-negative integer offsets, numbers)
39
+ * and converted. The rest (CSR shape, closure, monotonicity, NaN) the Rust
40
+ * core checks, naming the simplex.
41
+ */
42
+ export function complexArgs(v, name) {
43
+ const c = v;
44
+ const arrayLike = (x) => Array.isArray(x) || (viewKind(x) !== undefined && viewKind(x) !== 'DataView');
45
+ if (c === null || typeof c !== 'object' || !arrayLike(c.vertices) || !arrayLike(c.offsets) || !arrayLike(c.filtrations)) {
46
+ throw new TypeError(`${name} must be a complex { vertices, offsets, filtrations } (Int32Array, Uint32Array, Float64Array or arrays of numbers), got ${kind(v)}`);
47
+ }
48
+ let vertices;
49
+ if (isTyped(c.vertices, 'Int32Array')) {
50
+ vertices = c.vertices;
51
+ }
52
+ else {
53
+ const raw = c.vertices;
54
+ for (let j = 0; j < raw.length; j++) {
55
+ const x = raw[j];
56
+ if (typeof x !== 'number')
57
+ throw new TypeError(`${name}.vertices[${j}] must be a number, got ${kind(x)}`);
58
+ if (!Number.isInteger(x) || x < INT32_MIN || x > INT32_MAX) {
59
+ throw new RangeError(`${name}.vertices[${j}] must be an integer from ${INT32_MIN} to ${INT32_MAX}, got ${String(x)}`);
60
+ }
61
+ }
62
+ vertices = Int32Array.from(raw);
63
+ }
64
+ let offsets;
65
+ if (isTyped(c.offsets, 'Uint32Array')) {
66
+ offsets = c.offsets;
67
+ }
68
+ else {
69
+ const raw = c.offsets;
70
+ for (let j = 0; j < raw.length; j++) {
71
+ const x = raw[j];
72
+ if (typeof x !== 'number')
73
+ throw new TypeError(`${name}.offsets[${j}] must be a number, got ${kind(x)}`);
74
+ if (!Number.isInteger(x) || x < 0 || x > 4294967295) {
75
+ throw new RangeError(`${name}.offsets[${j}] must be an integer from 0 to 4294967295, got ${String(x)}`);
76
+ }
77
+ }
78
+ offsets = Uint32Array.from(raw);
79
+ }
80
+ let filtrations;
81
+ if (isTyped(c.filtrations, 'Float64Array')) {
82
+ filtrations = c.filtrations;
83
+ }
84
+ else {
85
+ const raw = c.filtrations;
86
+ for (let j = 0; j < raw.length; j++) {
87
+ if (typeof raw[j] !== 'number')
88
+ throw new TypeError(`${name}.filtrations[${j}] must be a number, got ${kind(raw[j])}`);
89
+ }
90
+ filtrations = Float64Array.from(raw);
91
+ }
92
+ const scale = c.scale === undefined ? 'value' : oneOf(c.scale, `${name}.scale`, SCALES);
93
+ let top = -1;
94
+ for (let i = 0; i + 1 < offsets.length; i++)
95
+ top = Math.max(top, offsets[i + 1] - offsets[i] - 1);
96
+ return { vertices, offsets, filtrations, scale, top };
97
+ }
98
+ /** @internal Whether checked complex arrays are the empty complex: no simplex, `offsets` `[0]`. */
99
+ export function isEmptyComplex(c) {
100
+ return c.filtrations.length === 0 && c.offsets.length === 1 && c.offsets[0] === 0 && c.vertices.length === 0;
101
+ }
102
+ /** @internal The option keys of {@link PersistenceOptions}. */
103
+ export const PERSISTENCE_KEYS = { coeff: true, minPersistence: true };
104
+ /**
105
+ * The persistence diagram of a filtered simplicial complex: one a builder
106
+ * returned, or one the caller builds as `{ vertices, offsets, filtrations }`
107
+ * (`scale` is read when present, `'value'` otherwise).
108
+ *
109
+ * The complex must be closed (every face of every simplex listed, its
110
+ * vertices included) and monotone (no face valued above a coface); no
111
+ * simplex may be listed twice or list a vertex twice, and no value may be
112
+ * NaN (`Infinity`, `-Infinity` and `-0` are fine). Anything else is a
113
+ * `RangeError` naming the simplex. Vertex ids are any 32-bit integers;
114
+ * vertex order within a simplex and simplex order do not matter.
115
+ *
116
+ * The Rust core puts the simplices in the documented order and its reducer
117
+ * computes the pairs over `Z/coeff`, in
118
+ * every dimension up to the complex's top one (an empty complex has an
119
+ * empty diagram). Within a dimension the finite pairs come in the order of
120
+ * their death simplex, then the essential classes in the order of their
121
+ * birth simplex: an order that depends on the complex only.
122
+ */
123
+ export function persistence(complex, opts) {
124
+ module();
125
+ const o = options(opts, 'persistence', PERSISTENCE_KEYS);
126
+ const c = complexArgs(complex, 'complex');
127
+ const coeff = checkCoeff(o.coeff);
128
+ const minPersistence = checkMinPersistence(o.minPersistence);
129
+ // The empty complex (one offset, 0) has an empty diagram; any other shape
130
+ // with no values goes to the engine, which refuses it.
131
+ if (isEmptyComplex(c))
132
+ return diagramOf(new Float64Array(0), c.top, c.scale, coeff);
133
+ return call('persistence', (m) => diagramOf(m.persistenceFlat(c.vertices, c.offsets, c.filtrations, coeff), c.top, c.scale, coeff, minPersistence));
134
+ }
135
+ const REPRESENTATIVES_KEYS = { kind: true, dims: true };
136
+ const RIPS_PERSISTENCE_KEYS = {
137
+ maxDim: true,
138
+ maxEdgeLength: true,
139
+ coeff: true,
140
+ representatives: true,
141
+ minPersistence: true
142
+ };
143
+ /** The kind and the dimension bit mask of a representatives request. */
144
+ function representativeRequest(v, maxDim) {
145
+ if (v === undefined || v === false)
146
+ return null;
147
+ const o = v === true ? {} : options(v, 'ripsPersistence', REPRESENTATIVES_KEYS, 'representatives', 'representatives.');
148
+ const k = o.kind === undefined ? 'cycles' : oneOf(o.kind, 'representatives.kind', ['cycles', 'cocycles']);
149
+ let mask = 0;
150
+ if (o.dims === undefined) {
151
+ mask = (1 << (maxDim + 1)) - 1;
152
+ }
153
+ else {
154
+ if (!Array.isArray(o.dims))
155
+ throw new TypeError(`representatives.dims must be an array of integers, got ${kind(o.dims)}`);
156
+ // An index loop, not forEach: a hole is an entry like any other, and refused.
157
+ for (let i = 0; i < o.dims.length; i++) {
158
+ const d = int(o.dims[i], `representatives.dims[${i}]`, 0, maxDim);
159
+ mask |= 1 << d;
160
+ }
161
+ }
162
+ return { kind: k, mask };
163
+ }
164
+ /**
165
+ * The engine's representatives as {@link RipsRepresentatives} against the
166
+ * per-dimension diagram. The engine has already left out the pairs
167
+ * `minPersistence` leaves out, with their representatives; here each representative's pair
168
+ * index into the flat list becomes (dimension, index within the dimension),
169
+ * the layout {@link diagramOf} gives the pairs.
170
+ */
171
+ function representativesOf(raw, kindOf) {
172
+ const flat = raw.pairs;
173
+ const m = flat.length / 3;
174
+ const within = new Uint32Array(m);
175
+ const seen = [];
176
+ for (let p = 0; p < m; p++) {
177
+ const k = flat[3 * p];
178
+ while (seen.length <= k)
179
+ seen.push(0);
180
+ within[p] = seen[k]++;
181
+ }
182
+ const index = raw.pairIndex;
183
+ const count = index.length;
184
+ const dims = new Uint8Array(count);
185
+ const pairIndex = new Uint32Array(count);
186
+ const births = new Float64Array(count);
187
+ const deaths = new Float64Array(count);
188
+ for (let i = 0; i < count; i++) {
189
+ const p = index[i];
190
+ dims[i] = flat[3 * p];
191
+ pairIndex[i] = within[p];
192
+ births[i] = flat[3 * p + 1];
193
+ deaths[i] = flat[3 * p + 2];
194
+ }
195
+ return {
196
+ diagram: flat,
197
+ reps: {
198
+ kind: kindOf,
199
+ dims,
200
+ pairIndex,
201
+ births,
202
+ deaths,
203
+ simplexOffsets: raw.simplexOffsets,
204
+ vertexOffsets: raw.vertexOffsets,
205
+ vertices: raw.vertices,
206
+ coefficients: raw.coefficients
207
+ }
208
+ };
209
+ }
210
+ /**
211
+ * The Vietoris–Rips persistence diagram of a point cloud or of a distance
212
+ * matrix, H₀ up to dimension `maxDim`, by the Rust core without building the complex
213
+ * (persistent cohomology with clearing, implicit coboundaries and
214
+ * apparent pairs, after Ripser ([reference](https://topolab.ai/tda/docs/references/#bauer-2021)); an edge collapse before H₂ and up).
215
+ * Distances are computed in double precision in GUDHI's order, so the
216
+ * diagram is GUDHI's, value for value, on dimensions 0 to `maxDim`; the
217
+ * classes a truncated complex reports in dimension `maxDim + 1` are not
218
+ * reported. A distance matrix is read in its strict lower triangle;
219
+ * `Infinity` entries are absent edges and no entry may be NaN or negative.
220
+ * A point cloud with two points whose squared distance overflows double
221
+ * precision is refused (a `RangeError`: rescale it). Within a dimension the pairs come in
222
+ * the engine's order. The Rips key holds the colex index of a simplex's
223
+ * vertices off its longest edge in 32 bits, so C(n, `maxDim`) must be below
224
+ * 2^32 for n points (at most 2,954 points at `maxDim` 3, 52 at 9); a larger
225
+ * input is refused with a `RangeError` whose message starts with
226
+ * `input too large:`.
227
+ *
228
+ * With `representatives`, the pairs (the same multiset, every value bit;
229
+ * the order within a dimension may differ) come with a representative cycle
230
+ * or cocycle each ({@link RipsRepresentatives}). Representatives are
231
+ * computed on the uncollapsed filtration, which is slower on dense
232
+ * filtrations in dimension 2 and up; past a working column of 256 MiB,
233
+ * cocycles are refused (a `RangeError`, `input too large:`) and cycles are computed on the collapsed
234
+ * filtration instead (still cycles of the Rips complex, of the same bars).
235
+ */
236
+ export function ripsPersistence(points, opts) {
237
+ module();
238
+ const o = options(opts, 'ripsPersistence', RIPS_PERSISTENCE_KEYS);
239
+ const matrix = isMatrix(points, 'points');
240
+ const n = matrix ? distanceMatrix(points, 'points') : checkPoints(points, 'points', { squaredDistances: true });
241
+ const maxDim = o.maxDim === undefined ? 1 : int(o.maxDim, 'maxDim', 0, 9);
242
+ const maxEdgeLength = o.maxEdgeLength === undefined ? Infinity : nonNegative(o.maxEdgeLength, 'maxEdgeLength');
243
+ const coeff = checkCoeff(o.coeff);
244
+ const request = representativeRequest(o.representatives, maxDim);
245
+ const minPersistence = checkMinPersistence(o.minPersistence);
246
+ return call('ripsPersistence', (m) => {
247
+ const head = matrix ? [points.distances, n] : [points.coords, points.d];
248
+ if (request === null) {
249
+ const flat = matrix
250
+ ? m.ripsPersistenceFromDistanceMatrixFlat(...head, maxDim, maxEdgeLength, coeff)
251
+ : m.ripsPersistenceFlat(...head, maxDim, maxEdgeLength, coeff);
252
+ return diagramOf(flat, maxDim, 'edgeLength', coeff, minPersistence);
253
+ }
254
+ const kindCode = request.kind === 'cocycles' ? 1 : 0;
255
+ const raw = matrix
256
+ ? m.ripsRepresentativesFromDistanceMatrixFlat(...head, maxDim, maxEdgeLength, coeff, kindCode, request.mask, minPersistence)
257
+ : m.ripsRepresentativesFlat(...head, maxDim, maxEdgeLength, coeff, kindCode, request.mask, minPersistence);
258
+ const { diagram, reps } = representativesOf(raw, request.kind);
259
+ return { ...diagramOf(diagram, maxDim, 'edgeLength', coeff), representatives: reps };
260
+ });
261
+ }
262
+ const CUBICAL_KEYS = { construction: true, coeff: true, minPersistence: true };
263
+ /**
264
+ * The sublevel-set persistence diagram of an image or a volume, homology up
265
+ * to the number of axes. 2-D and 3-D grids run the Rust core (union-find
266
+ * with Alexander duality; H₁ of volumes by a cohomology reduction over
267
+ * `Z/coeff`); other grids (up to 16 axes) run the Rust core's reducer over
268
+ * its cells. The T diagram
269
+ * is GUDHI's bitmap complex's in every case, up to the
270
+ * sign of a zero on input holding both -0 and +0; within a dimension the
271
+ * pairs come in the engine's order. In 2-D the field does not change the
272
+ * diagram.
273
+ */
274
+ export function cubicalPersistence(image, opts) {
275
+ module();
276
+ const o = options(opts, 'cubicalPersistence', CUBICAL_KEYS);
277
+ const extents = gridArgs(image, 'image');
278
+ const construction = o.construction === undefined ? 'T' : oneOf(o.construction, 'construction', ['T', 'V']);
279
+ const coeff = checkCoeff(o.coeff);
280
+ const minPersistence = checkMinPersistence(o.minPersistence);
281
+ const top = image.shape.length;
282
+ if (construction === 'V') {
283
+ if (image.shape.length !== 2) {
284
+ throw new RangeError(`construction 'V' takes a 2-D image (image.shape of length 2), got ${image.shape.length} axes`);
285
+ }
286
+ return call('cubicalPersistence', (m) => diagramOf(m.cubicalVertexPersistenceFlat(image.values, image.shape[1], image.shape[0]), top, 'value', coeff, minPersistence));
287
+ }
288
+ return call('cubicalPersistence', (m) => diagramOf(m.cubicalPersistenceFlat(extents, image.values, coeff), top, 'value', coeff, minPersistence));
289
+ }
290
+ /** Insert cell `cell` of dimension `dim` with faces `boundary`, at `value` if given. */
291
+ export function insertOp(cell, boundary, dim, value) {
292
+ return value === undefined ? { type: 'insert', cell, boundary, dim } : { type: 'insert', cell, boundary, dim, value };
293
+ }
294
+ /** Remove cell `cell`, at `value` if given. */
295
+ export function removeOp(cell, value) {
296
+ return value === undefined ? { type: 'remove', cell } : { type: 'remove', cell, value };
297
+ }
298
+ const ZIGZAG_KEYS = { minPersistence: true };
299
+ /**
300
+ * Zigzag persistence of a sequence of insertions and removals of cells,
301
+ * by the FastZigzag conversion ([reference](https://topolab.ai/tda/docs/references/#dey-and-hou-2022)): the zigzag becomes one ordinary
302
+ * filtration of the cone over a non-repetitive copy of it, reduced over Z/2
303
+ * and read back as zigzag intervals. Homology up to
304
+ * the highest cell dimension. Z/2 only; no representatives.
305
+ *
306
+ * The operations must describe a zigzag of cell complexes, or the call is
307
+ * refused with a `RangeError` naming the operation: every face of an
308
+ * inserted cell is in the complex at that moment and has one dimension
309
+ * less; a vertex has no face, an edge two; the faces of a cell of
310
+ * dimension 2 or more form a cycle (every cell two dimensions down is a face
311
+ * of an even number of them); a cell is not inserted while it
312
+ * is in the complex, nor removed while it is not or while a coface of it is.
313
+ * When the operations have values, the values must be monotone (all
314
+ * non-decreasing or all non-increasing) and not NaN; either every operation
315
+ * has a value or none has.
316
+ */
317
+ export function zigzagPersistence(ops, opts) {
318
+ module();
319
+ const o = options(opts, 'zigzagPersistence', ZIGZAG_KEYS);
320
+ let top = -1;
321
+ let records;
322
+ let withValues;
323
+ if (Array.isArray(ops)) {
324
+ if (ops.length * 5 * Float64Array.BYTES_PER_ELEMENT > ZIGZAG_OBJECT_CONVERSION_BUDGET)
325
+ refuseZigzagObjectConversion(ops.length);
326
+ if (ops.length === 0)
327
+ throw new RangeError('ops must hold at least one operation');
328
+ let length = 0;
329
+ let valued = 0;
330
+ // Index loops, not forEach: a hole is an entry like any other, and refused.
331
+ for (let i = 0; i < ops.length; i++) {
332
+ const op = ops[i];
333
+ if (op === null || typeof op !== 'object')
334
+ throw new TypeError(`ops[${i}] must be an operation, got ${kind(op)}`);
335
+ // Build parameter paths only on refusal, preserving the existing checks
336
+ // and messages without allocating a string for every valid cell/face.
337
+ const type = op.type;
338
+ if (type !== 'insert' && type !== 'remove')
339
+ oneOf(type, `ops[${i}].type`, ['insert', 'remove']);
340
+ if (!Number.isInteger(op.cell) || op.cell < INT32_MIN || op.cell > INT32_MAX)
341
+ int(op.cell, `ops[${i}].cell`, INT32_MIN, INT32_MAX);
342
+ if (op.value !== undefined) {
343
+ if (typeof op.value !== 'number')
344
+ num(op.value, `ops[${i}].value`);
345
+ valued++;
346
+ }
347
+ if (op.type === 'insert') {
348
+ if (!Array.isArray(op.boundary))
349
+ throw new TypeError(`ops[${i}].boundary must be an array of cell ids, got ${kind(op.boundary)}`);
350
+ const boundary = op.boundary;
351
+ for (let j = 0; j < boundary.length; j++) {
352
+ const id = boundary[j];
353
+ if (!Number.isInteger(id) || id < INT32_MIN || id > INT32_MAX)
354
+ int(id, `ops[${i}].boundary[${j}]`, INT32_MIN, INT32_MAX);
355
+ }
356
+ if (!Number.isSafeInteger(op.dim) || op.dim < 0 || op.dim > INT32_MAX)
357
+ int(op.dim, `ops[${i}].dim`, 0);
358
+ top = Math.max(top, op.dim);
359
+ length += 5 + boundary.length;
360
+ }
361
+ else {
362
+ length += 5;
363
+ }
364
+ }
365
+ if (valued !== 0 && valued !== ops.length) {
366
+ const missing = ops.findIndex((op) => op.value === undefined);
367
+ throw new RangeError(`ops[${missing}].value is missing: give every operation a value, or none`);
368
+ }
369
+ records = new Float64Array(length);
370
+ let at = 0;
371
+ for (const op of ops) {
372
+ records[at++] = op.type === 'insert' ? 0 : 1;
373
+ records[at++] = op.cell;
374
+ records[at++] = op.type === 'insert' ? op.dim : 0;
375
+ records[at++] = op.value ?? 0;
376
+ const boundary = op.type === 'insert' ? op.boundary : [];
377
+ records[at++] = boundary.length;
378
+ for (const id of boundary)
379
+ records[at++] = id;
380
+ }
381
+ withValues = valued === ops.length;
382
+ }
383
+ else {
384
+ if (ops === null || typeof ops !== 'object' || !isTyped(ops.records, 'Float64Array')) {
385
+ throw new TypeError(`ops must be an array of operations, got ${kind(ops)}`);
386
+ }
387
+ if (ops.withValues !== undefined && typeof ops.withValues !== 'boolean')
388
+ throw new TypeError('withValues must be a boolean');
389
+ records = ops.records;
390
+ withValues = ops.withValues ?? false;
391
+ if (records.length === 0)
392
+ throw new RangeError('ops.records must hold at least one operation');
393
+ // Discover the output's dimensions in constant heap space. The engine
394
+ // checks the record contents and operation semantics; reject incomplete
395
+ // headers/counts here so this scan never skips outside the typed array.
396
+ for (let at = 0; at < records.length;) {
397
+ if (records.length - at < 5)
398
+ throw new RangeError('truncated zigzag record header');
399
+ const count = records[at + 4];
400
+ if (!Number.isSafeInteger(count) || count < 0 || count > records.length - at - 5)
401
+ throw new RangeError('invalid zigzag boundary length');
402
+ if (records[at] === 0)
403
+ top = Math.max(top, records[at + 2]);
404
+ at += 5 + count;
405
+ }
406
+ }
407
+ const minPersistence = checkMinPersistence(o.minPersistence);
408
+ return call('zigzagPersistence', (m) => {
409
+ const raw = m.zigzagPersistenceFlat(records, withValues);
410
+ const indices = raw.indices;
411
+ for (let i = 2; i < indices.length; i += 3)
412
+ if (indices[i] === -1)
413
+ indices[i] = Infinity;
414
+ const indexPairs = diagramOf(indices, top, 'value', 2, withValues ? 0 : minPersistence).pairs;
415
+ const result = { indexPairs, scale: 'value', coeff: 2 };
416
+ if (withValues)
417
+ result.pairs = diagramOf(raw.values, top, 'value', 2, minPersistence).pairs;
418
+ return result;
419
+ });
420
+ }
421
+ const VOLUME_OPTIMAL_KEYS = { dim: true, pair: true, minPersistence: true };
422
+ /**
423
+ * The engine's one array (`volumeOptimalCyclesFlat`) cut into the typed
424
+ * arrays of {@link VolumeOptimalCycles}: `[count, volume rows, boundary
425
+ * rows, cycle vertices]`, then births, deaths, found, and the three CSR
426
+ * lists, each offsets then ids.
427
+ */
428
+ function cyclesOf(out, dim) {
429
+ const [count, volumeRows, boundaryRows, cycleLength] = [out[0], out[1], out[2], out[3]];
430
+ let at = 4;
431
+ const take = (length) => out.subarray(at, (at += length));
432
+ const births = take(count).slice();
433
+ const deaths = take(count).slice();
434
+ const found = Uint8Array.from(take(count));
435
+ const volumeOffsets = Uint32Array.from(take(count + 1));
436
+ const volumeVertices = Int32Array.from(take(volumeRows * (dim + 2)));
437
+ const boundaryOffsets = Uint32Array.from(take(count + 1));
438
+ const boundaryVertices = Int32Array.from(take(boundaryRows * (dim + 1)));
439
+ const cycleVertexOffsets = Uint32Array.from(take(count + 1));
440
+ const cycleVertices = Int32Array.from(take(cycleLength));
441
+ return { dim, births, deaths, found, volumeOffsets, volumeVertices, boundaryOffsets, boundaryVertices, cycleVertexOffsets, cycleVertices };
442
+ }
443
+ /**
444
+ * Experimental: volume-optimal cycles in dimension `dim`, by the merge-tree /
445
+ * Alexander-duality method ([reference](https://topolab.ai/tda/docs/references/#obayashi-2018), §5).
446
+ * Meaningful for triangulations of convex
447
+ * domains in R^(dim + 1), such as alpha complexes. With `pair`, the cycle of
448
+ * that one finite pair (or the pair echoed with `found[0] === 0`); without,
449
+ * every finite pair's (longer than `minPersistence`), sorted by birth then
450
+ * death. The engine orders and checks the complex itself (closed, values
451
+ * non-decreasing from face to coface; a simplex's vertices in any order,
452
+ * none listed twice). The general L1 problem and stable volumes are not
453
+ * implemented.
454
+ */
455
+ export function volumeOptimalCycles(complex, opts) {
456
+ module();
457
+ const o = options(opts, 'volumeOptimalCycles', VOLUME_OPTIMAL_KEYS);
458
+ const c = complexArgs(complex, 'complex');
459
+ const dim = int(o.dim, 'dim', 0, 0x7ffffffe);
460
+ let pair = null;
461
+ if (o.pair !== undefined) {
462
+ if (!Array.isArray(o.pair) || o.pair.length !== 2)
463
+ throw new TypeError(`pair must be [birth, death], got ${kind(o.pair)}`);
464
+ pair = [finite(o.pair[0], 'pair[0]'), finite(o.pair[1], 'pair[1]')];
465
+ }
466
+ const minPersistence = checkMinPersistence(o.minPersistence);
467
+ // The empty complex has no pairs; any other shape with no values goes to
468
+ // the engine, which refuses it as it refuses every malformed complex.
469
+ const empty = isEmptyComplex(c);
470
+ if (empty && pair === null)
471
+ return cyclesOf(Float64Array.of(0, 0, 0, 0, 0, 0, 0), dim);
472
+ if (empty)
473
+ throw new RangeError('complex must hold at least one simplex to find the cycle of a pair');
474
+ const [birth, death] = pair ?? [0, 0];
475
+ const out = call('volumeOptimalCycles', (m) => m.volumeOptimalCyclesFlat(c.vertices, c.offsets, c.filtrations, dim + 1, pair !== null, birth, death, minPersistence));
476
+ return cyclesOf(out, dim);
477
+ }
478
+ //# sourceMappingURL=persistence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence.js","sourceRoot":"","sources":["../src/persistence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,KAAK,IAAI,UAAU,EACnB,MAAM,EACN,GAAG,EACH,OAAO,EACP,IAAI,EACJ,cAAc,IAAI,mBAAmB,EACrC,WAAW,EACX,GAAG,EACH,KAAK,EACL,OAAO,EACP,MAAM,IAAI,WAAW,EACrB,QAAQ,EACT,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAO5C,MAAM,MAAM,GAAqB,CAAC,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;AAEpI,MAAM,SAAS,GAAG,CAAC,UAAU,CAAC;AAC9B,MAAM,SAAS,GAAG,UAAU,CAAC;AAC7B,yEAAyE;AACzE,8EAA8E;AAC9E,0EAA0E;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AAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvF,IAAI,KAAK;QAAE,MAAM,IAAI,UAAU,CAAC,oEAAoE,CAAC,CAAC;IACtG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,MAAM,GAAG,GAAiB,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1D,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,EAAE,IAAI,KAAK,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,CACtH,CAAC;IACF,OAAO,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /** One instance's glue: see tda_wasm.js. */
4
+ export interface TdaWasmGlue {
5
+ /** The bound functions and classes. */
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ readonly exports: Record<string, any>;
8
+ /** The imports to instantiate the module with. */
9
+ imports(): WebAssembly.Imports;
10
+ /** Takes the instance; call once, before any export. */
11
+ finalize(instance: WebAssembly.Instance, module: WebAssembly.Module): unknown;
12
+ }
13
+ export function __tda_create(): TdaWasmGlue;