@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,2528 @@
1
+ /* @ts-self-types="./tda_wasm.d.ts" */
2
+ /**
3
+ * wasm-bindgen's glue (--target web) for tda.wasm, wrapped in a
4
+ * factory: each __tda_create() holds the
5
+ * state of one instance, so that every load() has a module object of its
6
+ * own. instantiate the module with imports(), then call finalize(instance,
7
+ * module); exports are the bound functions and classes.
8
+ */
9
+ export function __tda_create() {
10
+
11
+ /**
12
+ * The native snapshot behind `prepareComplex` (src/prepared.ts). `delete()`
13
+ * frees it;
14
+ * wasm-bindgen's `free()` does too.
15
+ */
16
+ class PreparedComplex {
17
+ __destroy_into_raw() {
18
+ const ptr = this.__wbg_ptr;
19
+ this.__wbg_ptr = 0;
20
+ PreparedComplexFinalization.unregister(this);
21
+ return ptr;
22
+ }
23
+ free() {
24
+ if (this.__oomEpoch !== undefined && this.__oomEpoch !== __oomEpoch) throw new Error("wasm handle is invalid after instance recovery or unload");
25
+ const context = { function: "free", input: {...this.__oomContext?.input,}, parameters: {} };
26
+ const copies = [];
27
+ __oomBegin();
28
+ try {
29
+ const ptr = this.__destroy_into_raw();
30
+ wasm.__wbg_preparedcomplex_free(ptr, 0);
31
+
32
+ } catch (error) {
33
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
34
+ throw __oomNormalize(error, context);
35
+ }
36
+ }
37
+ /**
38
+ * Frees the object, as src/prepared.ts calls it.
39
+ */
40
+ delete() {
41
+ if (this.__oomEpoch !== undefined && this.__oomEpoch !== __oomEpoch) throw new Error("wasm handle is invalid after instance recovery or unload");
42
+ const context = { function: "delete", input: {...this.__oomContext?.input,}, parameters: {} };
43
+ const copies = [];
44
+ __oomBegin();
45
+ try {
46
+ const ptr = this.__destroy_into_raw();
47
+ wasm.preparedcomplex_delete(ptr);
48
+
49
+ } catch (error) {
50
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
51
+ throw __oomNormalize(error, context);
52
+ }
53
+ }
54
+ /**
55
+ * @returns {number}
56
+ */
57
+ static liveCount() {
58
+ const context = { function: "liveCount", input: {...this.__oomContext?.input,}, parameters: {} };
59
+ const copies = [];
60
+ __oomBegin();
61
+ try {
62
+ copies.length = 0;
63
+
64
+ const ret = wasm.preparedcomplex_liveCount();
65
+ return ret >>> 0;
66
+
67
+ } catch (error) {
68
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
69
+ throw __oomNormalize(error, context);
70
+ }
71
+ }
72
+ /**
73
+ * @param {Int32Array} vertices
74
+ * @param {Uint32Array} offsets
75
+ * @param {Float64Array} filtrations
76
+ */
77
+ constructor(vertices, offsets, filtrations) {
78
+ const context = { function: "prepareComplex", input: {...this.__oomContext?.input,"vertices": vertices.length,"offsets": offsets.length,"filtrations": filtrations.length}, parameters: {} };
79
+ const copies = [];
80
+ __oomBegin();
81
+ try {
82
+ const ptr0 = passArray32ToWasm0(vertices, (size, align) => __oomAllocate(size, align, copies, context));
83
+ const len0 = WASM_VECTOR_LEN;
84
+ const ptr1 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
85
+ const len1 = WASM_VECTOR_LEN;
86
+ const ptr2 = passArrayF64ToWasm0(filtrations, (size, align) => __oomAllocate(size, align, copies, context));
87
+ const len2 = WASM_VECTOR_LEN;
88
+ copies.length = 0;
89
+ const ret = wasm.preparedcomplex_new(ptr0, len0, ptr1, len1, ptr2, len2);
90
+ if (ret[2]) {
91
+ throw takeFromExternrefTable0(ret[1]);
92
+ }
93
+ this.__wbg_ptr = ret[0];
94
+ this.__oomEpoch = __oomEpoch;
95
+ this.__oomContext = context;
96
+ PreparedComplexFinalization.register(this, {ptr:this.__wbg_ptr, epoch:__oomEpoch}, this);
97
+ return this;
98
+
99
+ } catch (error) {
100
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
101
+ throw __oomNormalize(error, context);
102
+ }
103
+ }
104
+ /**
105
+ * @param {number} coeff_field
106
+ * @returns {Float64Array}
107
+ */
108
+ persistence(coeff_field) {
109
+ if (this.__oomEpoch !== undefined && this.__oomEpoch !== __oomEpoch) throw new Error("wasm handle is invalid after instance recovery or unload");
110
+ const context = { function: "persistence", input: {...this.__oomContext?.input,}, parameters: {"coeff": coeff_field} };
111
+ const copies = [];
112
+ __oomBegin();
113
+ try {
114
+ copies.length = 0;
115
+
116
+ const ret = wasm.preparedcomplex_persistence(this.__wbg_ptr, coeff_field);
117
+ if (ret[3]) {
118
+ throw takeFromExternrefTable0(ret[2]);
119
+ }
120
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
121
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
122
+ throw error;
123
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
124
+
125
+ } catch (error) {
126
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
127
+ throw __oomNormalize(error, context);
128
+ }
129
+ }
130
+ }
131
+ if (Symbol.dispose) PreparedComplex.prototype[Symbol.dispose] = PreparedComplex.prototype.free;
132
+
133
+ /**
134
+ * The native augmented arrangement behind `augmentedArrangement`
135
+ * (src/arrangement.ts). `delete()` frees it, as for `PreparedComplex`;
136
+ * wasm-bindgen's `free()` does too.
137
+ */
138
+ class TwoParameterArrangement {
139
+ __destroy_into_raw() {
140
+ const ptr = this.__wbg_ptr;
141
+ this.__wbg_ptr = 0;
142
+ TwoParameterArrangementFinalization.unregister(this);
143
+ return ptr;
144
+ }
145
+ free() {
146
+ if (this.__oomEpoch !== undefined && this.__oomEpoch !== __oomEpoch) throw new Error("wasm handle is invalid after instance recovery or unload");
147
+ const context = { function: "free", input: {...this.__oomContext?.input,}, parameters: {} };
148
+ const copies = [];
149
+ __oomBegin();
150
+ try {
151
+ const ptr = this.__destroy_into_raw();
152
+ wasm.__wbg_twoparameterarrangement_free(ptr, 0);
153
+
154
+ } catch (error) {
155
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
156
+ throw __oomNormalize(error, context);
157
+ }
158
+ }
159
+ /**
160
+ * The anchors as grades `[x, y, ...]`.
161
+ * @returns {Float64Array}
162
+ */
163
+ anchors() {
164
+ if (this.__oomEpoch !== undefined && this.__oomEpoch !== __oomEpoch) throw new Error("wasm handle is invalid after instance recovery or unload");
165
+ const context = { function: "augmentedArrangement", input: {...this.__oomContext?.input,}, parameters: {} };
166
+ const copies = [];
167
+ __oomBegin();
168
+ try {
169
+ copies.length = 0;
170
+
171
+ const ret = wasm.twoparameterarrangement_anchors(this.__wbg_ptr);
172
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
173
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
174
+ throw error;
175
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
176
+
177
+ } catch (error) {
178
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
179
+ throw __oomNormalize(error, context);
180
+ }
181
+ }
182
+ /**
183
+ * `{ pairs, offsets, lines }`, as `presentationSliceFlat`.
184
+ * @param {Float64Array} lines
185
+ * @param {Uint8Array} angles
186
+ * @returns {any}
187
+ */
188
+ barcodes(lines, angles) {
189
+ if (this.__oomEpoch !== undefined && this.__oomEpoch !== __oomEpoch) throw new Error("wasm handle is invalid after instance recovery or unload");
190
+ const context = { function: "AugmentedArrangement.fiberedBarcode", input: {...this.__oomContext?.input,"lines": lines.length,"angles": angles.length}, parameters: {} };
191
+ const copies = [];
192
+ __oomBegin();
193
+ try {
194
+ const ptr0 = passArrayF64ToWasm0(lines, (size, align) => __oomAllocate(size, align, copies, context));
195
+ const len0 = WASM_VECTOR_LEN;
196
+ const ptr1 = passArray8ToWasm0(angles, (size, align) => __oomAllocate(size, align, copies, context));
197
+ const len1 = WASM_VECTOR_LEN;
198
+ copies.length = 0;
199
+ const ret = wasm.twoparameterarrangement_barcodes(this.__wbg_ptr, ptr0, len0, ptr1, len1);
200
+ if (ret[2]) {
201
+ throw takeFromExternrefTable0(ret[1]);
202
+ }
203
+ return takeFromExternrefTable0(ret[0]);
204
+
205
+ } catch (error) {
206
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
207
+ throw __oomNormalize(error, context);
208
+ }
209
+ }
210
+ /**
211
+ * Frees the object.
212
+ */
213
+ delete() {
214
+ if (this.__oomEpoch !== undefined && this.__oomEpoch !== __oomEpoch) throw new Error("wasm handle is invalid after instance recovery or unload");
215
+ const context = { function: "delete", input: {...this.__oomContext?.input,}, parameters: {} };
216
+ const copies = [];
217
+ __oomBegin();
218
+ try {
219
+ const ptr = this.__destroy_into_raw();
220
+ wasm.twoparameterarrangement_delete(ptr);
221
+
222
+ } catch (error) {
223
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
224
+ throw __oomNormalize(error, context);
225
+ }
226
+ }
227
+ /**
228
+ * @returns {number}
229
+ */
230
+ static liveCount() {
231
+ const context = { function: "liveCount", input: {...this.__oomContext?.input,}, parameters: {} };
232
+ const copies = [];
233
+ __oomBegin();
234
+ try {
235
+ copies.length = 0;
236
+
237
+ const ret = wasm.twoparameterarrangement_liveCount();
238
+ return ret >>> 0;
239
+
240
+ } catch (error) {
241
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
242
+ throw __oomNormalize(error, context);
243
+ }
244
+ }
245
+ /**
246
+ * @param {Float64Array} xs
247
+ * @param {Float64Array} ys
248
+ * @param {Uint32Array} generators
249
+ * @param {Uint32Array} relations
250
+ * @param {Uint32Array} offsets
251
+ * @param {Uint32Array} rows
252
+ */
253
+ constructor(xs, ys, generators, relations, offsets, rows) {
254
+ const context = { function: "augmentedArrangement", input: {...this.__oomContext?.input,"xs": xs.length,"ys": ys.length,"generators": generators.length,"relations": relations.length,"offsets": offsets.length,"rows": rows.length}, parameters: {} };
255
+ const copies = [];
256
+ __oomBegin();
257
+ try {
258
+ const ptr0 = passArrayF64ToWasm0(xs, (size, align) => __oomAllocate(size, align, copies, context));
259
+ const len0 = WASM_VECTOR_LEN;
260
+ const ptr1 = passArrayF64ToWasm0(ys, (size, align) => __oomAllocate(size, align, copies, context));
261
+ const len1 = WASM_VECTOR_LEN;
262
+ const ptr2 = passArray32ToWasm0(generators, (size, align) => __oomAllocate(size, align, copies, context));
263
+ const len2 = WASM_VECTOR_LEN;
264
+ const ptr3 = passArray32ToWasm0(relations, (size, align) => __oomAllocate(size, align, copies, context));
265
+ const len3 = WASM_VECTOR_LEN;
266
+ const ptr4 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
267
+ const len4 = WASM_VECTOR_LEN;
268
+ const ptr5 = passArray32ToWasm0(rows, (size, align) => __oomAllocate(size, align, copies, context));
269
+ const len5 = WASM_VECTOR_LEN;
270
+ copies.length = 0;
271
+ const ret = wasm.twoparameterarrangement_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
272
+ if (ret[2]) {
273
+ throw takeFromExternrefTable0(ret[1]);
274
+ }
275
+ this.__wbg_ptr = ret[0];
276
+ this.__oomEpoch = __oomEpoch;
277
+ this.__oomContext = context;
278
+ TwoParameterArrangementFinalization.register(this, {ptr:this.__wbg_ptr, epoch:__oomEpoch}, this);
279
+ return this;
280
+
281
+ } catch (error) {
282
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
283
+ throw __oomNormalize(error, context);
284
+ }
285
+ }
286
+ /**
287
+ * `[anchors, vertices, faces, templates, transpositions, reductions]`.
288
+ * @returns {Float64Array}
289
+ */
290
+ stats() {
291
+ if (this.__oomEpoch !== undefined && this.__oomEpoch !== __oomEpoch) throw new Error("wasm handle is invalid after instance recovery or unload");
292
+ const context = { function: "augmentedArrangement", input: {...this.__oomContext?.input,}, parameters: {} };
293
+ const copies = [];
294
+ __oomBegin();
295
+ try {
296
+ copies.length = 0;
297
+
298
+ const ret = wasm.twoparameterarrangement_stats(this.__wbg_ptr);
299
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
300
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
301
+ throw error;
302
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
303
+
304
+ } catch (error) {
305
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
306
+ throw __oomNormalize(error, context);
307
+ }
308
+ }
309
+ }
310
+ if (Symbol.dispose) TwoParameterArrangement.prototype[Symbol.dispose] = TwoParameterArrangement.prototype.free;
311
+
312
+ /**
313
+ * @param {Float64Array} diagram
314
+ * @param {Float64Array} grid
315
+ * @returns {Float64Array}
316
+ */
317
+ function bettiCurveFlat(diagram, grid) {
318
+ const context = { function: "bettiCurve", input: {"diagram": diagram.length,"grid": grid.length}, parameters: {} };
319
+ const copies = [];
320
+ __oomBegin();
321
+ try {
322
+ const ptr0 = passArrayF64ToWasm0(diagram, (size, align) => __oomAllocate(size, align, copies, context));
323
+ const len0 = WASM_VECTOR_LEN;
324
+ const ptr1 = passArrayF64ToWasm0(grid, (size, align) => __oomAllocate(size, align, copies, context));
325
+ const len1 = WASM_VECTOR_LEN;
326
+ copies.length = 0;
327
+ const ret = wasm.bettiCurveFlat(ptr0, len0, ptr1, len1);
328
+ if (ret[3]) {
329
+ throw takeFromExternrefTable0(ret[2]);
330
+ }
331
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
332
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
333
+ throw error;
334
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
335
+
336
+ } catch (error) {
337
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
338
+ throw __oomNormalize(error, context);
339
+ }
340
+ }
341
+
342
+ /**
343
+ * @param {Float64Array} diagram
344
+ * @param {number} t
345
+ * @returns {Float64Array}
346
+ */
347
+ function bettiNumbersFlat(diagram, t) {
348
+ const context = { function: "bettiNumbers", input: {"diagram": diagram.length}, parameters: {"t": t} };
349
+ const copies = [];
350
+ __oomBegin();
351
+ try {
352
+ const ptr0 = passArrayF64ToWasm0(diagram, (size, align) => __oomAllocate(size, align, copies, context));
353
+ const len0 = WASM_VECTOR_LEN;
354
+ copies.length = 0;
355
+ const ret = wasm.bettiNumbersFlat(ptr0, len0, t);
356
+ if (ret[3]) {
357
+ throw takeFromExternrefTable0(ret[2]);
358
+ }
359
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
360
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
361
+ throw error;
362
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
363
+
364
+ } catch (error) {
365
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
366
+ throw __oomNormalize(error, context);
367
+ }
368
+ }
369
+
370
+ /**
371
+ * @param {Uint8Array} dims
372
+ * @param {Float64Array} grades
373
+ * @param {Uint32Array} offsets
374
+ * @param {Uint32Array} facets
375
+ * @param {number} degree
376
+ * @returns {any}
377
+ */
378
+ function bifiltrationPresentationFlat(dims, grades, offsets, facets, degree) {
379
+ const context = { function: "bifiltrationPresentation", input: {"dims": dims.length,"grades": grades.length,"offsets": offsets.length,"facets": facets.length}, parameters: {"degree": degree} };
380
+ const copies = [];
381
+ __oomBegin();
382
+ try {
383
+ const ptr0 = passArray8ToWasm0(dims, (size, align) => __oomAllocate(size, align, copies, context));
384
+ const len0 = WASM_VECTOR_LEN;
385
+ const ptr1 = passArrayF64ToWasm0(grades, (size, align) => __oomAllocate(size, align, copies, context));
386
+ const len1 = WASM_VECTOR_LEN;
387
+ const ptr2 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
388
+ const len2 = WASM_VECTOR_LEN;
389
+ const ptr3 = passArray32ToWasm0(facets, (size, align) => __oomAllocate(size, align, copies, context));
390
+ const len3 = WASM_VECTOR_LEN;
391
+ copies.length = 0;
392
+ const ret = wasm.bifiltrationPresentationFlat(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, degree);
393
+ if (ret[2]) {
394
+ throw takeFromExternrefTable0(ret[1]);
395
+ }
396
+ return takeFromExternrefTable0(ret[0]);
397
+
398
+ } catch (error) {
399
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
400
+ throw __oomNormalize(error, context);
401
+ }
402
+ }
403
+
404
+ /**
405
+ * @param {Float64Array} points
406
+ * @param {number} dimension
407
+ * @param {number} step_size
408
+ * @param {number} alpha
409
+ * @param {number} max_steps
410
+ * @param {number} max_simplex_dim
411
+ * @param {any} include_box_extents
412
+ * @returns {any}
413
+ */
414
+ function boxFiltrationFlat(points, dimension, step_size, alpha, max_steps, max_simplex_dim, include_box_extents) {
415
+ const context = { function: "boxFiltration", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"step_size": step_size,"alpha": alpha,"max_steps": max_steps,"maxDim": max_simplex_dim,"include_box_extents": include_box_extents} };
416
+ const copies = [];
417
+ __oomBegin();
418
+ try {
419
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
420
+ const len0 = WASM_VECTOR_LEN;
421
+ copies.length = 0;
422
+ const ret = wasm.boxFiltrationFlat(ptr0, len0, dimension, step_size, alpha, max_steps, max_simplex_dim, include_box_extents);
423
+ if (ret[2]) {
424
+ throw takeFromExternrefTable0(ret[1]);
425
+ }
426
+ return takeFromExternrefTable0(ret[0]);
427
+
428
+ } catch (error) {
429
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
430
+ throw __oomNormalize(error, context);
431
+ }
432
+ }
433
+
434
+ /**
435
+ * @param {Float64Array} points
436
+ * @param {number} dimension
437
+ * @param {number} step_size
438
+ * @param {number} alpha
439
+ * @param {number} max_steps
440
+ * @param {number} max_simplex_dim
441
+ * @param {any} include_box_extents
442
+ * @param {number} coeff_field
443
+ * @param {any} with_simplices
444
+ * @returns {any}
445
+ */
446
+ function boxFiltrationPipeline(points, dimension, step_size, alpha, max_steps, max_simplex_dim, include_box_extents, coeff_field, with_simplices) {
447
+ const context = { function: "boxFiltrationPersistence", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"step_size": step_size,"alpha": alpha,"max_steps": max_steps,"maxDim": max_simplex_dim,"include_box_extents": include_box_extents,"coeff": coeff_field,"complex": with_simplices} };
448
+ const copies = [];
449
+ __oomBegin();
450
+ try {
451
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
452
+ const len0 = WASM_VECTOR_LEN;
453
+ copies.length = 0;
454
+ const ret = wasm.boxFiltrationPipeline(ptr0, len0, dimension, step_size, alpha, max_steps, max_simplex_dim, include_box_extents, coeff_field, with_simplices);
455
+ if (ret[2]) {
456
+ throw takeFromExternrefTable0(ret[1]);
457
+ }
458
+ return takeFromExternrefTable0(ret[0]);
459
+
460
+ } catch (error) {
461
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
462
+ throw __oomNormalize(error, context);
463
+ }
464
+ }
465
+
466
+ /**
467
+ * @param {Float64Array} points
468
+ * @param {number} dimension
469
+ * @param {number} max_radius
470
+ * @param {number} max_simplex_dimension
471
+ * @returns {any}
472
+ */
473
+ function cechComplexFlat(points, dimension, max_radius, max_simplex_dimension) {
474
+ const context = { function: "cechComplex", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"maxRadius": max_radius,"maxDim": max_simplex_dimension} };
475
+ const copies = [];
476
+ __oomBegin();
477
+ try {
478
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
479
+ const len0 = WASM_VECTOR_LEN;
480
+ copies.length = 0;
481
+ const ret = wasm.cechComplexFlat(ptr0, len0, dimension, max_radius, max_simplex_dimension);
482
+ if (ret[2]) {
483
+ throw takeFromExternrefTable0(ret[1]);
484
+ }
485
+ return takeFromExternrefTable0(ret[0]);
486
+
487
+ } catch (error) {
488
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
489
+ throw __oomNormalize(error, context);
490
+ }
491
+ }
492
+
493
+ /**
494
+ * `{ simplices?, pairs }` or `{ simplices?, empty: true }`, as the glue's
495
+ * `pipelineResult`; for points in dimension 1 to 3 its
496
+ * `bulkPipelineResult` of the Delaunay–Čech complex (the same shape).
497
+ * @param {Float64Array} points
498
+ * @param {number} dimension
499
+ * @param {number} max_radius
500
+ * @param {number} max_simplex_dimension
501
+ * @param {number} coeff_field
502
+ * @param {any} with_simplices
503
+ * @returns {any}
504
+ */
505
+ function cechPipeline(points, dimension, max_radius, max_simplex_dimension, coeff_field, with_simplices) {
506
+ const context = { function: "cechPersistence", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"maxRadius": max_radius,"maxDim": max_simplex_dimension,"coeff": coeff_field,"complex": with_simplices} };
507
+ const copies = [];
508
+ __oomBegin();
509
+ try {
510
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
511
+ const len0 = WASM_VECTOR_LEN;
512
+ copies.length = 0;
513
+ const ret = wasm.cechPipeline(ptr0, len0, dimension, max_radius, max_simplex_dimension, coeff_field, with_simplices);
514
+ if (ret[2]) {
515
+ throw takeFromExternrefTable0(ret[1]);
516
+ }
517
+ return takeFromExternrefTable0(ret[0]);
518
+
519
+ } catch (error) {
520
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
521
+ throw __oomNormalize(error, context);
522
+ }
523
+ }
524
+
525
+ /**
526
+ * @param {Float64Array} points
527
+ * @param {number} dimension
528
+ * @param {number} neighborhood_size
529
+ * @param {number} axes_ratio
530
+ * @returns {Float64Array}
531
+ */
532
+ function computeEllipsoidGeometry(points, dimension, neighborhood_size, axes_ratio) {
533
+ const context = { function: "ellipsoids", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"neighborhood_size": neighborhood_size,"axes_ratio": axes_ratio} };
534
+ const copies = [];
535
+ __oomBegin();
536
+ try {
537
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
538
+ const len0 = WASM_VECTOR_LEN;
539
+ copies.length = 0;
540
+ const ret = wasm.computeEllipsoidGeometry(ptr0, len0, dimension, neighborhood_size, axes_ratio);
541
+ if (ret[3]) {
542
+ throw takeFromExternrefTable0(ret[2]);
543
+ }
544
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
545
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
546
+ throw error;
547
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
548
+
549
+ } catch (error) {
550
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
551
+ throw __oomNormalize(error, context);
552
+ }
553
+ }
554
+
555
+ /**
556
+ * @param {Float64Array} points
557
+ * @param {number} q
558
+ * @param {number} theta
559
+ * @param {Float64Array} normals_or_k
560
+ * @returns {Float64Array}
561
+ */
562
+ function computeWingGeometry(points, q, theta, normals_or_k) {
563
+ const context = { function: "wings", input: {"points": points.length,"normals_or_k": normals_or_k.length}, parameters: {"q": q,"theta": theta} };
564
+ const copies = [];
565
+ __oomBegin();
566
+ try {
567
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
568
+ const len0 = WASM_VECTOR_LEN;
569
+ const ptr1 = passArrayF64ToWasm0(normals_or_k, (size, align) => __oomAllocate(size, align, copies, context));
570
+ const len1 = WASM_VECTOR_LEN;
571
+ copies.length = 0;
572
+ const ret = wasm.computeWingGeometry(ptr0, len0, q, theta, ptr1, len1);
573
+ if (ret[3]) {
574
+ throw takeFromExternrefTable0(ret[2]);
575
+ }
576
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
577
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
578
+ throw error;
579
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
580
+
581
+ } catch (error) {
582
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
583
+ throw __oomNormalize(error, context);
584
+ }
585
+ }
586
+
587
+ /**
588
+ * @param {Float64Array} points
589
+ * @param {Float64Array} colors
590
+ * @param {number} max_squared_radius
591
+ * @param {number} max_simplex_dimension
592
+ * @returns {any}
593
+ */
594
+ function coupledAlphaComplex2DFlat(points, colors, max_squared_radius, max_simplex_dimension) {
595
+ const context = { function: "coupledAlphaComplex", input: {"points": points.length,"colors": colors.length}, parameters: {"maxSquaredRadius": max_squared_radius,"maxDim": max_simplex_dimension} };
596
+ const copies = [];
597
+ __oomBegin();
598
+ try {
599
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
600
+ const len0 = WASM_VECTOR_LEN;
601
+ const ptr1 = passArrayF64ToWasm0(colors, (size, align) => __oomAllocate(size, align, copies, context));
602
+ const len1 = WASM_VECTOR_LEN;
603
+ copies.length = 0;
604
+ const ret = wasm.coupledAlphaComplex2DFlat(ptr0, len0, ptr1, len1, max_squared_radius, max_simplex_dimension);
605
+ if (ret[2]) {
606
+ throw takeFromExternrefTable0(ret[1]);
607
+ }
608
+ return takeFromExternrefTable0(ret[0]);
609
+
610
+ } catch (error) {
611
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
612
+ throw __oomNormalize(error, context);
613
+ }
614
+ }
615
+
616
+ /**
617
+ * @param {Uint32Array} dimensions
618
+ * @param {Float64Array} values
619
+ * @returns {any}
620
+ */
621
+ function cubicalComplexFlat(dimensions, values) {
622
+ const context = { function: "cubicalComplex", input: {shape: Array.from(dimensions), cells: values.length}, parameters: {} };
623
+ const copies = [];
624
+ __oomBegin();
625
+ try {
626
+ const ptr0 = passArray32ToWasm0(dimensions, (size, align) => __oomAllocate(size, align, copies, context));
627
+ const len0 = WASM_VECTOR_LEN;
628
+ const ptr1 = passArrayF64ToWasm0(values, (size, align) => __oomAllocate(size, align, copies, context));
629
+ const len1 = WASM_VECTOR_LEN;
630
+ copies.length = 0;
631
+ const ret = wasm.cubicalComplexFlat(ptr0, len0, ptr1, len1);
632
+ if (ret[2]) {
633
+ throw takeFromExternrefTable0(ret[1]);
634
+ }
635
+ return takeFromExternrefTable0(ret[0]);
636
+
637
+ } catch (error) {
638
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
639
+ throw __oomNormalize(error, context);
640
+ }
641
+ }
642
+
643
+ /**
644
+ * @param {Uint32Array} dimensions
645
+ * @param {Float64Array} values
646
+ * @param {number} coeff_field
647
+ * @returns {Float64Array}
648
+ */
649
+ function cubicalPersistenceFlat(dimensions, values, coeff_field) {
650
+ const context = { function: "cubicalPersistence", input: {shape: Array.from(dimensions), cells: values.length}, parameters: {"coeff": coeff_field} };
651
+ const copies = [];
652
+ __oomBegin();
653
+ try {
654
+ const ptr0 = passArray32ToWasm0(dimensions, (size, align) => __oomAllocate(size, align, copies, context));
655
+ const len0 = WASM_VECTOR_LEN;
656
+ const ptr1 = passArrayF64ToWasm0(values, (size, align) => __oomAllocate(size, align, copies, context));
657
+ const len1 = WASM_VECTOR_LEN;
658
+ copies.length = 0;
659
+ const ret = wasm.cubicalPersistenceFlat(ptr0, len0, ptr1, len1, coeff_field);
660
+ if (ret[3]) {
661
+ throw takeFromExternrefTable0(ret[2]);
662
+ }
663
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
664
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
665
+ throw error;
666
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
667
+
668
+ } catch (error) {
669
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
670
+ throw __oomNormalize(error, context);
671
+ }
672
+ }
673
+
674
+ /**
675
+ * @param {Float64Array} values
676
+ * @param {number} width
677
+ * @param {number} height
678
+ * @returns {Float64Array}
679
+ */
680
+ function cubicalVertexPersistenceFlat(values, width, height) {
681
+ const context = { function: "cubicalPersistence", input: {shape:[width,height], cells:values.length}, parameters: {coeff:2,construction:"V"} };
682
+ const copies = [];
683
+ __oomBegin();
684
+ try {
685
+ const ptr0 = passArrayF64ToWasm0(values, (size, align) => __oomAllocate(size, align, copies, context));
686
+ const len0 = WASM_VECTOR_LEN;
687
+ copies.length = 0;
688
+ const ret = wasm.cubicalVertexPersistenceFlat(ptr0, len0, width, height);
689
+ if (ret[3]) {
690
+ throw takeFromExternrefTable0(ret[2]);
691
+ }
692
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
693
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
694
+ throw error;
695
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
696
+
697
+ } catch (error) {
698
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
699
+ throw __oomNormalize(error, context);
700
+ }
701
+ }
702
+
703
+ /**
704
+ * @param {Uint32Array} dimensions
705
+ * @param {Float64Array} frames
706
+ * @param {number} frame_count
707
+ * @param {number} min_persistence
708
+ * @param {number} coeff_field
709
+ * @param {Float64Array} rep_times
710
+ * @param {any} with_reps
711
+ * @param {Uint32Array} rep_dims
712
+ * @param {any} filter_dims
713
+ * @returns {any}
714
+ */
715
+ function cubicalVineyardFlat(dimensions, frames, frame_count, min_persistence, coeff_field, rep_times, with_reps, rep_dims, filter_dims) {
716
+ const context = { function: "cubicalVineyard", input: {shape: Array.from(dimensions), images: frame_count, values: frames.length}, parameters: {"frame_count": frame_count,"minPersistence": min_persistence,"coeff": coeff_field,"with_reps": with_reps,"filter_dims": filter_dims} };
717
+ const copies = [];
718
+ __oomBegin();
719
+ try {
720
+ const ptr0 = passArray32ToWasm0(dimensions, (size, align) => __oomAllocate(size, align, copies, context));
721
+ const len0 = WASM_VECTOR_LEN;
722
+ const ptr1 = passArrayF64ToWasm0(frames, (size, align) => __oomAllocate(size, align, copies, context));
723
+ const len1 = WASM_VECTOR_LEN;
724
+ const ptr2 = passArrayF64ToWasm0(rep_times, (size, align) => __oomAllocate(size, align, copies, context));
725
+ const len2 = WASM_VECTOR_LEN;
726
+ const ptr3 = passArray32ToWasm0(rep_dims, (size, align) => __oomAllocate(size, align, copies, context));
727
+ const len3 = WASM_VECTOR_LEN;
728
+ copies.length = 0;
729
+ const ret = wasm.cubicalVineyardFlat(ptr0, len0, ptr1, len1, frame_count, min_persistence, coeff_field, ptr2, len2, with_reps, ptr3, len3, filter_dims);
730
+ if (ret[2]) {
731
+ throw takeFromExternrefTable0(ret[1]);
732
+ }
733
+ return takeFromExternrefTable0(ret[0]);
734
+
735
+ } catch (error) {
736
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
737
+ throw __oomNormalize(error, context);
738
+ }
739
+ }
740
+
741
+ /**
742
+ * @param {Float64Array} points
743
+ * @param {number} dimension
744
+ * @param {number} threshold
745
+ * @param {number} degree
746
+ * @returns {any}
747
+ */
748
+ function degreeRipsPresentationFlat(points, dimension, threshold, degree) {
749
+ const context = { function: "degreeRipsPresentation", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"maxEdgeLength": threshold,"degree": degree} };
750
+ const copies = [];
751
+ __oomBegin();
752
+ try {
753
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
754
+ const len0 = WASM_VECTOR_LEN;
755
+ copies.length = 0;
756
+ const ret = wasm.degreeRipsPresentationFlat(ptr0, len0, dimension, threshold, degree);
757
+ if (ret[2]) {
758
+ throw takeFromExternrefTable0(ret[1]);
759
+ }
760
+ return takeFromExternrefTable0(ret[0]);
761
+
762
+ } catch (error) {
763
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
764
+ throw __oomNormalize(error, context);
765
+ }
766
+ }
767
+
768
+ /**
769
+ * @param {Float64Array} matrix
770
+ * @param {number} num_points
771
+ * @param {number} threshold
772
+ * @param {number} degree
773
+ * @returns {any}
774
+ */
775
+ function degreeRipsPresentationFromMatrixFlat(matrix, num_points, threshold, degree) {
776
+ const context = { function: "degreeRipsPresentation", input: {rows: num_points, columns: num_points, entries: matrix.length}, parameters: {"num_points": num_points,"maxEdgeLength": threshold,"degree": degree} };
777
+ const copies = [];
778
+ __oomBegin();
779
+ try {
780
+ const ptr0 = passArrayF64ToWasm0(matrix, (size, align) => __oomAllocate(size, align, copies, context));
781
+ const len0 = WASM_VECTOR_LEN;
782
+ copies.length = 0;
783
+ const ret = wasm.degreeRipsPresentationFromMatrixFlat(ptr0, len0, num_points, threshold, degree);
784
+ if (ret[2]) {
785
+ throw takeFromExternrefTable0(ret[1]);
786
+ }
787
+ return takeFromExternrefTable0(ret[0]);
788
+
789
+ } catch (error) {
790
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
791
+ throw __oomNormalize(error, context);
792
+ }
793
+ }
794
+
795
+ /**
796
+ * @param {Float64Array} points
797
+ * @param {number} dimension
798
+ * @param {number} max_radius
799
+ * @param {number} max_simplex_dimension
800
+ * @param {number} flat_tolerance
801
+ * @returns {any}
802
+ */
803
+ function delaunayCechComplexFlat(points, dimension, max_radius, max_simplex_dimension, flat_tolerance) {
804
+ const context = { function: "delaunayCechComplex", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"maxRadius": max_radius,"maxDim": max_simplex_dimension,"flatTolerance": (Number.isNaN(flat_tolerance) ? undefined : flat_tolerance)} };
805
+ const copies = [];
806
+ __oomBegin();
807
+ try {
808
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
809
+ const len0 = WASM_VECTOR_LEN;
810
+ copies.length = 0;
811
+ const ret = wasm.delaunayCechComplexFlat(ptr0, len0, dimension, max_radius, max_simplex_dimension, flat_tolerance);
812
+ if (ret[2]) {
813
+ throw takeFromExternrefTable0(ret[1]);
814
+ }
815
+ return takeFromExternrefTable0(ret[0]);
816
+
817
+ } catch (error) {
818
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
819
+ throw __oomNormalize(error, context);
820
+ }
821
+ }
822
+
823
+ /**
824
+ * @param {Float64Array} d
825
+ * @param {Float64Array} e
826
+ * @returns {Float64Array}
827
+ */
828
+ function diagramBottleneckFlat(d, e) {
829
+ const context = { function: "diagramBottleneck", input: {n:d.length/2,m:e.length/2}, parameters: {} };
830
+ const copies = [];
831
+ __oomBegin();
832
+ try {
833
+ const ptr0 = passArrayF64ToWasm0(d, (size, align) => __oomAllocate(size, align, copies, context));
834
+ const len0 = WASM_VECTOR_LEN;
835
+ const ptr1 = passArrayF64ToWasm0(e, (size, align) => __oomAllocate(size, align, copies, context));
836
+ const len1 = WASM_VECTOR_LEN;
837
+ copies.length = 0;
838
+ const ret = wasm.diagramBottleneckFlat(ptr0, len0, ptr1, len1);
839
+ if (ret[3]) {
840
+ throw takeFromExternrefTable0(ret[2]);
841
+ }
842
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
843
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
844
+ throw error;
845
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
846
+
847
+ } catch (error) {
848
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
849
+ throw __oomNormalize(error, context);
850
+ }
851
+ }
852
+
853
+ /**
854
+ * @param {Float64Array} d
855
+ * @param {Float64Array} e
856
+ * @param {number} order
857
+ * @param {number} internal_p
858
+ * @returns {Float64Array}
859
+ */
860
+ function diagramWassersteinFlat(d, e, order, internal_p) {
861
+ const context = { function: "diagramWasserstein", input: {n:d.length/2,m:e.length/2}, parameters: {"order": order,"internal_p": internal_p} };
862
+ const copies = [];
863
+ __oomBegin();
864
+ try {
865
+ const ptr0 = passArrayF64ToWasm0(d, (size, align) => __oomAllocate(size, align, copies, context));
866
+ const len0 = WASM_VECTOR_LEN;
867
+ const ptr1 = passArrayF64ToWasm0(e, (size, align) => __oomAllocate(size, align, copies, context));
868
+ const len1 = WASM_VECTOR_LEN;
869
+ copies.length = 0;
870
+ const ret = wasm.diagramWassersteinFlat(ptr0, len0, ptr1, len1, order, internal_p);
871
+ if (ret[3]) {
872
+ throw takeFromExternrefTable0(ret[2]);
873
+ }
874
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
875
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
876
+ throw error;
877
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
878
+
879
+ } catch (error) {
880
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
881
+ throw __oomNormalize(error, context);
882
+ }
883
+ }
884
+
885
+ /**
886
+ * @param {Float64Array} points
887
+ * @param {number} dimension
888
+ * @param {number} neighborhood_size
889
+ * @param {number} axes_ratio
890
+ * @param {number} max_simplex_dimension
891
+ * @param {number} max_radius
892
+ * @returns {any}
893
+ */
894
+ function ellipsoidCechComplexFlat(points, dimension, neighborhood_size, axes_ratio, max_simplex_dimension, max_radius) {
895
+ const context = { function: "ellipsoidCechComplex", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"neighborhood_size": neighborhood_size,"axes_ratio": axes_ratio,"maxDim": max_simplex_dimension,"maxRadius": max_radius} };
896
+ const copies = [];
897
+ __oomBegin();
898
+ try {
899
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
900
+ const len0 = WASM_VECTOR_LEN;
901
+ copies.length = 0;
902
+ const ret = wasm.ellipsoidCechComplexFlat(ptr0, len0, dimension, neighborhood_size, axes_ratio, max_simplex_dimension, max_radius);
903
+ if (ret[2]) {
904
+ throw takeFromExternrefTable0(ret[1]);
905
+ }
906
+ return takeFromExternrefTable0(ret[0]);
907
+
908
+ } catch (error) {
909
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
910
+ throw __oomNormalize(error, context);
911
+ }
912
+ }
913
+
914
+ /**
915
+ * @param {Float64Array} points
916
+ * @param {number} dimension
917
+ * @param {number} neighborhood_size
918
+ * @param {number} axes_ratio
919
+ * @param {number} max_simplex_dimension
920
+ * @param {number} max_radius
921
+ * @param {number} coeff_field
922
+ * @param {any} with_simplices
923
+ * @returns {any}
924
+ */
925
+ function ellipsoidCechPipeline(points, dimension, neighborhood_size, axes_ratio, max_simplex_dimension, max_radius, coeff_field, with_simplices) {
926
+ const context = { function: "ellipsoidCechPersistence", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"neighborhood_size": neighborhood_size,"axes_ratio": axes_ratio,"maxDim": max_simplex_dimension,"maxRadius": max_radius,"coeff": coeff_field,"complex": with_simplices} };
927
+ const copies = [];
928
+ __oomBegin();
929
+ try {
930
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
931
+ const len0 = WASM_VECTOR_LEN;
932
+ copies.length = 0;
933
+ const ret = wasm.ellipsoidCechPipeline(ptr0, len0, dimension, neighborhood_size, axes_ratio, max_simplex_dimension, max_radius, coeff_field, with_simplices);
934
+ if (ret[2]) {
935
+ throw takeFromExternrefTable0(ret[1]);
936
+ }
937
+ return takeFromExternrefTable0(ret[0]);
938
+
939
+ } catch (error) {
940
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
941
+ throw __oomNormalize(error, context);
942
+ }
943
+ }
944
+
945
+ /**
946
+ * @param {Float64Array} points
947
+ * @param {number} dimension
948
+ * @param {number} neighborhood_size
949
+ * @param {number} axes_ratio
950
+ * @param {number} max_simplex_dimension
951
+ * @param {number} max_filtration
952
+ * @returns {any}
953
+ */
954
+ function ellipsoidRipsComplexFlat(points, dimension, neighborhood_size, axes_ratio, max_simplex_dimension, max_filtration) {
955
+ const context = { function: "ellipsoidRipsComplex", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"neighborhood_size": neighborhood_size,"axes_ratio": axes_ratio,"maxDim": max_simplex_dimension,"max_filtration": max_filtration} };
956
+ const copies = [];
957
+ __oomBegin();
958
+ try {
959
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
960
+ const len0 = WASM_VECTOR_LEN;
961
+ copies.length = 0;
962
+ const ret = wasm.ellipsoidRipsComplexFlat(ptr0, len0, dimension, neighborhood_size, axes_ratio, max_simplex_dimension, max_filtration);
963
+ if (ret[2]) {
964
+ throw takeFromExternrefTable0(ret[1]);
965
+ }
966
+ return takeFromExternrefTable0(ret[0]);
967
+
968
+ } catch (error) {
969
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
970
+ throw __oomNormalize(error, context);
971
+ }
972
+ }
973
+
974
+ /**
975
+ * @param {Float64Array} points
976
+ * @param {number} dimension
977
+ * @param {number} neighborhood_size
978
+ * @param {number} axes_ratio
979
+ * @param {number} max_simplex_dimension
980
+ * @param {number} max_filtration
981
+ * @param {number} coeff_field
982
+ * @param {any} with_simplices
983
+ * @returns {any}
984
+ */
985
+ function ellipsoidRipsPipeline(points, dimension, neighborhood_size, axes_ratio, max_simplex_dimension, max_filtration, coeff_field, with_simplices) {
986
+ const context = { function: "ellipsoidRipsPersistence", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"neighborhood_size": neighborhood_size,"axes_ratio": axes_ratio,"maxDim": max_simplex_dimension,"max_filtration": max_filtration,"coeff": coeff_field,"complex": with_simplices} };
987
+ const copies = [];
988
+ __oomBegin();
989
+ try {
990
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
991
+ const len0 = WASM_VECTOR_LEN;
992
+ copies.length = 0;
993
+ const ret = wasm.ellipsoidRipsPipeline(ptr0, len0, dimension, neighborhood_size, axes_ratio, max_simplex_dimension, max_filtration, coeff_field, with_simplices);
994
+ if (ret[2]) {
995
+ throw takeFromExternrefTable0(ret[1]);
996
+ }
997
+ return takeFromExternrefTable0(ret[0]);
998
+
999
+ } catch (error) {
1000
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1001
+ throw __oomNormalize(error, context);
1002
+ }
1003
+ }
1004
+
1005
+ /**
1006
+ * @param {Float64Array} points
1007
+ * @param {number} dimension
1008
+ * @param {number} num_landmarks
1009
+ * @param {number} max_alpha_square
1010
+ * @param {number} max_simplex_dimension
1011
+ * @returns {any}
1012
+ */
1013
+ function euclideanWitnessComplexFlat(points, dimension, num_landmarks, max_alpha_square, max_simplex_dimension) {
1014
+ const context = { function: "witnessComplex", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"num_landmarks": num_landmarks,"max_alpha_square": max_alpha_square,"maxDim": max_simplex_dimension} };
1015
+ const copies = [];
1016
+ __oomBegin();
1017
+ try {
1018
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
1019
+ const len0 = WASM_VECTOR_LEN;
1020
+ copies.length = 0;
1021
+ const ret = wasm.euclideanWitnessComplexFlat(ptr0, len0, dimension, num_landmarks, max_alpha_square, max_simplex_dimension);
1022
+ if (ret[2]) {
1023
+ throw takeFromExternrefTable0(ret[1]);
1024
+ }
1025
+ return takeFromExternrefTable0(ret[0]);
1026
+
1027
+ } catch (error) {
1028
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1029
+ throw __oomNormalize(error, context);
1030
+ }
1031
+ }
1032
+
1033
+ /**
1034
+ * The minimal presentation of a FIRep.
1035
+ * @param {Float64Array} high_grades
1036
+ * @param {Uint32Array} high_offsets
1037
+ * @param {Uint32Array} high_rows
1038
+ * @param {Float64Array} low_grades
1039
+ * @param {Uint32Array} low_offsets
1040
+ * @param {Uint32Array} low_rows
1041
+ * @param {number} low_rank
1042
+ * @returns {any}
1043
+ */
1044
+ function firepPresentationFlat(high_grades, high_offsets, high_rows, low_grades, low_offsets, low_rows, low_rank) {
1045
+ const context = { function: "firepPresentation", input: {"high_grades": high_grades.length,"high_offsets": high_offsets.length,"high_rows": high_rows.length,"low_grades": low_grades.length,"low_offsets": low_offsets.length,"low_rows": low_rows.length}, parameters: {"low_rank": low_rank} };
1046
+ const copies = [];
1047
+ __oomBegin();
1048
+ try {
1049
+ const ptr0 = passArrayF64ToWasm0(high_grades, (size, align) => __oomAllocate(size, align, copies, context));
1050
+ const len0 = WASM_VECTOR_LEN;
1051
+ const ptr1 = passArray32ToWasm0(high_offsets, (size, align) => __oomAllocate(size, align, copies, context));
1052
+ const len1 = WASM_VECTOR_LEN;
1053
+ const ptr2 = passArray32ToWasm0(high_rows, (size, align) => __oomAllocate(size, align, copies, context));
1054
+ const len2 = WASM_VECTOR_LEN;
1055
+ const ptr3 = passArrayF64ToWasm0(low_grades, (size, align) => __oomAllocate(size, align, copies, context));
1056
+ const len3 = WASM_VECTOR_LEN;
1057
+ const ptr4 = passArray32ToWasm0(low_offsets, (size, align) => __oomAllocate(size, align, copies, context));
1058
+ const len4 = WASM_VECTOR_LEN;
1059
+ const ptr5 = passArray32ToWasm0(low_rows, (size, align) => __oomAllocate(size, align, copies, context));
1060
+ const len5 = WASM_VECTOR_LEN;
1061
+ copies.length = 0;
1062
+ const ret = wasm.firepPresentationFlat(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, low_rank);
1063
+ if (ret[2]) {
1064
+ throw takeFromExternrefTable0(ret[1]);
1065
+ }
1066
+ return takeFromExternrefTable0(ret[0]);
1067
+
1068
+ } catch (error) {
1069
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1070
+ throw __oomNormalize(error, context);
1071
+ }
1072
+ }
1073
+
1074
+ /**
1075
+ * @param {Float64Array} points
1076
+ * @param {number} dimension
1077
+ * @param {Float64Array} _function
1078
+ * @param {number} threshold
1079
+ * @param {number} degree
1080
+ * @returns {any}
1081
+ */
1082
+ function functionRipsPresentationFlat(points, dimension, _function, threshold, degree) {
1083
+ const context = { function: "functionRipsPresentation", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"maxEdgeLength": threshold,"degree": degree} };
1084
+ const copies = [];
1085
+ __oomBegin();
1086
+ try {
1087
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
1088
+ const len0 = WASM_VECTOR_LEN;
1089
+ const ptr1 = passArrayF64ToWasm0(_function, (size, align) => __oomAllocate(size, align, copies, context));
1090
+ const len1 = WASM_VECTOR_LEN;
1091
+ copies.length = 0;
1092
+ const ret = wasm.functionRipsPresentationFlat(ptr0, len0, dimension, ptr1, len1, threshold, degree);
1093
+ if (ret[2]) {
1094
+ throw takeFromExternrefTable0(ret[1]);
1095
+ }
1096
+ return takeFromExternrefTable0(ret[0]);
1097
+
1098
+ } catch (error) {
1099
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1100
+ throw __oomNormalize(error, context);
1101
+ }
1102
+ }
1103
+
1104
+ /**
1105
+ * @param {Float64Array} matrix
1106
+ * @param {number} num_points
1107
+ * @param {Float64Array} _function
1108
+ * @param {number} threshold
1109
+ * @param {number} degree
1110
+ * @returns {any}
1111
+ */
1112
+ function functionRipsPresentationFromMatrixFlat(matrix, num_points, _function, threshold, degree) {
1113
+ const context = { function: "functionRipsPresentation", input: {rows: num_points, columns: num_points, entries: matrix.length}, parameters: {"num_points": num_points,"maxEdgeLength": threshold,"degree": degree} };
1114
+ const copies = [];
1115
+ __oomBegin();
1116
+ try {
1117
+ const ptr0 = passArrayF64ToWasm0(matrix, (size, align) => __oomAllocate(size, align, copies, context));
1118
+ const len0 = WASM_VECTOR_LEN;
1119
+ const ptr1 = passArrayF64ToWasm0(_function, (size, align) => __oomAllocate(size, align, copies, context));
1120
+ const len1 = WASM_VECTOR_LEN;
1121
+ copies.length = 0;
1122
+ const ret = wasm.functionRipsPresentationFromMatrixFlat(ptr0, len0, num_points, ptr1, len1, threshold, degree);
1123
+ if (ret[2]) {
1124
+ throw takeFromExternrefTable0(ret[1]);
1125
+ }
1126
+ return takeFromExternrefTable0(ret[0]);
1127
+
1128
+ } catch (error) {
1129
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1130
+ throw __oomNormalize(error, context);
1131
+ }
1132
+ }
1133
+
1134
+ /**
1135
+ * The test hook: `{ pairs, simplexOffsets, vertices }`.
1136
+ * @param {Int32Array} vertices
1137
+ * @param {Uint32Array} offsets
1138
+ * @param {Float64Array} filtrations
1139
+ * @param {number} coeff_field
1140
+ * @returns {any}
1141
+ */
1142
+ function getPersistentPairs(vertices, offsets, filtrations, coeff_field) {
1143
+ const context = { function: "getPersistentPairs", input: {"vertices": vertices.length,"offsets": offsets.length,"filtrations": filtrations.length}, parameters: {"coeff": coeff_field} };
1144
+ const copies = [];
1145
+ __oomBegin();
1146
+ try {
1147
+ const ptr0 = passArray32ToWasm0(vertices, (size, align) => __oomAllocate(size, align, copies, context));
1148
+ const len0 = WASM_VECTOR_LEN;
1149
+ const ptr1 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
1150
+ const len1 = WASM_VECTOR_LEN;
1151
+ const ptr2 = passArrayF64ToWasm0(filtrations, (size, align) => __oomAllocate(size, align, copies, context));
1152
+ const len2 = WASM_VECTOR_LEN;
1153
+ copies.length = 0;
1154
+ const ret = wasm.getPersistentPairs(ptr0, len0, ptr1, len1, ptr2, len2, coeff_field);
1155
+ if (ret[2]) {
1156
+ throw takeFromExternrefTable0(ret[1]);
1157
+ }
1158
+ return takeFromExternrefTable0(ret[0]);
1159
+
1160
+ } catch (error) {
1161
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1162
+ throw __oomNormalize(error, context);
1163
+ }
1164
+ }
1165
+
1166
+ /**
1167
+ * @param {Float64Array} points
1168
+ * @param {number} k
1169
+ * @param {number} max_squared_radius
1170
+ * @param {number} max_simplex_dim
1171
+ * @returns {any}
1172
+ */
1173
+ function kFoldCoverComplexFlat(points, k, max_squared_radius, max_simplex_dim) {
1174
+ const context = { function: "kFoldCoverComplex", input: {points: points.length / 3, dimension:3, coordinateElements:points.length}, parameters: {"k": k,"maxSquaredRadius": (max_squared_radius === 0 ? Infinity : max_squared_radius),"maxDim": max_simplex_dim} };
1175
+ const copies = [];
1176
+ __oomBegin();
1177
+ try {
1178
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
1179
+ const len0 = WASM_VECTOR_LEN;
1180
+ copies.length = 0;
1181
+ const ret = wasm.kFoldCoverComplexFlat(ptr0, len0, k, max_squared_radius, max_simplex_dim);
1182
+ if (ret[2]) {
1183
+ throw takeFromExternrefTable0(ret[1]);
1184
+ }
1185
+ return takeFromExternrefTable0(ret[0]);
1186
+
1187
+ } catch (error) {
1188
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1189
+ throw __oomNormalize(error, context);
1190
+ }
1191
+ }
1192
+
1193
+ /**
1194
+ * @param {Float64Array} points
1195
+ * @param {number} k
1196
+ * @param {number} max_squared_radius
1197
+ * @param {number} max_simplex_dim
1198
+ * @param {number} coeff_field
1199
+ * @param {any} with_simplices
1200
+ * @returns {any}
1201
+ */
1202
+ function kFoldCoverPipeline(points, k, max_squared_radius, max_simplex_dim, coeff_field, with_simplices) {
1203
+ const context = { function: "kFoldCoverPersistence", input: {points: points.length / 3, dimension:3, coordinateElements:points.length}, parameters: {"k": k,"maxSquaredRadius": (max_squared_radius === 0 ? Infinity : max_squared_radius),"maxDim": max_simplex_dim,"coeff": coeff_field,"complex": with_simplices} };
1204
+ const copies = [];
1205
+ __oomBegin();
1206
+ try {
1207
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
1208
+ const len0 = WASM_VECTOR_LEN;
1209
+ copies.length = 0;
1210
+ const ret = wasm.kFoldCoverPipeline(ptr0, len0, k, max_squared_radius, max_simplex_dim, coeff_field, with_simplices);
1211
+ if (ret[2]) {
1212
+ throw takeFromExternrefTable0(ret[1]);
1213
+ }
1214
+ return takeFromExternrefTable0(ret[0]);
1215
+
1216
+ } catch (error) {
1217
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1218
+ throw __oomNormalize(error, context);
1219
+ }
1220
+ }
1221
+
1222
+ /**
1223
+ * @param {Float64Array} flat
1224
+ * @param {number} min_persistence
1225
+ * @returns {Float64Array}
1226
+ */
1227
+ function longPairsFlat(flat, min_persistence) {
1228
+ const context = { function: "longPairs", input: {"flat": flat.length}, parameters: {"minPersistence": min_persistence} };
1229
+ const copies = [];
1230
+ __oomBegin();
1231
+ try {
1232
+ const ptr0 = passArrayF64ToWasm0(flat, (size, align) => __oomAllocate(size, align, copies, context));
1233
+ const len0 = WASM_VECTOR_LEN;
1234
+ copies.length = 0;
1235
+ const ret = wasm.longPairsFlat(ptr0, len0, min_persistence);
1236
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
1237
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
1238
+ throw error;
1239
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
1240
+
1241
+ } catch (error) {
1242
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1243
+ throw __oomNormalize(error, context);
1244
+ }
1245
+ }
1246
+
1247
+ /**
1248
+ * @param {Uint8Array} dims
1249
+ * @param {Uint32Array} grade_offsets
1250
+ * @param {Float64Array} grades
1251
+ * @param {Uint32Array} offsets
1252
+ * @param {Uint32Array} facets
1253
+ * @param {number} degree
1254
+ * @returns {any}
1255
+ */
1256
+ function multicriticalPresentationFlat(dims, grade_offsets, grades, offsets, facets, degree) {
1257
+ const context = { function: "bifiltrationPresentation", input: {"dims": dims.length,"grade_offsets": grade_offsets.length,"grades": grades.length,"offsets": offsets.length,"facets": facets.length}, parameters: {"degree": degree} };
1258
+ const copies = [];
1259
+ __oomBegin();
1260
+ try {
1261
+ const ptr0 = passArray8ToWasm0(dims, (size, align) => __oomAllocate(size, align, copies, context));
1262
+ const len0 = WASM_VECTOR_LEN;
1263
+ const ptr1 = passArray32ToWasm0(grade_offsets, (size, align) => __oomAllocate(size, align, copies, context));
1264
+ const len1 = WASM_VECTOR_LEN;
1265
+ const ptr2 = passArrayF64ToWasm0(grades, (size, align) => __oomAllocate(size, align, copies, context));
1266
+ const len2 = WASM_VECTOR_LEN;
1267
+ const ptr3 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
1268
+ const len3 = WASM_VECTOR_LEN;
1269
+ const ptr4 = passArray32ToWasm0(facets, (size, align) => __oomAllocate(size, align, copies, context));
1270
+ const len4 = WASM_VECTOR_LEN;
1271
+ copies.length = 0;
1272
+ const ret = wasm.multicriticalPresentationFlat(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, degree);
1273
+ if (ret[2]) {
1274
+ throw takeFromExternrefTable0(ret[1]);
1275
+ }
1276
+ return takeFromExternrefTable0(ret[0]);
1277
+
1278
+ } catch (error) {
1279
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1280
+ throw __oomNormalize(error, context);
1281
+ }
1282
+ }
1283
+
1284
+ /**
1285
+ * @param {Int32Array} vertices
1286
+ * @param {Uint32Array} offsets
1287
+ * @param {Float64Array} filtrations
1288
+ * @param {number} coeff_field
1289
+ * @returns {Float64Array}
1290
+ */
1291
+ function persistenceFlat(vertices, offsets, filtrations, coeff_field) {
1292
+ const context = { function: "persistence", input: {"vertices": vertices.length,"offsets": offsets.length,"filtrations": filtrations.length}, parameters: {"coeff": coeff_field} };
1293
+ const copies = [];
1294
+ __oomBegin();
1295
+ try {
1296
+ const ptr0 = passArray32ToWasm0(vertices, (size, align) => __oomAllocate(size, align, copies, context));
1297
+ const len0 = WASM_VECTOR_LEN;
1298
+ const ptr1 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
1299
+ const len1 = WASM_VECTOR_LEN;
1300
+ const ptr2 = passArrayF64ToWasm0(filtrations, (size, align) => __oomAllocate(size, align, copies, context));
1301
+ const len2 = WASM_VECTOR_LEN;
1302
+ copies.length = 0;
1303
+ const ret = wasm.persistenceFlat(ptr0, len0, ptr1, len1, ptr2, len2, coeff_field);
1304
+ if (ret[3]) {
1305
+ throw takeFromExternrefTable0(ret[2]);
1306
+ }
1307
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
1308
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
1309
+ throw error;
1310
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
1311
+
1312
+ } catch (error) {
1313
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1314
+ throw __oomNormalize(error, context);
1315
+ }
1316
+ }
1317
+
1318
+ /**
1319
+ * @param {Float64Array} pairs
1320
+ * @param {number} rows
1321
+ * @param {number} cols
1322
+ * @param {any} auto_bounds
1323
+ * @param {number} birth_min
1324
+ * @param {number} birth_max
1325
+ * @param {number} pers_min
1326
+ * @param {number} pers_max
1327
+ * @param {number} sigma
1328
+ * @param {number} weight_power
1329
+ * @returns {Float64Array}
1330
+ */
1331
+ function persistenceImageFlat(pairs, rows, cols, auto_bounds, birth_min, birth_max, pers_min, pers_max, sigma, weight_power) {
1332
+ const context = { function: "persistenceImage", input: {shape:[rows,cols], cells:rows*cols, pairElements:pairs.length}, parameters: {"rows": rows,"cols": cols,"auto_bounds": auto_bounds,"birth_min": birth_min,"birth_max": birth_max,"pers_min": pers_min,"pers_max": pers_max,"sigma": sigma,"weight_power": weight_power} };
1333
+ const copies = [];
1334
+ __oomBegin();
1335
+ try {
1336
+ const ptr0 = passArrayF64ToWasm0(pairs, (size, align) => __oomAllocate(size, align, copies, context));
1337
+ const len0 = WASM_VECTOR_LEN;
1338
+ copies.length = 0;
1339
+ const ret = wasm.persistenceImageFlat(ptr0, len0, rows, cols, auto_bounds, birth_min, birth_max, pers_min, pers_max, sigma, weight_power);
1340
+ if (ret[3]) {
1341
+ throw takeFromExternrefTable0(ret[2]);
1342
+ }
1343
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
1344
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
1345
+ throw error;
1346
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
1347
+
1348
+ } catch (error) {
1349
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1350
+ throw __oomNormalize(error, context);
1351
+ }
1352
+ }
1353
+
1354
+ /**
1355
+ * @param {Float64Array} pairs
1356
+ * @param {number} first
1357
+ * @param {number} last
1358
+ * @param {Float64Array} grid
1359
+ * @returns {Float64Array}
1360
+ */
1361
+ function persistenceLandscapeFlat(pairs, first, last, grid) {
1362
+ const context = { function: "persistenceLandscape", input: {gridPoints:grid.length, pairElements:pairs.length}, parameters: {"first": first,"last": last} };
1363
+ const copies = [];
1364
+ __oomBegin();
1365
+ try {
1366
+ const ptr0 = passArrayF64ToWasm0(pairs, (size, align) => __oomAllocate(size, align, copies, context));
1367
+ const len0 = WASM_VECTOR_LEN;
1368
+ const ptr1 = passArrayF64ToWasm0(grid, (size, align) => __oomAllocate(size, align, copies, context));
1369
+ const len1 = WASM_VECTOR_LEN;
1370
+ copies.length = 0;
1371
+ const ret = wasm.persistenceLandscapeFlat(ptr0, len0, first, last, ptr1, len1);
1372
+ if (ret[3]) {
1373
+ throw takeFromExternrefTable0(ret[2]);
1374
+ }
1375
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
1376
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
1377
+ throw error;
1378
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
1379
+
1380
+ } catch (error) {
1381
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1382
+ throw __oomNormalize(error, context);
1383
+ }
1384
+ }
1385
+
1386
+ /**
1387
+ * The presentation coarsened onto RIVET's grids.
1388
+ * @param {Float64Array} xs
1389
+ * @param {Float64Array} ys
1390
+ * @param {Uint32Array} generators
1391
+ * @param {Uint32Array} relations
1392
+ * @param {Uint32Array} offsets
1393
+ * @param {Uint32Array} rows
1394
+ * @param {number} xbins
1395
+ * @param {number} ybins
1396
+ * @param {Float64Array} x_range
1397
+ * @param {Float64Array} y_range
1398
+ * @returns {any}
1399
+ */
1400
+ function presentationCoarsenFlat(xs, ys, generators, relations, offsets, rows, xbins, ybins, x_range, y_range) {
1401
+ const context = { function: "coarsenPresentation", input: {"xs": xs.length,"ys": ys.length,"generators": generators.length,"relations": relations.length,"offsets": offsets.length,"rows": rows.length,"x_range": x_range.length,"y_range": y_range.length}, parameters: {"xbins": xbins,"ybins": ybins} };
1402
+ const copies = [];
1403
+ __oomBegin();
1404
+ try {
1405
+ const ptr0 = passArrayF64ToWasm0(xs, (size, align) => __oomAllocate(size, align, copies, context));
1406
+ const len0 = WASM_VECTOR_LEN;
1407
+ const ptr1 = passArrayF64ToWasm0(ys, (size, align) => __oomAllocate(size, align, copies, context));
1408
+ const len1 = WASM_VECTOR_LEN;
1409
+ const ptr2 = passArray32ToWasm0(generators, (size, align) => __oomAllocate(size, align, copies, context));
1410
+ const len2 = WASM_VECTOR_LEN;
1411
+ const ptr3 = passArray32ToWasm0(relations, (size, align) => __oomAllocate(size, align, copies, context));
1412
+ const len3 = WASM_VECTOR_LEN;
1413
+ const ptr4 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
1414
+ const len4 = WASM_VECTOR_LEN;
1415
+ const ptr5 = passArray32ToWasm0(rows, (size, align) => __oomAllocate(size, align, copies, context));
1416
+ const len5 = WASM_VECTOR_LEN;
1417
+ const ptr6 = passArrayF64ToWasm0(x_range, (size, align) => __oomAllocate(size, align, copies, context));
1418
+ const len6 = WASM_VECTOR_LEN;
1419
+ const ptr7 = passArrayF64ToWasm0(y_range, (size, align) => __oomAllocate(size, align, copies, context));
1420
+ const len7 = WASM_VECTOR_LEN;
1421
+ copies.length = 0;
1422
+ const ret = wasm.presentationCoarsenFlat(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, xbins, ybins, ptr6, len6, ptr7, len7);
1423
+ if (ret[2]) {
1424
+ throw takeFromExternrefTable0(ret[1]);
1425
+ }
1426
+ return takeFromExternrefTable0(ret[0]);
1427
+
1428
+ } catch (error) {
1429
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1430
+ throw __oomNormalize(error, context);
1431
+ }
1432
+ }
1433
+
1434
+ /**
1435
+ * `{ syzygies, hilbert }`.
1436
+ * @param {Float64Array} xs
1437
+ * @param {Float64Array} ys
1438
+ * @param {Uint32Array} generators
1439
+ * @param {Uint32Array} relations
1440
+ * @param {Uint32Array} offsets
1441
+ * @param {Uint32Array} rows
1442
+ * @returns {any}
1443
+ */
1444
+ function presentationInvariantsFlat(xs, ys, generators, relations, offsets, rows) {
1445
+ const context = { function: "bigradedBetti", input: {"xs": xs.length,"ys": ys.length,"generators": generators.length,"relations": relations.length,"offsets": offsets.length,"rows": rows.length}, parameters: {} };
1446
+ const copies = [];
1447
+ __oomBegin();
1448
+ try {
1449
+ const ptr0 = passArrayF64ToWasm0(xs, (size, align) => __oomAllocate(size, align, copies, context));
1450
+ const len0 = WASM_VECTOR_LEN;
1451
+ const ptr1 = passArrayF64ToWasm0(ys, (size, align) => __oomAllocate(size, align, copies, context));
1452
+ const len1 = WASM_VECTOR_LEN;
1453
+ const ptr2 = passArray32ToWasm0(generators, (size, align) => __oomAllocate(size, align, copies, context));
1454
+ const len2 = WASM_VECTOR_LEN;
1455
+ const ptr3 = passArray32ToWasm0(relations, (size, align) => __oomAllocate(size, align, copies, context));
1456
+ const len3 = WASM_VECTOR_LEN;
1457
+ const ptr4 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
1458
+ const len4 = WASM_VECTOR_LEN;
1459
+ const ptr5 = passArray32ToWasm0(rows, (size, align) => __oomAllocate(size, align, copies, context));
1460
+ const len5 = WASM_VECTOR_LEN;
1461
+ copies.length = 0;
1462
+ const ret = wasm.presentationInvariantsFlat(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
1463
+ if (ret[2]) {
1464
+ throw takeFromExternrefTable0(ret[1]);
1465
+ }
1466
+ return takeFromExternrefTable0(ret[0]);
1467
+
1468
+ } catch (error) {
1469
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1470
+ throw __oomNormalize(error, context);
1471
+ }
1472
+ }
1473
+
1474
+ /**
1475
+ * `{ pairs, offsets, lines }`: the barcodes along the lines end to end,
1476
+ * and the lines as Rust built them. `lines` holds `[point x, point y, a,
1477
+ * b]` per line and `angles` one flag per line: 0 for the direction `(a,
1478
+ * b)`, 1 for `a` degrees from the first axis (see `api::two_parameter`).
1479
+ * @param {Float64Array} xs
1480
+ * @param {Float64Array} ys
1481
+ * @param {Uint32Array} generators
1482
+ * @param {Uint32Array} relations
1483
+ * @param {Uint32Array} offsets
1484
+ * @param {Uint32Array} rows
1485
+ * @param {Float64Array} lines
1486
+ * @param {Uint8Array} angles
1487
+ * @returns {any}
1488
+ */
1489
+ function presentationSliceFlat(xs, ys, generators, relations, offsets, rows, lines, angles) {
1490
+ const context = { function: "fiberedBarcode", input: {"xs": xs.length,"ys": ys.length,"generators": generators.length,"relations": relations.length,"offsets": offsets.length,"rows": rows.length,"lines": lines.length,"angles": angles.length}, parameters: {} };
1491
+ const copies = [];
1492
+ __oomBegin();
1493
+ try {
1494
+ const ptr0 = passArrayF64ToWasm0(xs, (size, align) => __oomAllocate(size, align, copies, context));
1495
+ const len0 = WASM_VECTOR_LEN;
1496
+ const ptr1 = passArrayF64ToWasm0(ys, (size, align) => __oomAllocate(size, align, copies, context));
1497
+ const len1 = WASM_VECTOR_LEN;
1498
+ const ptr2 = passArray32ToWasm0(generators, (size, align) => __oomAllocate(size, align, copies, context));
1499
+ const len2 = WASM_VECTOR_LEN;
1500
+ const ptr3 = passArray32ToWasm0(relations, (size, align) => __oomAllocate(size, align, copies, context));
1501
+ const len3 = WASM_VECTOR_LEN;
1502
+ const ptr4 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
1503
+ const len4 = WASM_VECTOR_LEN;
1504
+ const ptr5 = passArray32ToWasm0(rows, (size, align) => __oomAllocate(size, align, copies, context));
1505
+ const len5 = WASM_VECTOR_LEN;
1506
+ const ptr6 = passArrayF64ToWasm0(lines, (size, align) => __oomAllocate(size, align, copies, context));
1507
+ const len6 = WASM_VECTOR_LEN;
1508
+ const ptr7 = passArray8ToWasm0(angles, (size, align) => __oomAllocate(size, align, copies, context));
1509
+ const len7 = WASM_VECTOR_LEN;
1510
+ copies.length = 0;
1511
+ const ret = wasm.presentationSliceFlat(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7);
1512
+ if (ret[2]) {
1513
+ throw takeFromExternrefTable0(ret[1]);
1514
+ }
1515
+ return takeFromExternrefTable0(ret[0]);
1516
+
1517
+ } catch (error) {
1518
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1519
+ throw __oomNormalize(error, context);
1520
+ }
1521
+ }
1522
+
1523
+ /**
1524
+ * @param {Float64Array} points
1525
+ * @param {number} dimension
1526
+ * @param {number} max_edge_length
1527
+ * @param {number} max_simplex_dimension
1528
+ * @returns {any}
1529
+ */
1530
+ function ripsComplexFlat(points, dimension, max_edge_length, max_simplex_dimension) {
1531
+ const context = { function: "ripsComplex", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"maxEdgeLength": max_edge_length,"maxDim": max_simplex_dimension} };
1532
+ const copies = [];
1533
+ __oomBegin();
1534
+ try {
1535
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
1536
+ const len0 = WASM_VECTOR_LEN;
1537
+ copies.length = 0;
1538
+ const ret = wasm.ripsComplexFlat(ptr0, len0, dimension, max_edge_length, max_simplex_dimension);
1539
+ if (ret[2]) {
1540
+ throw takeFromExternrefTable0(ret[1]);
1541
+ }
1542
+ return takeFromExternrefTable0(ret[0]);
1543
+
1544
+ } catch (error) {
1545
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1546
+ throw __oomNormalize(error, context);
1547
+ }
1548
+ }
1549
+
1550
+ /**
1551
+ * @param {Float64Array} matrix
1552
+ * @param {number} num_points
1553
+ * @param {number} max_edge_length
1554
+ * @param {number} max_simplex_dimension
1555
+ * @returns {any}
1556
+ */
1557
+ function ripsComplexFromMatrixFlat(matrix, num_points, max_edge_length, max_simplex_dimension) {
1558
+ const context = { function: "ripsComplex", input: {rows: num_points, columns: num_points, entries: matrix.length}, parameters: {"num_points": num_points,"maxEdgeLength": max_edge_length,"maxDim": max_simplex_dimension} };
1559
+ const copies = [];
1560
+ __oomBegin();
1561
+ try {
1562
+ const ptr0 = passArrayF64ToWasm0(matrix, (size, align) => __oomAllocate(size, align, copies, context));
1563
+ const len0 = WASM_VECTOR_LEN;
1564
+ copies.length = 0;
1565
+ const ret = wasm.ripsComplexFromMatrixFlat(ptr0, len0, num_points, max_edge_length, max_simplex_dimension);
1566
+ if (ret[2]) {
1567
+ throw takeFromExternrefTable0(ret[1]);
1568
+ }
1569
+ return takeFromExternrefTable0(ret[0]);
1570
+
1571
+ } catch (error) {
1572
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1573
+ throw __oomNormalize(error, context);
1574
+ }
1575
+ }
1576
+
1577
+ /**
1578
+ * @param {Float64Array} points
1579
+ * @param {number} dimension
1580
+ * @param {number} max_dim
1581
+ * @param {number} threshold
1582
+ * @param {number} modulus
1583
+ * @returns {Float64Array}
1584
+ */
1585
+ function ripsPersistenceFlat(points, dimension, max_dim, threshold, modulus) {
1586
+ const context = { function: "ripsPersistence", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"maxDim": max_dim,"maxEdgeLength": threshold,"coeff": modulus} };
1587
+ const copies = [];
1588
+ __oomBegin();
1589
+ try {
1590
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
1591
+ const len0 = WASM_VECTOR_LEN;
1592
+ copies.length = 0;
1593
+ const ret = wasm.ripsPersistenceFlat(ptr0, len0, dimension, max_dim, threshold, modulus);
1594
+ if (ret[3]) {
1595
+ throw takeFromExternrefTable0(ret[2]);
1596
+ }
1597
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
1598
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
1599
+ throw error;
1600
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
1601
+
1602
+ } catch (error) {
1603
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1604
+ throw __oomNormalize(error, context);
1605
+ }
1606
+ }
1607
+
1608
+ /**
1609
+ * @param {Float64Array} matrix
1610
+ * @param {number} num_points
1611
+ * @param {number} max_dim
1612
+ * @param {number} threshold
1613
+ * @param {number} modulus
1614
+ * @returns {Float64Array}
1615
+ */
1616
+ function ripsPersistenceFromDistanceMatrixFlat(matrix, num_points, max_dim, threshold, modulus) {
1617
+ const context = { function: "ripsPersistence", input: {rows: num_points, columns: num_points, entries: matrix.length}, parameters: {"num_points": num_points,"maxDim": max_dim,"maxEdgeLength": threshold,"coeff": modulus} };
1618
+ const copies = [];
1619
+ __oomBegin();
1620
+ try {
1621
+ const ptr0 = passArrayF64ToWasm0(matrix, (size, align) => __oomAllocate(size, align, copies, context));
1622
+ const len0 = WASM_VECTOR_LEN;
1623
+ copies.length = 0;
1624
+ const ret = wasm.ripsPersistenceFromDistanceMatrixFlat(ptr0, len0, num_points, max_dim, threshold, modulus);
1625
+ if (ret[3]) {
1626
+ throw takeFromExternrefTable0(ret[2]);
1627
+ }
1628
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
1629
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
1630
+ throw error;
1631
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
1632
+
1633
+ } catch (error) {
1634
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1635
+ throw __oomNormalize(error, context);
1636
+ }
1637
+ }
1638
+
1639
+ /**
1640
+ * @param {Float64Array} points
1641
+ * @param {number} dimension
1642
+ * @param {number} max_dim
1643
+ * @param {number} threshold
1644
+ * @param {number} modulus
1645
+ * @param {number} kind
1646
+ * @param {number} dims_mask
1647
+ * @param {number} min_persistence
1648
+ * @returns {any}
1649
+ */
1650
+ function ripsRepresentativesFlat(points, dimension, max_dim, threshold, modulus, kind, dims_mask, min_persistence) {
1651
+ const context = { function: "ripsRepresentatives", input: {points: points.length / dimension, dimension, coordinateElements: points.length}, parameters: {"dimension": dimension,"maxDim": max_dim,"maxEdgeLength": threshold,"coeff": modulus,"kind": kind,"dims_mask": dims_mask,"minPersistence": min_persistence} };
1652
+ const copies = [];
1653
+ __oomBegin();
1654
+ try {
1655
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
1656
+ const len0 = WASM_VECTOR_LEN;
1657
+ copies.length = 0;
1658
+ const ret = wasm.ripsRepresentativesFlat(ptr0, len0, dimension, max_dim, threshold, modulus, kind, dims_mask, min_persistence);
1659
+ if (ret[2]) {
1660
+ throw takeFromExternrefTable0(ret[1]);
1661
+ }
1662
+ return takeFromExternrefTable0(ret[0]);
1663
+
1664
+ } catch (error) {
1665
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1666
+ throw __oomNormalize(error, context);
1667
+ }
1668
+ }
1669
+
1670
+ /**
1671
+ * @param {Float64Array} matrix
1672
+ * @param {number} num_points
1673
+ * @param {number} max_dim
1674
+ * @param {number} threshold
1675
+ * @param {number} modulus
1676
+ * @param {number} kind
1677
+ * @param {number} dims_mask
1678
+ * @param {number} min_persistence
1679
+ * @returns {any}
1680
+ */
1681
+ function ripsRepresentativesFromDistanceMatrixFlat(matrix, num_points, max_dim, threshold, modulus, kind, dims_mask, min_persistence) {
1682
+ const context = { function: "ripsRepresentativesFromDistanceMatrix", input: {rows: num_points, columns: num_points, entries: matrix.length}, parameters: {"num_points": num_points,"maxDim": max_dim,"maxEdgeLength": threshold,"coeff": modulus,"kind": kind,"dims_mask": dims_mask,"minPersistence": min_persistence} };
1683
+ const copies = [];
1684
+ __oomBegin();
1685
+ try {
1686
+ const ptr0 = passArrayF64ToWasm0(matrix, (size, align) => __oomAllocate(size, align, copies, context));
1687
+ const len0 = WASM_VECTOR_LEN;
1688
+ copies.length = 0;
1689
+ const ret = wasm.ripsRepresentativesFromDistanceMatrixFlat(ptr0, len0, num_points, max_dim, threshold, modulus, kind, dims_mask, min_persistence);
1690
+ if (ret[2]) {
1691
+ throw takeFromExternrefTable0(ret[1]);
1692
+ }
1693
+ return takeFromExternrefTable0(ret[0]);
1694
+
1695
+ } catch (error) {
1696
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1697
+ throw __oomNormalize(error, context);
1698
+ }
1699
+ }
1700
+
1701
+ /**
1702
+ * @param {Float64Array} clouds
1703
+ * @param {number} dimension
1704
+ * @param {number} frame_count
1705
+ * @param {number} max_edge_length
1706
+ * @param {number} max_dim
1707
+ * @param {number} min_persistence
1708
+ * @param {number} coeff_field
1709
+ * @param {Float64Array} rep_times
1710
+ * @param {any} with_reps
1711
+ * @param {Uint32Array} rep_dims
1712
+ * @param {any} filter_dims
1713
+ * @returns {any}
1714
+ */
1715
+ function ripsVineyardFlat(clouds, dimension, frame_count, max_edge_length, max_dim, min_persistence, coeff_field, rep_times, with_reps, rep_dims, filter_dims) {
1716
+ const context = { function: "ripsVineyard", input: {points: clouds.length / (dimension * frame_count), dimension, clouds: frame_count, coordinateElements: clouds.length}, parameters: {"dimension": dimension,"frame_count": frame_count,"maxEdgeLength": max_edge_length,"maxDim": max_dim,"minPersistence": min_persistence,"coeff": coeff_field,"with_reps": with_reps,"filter_dims": filter_dims} };
1717
+ const copies = [];
1718
+ __oomBegin();
1719
+ try {
1720
+ const ptr0 = passArrayF64ToWasm0(clouds, (size, align) => __oomAllocate(size, align, copies, context));
1721
+ const len0 = WASM_VECTOR_LEN;
1722
+ const ptr1 = passArrayF64ToWasm0(rep_times, (size, align) => __oomAllocate(size, align, copies, context));
1723
+ const len1 = WASM_VECTOR_LEN;
1724
+ const ptr2 = passArray32ToWasm0(rep_dims, (size, align) => __oomAllocate(size, align, copies, context));
1725
+ const len2 = WASM_VECTOR_LEN;
1726
+ copies.length = 0;
1727
+ const ret = wasm.ripsVineyardFlat(ptr0, len0, dimension, frame_count, max_edge_length, max_dim, min_persistence, coeff_field, ptr1, len1, with_reps, ptr2, len2, filter_dims);
1728
+ if (ret[2]) {
1729
+ throw takeFromExternrefTable0(ret[1]);
1730
+ }
1731
+ return takeFromExternrefTable0(ret[0]);
1732
+
1733
+ } catch (error) {
1734
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1735
+ throw __oomNormalize(error, context);
1736
+ }
1737
+ }
1738
+
1739
+ /**
1740
+ * A RIVET input file read (`text` its UTF-8 bytes): `{ datatype, flags,
1741
+ * maxDistance, ... }`, `flags` as `[[name, value], ...]` in the order of
1742
+ * their first lines (`value` `true` for a flag without one), and the data
1743
+ * of its kind as flat arrays: `coords` and `d` (`points`, `points_fn`),
1744
+ * `distances` (`metric`, `metric_fn`, the full matrix), `values` (`_fn`),
1745
+ * `dims`, `grades`, `offsets`, `facets` and, when a simplex has several
1746
+ * grades, `gradeOffsets` (`bifiltration`), `highGrades`, `highOffsets`,
1747
+ * `highRows`, `lowGrades`, `lowOffsets`, `lowRows` and `lowRank`
1748
+ * (`firep`). src/rivet_input.ts shapes it into a `RivetInput`.
1749
+ * @param {Uint8Array} text
1750
+ * @returns {any}
1751
+ */
1752
+ function rivetInputFlat(text) {
1753
+ const context = { function: "parseRivetInput", input: {"text": text.length}, parameters: {} };
1754
+ const copies = [];
1755
+ __oomBegin();
1756
+ try {
1757
+ const ptr0 = passArray8ToWasm0(text, (size, align) => __oomAllocate(size, align, copies, context));
1758
+ const len0 = WASM_VECTOR_LEN;
1759
+ copies.length = 0;
1760
+ const ret = wasm.rivetInputFlat(ptr0, len0);
1761
+ if (ret[2]) {
1762
+ throw takeFromExternrefTable0(ret[1]);
1763
+ }
1764
+ return takeFromExternrefTable0(ret[0]);
1765
+
1766
+ } catch (error) {
1767
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1768
+ throw __oomNormalize(error, context);
1769
+ }
1770
+ }
1771
+
1772
+ /**
1773
+ * The minimal presentation of the module a RIVET input file describes (`text`
1774
+ * its UTF-8 bytes), in degree `degree`.
1775
+ * @param {Uint8Array} text
1776
+ * @param {number} degree
1777
+ * @returns {any}
1778
+ */
1779
+ function rivetPresentationFlat(text, degree) {
1780
+ const context = { function: "rivetPresentation", input: {"text": text.length}, parameters: {"degree": degree} };
1781
+ const copies = [];
1782
+ __oomBegin();
1783
+ try {
1784
+ const ptr0 = passArray8ToWasm0(text, (size, align) => __oomAllocate(size, align, copies, context));
1785
+ const len0 = WASM_VECTOR_LEN;
1786
+ copies.length = 0;
1787
+ const ret = wasm.rivetPresentationFlat(ptr0, len0, degree);
1788
+ if (ret[2]) {
1789
+ throw takeFromExternrefTable0(ret[1]);
1790
+ }
1791
+ return takeFromExternrefTable0(ret[0]);
1792
+
1793
+ } catch (error) {
1794
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1795
+ throw __oomNormalize(error, context);
1796
+ }
1797
+ }
1798
+
1799
+ /**
1800
+ * The package version this module was built as (package.json's).
1801
+ * @returns {string}
1802
+ */
1803
+ function version() {
1804
+ const context = { function: "version", input: {}, parameters: {} };
1805
+ const copies = [];
1806
+ __oomBegin();
1807
+ try {
1808
+ let deferred1_0;
1809
+ let deferred1_1;
1810
+ try {
1811
+ copies.length = 0;
1812
+ const ret = wasm.version();
1813
+ deferred1_0 = ret[0];
1814
+ deferred1_1 = ret[1];
1815
+ return getStringFromWasm0(ret[0], ret[1]);
1816
+ } finally {
1817
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1818
+ }
1819
+
1820
+ } catch (error) {
1821
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1822
+ throw __oomNormalize(error, context);
1823
+ }
1824
+ }
1825
+
1826
+ /**
1827
+ * @param {Int32Array} vertices
1828
+ * @param {Uint32Array} offsets
1829
+ * @param {Float64Array} frames
1830
+ * @param {number} frame_count
1831
+ * @param {number} min_persistence
1832
+ * @param {number} coeff_field
1833
+ * @param {Float64Array} rep_times
1834
+ * @param {any} with_reps
1835
+ * @param {Uint32Array} rep_dims
1836
+ * @param {any} filter_dims
1837
+ * @returns {any}
1838
+ */
1839
+ function vineyardFlat(vertices, offsets, frames, frame_count, min_persistence, coeff_field, rep_times, with_reps, rep_dims, filter_dims) {
1840
+ const context = { function: "vineyard", input: {"vertices": vertices.length,"offsets": offsets.length,"frames": frames.length,"rep_times": rep_times.length,"rep_dims": rep_dims.length}, parameters: {"frame_count": frame_count,"minPersistence": min_persistence,"coeff": coeff_field,"with_reps": with_reps,"filter_dims": filter_dims} };
1841
+ const copies = [];
1842
+ __oomBegin();
1843
+ try {
1844
+ const ptr0 = passArray32ToWasm0(vertices, (size, align) => __oomAllocate(size, align, copies, context));
1845
+ const len0 = WASM_VECTOR_LEN;
1846
+ const ptr1 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
1847
+ const len1 = WASM_VECTOR_LEN;
1848
+ const ptr2 = passArrayF64ToWasm0(frames, (size, align) => __oomAllocate(size, align, copies, context));
1849
+ const len2 = WASM_VECTOR_LEN;
1850
+ const ptr3 = passArrayF64ToWasm0(rep_times, (size, align) => __oomAllocate(size, align, copies, context));
1851
+ const len3 = WASM_VECTOR_LEN;
1852
+ const ptr4 = passArray32ToWasm0(rep_dims, (size, align) => __oomAllocate(size, align, copies, context));
1853
+ const len4 = WASM_VECTOR_LEN;
1854
+ copies.length = 0;
1855
+ const ret = wasm.vineyardFlat(ptr0, len0, ptr1, len1, ptr2, len2, frame_count, min_persistence, coeff_field, ptr3, len3, with_reps, ptr4, len4, filter_dims);
1856
+ if (ret[2]) {
1857
+ throw takeFromExternrefTable0(ret[1]);
1858
+ }
1859
+ return takeFromExternrefTable0(ret[0]);
1860
+
1861
+ } catch (error) {
1862
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1863
+ throw __oomNormalize(error, context);
1864
+ }
1865
+ }
1866
+
1867
+ /**
1868
+ * @param {Int32Array} vertices
1869
+ * @param {Uint32Array} offsets
1870
+ * @param {Float64Array} filtrations
1871
+ * @param {number} ambient_dim
1872
+ * @param {any} single
1873
+ * @param {number} birth
1874
+ * @param {number} death
1875
+ * @param {number} min_persistence
1876
+ * @returns {Float64Array}
1877
+ */
1878
+ function volumeOptimalCyclesFlat(vertices, offsets, filtrations, ambient_dim, single, birth, death, min_persistence) {
1879
+ const context = { function: "volumeOptimalCycles", input: {"vertices": vertices.length,"offsets": offsets.length,"filtrations": filtrations.length}, parameters: {"ambient_dim": ambient_dim,"single": single,"birth": birth,"death": death,"minPersistence": min_persistence} };
1880
+ const copies = [];
1881
+ __oomBegin();
1882
+ try {
1883
+ const ptr0 = passArray32ToWasm0(vertices, (size, align) => __oomAllocate(size, align, copies, context));
1884
+ const len0 = WASM_VECTOR_LEN;
1885
+ const ptr1 = passArray32ToWasm0(offsets, (size, align) => __oomAllocate(size, align, copies, context));
1886
+ const len1 = WASM_VECTOR_LEN;
1887
+ const ptr2 = passArrayF64ToWasm0(filtrations, (size, align) => __oomAllocate(size, align, copies, context));
1888
+ const len2 = WASM_VECTOR_LEN;
1889
+ copies.length = 0;
1890
+ const ret = wasm.volumeOptimalCyclesFlat(ptr0, len0, ptr1, len1, ptr2, len2, ambient_dim, single, birth, death, min_persistence);
1891
+ if (ret[3]) {
1892
+ throw takeFromExternrefTable0(ret[2]);
1893
+ }
1894
+ try { return new Float64Array(getArrayF64FromWasm0(ret[0], ret[1])); } catch (error) {
1895
+ if (error instanceof RangeError) throw __oomCapacity(context, 'output-copy', ret[1] * 8, {elementBytes:8, elements:ret[1]});
1896
+ throw error;
1897
+ } finally { wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); }
1898
+
1899
+ } catch (error) {
1900
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1901
+ throw __oomNormalize(error, context);
1902
+ }
1903
+ }
1904
+
1905
+ /**
1906
+ * `flat_tolerance`: NaN (or an omitted argument) is off.
1907
+ * @param {Float64Array} coords
1908
+ * @param {number} max_squared_radius
1909
+ * @param {number} flat_tolerance
1910
+ * @returns {any}
1911
+ */
1912
+ function weightedAlphaComplexFlat(coords, max_squared_radius, flat_tolerance) {
1913
+ const context = { function: "alphaComplex", input: {points: coords.length / 4, storedCoordinatesPerPoint: 4}, parameters: {"maxSquaredRadius": (max_squared_radius === 0 ? Infinity : max_squared_radius),"flatTolerance": (Number.isNaN(flat_tolerance) ? undefined : flat_tolerance)} };
1914
+ const copies = [];
1915
+ __oomBegin();
1916
+ try {
1917
+ const ptr0 = passArrayF64ToWasm0(coords, (size, align) => __oomAllocate(size, align, copies, context));
1918
+ const len0 = WASM_VECTOR_LEN;
1919
+ copies.length = 0;
1920
+ const ret = wasm.weightedAlphaComplexFlat(ptr0, len0, max_squared_radius, flat_tolerance);
1921
+ if (ret[2]) {
1922
+ throw takeFromExternrefTable0(ret[1]);
1923
+ }
1924
+ return takeFromExternrefTable0(ret[0]);
1925
+
1926
+ } catch (error) {
1927
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1928
+ throw __oomNormalize(error, context);
1929
+ }
1930
+ }
1931
+
1932
+ /**
1933
+ * @param {Float64Array} coords
1934
+ * @param {number} max_squared_radius
1935
+ * @param {number} coeff_field
1936
+ * @param {any} with_simplices
1937
+ * @param {number} flat_tolerance
1938
+ * @returns {any}
1939
+ */
1940
+ function weightedAlphaPipeline(coords, max_squared_radius, coeff_field, with_simplices, flat_tolerance) {
1941
+ const context = { function: "alphaPersistence", input: {points: coords.length / 4, storedCoordinatesPerPoint: 4}, parameters: {"maxSquaredRadius": (max_squared_radius === 0 ? Infinity : max_squared_radius),"coeff": coeff_field,"complex": with_simplices,"flatTolerance": (Number.isNaN(flat_tolerance) ? undefined : flat_tolerance)} };
1942
+ const copies = [];
1943
+ __oomBegin();
1944
+ try {
1945
+ const ptr0 = passArrayF64ToWasm0(coords, (size, align) => __oomAllocate(size, align, copies, context));
1946
+ const len0 = WASM_VECTOR_LEN;
1947
+ copies.length = 0;
1948
+ const ret = wasm.weightedAlphaPipeline(ptr0, len0, max_squared_radius, coeff_field, with_simplices, flat_tolerance);
1949
+ if (ret[2]) {
1950
+ throw takeFromExternrefTable0(ret[1]);
1951
+ }
1952
+ return takeFromExternrefTable0(ret[0]);
1953
+
1954
+ } catch (error) {
1955
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1956
+ throw __oomNormalize(error, context);
1957
+ }
1958
+ }
1959
+
1960
+ /**
1961
+ * @param {Float64Array} points
1962
+ * @param {number} q
1963
+ * @param {number} theta
1964
+ * @param {Float64Array} normals_or_k
1965
+ * @param {number} max_simplex_dimension
1966
+ * @param {number} max_eps
1967
+ * @returns {any}
1968
+ */
1969
+ function wingComplexFlat(points, q, theta, normals_or_k, max_simplex_dimension, max_eps) {
1970
+ const context = { function: "wingComplex", input: {"points": points.length,"normals_or_k": normals_or_k.length}, parameters: {"q": q,"theta": theta,"maxDim": max_simplex_dimension,"max_eps": max_eps} };
1971
+ const copies = [];
1972
+ __oomBegin();
1973
+ try {
1974
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
1975
+ const len0 = WASM_VECTOR_LEN;
1976
+ const ptr1 = passArrayF64ToWasm0(normals_or_k, (size, align) => __oomAllocate(size, align, copies, context));
1977
+ const len1 = WASM_VECTOR_LEN;
1978
+ copies.length = 0;
1979
+ const ret = wasm.wingComplexFlat(ptr0, len0, q, theta, ptr1, len1, max_simplex_dimension, max_eps);
1980
+ if (ret[2]) {
1981
+ throw takeFromExternrefTable0(ret[1]);
1982
+ }
1983
+ return takeFromExternrefTable0(ret[0]);
1984
+
1985
+ } catch (error) {
1986
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
1987
+ throw __oomNormalize(error, context);
1988
+ }
1989
+ }
1990
+
1991
+ /**
1992
+ * @param {Float64Array} points
1993
+ * @param {number} q
1994
+ * @param {number} theta
1995
+ * @param {Float64Array} normals_or_k
1996
+ * @param {number} max_simplex_dimension
1997
+ * @param {number} max_eps
1998
+ * @param {number} coeff_field
1999
+ * @param {any} with_simplices
2000
+ * @returns {any}
2001
+ */
2002
+ function wingPipeline(points, q, theta, normals_or_k, max_simplex_dimension, max_eps, coeff_field, with_simplices) {
2003
+ const context = { function: "wingPersistence", input: {"points": points.length,"normals_or_k": normals_or_k.length}, parameters: {"q": q,"theta": theta,"maxDim": max_simplex_dimension,"max_eps": max_eps,"coeff": coeff_field,"complex": with_simplices} };
2004
+ const copies = [];
2005
+ __oomBegin();
2006
+ try {
2007
+ const ptr0 = passArrayF64ToWasm0(points, (size, align) => __oomAllocate(size, align, copies, context));
2008
+ const len0 = WASM_VECTOR_LEN;
2009
+ const ptr1 = passArrayF64ToWasm0(normals_or_k, (size, align) => __oomAllocate(size, align, copies, context));
2010
+ const len1 = WASM_VECTOR_LEN;
2011
+ copies.length = 0;
2012
+ const ret = wasm.wingPipeline(ptr0, len0, q, theta, ptr1, len1, max_simplex_dimension, max_eps, coeff_field, with_simplices);
2013
+ if (ret[2]) {
2014
+ throw takeFromExternrefTable0(ret[1]);
2015
+ }
2016
+ return takeFromExternrefTable0(ret[0]);
2017
+
2018
+ } catch (error) {
2019
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
2020
+ throw __oomNormalize(error, context);
2021
+ }
2022
+ }
2023
+
2024
+ /**
2025
+ * @param {Float64Array} records
2026
+ * @param {any} with_values
2027
+ * @returns {any}
2028
+ */
2029
+ function zigzagPersistenceFlat(records, with_values) {
2030
+ const context = { function: "zigzagPersistence", input: {"records": records.length}, parameters: {"with_values": with_values} };
2031
+ const copies = [];
2032
+ __oomBegin();
2033
+ try {
2034
+ const ptr0 = passArrayF64ToWasm0(records, (size, align) => __oomAllocate(size, align, copies, context));
2035
+ const len0 = WASM_VECTOR_LEN;
2036
+ copies.length = 0;
2037
+ const ret = wasm.zigzagPersistenceFlat(ptr0, len0, with_values);
2038
+ if (ret[2]) {
2039
+ throw takeFromExternrefTable0(ret[1]);
2040
+ }
2041
+ return takeFromExternrefTable0(ret[0]);
2042
+
2043
+ } catch (error) {
2044
+ if (!__oomPoisoned) for (const [ptr, size, align] of copies) wasm.__wbindgen_free(ptr, size, align);
2045
+ throw __oomNormalize(error, context);
2046
+ }
2047
+ }
2048
+ function __wbg_get_imports() {
2049
+ const import0 = {
2050
+ __proto__: null,
2051
+ __wbg___wbindgen_is_falsy_16bd49b68658263e: function(arg0) {
2052
+ const ret = !arg0;
2053
+ return ret;
2054
+ },
2055
+ __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
2056
+ throw new Error(getStringFromWasm0(arg0, arg1));
2057
+ },
2058
+ __wbg_instanceof_RangeError_62996e9dbf747e67: function(arg0) {
2059
+ let result;
2060
+ try {
2061
+ result = arg0 instanceof RangeError;
2062
+ } catch (_) {
2063
+ result = false;
2064
+ }
2065
+ const ret = result;
2066
+ return ret;
2067
+ },
2068
+ __wbg_new_2bdcdfcebdfc34d2: function(arg0, arg1) {
2069
+ const ret = new TypeError(getStringFromWasm0(arg0, arg1));
2070
+ return ret;
2071
+ },
2072
+ __wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
2073
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2074
+ return ret;
2075
+ },
2076
+ __wbg_new_511b7d84dfb30888: function() { return handleError(function (arg0, arg1) {
2077
+ const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
2078
+ return ret;
2079
+ }, arguments); },
2080
+ __wbg_new_55ed41becb58cd16: function() { return handleError(function (arg0, arg1) {
2081
+ const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
2082
+ return ret;
2083
+ }, arguments); },
2084
+ __wbg_new_617a8cdb8bb1130e: function() {
2085
+ const ret = new Object();
2086
+ return ret;
2087
+ },
2088
+ __wbg_new_6ab88fbe741af6b5: function(arg0, arg1) {
2089
+ const ret = new RangeError(getStringFromWasm0(arg0, arg1));
2090
+ return ret;
2091
+ },
2092
+ __wbg_new_81d0c780bd13b3c8: function() { return handleError(function (arg0, arg1) {
2093
+ const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
2094
+ return ret;
2095
+ }, arguments); },
2096
+ __wbg_new_bc524849b21af6ee: function() { return handleError(function (arg0, arg1) {
2097
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2098
+ return ret;
2099
+ }, arguments); },
2100
+ __wbg_new_ee2291f50781bf1d: function() {
2101
+ const ret = new Array();
2102
+ return ret;
2103
+ },
2104
+ __wbg_of_20798cb14708764f: function(arg0, arg1) {
2105
+ const ret = Array.of(arg0, arg1);
2106
+ return ret;
2107
+ },
2108
+ __wbg_push_2baf45db356cf468: function(arg0, arg1) {
2109
+ const ret = arg0.push(arg1);
2110
+ return ret;
2111
+ },
2112
+ __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
2113
+ const ret = Reflect.set(arg0, arg1, arg2);
2114
+ return ret;
2115
+ }, arguments); },
2116
+ __wbindgen_generic_0000000000000001: function(arg0) {
2117
+ // Cast intrinsic for `F64 -> Externref`.
2118
+ const ret = arg0;
2119
+ return ret;
2120
+ },
2121
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
2122
+ // Cast intrinsic for `Ref(String) -> Externref`.
2123
+ const ret = getStringFromWasm0(arg0, arg1);
2124
+ return ret;
2125
+ },
2126
+ __wbindgen_init_externref_table: function() {
2127
+ const table = wasm.__wbindgen_externrefs;
2128
+ const offset = table.grow(4);
2129
+ table.set(0, undefined);
2130
+ table.set(offset + 0, undefined);
2131
+ table.set(offset + 1, null);
2132
+ table.set(offset + 2, true);
2133
+ table.set(offset + 3, false);
2134
+ },
2135
+ };
2136
+ return {
2137
+ __proto__: null,
2138
+ "./tda_wasm_bg.js": import0,
2139
+ };
2140
+ }
2141
+
2142
+ const PreparedComplexFinalization = (typeof FinalizationRegistry === 'undefined')
2143
+ ? { register: () => {}, unregister: () => {} }
2144
+ : new FinalizationRegistry(({ptr,epoch}) => { if (epoch === __oomEpoch) wasm.__wbg_preparedcomplex_free(ptr, 1); });
2145
+ const TwoParameterArrangementFinalization = (typeof FinalizationRegistry === 'undefined')
2146
+ ? { register: () => {}, unregister: () => {} }
2147
+ : new FinalizationRegistry(({ptr,epoch}) => { if (epoch === __oomEpoch) wasm.__wbg_twoparameterarrangement_free(ptr, 1); });
2148
+
2149
+ function addToExternrefTable0(obj) {
2150
+ const idx = wasm.__externref_table_alloc();
2151
+ wasm.__wbindgen_externrefs.set(idx, obj);
2152
+ return idx;
2153
+ }
2154
+
2155
+ function getArrayF64FromWasm0(ptr, len) {
2156
+ ptr = ptr >>> 0;
2157
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
2158
+ }
2159
+
2160
+ function getArrayI32FromWasm0(ptr, len) {
2161
+ ptr = ptr >>> 0;
2162
+ return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
2163
+ }
2164
+
2165
+ function getArrayU32FromWasm0(ptr, len) {
2166
+ ptr = ptr >>> 0;
2167
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
2168
+ }
2169
+
2170
+ function getArrayU8FromWasm0(ptr, len) {
2171
+ ptr = ptr >>> 0;
2172
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
2173
+ }
2174
+
2175
+ let cachedFloat64ArrayMemory0 = null;
2176
+ function getFloat64ArrayMemory0() {
2177
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
2178
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
2179
+ }
2180
+ return cachedFloat64ArrayMemory0;
2181
+ }
2182
+
2183
+ let cachedInt32ArrayMemory0 = null;
2184
+ function getInt32ArrayMemory0() {
2185
+ if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
2186
+ cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
2187
+ }
2188
+ return cachedInt32ArrayMemory0;
2189
+ }
2190
+
2191
+ function getStringFromWasm0(ptr, len) {
2192
+ return decodeText(ptr >>> 0, len);
2193
+ }
2194
+
2195
+ let cachedUint32ArrayMemory0 = null;
2196
+ function getUint32ArrayMemory0() {
2197
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
2198
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
2199
+ }
2200
+ return cachedUint32ArrayMemory0;
2201
+ }
2202
+
2203
+ let cachedUint8ArrayMemory0 = null;
2204
+ function getUint8ArrayMemory0() {
2205
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
2206
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
2207
+ }
2208
+ return cachedUint8ArrayMemory0;
2209
+ }
2210
+
2211
+ function handleError(f, args) {
2212
+ try {
2213
+ return f.apply(this, args);
2214
+ } catch (e) {
2215
+ const idx = addToExternrefTable0(e);
2216
+ wasm.__wbindgen_exn_store(idx);
2217
+ }
2218
+ }
2219
+
2220
+ function passArray32ToWasm0(arg, malloc) {
2221
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
2222
+ getUint32ArrayMemory0().set(arg, ptr / 4);
2223
+ WASM_VECTOR_LEN = arg.length;
2224
+ return ptr;
2225
+ }
2226
+
2227
+ function passArray8ToWasm0(arg, malloc) {
2228
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
2229
+ getUint8ArrayMemory0().set(arg, ptr / 1);
2230
+ WASM_VECTOR_LEN = arg.length;
2231
+ return ptr;
2232
+ }
2233
+
2234
+ function passArrayF64ToWasm0(arg, malloc) {
2235
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
2236
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
2237
+ WASM_VECTOR_LEN = arg.length;
2238
+ return ptr;
2239
+ }
2240
+
2241
+ function takeFromExternrefTable0(idx) {
2242
+ const value = wasm.__wbindgen_externrefs.get(idx);
2243
+ wasm.__externref_table_dealloc(idx);
2244
+ return value;
2245
+ }
2246
+
2247
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2248
+ cachedTextDecoder.decode();
2249
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2250
+ let numBytesDecoded = 0;
2251
+ function decodeText(ptr, len) {
2252
+ numBytesDecoded += len;
2253
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2254
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2255
+ cachedTextDecoder.decode();
2256
+ numBytesDecoded = len;
2257
+ }
2258
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2259
+ }
2260
+
2261
+ let WASM_VECTOR_LEN = 0;
2262
+
2263
+ let wasmModule, wasmInstance, wasm;
2264
+ function __wbg_finalize_init(instance, module) {
2265
+ const limits = WebAssembly.Module.customSections(module, 'topolab.memory-limit');
2266
+ if (limits.length) __oomLimit = Number(new TextDecoder().decode(limits[limits.length - 1]));
2267
+ wasmInstance = instance;
2268
+ wasm = __oomExports(instance.exports);
2269
+ __oomEpoch++;
2270
+ __oomInitialBytes = wasm.memory.buffer.byteLength;
2271
+ __oomRecordAddress = wasm.__oom_record();
2272
+ __capacityRecordAddress = wasm.__capacity_record();
2273
+ wasmModule = module;
2274
+ cachedFloat64ArrayMemory0 = null;
2275
+ cachedInt32ArrayMemory0 = null;
2276
+ cachedUint32ArrayMemory0 = null;
2277
+ cachedUint8ArrayMemory0 = null;
2278
+ wasm.__wbindgen_start();
2279
+ return wasm;
2280
+ }
2281
+ // Only evaluated on refusal. Sizes describe a fresh instance with retained
2282
+ // handles discarded; this is an estimate, never an admission check.
2283
+ const __oomPhases = ['allocator','edge list','adjacency matrix','edge collapse',
2284
+ 'coboundary columns','Delaunay triangulation','filtration','boundary matrix',
2285
+ 'cubical cells','cost matrix','transport plan','transport solver',
2286
+ 'sorted samples','projections','directions','result','input validation',
2287
+ 'geometric neighborhoods','zigzag interval state','volume optimization',
2288
+ 'representation grid','ladder matrices','(unused)','catalogue'];
2289
+ function __oomSize(bytes) {
2290
+ const units=['bytes','KiB','MiB','GiB'];
2291
+ let u=0; while(bytes>=1024 && u<3) {bytes/=1024;u++;}
2292
+ return bytes.toFixed(2)+' '+units[u];
2293
+ }
2294
+ function __oomEstimate(details) {
2295
+ const {function:fn,input:i,parameters:p,requestedBytes:r}=details;
2296
+ const headroom=Math.max(0,details.limitBytes-__oomInitialBytes);
2297
+ // Committed pages are NOT live usage. Their sum with the failed request
2298
+ // is a conservative pressure observation, not an exact peak calculation.
2299
+ const pressure=details.memoryBytes+r;
2300
+ const budget=0.5*headroom;
2301
+ const limits=details.allocationLimitBytes;
2302
+ let n,m,degree=2,working,unit='points per side',law,reference;
2303
+ if(fn==='ripsPersistence' && (p.maxDim??1)<=1 && (p.maxEdgeLength===Infinity) && p.coeff===2) {
2304
+ n=i.points??i.rows;
2305
+ // Infinity bounds edges by n*(n-1)/2; the enclosing-radius shortcut
2306
+ // can remove some. Radix staging and reduction also occupy memory.
2307
+ working=x=>(i.rows?56:48)*x*x+8*(i.dimension??0)*x;
2308
+ unit='points';law='Rips edge storage O(n^2), at most n*(n-1)/2 edges; same maxDim<=1, Infinity and coeff=2. Reduction is data dependent.';
2309
+ if(p.maxDim===1&&((i.dimension===3)||i.rows)) reference={size:i.rows?4096:8192,limitBytes:2147483648,unit:'points',parameters:'uniform unit-cube cloud, maxDim=1, Infinity, coeff=2; dense Euclidean matrix when applicable'};
2310
+ } else if((fn==='cubicalComplex'||fn==='cubicalPersistence') && i.shape?.length>=1 && i.shape.length<=3 && (fn==='cubicalComplex'||p.coeff===2)) {
2311
+ const d=i.shape.length; n=i.cells;degree=1;
2312
+ working=x=>32*3**d*x;
2313
+ unit='grid cells';law='Cubical cell count O(3^d * voxels), fixed dimension and aspect ratio, coeff=2. Reduction fill depends on values; conservative structural model.';
2314
+ if(fn==='cubicalPersistence'&&p.construction!=='V'&&d>=2&&i.shape.every(x=>x===i.shape[0])) reference={size:(d===2?4096**2:128**3),limitBytes:2147483648,unit:'grid cells',parameters:'uniform values, construction T, coeff=2, equal grid sides'};
2315
+ } else if(fn==='ripsComplex' && p.maxEdgeLength===Infinity && p.maxDim>=0 && p.maxDim<=3) {
2316
+ n=i.points??i.rows;degree=Math.max(i.rows?2:1,p.maxDim+1);
2317
+ working=x=>{let cells=0,choose=1;for(let k=1;k<=p.maxDim+1;k++){choose*=Math.max(0,x-k+1)/k;cells+=choose;}return 64*cells+(i.rows?8*x*x:8*x*(i.dimension??1));};
2318
+ unit='points';law='Full Rips complex bounded by sum(k=1..maxDim+1) binomial(n,k) simplices, plus graph and input, at Infinity; fixed maxDim<=3.';
2319
+ } else if(fn==='diagramWasserstein' && i.n>0 && i.m>0) {
2320
+ n=i.n;m=i.m;const ratio=m/n;
2321
+ working=x=>(x+1)*(ratio*x+1)>16777216?Infinity:64*(x+1)*(ratio*x+1)+512*(1+ratio)*x;
2322
+ unit='pairs per source diagram';law='Diagram Wasserstein O((n+1)*(m+1)), finite-pair counts bounded by total pairs, fixed ratio; includes cost matrix, diagonal node and simplex scratch. Existing 16777216-entry cap still applies.';
2323
+ if(n===m&&p.order===2&&p.internal_p===Infinity) reference={size:2048,limitBytes:2147483648,unit:'pairs per diagram',parameters:'finite uniform births/lifetimes, order=2, internalP=Infinity'};
2324
+ } else if(fn==='persistenceLandscape' && i.gridPoints>0 && p.first>=1 && p.last>=p.first) {
2325
+ n=i.gridPoints;degree=1;
2326
+ working=x=>8*x*(p.last-p.first+1+2*Math.min(p.last,16)+8)+64*i.pairElements;
2327
+ unit='grid points';law='Landscape memory O(gridPoints*levels+pairs), fixed first/last levels and same pairs. Includes output, per-grid work and sort buffers.';
2328
+ } else if(fn==='persistenceImage' && i.shape?.every(x=>x>0)) {
2329
+ n=i.cells;degree=1;
2330
+ working=x=>32*x+64*i.pairElements;
2331
+ unit='pixels';law='Persistence image memory O(rows*cols+pairs), fixed aspect ratio and same pairs. Output and per-axis work; double output allowance.';
2332
+ }
2333
+ if(!working || !(n>0) || !Number.isFinite(r) || !(r>0)) {
2334
+ details.estimateMethod='Omitted: data-dependent output size or reduction fill, or missing input dimensions, prevent a whole-input estimate. Input-copy and result-copy ceilings alone do not predict pipeline capacity.';
2335
+ return;
2336
+ }
2337
+ // Invert both the full working-set model and the failed structure's
2338
+ // measured pressure under its known degree. Round down, never up.
2339
+ const structural=n*Math.min(1,(budget/Math.max(pressure,1))**(1/degree), (limits/r)**(1/degree));
2340
+ let lo=0,hi=Math.min(n,structural);
2341
+ for(let k=0;k<48;k++) {const mid=(lo+hi)/2;if(working(mid)<=budget)lo=mid;else hi=mid;}
2342
+ let fit=Math.floor(lo);
2343
+ if(reference) {
2344
+ // Cross-check against the same-parameter capacity-benchmark doubling ladder.
2345
+ // A measured largest success is a conservative ceiling, not the true
2346
+ // maximum. Scaling that reference is still only a model at 64 MiB.
2347
+ fit=Math.min(fit,Math.floor(reference.size*(details.limitBytes/reference.limitBytes)**(1/degree)));
2348
+ details.capacityReference=reference;
2349
+ }
2350
+ if(fit<1) {details.estimateMethod=law+' Omitted: fixed inputs or the modeled working set leave no positive retry size.';return;}
2351
+ if(i.shape) {
2352
+ const factor=(fit/n)**(1/i.shape.length);
2353
+ const shape=i.shape.map(x=>Math.max(1,Math.floor(x*factor)));
2354
+ fit=shape.reduce((a,b)=>a*b,1);details.estimatedInputShape=shape;
2355
+ } else if(m) details.estimatedInputShape=[fit,Math.floor(fit*m/n)];
2356
+ if(fit<1 || (details.estimatedInputShape?.some(x=>x<1))) return;
2357
+ details.estimatedMaxInput=fit;
2358
+ details.estimateUnit=unit;
2359
+ details.estimateMethod=law+' Invert requestedBytes and committedBytes pressure with growth degree '+degree+'; take the smaller of that and the full working-set model using 50% of fresh-instance headroom, bounded by the single-buffer ceiling'+(reference?' and cross-checked against the 2026-10-17 capacity benchmark at the stated parameters':'')+'. Round down. Discard retained handles first; fragmentation, data-dependent fill and later stages can reduce capacity. Estimate, not a guarantee.';
2360
+ }
2361
+
2362
+ // Embedded inside each generated glue instance by patch_memory_glue.mjs.
2363
+ let __oomLimit = 4294967296;
2364
+ let __oomEpoch = 0, __oomPoisoned = false, __oomInitialBytes = 0;
2365
+ let __oomRecovery = () => {};
2366
+ let __oomCallDepth = 0, __oomFailureContext;
2367
+ function __oom_on_recover(callback) { __oomRecovery = callback; }
2368
+ function __oom_status() { return {memory:wasm.memory, epoch:__oomEpoch, limitBytes:__oomLimit}; }
2369
+ function __oomExports(raw) {
2370
+ const exports = {...raw};
2371
+ for (const [name, fn] of Object.entries(raw)) {
2372
+ if (typeof fn !== 'function') continue;
2373
+ exports[name] = (...args) => {
2374
+ if (__oomPoisoned) {
2375
+ if (/free|dealloc/.test(name)) return;
2376
+ throw new WebAssembly.RuntimeError('instance already trapped');
2377
+ }
2378
+ __oomCallDepth++;
2379
+ try {
2380
+ const result=fn(...args);
2381
+ if (__oomPoisoned) throw new WebAssembly.RuntimeError('nested engine call trapped');
2382
+ return result;
2383
+ }
2384
+ catch (error) {
2385
+ if (error instanceof WebAssembly.RuntimeError) __oomPoisoned = true;
2386
+ throw error;
2387
+ } finally { __oomCallDepth--; }
2388
+ };
2389
+ }
2390
+ return exports;
2391
+ }
2392
+ function __oomBegin() {
2393
+ if (__oomPoisoned) throw new WebAssembly.RuntimeError('instance already trapped');
2394
+ // A previous fallible reservation may have returned an ordinary error.
2395
+ // Clear only the failure marker; Rust exports set their own function id.
2396
+ new Uint32Array(wasm.memory.buffer, __oomRecordAddress, 5)[0] = 0;
2397
+ new Uint32Array(wasm.memory.buffer, __capacityRecordAddress, 5).fill(0);
2398
+ }
2399
+ function __oomCapacity(context, phase, requestedBytes, extra = {}) {
2400
+ const memoryBytes = extra.memoryBytes ?? wasm.memory.buffer.byteLength;
2401
+ // A recorded allocator failure whose request still fits the declared
2402
+ // remaining address space means the host refused growth before that max.
2403
+ // The reached pages are a conservative retry budget, not a discovered
2404
+ // permanent browser ceiling. Never infer this from a Layout/JS-copy error.
2405
+ const record = new Uint32Array(wasm.memory.buffer, __oomRecordAddress, 5);
2406
+ const capacityOverflow = extra.capacityOverflow === true || (phase === 'input-copy' && requestedBytes > 2147483647);
2407
+ const growthRefused = !capacityOverflow && phase !== 'output-copy' && record[0] > 0
2408
+ && memoryBytes < __oomLimit && requestedBytes <= __oomLimit - memoryBytes;
2409
+ const limitBytes = capacityOverflow ? Math.min(__oomLimit,2147483647) : growthRefused ? memoryBytes : __oomLimit;
2410
+ const details = {...context, phase, requestedBytes, inUseBytes:null,
2411
+ memoryBytes, committedBytes:memoryBytes, limitBytes, declaredMaxBytes:__oomLimit,
2412
+ allocationLimitBytes:Math.min(limitBytes,2147483647), ...extra};
2413
+ if (extra.elementBytes > 0) details.capacityEstimate = {
2414
+ maximumElements: Math.floor(details.allocationLimitBytes / extra.elementBytes),
2415
+ method:'Absolute ceiling for this buffer alone; other allocations and fragmentation reduce it. Not a largest-fitting whole-input estimate.'
2416
+ };
2417
+ __oomEstimate(details);
2418
+ const describe = value => JSON.stringify(value,(_key,x)=>typeof x==='number' && !Number.isFinite(x)?String(x):x);
2419
+ const remedy = __oomRemedies[context.function] ?? 'Use a smaller input.';
2420
+ const ceiling = requestedBytes > 2147483647 ? '; exceeds the wasm32 per-allocation ceiling (just below 2 GiB)' : '';
2421
+ // A growth the standard library refused before its size was checked
2422
+ // (the panic hook's record, alignment 0): only a lower bound is known.
2423
+ const atLeast = capacityOverflow && extra.alignment === 0 ? 'at least ' : '';
2424
+ const growth = growthRefused ? '; this browser refused to grow WebAssembly memory beyond '+__oomSize(limitBytes)+' (declared maximum '+__oomSize(__oomLimit)+')' : '';
2425
+ const fit = details.estimatedMaxInput;
2426
+ const estimate = fit ? '. About '+fit.toLocaleString('en-US')+' '+details.estimateUnit+' should fit with these parameters'+(details.estimatedInputShape ? ' (shape '+details.estimatedInputShape.join(' × ')+')' : '')+' in a fresh instance; estimate, not a guarantee' : '. No whole-input fit estimate is available for this stage';
2427
+ const error = new RangeError(context.function+': input too large for WebAssembly memory while building '+phase+'; '+atLeast+__oomSize(requestedBytes)+' requested'+ceiling+'; '+__oomSize(details.memoryBytes)+' committed (live usage unknown) of a '+__oomSize(__oomLimit)+' maximum'+growth+'; input '+describe(context.input)+'; parameters '+describe(context.parameters)+estimate+'. '+remedy);
2428
+ error.code='TOO_LARGE'; error.details=details;
2429
+ return error;
2430
+ }
2431
+ function __oomAllocate(size, align, copies, context) {
2432
+ const ptr=Number.isSafeInteger(size) && size>=0 && size<=Math.min(__oomLimit,2147483647) ? wasm.oom_reserve(size/align,align)>>>0 : 0;
2433
+ if (!ptr) throw __oomCapacity(context,'input-copy',size,{elements:size/align,elementBytes:align});
2434
+ copies.push([ptr,size,align]);
2435
+ return ptr;
2436
+ }
2437
+ function __oomNormalize(error, context) {
2438
+ if (error instanceof WebAssembly.RuntimeError) {
2439
+ // A nested user callback may catch a trap while an outer Rust call
2440
+ // is still on the stack. Recover only after all old wasm frames exit.
2441
+ __oomFailureContext ??= context;
2442
+ if (__oomCallDepth) throw error;
2443
+ context=__oomFailureContext;
2444
+ __oomFailureContext=undefined;
2445
+ // Read the poisoned instance before replacing any glue state. Do not
2446
+ // call back into it: even the record's address is cached at finalize.
2447
+ const record=Array.from(new Uint32Array(wasm.memory.buffer,__oomRecordAddress,5));
2448
+ const capacity=Array.from(new Uint32Array(wasm.memory.buffer,__capacityRecordAddress,5));
2449
+ const failure=(capacity[0] || capacity[1]) ? __oomCapacity(context,__oomPhases[capacity[3]]??'allocator',capacity[0]+4294967296*capacity[1],{
2450
+ capacityOverflow:true,alignment:capacity[2],functionId:record[2],phaseId:capacity[3],memoryBytes:capacity[4]*65536
2451
+ }) : record[0] ? __oomCapacity(context,__oomPhases[record[3]]??'allocator',record[0],{
2452
+ alignment:record[1],functionId:record[2],phaseId:record[3],memoryBytes:record[4]*65536
2453
+ }) : new Error(context.function+': internal WebAssembly trap ('+error.message+'); instance recovered',{cause:error});
2454
+ const compiled=wasmModule;
2455
+ const start=performance.now();
2456
+ __oomPoisoned=false;
2457
+ try {
2458
+ __wbg_finalize_init(new WebAssembly.Instance(compiled,__wbg_get_imports()),compiled);
2459
+ } catch (recoveryError) {
2460
+ __oomPoisoned=true;
2461
+ throw new Error(context.function+': WebAssembly instance recovery failed',{cause:recoveryError});
2462
+ }
2463
+ if (failure.details) failure.details.recoveryMilliseconds=performance.now()-start;
2464
+ // Memory views, scratch addresses and handles are invalidated before
2465
+ // control returns to the caller, including for an internal trap.
2466
+ __oomRecovery(wasm.memory);
2467
+ throw failure;
2468
+ }
2469
+ if (error && error.code==='TOO_LARGE') return error.details?.function ? error : __oomCapacity(context,error.details.phase,error.details.requestedBytes,error.details);
2470
+ // Existing allocation Result errors are retained only where already free.
2471
+ const match=/out of memory allocating (\d+) elements/.exec(error?.message);
2472
+ if (match) {
2473
+ const record=new Uint32Array(wasm.memory.buffer,__oomRecordAddress,5);
2474
+ if(record[0]) return __oomCapacity(context,__oomPhases[record[3]]??'allocator',record[0],{alignment:record[1],functionId:record[2],phaseId:record[3],memoryBytes:record[4]*65536});
2475
+ }
2476
+ return error;
2477
+ }
2478
+ let __oomRecordAddress=0, __capacityRecordAddress=0;
2479
+ // What a caller of each function can make smaller, in the API's own names.
2480
+ const __oomRemedies = {
2481
+ ripsPersistence:'Use fewer points, a smaller maxEdgeLength or a smaller maxDim.',
2482
+ ripsComplex:'Use fewer points, a smaller maxEdgeLength or a smaller maxSimplexDim.',
2483
+ ripsVineyard:'Use fewer points or clouds, a smaller maxEdgeLength or a smaller maxDim.',
2484
+ cechComplex:'Use fewer points, a smaller maxRadius or a smaller maxSimplexDim.',
2485
+ cechPersistence:'Use fewer points, a smaller maxRadius or a smaller maxSimplexDim.',
2486
+ delaunayCechComplex:'Use fewer points or a smaller maxRadius.',
2487
+ alphaComplex:'Use fewer points or a smaller maxSquaredRadius.',
2488
+ alphaPersistence:'Use fewer points or a smaller maxSquaredRadius.',
2489
+ coupledAlphaComplex:'Use a smaller maxSquaredRadius or a smaller maxSimplexDim.',
2490
+ kFoldCoverComplex:'Use fewer points, a smaller k, a smaller maxSquaredRadius or a smaller maxSimplexDim.',
2491
+ kFoldCoverPersistence:'Use fewer points, a smaller k, a smaller maxSquaredRadius or a smaller maxSimplexDim.',
2492
+ witnessComplex:'Use fewer points or landmarks, a smaller maxSquaredRelaxation or a smaller maxSimplexDim.',
2493
+ ellipsoids:'Use fewer points or a smaller neighbors.',
2494
+ ellipsoidRipsComplex:'Use fewer points, a smaller maxEdgeLength or a smaller maxSimplexDim.',
2495
+ ellipsoidRipsPersistence:'Use fewer points, a smaller maxEdgeLength or a smaller maxSimplexDim.',
2496
+ ellipsoidCechComplex:'Use fewer points, a smaller maxRadius or a smaller maxSimplexDim.',
2497
+ ellipsoidCechPersistence:'Use fewer points, a smaller maxRadius or a smaller maxSimplexDim.',
2498
+ wings:'Use fewer points.',
2499
+ wingComplex:'Use fewer points, a smaller maxEpsilon or a smaller maxSimplexDim.',
2500
+ wingPersistence:'Use fewer points, a smaller maxEpsilon or a smaller maxSimplexDim.',
2501
+ boxFiltration:'Use fewer points, a smaller maxSteps or a smaller maxSimplexDim.',
2502
+ boxFiltrationPersistence:'Use fewer points, a smaller maxSteps or a smaller maxSimplexDim.',
2503
+ cubicalComplex:'Use a smaller image or volume.',
2504
+ cubicalPersistence:'Use a smaller image or volume.',
2505
+ cubicalVineyard:'Use fewer or smaller images.',
2506
+ persistence:'Use a smaller complex.',
2507
+ prepareComplex:'Use a smaller complex.',
2508
+ vineyard:'Use a smaller complex or fewer frames.',
2509
+ zigzagPersistence:'Use fewer operations.',
2510
+ volumeOptimalCycles:'Use a smaller complex.',
2511
+ longPairs:'Use a smaller diagram.',
2512
+ bettiNumbers:'Use a smaller diagram.',
2513
+ bettiCurve:'Use a smaller diagram or grid.',
2514
+ persistenceLandscape:'Use a smaller diagram, a smaller grid or fewer layers.',
2515
+ persistenceImage:'Use a smaller diagram or resolution.',
2516
+ diagramWasserstein:'Use smaller diagrams.',
2517
+ diagramBottleneck:'Use smaller diagrams.',
2518
+ intervalApproximation:'Use a shorter ladder (a smaller n) or a smaller filtration.',
2519
+ decomposeCL4:'Use a smaller filtration.',
2520
+ courseRank:'Use a smaller filtration or a shorter course.',
2521
+ ripsThinningLadder:'Use fewer points, fewer edgeLengths or a smaller maxSimplexDim.'
2522
+ };
2523
+ return {
2524
+ exports: { PreparedComplex, TwoParameterArrangement, bettiCurveFlat, bettiNumbersFlat, bifiltrationPresentationFlat, boxFiltrationFlat, boxFiltrationPipeline, cechComplexFlat, cechPipeline, computeEllipsoidGeometry, computeWingGeometry, coupledAlphaComplex2DFlat, cubicalComplexFlat, cubicalPersistenceFlat, cubicalVertexPersistenceFlat, cubicalVineyardFlat, degreeRipsPresentationFlat, degreeRipsPresentationFromMatrixFlat, delaunayCechComplexFlat, diagramBottleneckFlat, diagramWassersteinFlat, ellipsoidCechComplexFlat, ellipsoidCechPipeline, ellipsoidRipsComplexFlat, ellipsoidRipsPipeline, euclideanWitnessComplexFlat, firepPresentationFlat, functionRipsPresentationFlat, functionRipsPresentationFromMatrixFlat, getPersistentPairs, kFoldCoverComplexFlat, kFoldCoverPipeline, longPairsFlat, multicriticalPresentationFlat, persistenceFlat, persistenceImageFlat, persistenceLandscapeFlat, presentationCoarsenFlat, presentationInvariantsFlat, presentationSliceFlat, ripsComplexFlat, ripsComplexFromMatrixFlat, ripsPersistenceFlat, ripsPersistenceFromDistanceMatrixFlat, ripsRepresentativesFlat, ripsRepresentativesFromDistanceMatrixFlat, ripsVineyardFlat, rivetInputFlat, rivetPresentationFlat, version, vineyardFlat, volumeOptimalCyclesFlat, weightedAlphaComplexFlat, weightedAlphaPipeline, wingComplexFlat, wingPipeline, zigzagPersistenceFlat, __oom_on_recover, __oom_status },
2525
+ imports: __wbg_get_imports,
2526
+ finalize: __wbg_finalize_init,
2527
+ };
2528
+ }