@topolab/tda 0.3.0 → 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.
@@ -130,6 +130,185 @@ class PreparedComplex {
130
130
  }
131
131
  if (Symbol.dispose) PreparedComplex.prototype[Symbol.dispose] = PreparedComplex.prototype.free;
132
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
+
133
312
  /**
134
313
  * @param {Float64Array} diagram
135
314
  * @param {Float64Array} grid
@@ -188,6 +367,40 @@ function bettiNumbersFlat(diagram, t) {
188
367
  }
189
368
  }
190
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
+
191
404
  /**
192
405
  * @param {Float64Array} points
193
406
  * @param {number} dimension
@@ -525,6 +738,60 @@ function cubicalVineyardFlat(dimensions, frames, frame_count, min_persistence, c
525
738
  }
526
739
  }
527
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
+
528
795
  /**
529
796
  * @param {Float64Array} points
530
797
  * @param {number} dimension
@@ -763,6 +1030,107 @@ function euclideanWitnessComplexFlat(points, dimension, num_landmarks, max_alpha
763
1030
  }
764
1031
  }
765
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
+
766
1134
  /**
767
1135
  * The test hook: `{ pairs, simplexOffsets, vertices }`.
768
1136
  * @param {Int32Array} vertices
@@ -876,6 +1244,43 @@ function longPairsFlat(flat, min_persistence) {
876
1244
  }
877
1245
  }
878
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
+
879
1284
  /**
880
1285
  * @param {Int32Array} vertices
881
1286
  * @param {Uint32Array} offsets
@@ -978,6 +1383,143 @@ function persistenceLandscapeFlat(pairs, first, last, grid) {
978
1383
  }
979
1384
  }
980
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
+
981
1523
  /**
982
1524
  * @param {Float64Array} points
983
1525
  * @param {number} dimension
@@ -1194,6 +1736,66 @@ function ripsVineyardFlat(clouds, dimension, frame_count, max_edge_length, max_d
1194
1736
  }
1195
1737
  }
1196
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
+
1197
1799
  /**
1198
1800
  * The package version this module was built as (package.json's).
1199
1801
  * @returns {string}
@@ -1463,6 +2065,10 @@ function __wbg_get_imports() {
1463
2065
  const ret = result;
1464
2066
  return ret;
1465
2067
  },
2068
+ __wbg_new_2bdcdfcebdfc34d2: function(arg0, arg1) {
2069
+ const ret = new TypeError(getStringFromWasm0(arg0, arg1));
2070
+ return ret;
2071
+ },
1466
2072
  __wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
1467
2073
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1468
2074
  return ret;
@@ -1491,6 +2097,18 @@ function __wbg_get_imports() {
1491
2097
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1492
2098
  return ret;
1493
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
+ },
1494
2112
  __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
1495
2113
  const ret = Reflect.set(arg0, arg1, arg2);
1496
2114
  return ret;
@@ -1524,6 +2142,9 @@ function __wbg_get_imports() {
1524
2142
  const PreparedComplexFinalization = (typeof FinalizationRegistry === 'undefined')
1525
2143
  ? { register: () => {}, unregister: () => {} }
1526
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); });
1527
2148
 
1528
2149
  function addToExternrefTable0(obj) {
1529
2150
  const idx = wasm.__externref_table_alloc();
@@ -1603,6 +2224,13 @@ function passArray32ToWasm0(arg, malloc) {
1603
2224
  return ptr;
1604
2225
  }
1605
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
+
1606
2234
  function passArrayF64ToWasm0(arg, malloc) {
1607
2235
  const ptr = malloc(arg.length * 8, 8) >>> 0;
1608
2236
  getFloat64ArrayMemory0().set(arg, ptr / 8);
@@ -1893,7 +2521,7 @@ const __oomRemedies = {
1893
2521
  ripsThinningLadder:'Use fewer points, fewer edgeLengths or a smaller maxSimplexDim.'
1894
2522
  };
1895
2523
  return {
1896
- exports: { PreparedComplex, bettiCurveFlat, bettiNumbersFlat, boxFiltrationFlat, boxFiltrationPipeline, cechComplexFlat, cechPipeline, computeEllipsoidGeometry, computeWingGeometry, coupledAlphaComplex2DFlat, cubicalComplexFlat, cubicalPersistenceFlat, cubicalVertexPersistenceFlat, cubicalVineyardFlat, delaunayCechComplexFlat, diagramBottleneckFlat, diagramWassersteinFlat, ellipsoidCechComplexFlat, ellipsoidCechPipeline, ellipsoidRipsComplexFlat, ellipsoidRipsPipeline, euclideanWitnessComplexFlat, getPersistentPairs, kFoldCoverComplexFlat, kFoldCoverPipeline, longPairsFlat, persistenceFlat, persistenceImageFlat, persistenceLandscapeFlat, ripsComplexFlat, ripsComplexFromMatrixFlat, ripsPersistenceFlat, ripsPersistenceFromDistanceMatrixFlat, ripsRepresentativesFlat, ripsRepresentativesFromDistanceMatrixFlat, ripsVineyardFlat, version, vineyardFlat, volumeOptimalCyclesFlat, weightedAlphaComplexFlat, weightedAlphaPipeline, wingComplexFlat, wingPipeline, zigzagPersistenceFlat, __oom_on_recover, __oom_status },
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 },
1897
2525
  imports: __wbg_get_imports,
1898
2526
  finalize: __wbg_finalize_init,
1899
2527
  };