@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,243 @@
1
+ import type { PointCloud } from './check.js';
2
+ import type { DistanceMatrix } from './types.js';
3
+ /**
4
+ * A minimal presentation of a two-parameter persistence module: generators
5
+ * and relations with grades `(x, y)`, and each relation as a sum of
6
+ * generators. Grades are stored as indices into the axes `xs` and `ys`.
7
+ * Relations are ordered by `y`, then `x`.
8
+ */
9
+ export interface Presentation {
10
+ /** The distinct first coordinates of the grades, increasing. */
11
+ xs: Float64Array;
12
+ /** The distinct second coordinates of the grades, increasing. */
13
+ ys: Float64Array;
14
+ /** `[x index, y index]` for each generator. */
15
+ generators: Uint32Array;
16
+ /** `[x index, y index]` for each relation. */
17
+ relations: Uint32Array;
18
+ /** Relation `j` is the sum of the generators `rows[offsets[j] .. offsets[j + 1]]`. */
19
+ offsets: Uint32Array;
20
+ /** Generator indices of the relations, increasing within a relation. */
21
+ rows: Uint32Array;
22
+ /** The homology degree the module is of. */
23
+ degree: number;
24
+ }
25
+ /** Options of {@link functionRipsPresentation}. */
26
+ export interface FunctionRipsPresentationOptions {
27
+ /** Homology degree, a non-negative integer. Default 1. */
28
+ degree?: number;
29
+ /** Largest edge kept, non-negative. Default `Infinity` (every pair). */
30
+ maxEdgeLength?: number;
31
+ }
32
+ /** The module's six arrays with the degree (internal: also used by src/rivet_input.ts). */
33
+ export declare function presentationOf(raw: Omit<Presentation, 'degree'>, degree: number): Presentation;
34
+ /**
35
+ * The minimal presentation of the degree-`degree` homology of the
36
+ * function-Rips bifiltration of a point cloud or a distance matrix: the
37
+ * simplex on a set of points is present at `(a, r)` when every point has
38
+ * function value `<= a` and every pair is at distance `<= r`. `values[i]` is
39
+ * the function at point `i` (for instance a codensity, so that dense
40
+ * regions come first). Degrees 0, 1 and 2 never build the complex (degrees 0
41
+ * and 1 take thousands of points, degree 2 hundreds); higher degrees build it
42
+ * up to dimension `degree + 1`.
43
+ */
44
+ export declare function functionRipsPresentation(points: PointCloud | DistanceMatrix, values: ArrayLike<number>, opts?: FunctionRipsPresentationOptions): Presentation;
45
+ /** Options of {@link degreeRipsPresentation}. */
46
+ export interface DegreeRipsPresentationOptions {
47
+ /** Homology degree, a non-negative integer. Default 1. */
48
+ degree?: number;
49
+ /** Largest edge kept, non-negative; degrees are counted among the edges kept. Default `Infinity`. */
50
+ maxEdgeLength?: number;
51
+ }
52
+ /**
53
+ * The minimal presentation of the degree-`degree` homology of the
54
+ * degree-Rips bifiltration of a point cloud or a distance matrix: at
55
+ * `(−k, r)`, the Rips complex at scale `r` on the points with at least `k`
56
+ * other points within `r`. The first coordinate is minus the degree, so that
57
+ * the complex grows along both axes; it needs no function on the points.
58
+ * Every simplex has one grade per degree its points reach, so the cost
59
+ * grows with the number of simplices times the number of points: for small
60
+ * clouds (about 60 points in degree 1 take a second).
61
+ */
62
+ export declare function degreeRipsPresentation(points: PointCloud | DistanceMatrix, opts?: DegreeRipsPresentationOptions): Presentation;
63
+ /**
64
+ * A bifiltered cell complex: cell `k` has dimension `dims[k]` and facets
65
+ * `facets[offsets[k] .. offsets[k + 1]]` (cell indices; none for a vertex).
66
+ * Without `gradeOffsets` each cell has one grade, `(grades[2k], grades[2k +
67
+ * 1])`, and every facet's grade must be at most its cell's in both
68
+ * coordinates. With `gradeOffsets` the bifiltration is multicritical: cell
69
+ * `k` is present from each of the grades number `gradeOffsets[k]` to
70
+ * `gradeOffsets[k + 1]` of `grades` on, and a facet must be present wherever
71
+ * its cell is.
72
+ */
73
+ export interface Bifiltration {
74
+ /** Dimension of each cell. */
75
+ dims: Uint8Array;
76
+ /** `[x, y]` for each grade: one per cell, or as `gradeOffsets` says. */
77
+ grades: Float64Array;
78
+ /** Multicritical only: offsets of the cells' grades (one more than the cells), counted in grades. */
79
+ gradeOffsets?: Uint32Array;
80
+ /** CSR offsets of the facets (one more than the cells). */
81
+ offsets: Uint32Array;
82
+ /** Facets as cell indices. */
83
+ facets: Uint32Array;
84
+ }
85
+ /** Options of {@link bifiltrationPresentation}. */
86
+ export interface BifiltrationPresentationOptions {
87
+ /** Homology degree, a non-negative integer. Default 1. */
88
+ degree?: number;
89
+ }
90
+ /**
91
+ * The minimal presentation of the degree-`degree` homology of any
92
+ * bifiltered cell complex, one grade a cell or several, over Z/2.
93
+ */
94
+ export declare function bifiltrationPresentation(bifiltration: Bifiltration, opts?: BifiltrationPresentationOptions): Presentation;
95
+ /** A presentation's arrays, checked for their kinds (internal: also used by src/arrangement.ts). */
96
+ export declare function checked(p: Presentation, name: string): Presentation;
97
+ /** The bigraded Betti numbers of a module and its Hilbert function. */
98
+ export interface BigradedBetti {
99
+ /** Grades `[x, y, …]` of the generators (ξ₀). */
100
+ b0: Float64Array;
101
+ /** Grades `[x, y, …]` of the relations (ξ₁). */
102
+ b1: Float64Array;
103
+ /** Grades `[x, y, …]` of the relations among the relations (ξ₂). */
104
+ b2: Float64Array;
105
+ /** The axes the Hilbert function is given on (the presentation's). */
106
+ xs: Float64Array;
107
+ /** See `xs`. */
108
+ ys: Float64Array;
109
+ /**
110
+ * The Hilbert function: `hilbert[iy · xs.length + ix]` is the dimension of
111
+ * the module at `(xs[ix], ys[iy])`, and at every point up to the next
112
+ * grid line on either axis. The module is zero below `xs[0]` or `ys[0]`.
113
+ */
114
+ hilbert: Uint32Array;
115
+ }
116
+ /**
117
+ * The bigraded Betti numbers ξ₀, ξ₁, ξ₂ of a presented module (the grades
118
+ * of the generators, the relations and the relations among relations, with
119
+ * multiplicity) and its Hilbert function, the dimension of the module at
120
+ * every point of the plane.
121
+ */
122
+ export declare function bigradedBetti(presentation: Presentation): BigradedBetti;
123
+ /**
124
+ * A line of non-negative slope: through `point`, along `direction` (both
125
+ * coordinates non-negative, not both zero) or at `angle` degrees from the
126
+ * first axis (0 to 90).
127
+ */
128
+ export type SliceLine = {
129
+ point: ArrayLike<number>;
130
+ direction: ArrayLike<number>;
131
+ } | {
132
+ point: ArrayLike<number>;
133
+ angle: number;
134
+ };
135
+ /** The barcode of a module along one line. */
136
+ export interface FiberedBarcode {
137
+ /**
138
+ * `[birth, death, …]` in the line's parameter `t`: the point of the line
139
+ * at `t` is `point + t · direction`. `death` is `Infinity` for a class
140
+ * that persists along the rest of the line. Sorted by birth, then death.
141
+ */
142
+ pairs: Float64Array;
143
+ /** The point of the line that `t = 0` is: the line's `point`. */
144
+ point: [number, number];
145
+ /** The unit direction of the line, as the module computed it from `direction` or `angle`. */
146
+ direction: [number, number];
147
+ }
148
+ /**
149
+ * The fibered barcode of a presented module: its barcode along each given
150
+ * line of non-negative slope. Restricted to such a line, a two-parameter
151
+ * module is a one-parameter module, and this is its barcode, in the line's
152
+ * parameter. One line gives one barcode; an array of lines an array of
153
+ * barcodes, in one call. The Rust core builds each line, as the crate's
154
+ * `Line::new` (a direction, normalised) or `Line::from_angle` (an angle: 0,
155
+ * 45 and 90 degrees exactly, others from the cosine and sine of the `libm`
156
+ * crate, a port of musl's) builds it, and returns it as the barcode's
157
+ * `point` and `direction`: the same bits in every JavaScript engine, in the
158
+ * Python package and from the crate.
159
+ */
160
+ export declare function fiberedBarcode(presentation: Presentation, line: SliceLine): FiberedBarcode;
161
+ export declare function fiberedBarcode(presentation: Presentation, lines: readonly SliceLine[]): FiberedBarcode[];
162
+ /**
163
+ * One line or an array of lines as the module reads them: `[px, py, a, b, …]`
164
+ * and one flag per line, 1 when the line is given by its angle (internal:
165
+ * also used by src/arrangement.ts).
166
+ */
167
+ export declare function linesOf(lines: SliceLine | readonly SliceLine[]): {
168
+ many: boolean;
169
+ flat: Float64Array;
170
+ angles: Uint8Array;
171
+ };
172
+ /**
173
+ * The barcodes of `{ pairs, offsets, lines }`, each with the line the module
174
+ * built (internal: also used by src/arrangement.ts).
175
+ */
176
+ export declare function barcodesOf(r: {
177
+ pairs: Float64Array;
178
+ offsets: Uint32Array;
179
+ lines: Float64Array;
180
+ }, many: boolean): FiberedBarcode | FiberedBarcode[];
181
+ /** One map of a {@link Firep}: a column per generator of its source, with that generator's grade and the indices of its non-zero rows. */
182
+ export interface FirepMatrix {
183
+ /** `[x, y]` for each column. */
184
+ grades: Float64Array;
185
+ /** Column `j` has the rows `rows[offsets[j] .. offsets[j + 1]]`. */
186
+ offsets: Uint32Array;
187
+ /** Row indices into the target's generators, from 0. */
188
+ rows: Uint32Array;
189
+ }
190
+ /**
191
+ * A chain complex of free bigraded modules `C2 → C1 → C0` over Z/2, RIVET's
192
+ * free implicit representation (FIRep): the module it presents is the
193
+ * homology at `C1`. Every row of a column of `high` must have a grade at most
194
+ * the column's, and the two maps must compose to zero.
195
+ */
196
+ export interface Firep {
197
+ /** `C2 → C1`: a column per generator of `C2`, rows indexing `C1`. */
198
+ high: FirepMatrix;
199
+ /** `C1 → C0`: a column per generator of `C1` (so its grades are those of `C1`), rows indexing `C0`. */
200
+ low: FirepMatrix;
201
+ /** The number of generators of `C0` (their grades are not needed). */
202
+ lowRank: number;
203
+ }
204
+ /** Options of {@link firepPresentation}. */
205
+ export interface FirepPresentationOptions {
206
+ /** The homology degree recorded in the result (the module is the homology at `C1` whatever it is). Default 1. */
207
+ degree?: number;
208
+ }
209
+ /**
210
+ * The minimal presentation of the homology of a chain complex of free
211
+ * bigraded modules at its middle (RIVET's FIRep input), over Z/2.
212
+ */
213
+ export declare function firepPresentation(firep: Firep, opts?: FirepPresentationOptions): Presentation;
214
+ /** Options of {@link coarsenPresentation}. */
215
+ export interface CoarsenPresentationOptions {
216
+ /**
217
+ * Bins on the first axis (RIVET's `--xbins`), a non-negative integer.
218
+ * Default 0: the axis as it is. So is an axis with at most this many
219
+ * distinct grades.
220
+ */
221
+ xbins?: number;
222
+ /** Bins on the second axis (RIVET's `--ybins`), as `xbins`. */
223
+ ybins?: number;
224
+ /**
225
+ * `[lo, hi]` covered by the bins of the first axis. Default: from the
226
+ * smallest to the largest first coordinate of the grades. `hi` must be at
227
+ * least the largest one.
228
+ */
229
+ xRange?: ArrayLike<number>;
230
+ /** `[lo, hi]` covered by the bins of the second axis, as `xRange`. */
231
+ yRange?: ArrayLike<number>;
232
+ }
233
+ /**
234
+ * The minimal presentation of the module coarsened onto a grid, as RIVET
235
+ * coarsens with `--xbins` and `--ybins`: `xbins` values evenly spaced over
236
+ * `xRange`, the last at its end (`lo + k (hi − lo) / xbins`, `k = 1 …
237
+ * xbins`), the same for `y`, and every grade rounded up to the grid. The
238
+ * coarsened module at a point is the module at the largest grid point below
239
+ * it, so fewer grades, fewer anchors and a smaller augmented arrangement,
240
+ * at the price of moving every interval's ends up to the grid.
241
+ */
242
+ export declare function coarsenPresentation(presentation: Presentation, opts?: CoarsenPresentationOptions): Presentation;
243
+ //# sourceMappingURL=two_parameter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"two_parameter.d.ts","sourceRoot":"","sources":["../src/two_parameter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,EAAE,EAAE,YAAY,CAAC;IACjB,iEAAiE;IACjE,EAAE,EAAE,YAAY,CAAC;IACjB,+CAA+C;IAC/C,UAAU,EAAE,WAAW,CAAC;IACxB,8CAA8C;IAC9C,SAAS,EAAE,WAAW,CAAC;IACvB,sFAAsF;IACtF,OAAO,EAAE,WAAW,CAAC;IACrB,wEAAwE;IACxE,IAAI,EAAE,WAAW,CAAC;IAClB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;CAChB;A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B,mBAAmB,CAAC,YAAY,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,0BAA0B,GAAG,YAAY,CAY/G"}
@@ -0,0 +1,275 @@
1
+ /**
2
+ * Two-parameter persistent homology: minimal presentations, bigraded Betti
3
+ * numbers, the Hilbert function and the fibered barcode (the barcode along a
4
+ * line), over Z/2.
5
+ */
6
+ import { allFinite, f64, finite, int, isTyped, kind, nonNegative, options, points as checkPoints, sized } from './check.js';
7
+ import { distanceMatrix, isMatrix } from './complex.js';
8
+ import { call, module } from './load.js';
9
+ const FUNCTION_RIPS_KEYS = { degree: true, maxEdgeLength: true };
10
+ /** The module's six arrays with the degree (internal: also used by src/rivet_input.ts). */
11
+ export function presentationOf(raw, degree) {
12
+ return {
13
+ xs: raw.xs,
14
+ ys: raw.ys,
15
+ generators: raw.generators,
16
+ relations: raw.relations,
17
+ offsets: raw.offsets,
18
+ rows: raw.rows,
19
+ degree
20
+ };
21
+ }
22
+ /**
23
+ * The minimal presentation of the degree-`degree` homology of the
24
+ * function-Rips bifiltration of a point cloud or a distance matrix: the
25
+ * simplex on a set of points is present at `(a, r)` when every point has
26
+ * function value `<= a` and every pair is at distance `<= r`. `values[i]` is
27
+ * the function at point `i` (for instance a codensity, so that dense
28
+ * regions come first). Degrees 0, 1 and 2 never build the complex (degrees 0
29
+ * and 1 take thousands of points, degree 2 hundreds); higher degrees build it
30
+ * up to dimension `degree + 1`.
31
+ */
32
+ export function functionRipsPresentation(points, values, opts) {
33
+ module();
34
+ const o = options(opts, 'functionRipsPresentation', FUNCTION_RIPS_KEYS);
35
+ const matrix = isMatrix(points, 'points');
36
+ const n = matrix ? distanceMatrix(points, 'points') : checkPoints(points, 'points');
37
+ const fn = f64(values, 'values');
38
+ sized(fn.length, n, 'values', 'one function value per point');
39
+ allFinite(fn, 'values');
40
+ const degree = o.degree === undefined ? 1 : int(o.degree, 'degree', 0, 254);
41
+ const threshold = o.maxEdgeLength === undefined ? Infinity : nonNegative(o.maxEdgeLength, 'maxEdgeLength');
42
+ return call((m) => {
43
+ if (matrix) {
44
+ return presentationOf(m.functionRipsPresentationFromMatrixFlat(points.distances, n, fn, threshold, degree), degree);
45
+ }
46
+ const { coords, d } = points;
47
+ return presentationOf(m.functionRipsPresentationFlat(coords, d, fn, threshold, degree), degree);
48
+ });
49
+ }
50
+ const DEGREE_RIPS_KEYS = { degree: true, maxEdgeLength: true };
51
+ /**
52
+ * The minimal presentation of the degree-`degree` homology of the
53
+ * degree-Rips bifiltration of a point cloud or a distance matrix: at
54
+ * `(−k, r)`, the Rips complex at scale `r` on the points with at least `k`
55
+ * other points within `r`. The first coordinate is minus the degree, so that
56
+ * the complex grows along both axes; it needs no function on the points.
57
+ * Every simplex has one grade per degree its points reach, so the cost
58
+ * grows with the number of simplices times the number of points: for small
59
+ * clouds (about 60 points in degree 1 take a second).
60
+ */
61
+ export function degreeRipsPresentation(points, opts) {
62
+ module();
63
+ const o = options(opts, 'degreeRipsPresentation', DEGREE_RIPS_KEYS);
64
+ const matrix = isMatrix(points, 'points');
65
+ const n = matrix ? distanceMatrix(points, 'points') : checkPoints(points, 'points');
66
+ const degree = o.degree === undefined ? 1 : int(o.degree, 'degree', 0, 254);
67
+ const threshold = o.maxEdgeLength === undefined ? Infinity : nonNegative(o.maxEdgeLength, 'maxEdgeLength');
68
+ return call((m) => {
69
+ if (matrix) {
70
+ return presentationOf(m.degreeRipsPresentationFromMatrixFlat(points.distances, n, threshold, degree), degree);
71
+ }
72
+ const { coords, d } = points;
73
+ return presentationOf(m.degreeRipsPresentationFlat(coords, d, threshold, degree), degree);
74
+ });
75
+ }
76
+ const BIFILTRATION_PRESENTATION_KEYS = { degree: true };
77
+ /** A typed array of kind `arrayKind`, from this realm or another. */
78
+ function typed(v, arrayKind, name) {
79
+ if (!isTyped(v, arrayKind))
80
+ throw new TypeError(`${name} must be a ${arrayKind}, got ${kind(v)}`);
81
+ return v;
82
+ }
83
+ /** A data object (its fields are read, not listed): anything but an object is a `TypeError`. */
84
+ function record(v, name) {
85
+ if (v === null || typeof v !== 'object' || Array.isArray(v))
86
+ throw new TypeError(`${name} must be an object, got ${kind(v)}`);
87
+ return v;
88
+ }
89
+ /**
90
+ * The minimal presentation of the degree-`degree` homology of any
91
+ * bifiltered cell complex, one grade a cell or several, over Z/2.
92
+ */
93
+ export function bifiltrationPresentation(bifiltration, opts) {
94
+ module();
95
+ const b = record(bifiltration, 'bifiltration');
96
+ const o = options(opts, 'bifiltrationPresentation', BIFILTRATION_PRESENTATION_KEYS);
97
+ const dims = typed(b.dims, 'Uint8Array', 'bifiltration.dims');
98
+ const grades = typed(b.grades, 'Float64Array', 'bifiltration.grades');
99
+ const offsets = typed(b.offsets, 'Uint32Array', 'bifiltration.offsets');
100
+ const facets = typed(b.facets, 'Uint32Array', 'bifiltration.facets');
101
+ const degree = o.degree === undefined ? 1 : int(o.degree, 'degree', 0, 254);
102
+ if (b.gradeOffsets !== undefined) {
103
+ const gradeOffsets = typed(b.gradeOffsets, 'Uint32Array', 'bifiltration.gradeOffsets');
104
+ return call((m) => presentationOf(m.multicriticalPresentationFlat(dims, gradeOffsets, grades, offsets, facets, degree), degree));
105
+ }
106
+ return call((m) => presentationOf(m.bifiltrationPresentationFlat(dims, grades, offsets, facets, degree), degree));
107
+ }
108
+ /** A presentation's arrays, checked for their kinds (internal: also used by src/arrangement.ts). */
109
+ export function checked(p, name) {
110
+ const o = record(p, name);
111
+ typed(o.xs, 'Float64Array', `${name}.xs`);
112
+ typed(o.ys, 'Float64Array', `${name}.ys`);
113
+ typed(o.generators, 'Uint32Array', `${name}.generators`);
114
+ typed(o.relations, 'Uint32Array', `${name}.relations`);
115
+ typed(o.offsets, 'Uint32Array', `${name}.offsets`);
116
+ typed(o.rows, 'Uint32Array', `${name}.rows`);
117
+ return o;
118
+ }
119
+ function gradesOf(p, grid) {
120
+ const out = new Float64Array(grid.length);
121
+ for (let i = 0; i < grid.length; i += 2) {
122
+ out[i] = p.xs[grid[i]];
123
+ out[i + 1] = p.ys[grid[i + 1]];
124
+ }
125
+ return out;
126
+ }
127
+ /**
128
+ * The bigraded Betti numbers ξ₀, ξ₁, ξ₂ of a presented module (the grades
129
+ * of the generators, the relations and the relations among relations, with
130
+ * multiplicity) and its Hilbert function, the dimension of the module at
131
+ * every point of the plane.
132
+ */
133
+ export function bigradedBetti(presentation) {
134
+ module();
135
+ const p = checked(presentation, 'presentation');
136
+ return call((m) => {
137
+ const r = m.presentationInvariantsFlat(p.xs, p.ys, p.generators, p.relations, p.offsets, p.rows);
138
+ return {
139
+ b0: gradesOf(p, p.generators),
140
+ b1: gradesOf(p, p.relations),
141
+ b2: gradesOf(p, r.syzygies),
142
+ xs: p.xs,
143
+ ys: p.ys,
144
+ hilbert: r.hilbert
145
+ };
146
+ });
147
+ }
148
+ /**
149
+ * One line, checked, as the module reads it: `[px, py, a, b]` with `angle`
150
+ * false for the direction `(a, b)`, or `[px, py, degrees, 0]` with `angle`
151
+ * true. The module builds the line (it normalises the direction, or takes
152
+ * the cosine and sine of the angle), so that it is the line a Rust caller of
153
+ * `Line::new` or `Line::from_angle` gets, to the bit.
154
+ */
155
+ function lineOf(line, name) {
156
+ const l = record(line, name);
157
+ const point = l.point;
158
+ if (point === null || typeof point !== 'object' || point.length !== 2) {
159
+ throw new TypeError(`${name}.point must be [x, y], got ${kind(point)}`);
160
+ }
161
+ const px = finite(point[0], `${name}.point[0]`);
162
+ const py = finite(point[1], `${name}.point[1]`);
163
+ if (l.direction !== undefined) {
164
+ const direction = l.direction;
165
+ if (direction === null || typeof direction !== 'object' || direction.length !== 2) {
166
+ throw new TypeError(`${name}.direction must be [dx, dy], got ${kind(direction)}`);
167
+ }
168
+ const dx = nonNegative(direction[0], `${name}.direction[0]`);
169
+ const dy = nonNegative(direction[1], `${name}.direction[1]`);
170
+ if (!Number.isFinite(dx) || !Number.isFinite(dy) || (dx === 0 && dy === 0)) {
171
+ throw new RangeError(`${name}.direction must be finite and not zero, got [${dx}, ${dy}]`);
172
+ }
173
+ return { numbers: [px, py, dx, dy], angle: false };
174
+ }
175
+ const angle = finite(l.angle, `${name}.angle`);
176
+ if (angle < 0 || angle > 90)
177
+ throw new RangeError(`${name}.angle must be between 0 and 90 degrees, got ${angle}`);
178
+ return { numbers: [px, py, angle, 0], angle: true };
179
+ }
180
+ export function fiberedBarcode(presentation, lines) {
181
+ module();
182
+ const p = checked(presentation, 'presentation');
183
+ const { many, flat, angles } = linesOf(lines);
184
+ return call((m) => barcodesOf(m.presentationSliceFlat(p.xs, p.ys, p.generators, p.relations, p.offsets, p.rows, flat, angles), many));
185
+ }
186
+ /**
187
+ * One line or an array of lines as the module reads them: `[px, py, a, b, …]`
188
+ * and one flag per line, 1 when the line is given by its angle (internal:
189
+ * also used by src/arrangement.ts).
190
+ */
191
+ export function linesOf(lines) {
192
+ const many = Array.isArray(lines);
193
+ const list = (many ? lines : [lines]);
194
+ const flat = new Float64Array(4 * list.length);
195
+ const angles = new Uint8Array(list.length);
196
+ list.forEach((l, i) => {
197
+ const { numbers, angle } = lineOf(l, many ? `lines[${i}]` : 'line');
198
+ flat.set(numbers, 4 * i);
199
+ angles[i] = angle ? 1 : 0;
200
+ });
201
+ return { many, flat, angles };
202
+ }
203
+ /**
204
+ * The barcodes of `{ pairs, offsets, lines }`, each with the line the module
205
+ * built (internal: also used by src/arrangement.ts).
206
+ */
207
+ export function barcodesOf(r, many) {
208
+ const out = [];
209
+ for (let i = 0; i < r.lines.length / 4; i++) {
210
+ out.push({
211
+ pairs: r.pairs.slice(2 * r.offsets[i], 2 * r.offsets[i + 1]),
212
+ point: [r.lines[4 * i], r.lines[4 * i + 1]],
213
+ direction: [r.lines[4 * i + 2], r.lines[4 * i + 3]]
214
+ });
215
+ }
216
+ return many ? out : out[0];
217
+ }
218
+ const FIREP_KEYS = { degree: true };
219
+ function firepMatrix(v, name) {
220
+ const m = record(v, name);
221
+ return {
222
+ grades: typed(m.grades, 'Float64Array', `${name}.grades`),
223
+ offsets: typed(m.offsets, 'Uint32Array', `${name}.offsets`),
224
+ rows: typed(m.rows, 'Uint32Array', `${name}.rows`)
225
+ };
226
+ }
227
+ /**
228
+ * The minimal presentation of the homology of a chain complex of free
229
+ * bigraded modules at its middle (RIVET's FIRep input), over Z/2.
230
+ */
231
+ export function firepPresentation(firep, opts) {
232
+ module();
233
+ const f = record(firep, 'firep');
234
+ const high = firepMatrix(f.high, 'firep.high');
235
+ const low = firepMatrix(f.low, 'firep.low');
236
+ const lowRank = int(f.lowRank, 'firep.lowRank', 0);
237
+ const o = options(opts, 'firepPresentation', FIREP_KEYS);
238
+ const degree = o.degree === undefined ? 1 : int(o.degree, 'degree', 0, 254);
239
+ return call((m) => presentationOf(m.firepPresentationFlat(high.grades, high.offsets, high.rows, low.grades, low.offsets, low.rows, lowRank), degree));
240
+ }
241
+ const COARSEN_KEYS = { xbins: true, ybins: true, xRange: true, yRange: true };
242
+ function rangeOf(v, name) {
243
+ if (v === undefined)
244
+ return new Float64Array(0);
245
+ if (v === null || typeof v !== 'object' || v.length !== 2) {
246
+ throw new TypeError(`${name} must be [lo, hi], got ${kind(v)}`);
247
+ }
248
+ const r = v;
249
+ const lo = finite(r[0], `${name}[0]`);
250
+ const hi = finite(r[1], `${name}[1]`);
251
+ if (lo > hi)
252
+ throw new RangeError(`${name} must have lo <= hi, got [${lo}, ${hi}]`);
253
+ return Float64Array.of(lo, hi);
254
+ }
255
+ /**
256
+ * The minimal presentation of the module coarsened onto a grid, as RIVET
257
+ * coarsens with `--xbins` and `--ybins`: `xbins` values evenly spaced over
258
+ * `xRange`, the last at its end (`lo + k (hi − lo) / xbins`, `k = 1 …
259
+ * xbins`), the same for `y`, and every grade rounded up to the grid. The
260
+ * coarsened module at a point is the module at the largest grid point below
261
+ * it, so fewer grades, fewer anchors and a smaller augmented arrangement,
262
+ * at the price of moving every interval's ends up to the grid.
263
+ */
264
+ export function coarsenPresentation(presentation, opts) {
265
+ module();
266
+ const p = checked(presentation, 'presentation');
267
+ const o = options(opts, 'coarsenPresentation', COARSEN_KEYS);
268
+ const xbins = o.xbins === undefined ? 0 : int(o.xbins, 'xbins', 0);
269
+ const ybins = o.ybins === undefined ? 0 : int(o.ybins, 'ybins', 0);
270
+ const xRange = rangeOf(o.xRange, 'xRange');
271
+ const yRange = rangeOf(o.yRange, 'yRange');
272
+ const degree = typeof p.degree === 'number' ? p.degree : 0;
273
+ return call((m) => presentationOf(m.presentationCoarsenFlat(p.xs, p.ys, p.generators, p.relations, p.offsets, p.rows, xbins, ybins, xRange, yRange), degree));
274
+ }
275
+ //# sourceMappingURL=two_parameter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"two_parameter.js","sourceRoot":"","sources":["../src/two_parameter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE5H,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAiCzC,MAAM,kBAAkB,GAA0C,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AAExG,2FAA2F;AAC3F,MAAM,UAAU,cAAc,CAAC,GAAiC,EAAE,MAAc;IAC9E,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAmC,EACnC,MAAyB,EACz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