wasm-bhtsne 0.3.3 → 1.1.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.
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -3,25 +3,32 @@
3
3
  <div align="center">
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
-
7
6
  </div>
8
7
 
8
+
9
9
  This is the wasm version of the [bhtsne](https://github.com/frjnn/bhtsne) crate.
10
10
 
11
- Parallel implementations of Barnes-Hut and exact implementations of the t-SNE algorithm written in Rust to run in wasm. The tree-accelerated version of the algorithm is described with fine detail in [this paper](http://lvdmaaten.github.io/publications/papers/JMLR_2014.pdf) by [Laurens van der Maaten](https://github.com/lvdmaaten). The exact, original, version of the algorithm is described in [this other paper](https://www.jmlr.org/papers/volume9/vandermaaten08a/vandermaaten08a.pdf) by [G. Hinton](https://www.cs.toronto.edu/~hinton/) and Laurens van der Maaten.
12
- Additional implementations of the algorithm, are listed at [this page](http://lvdmaaten.github.io/tsne/).
11
+ ## Features
12
+ - Harnesses multi-threading capabilities through [wasm-bindgen-rayon](https://github.com/RReverser/wasm-bindgen-rayon).
13
+ - Allows passing t-SNE hyperparameters through a JavaScript object, where you only need to include the parameters you want to change from the defaults. If you don't specify any, default values are used.
14
+ - Supports running the algorithm in iterations, enabling progressive refinement of the embedding
15
+ - Supports both Float32Array and Float64Array for data input
16
+
17
+ ## Requirements
18
+ To use the multithreading feature, you need to enable `SharedArrayBuffer` on the Web. As stated in the [wasm-bindgen-rayon readme](https://github.com/RReverser/wasm-bindgen-rayon/blob/main/README.md):
19
+
20
+ In order to use `SharedArrayBuffer` on the Web, you need to enable [cross-origin isolation policies](https://web.dev/coop-coep/). Check out the linked article for details.
13
21
 
14
22
  ## Installation
23
+ Install the [wasm-bhtsne npm package](https://www.npmjs.com/package/wasm-bhtsne):
15
24
  ```shell
16
25
  npm i wasm-bhtsne
17
26
  ```
18
27
 
19
- ### Example
28
+ ## Example
20
29
 
21
30
  ```javascript
22
- import init, { tSNE } from "wasm_bhtsne";
23
-
24
- await init();
31
+ import { threads } from 'wasm-feature-detect';
25
32
 
26
33
  function createRandomMatrix(rows, columns) {
27
34
  return Array.from({ length: rows }, () =>
@@ -29,14 +36,57 @@ function createRandomMatrix(rows, columns) {
29
36
  );
30
37
  }
31
38
 
32
- // create random points and dimensions
33
- const data = createRandomMatrix(500, 4);
39
+ (async function initMultiThread() {
40
+ const multiThread = await import('./pkg-parallel/wasm_bhtsne.js');
41
+ await multiThread.default();
42
+ if (await threads()) {
43
+ console.log("Browser supports threads");
44
+ await multiThread.initThreadPool(navigator.hardwareConcurrency);
45
+ } else {
46
+ console.log("Browser does not support threads");
47
+ }
34
48
 
35
- const tsne_encoder = new tSNE(data);
49
+ Object.assign(document.getElementById("wasm-bhtsne"), {
50
+ async onclick() {
36
51
 
37
- // as argument the number of epochs,
38
- const compressed_vectors = tsne_encoder.barnes_hut(1000);
52
+ // create random points and dimensions
53
+ const data = createRandomMatrix(5000, 512);
54
+
55
+ // Example of setting hyperparameters
56
+ const opt = {
57
+ learning_rate: 150.0,
58
+ perplexity: 30.0,
59
+ theta: 0.6
60
+ };
61
+
62
+ // let tsne_encoder = new multiThread.bhtSNEf64(data, opt);
63
+ // or
64
+ let tsne_encoder = new multiThread.bhtSNEf32(data, opt);
65
+ let compressed_vectors;
66
+
67
+ for (let i = 0; i < 1000; i++) {
68
+ compressed_vectors = tsne_encoder.step(1)
69
+ /* …do something with `compressed_vectors`… */
70
+ }
71
+
72
+ console.log("Compressed Vectors:", compressed_vectors);
73
+ },
74
+ disabled: false
75
+ });
76
+ })();
77
+ ```
39
78
 
40
- console.log("Compressed Vectors:", compressed_vectors);
79
+ ## Hyperparameters
80
+ Here is a list of hyperparameters that can be set in the JavaScript object, along with their default values and descriptions:
41
81
 
42
- ```
82
+ - **`learning_rate`** (default: `200.0`): controls the step size during the optimization.
83
+ - **`momentum`** (default: `0.5`): helps accelerate gradients vectors in the right directions, thus leading to faster converging.
84
+ - **`final_momentum`** (default: `0.8`): momentum value used after a certain number of iterations.
85
+ - **`momentum_switch_epoch`** (default: `250`): the epoch after which the algorithm switches to `final_momentum` for the map update.
86
+ - **`stop_lying_epoch`** (default: `250`): the epoch after which the P distribution values become true. For epochs < `stop_lying_epoch`, the values of the P distribution are multiplied by a factor equal to `12.0`.
87
+ - **`theta`** (default: `0.5`): Determines the accuracy of the approximation. Larger values increase the speed but decrease accuracy. Must be strictly greater than 0.0.
88
+ - **`embedding_dim`** (default: `2`): the dimensionality of the embedding space.
89
+ - **`perplexity`** (default: `20.0`): the perplexity value. It determines the balance between local and global aspects of the data. A good value lies between 5.0 and 50.0.
90
+
91
+
92
+
package/package.json CHANGED
@@ -3,8 +3,8 @@
3
3
  "collaborators": [
4
4
  "lv291 <baiunco291@proton.me>"
5
5
  ],
6
- "description": "Exact and Barnes-Hut implementations of t-SNE in wasm",
7
- "version": "0.3.3",
6
+ "description": "Barnes-Hut implementations of t-SNE in wasm",
7
+ "version": "1.1.0",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
@@ -23,8 +23,8 @@
23
23
  "keywords": [
24
24
  "tsne",
25
25
  "data-visualization",
26
- "data-analysis",
27
- "Barnes-Hut",
28
- "machine-learning"
26
+ "webassembly",
27
+ "wasm",
28
+ "rust"
29
29
  ]
30
30
  }
package/wasm_bhtsne.d.ts CHANGED
@@ -1,52 +1,95 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
+ * @param {number} num_threads
5
+ * @returns {Promise<any>}
6
+ */
7
+ export function initThreadPool(num_threads: number): Promise<any>;
8
+ /**
9
+ * @param {number} receiver
10
+ */
11
+ export function wbg_rayon_start_worker(receiver: number): void;
12
+ /**
4
13
  * t-distributed stochastic neighbor embedding. Provides a parallel implementation of both the
5
14
  * exact version of the algorithm and the tree accelerated one leveraging space partitioning trees.
6
15
  */
7
- export class tSNE {
16
+ export class bhtSNEf32 {
8
17
  free(): void;
9
18
  /**
10
- * @param {Array<any>} vectors
19
+ * @param {any} data
20
+ * @param {any} opt
11
21
  */
12
- constructor(vectors: Array<any>);
22
+ constructor(data: any, opt: any);
13
23
  /**
14
24
  * Performs a parallel Barnes-Hut approximation of the t-SNE algorithm.
15
25
  *
16
26
  * # Arguments
17
27
  *
18
- * * `theta` - determines the accuracy of the approximation. Must be **strictly greater than
19
- * 0.0**. Large values for θ increase the speed of the algorithm but decrease its accuracy.
20
- * For small values of θ it is less probable that a cell in the space partitioning tree will
21
- * be treated as a single point. For θ equal to 0.0 the method degenerates in the exact
22
- * version.
23
- *
24
- * * `metric_f` - metric function.
28
+ * `epochs` - the maximum number of fitting iterations. Must be positive
29
+ * @param {number} epochs
30
+ * @returns {any}
31
+ */
32
+ step(epochs: number): any;
33
+ }
34
+ /**
35
+ */
36
+ export class bhtSNEf64 {
37
+ free(): void;
38
+ /**
39
+ * @param {any} data
40
+ * @param {any} opt
41
+ */
42
+ constructor(data: any, opt: any);
43
+ /**
44
+ * Performs a parallel Barnes-Hut approximation of the t-SNE algorithm.
25
45
  *
46
+ * # Arguments
26
47
  *
27
- * **Do note that** `metric_f` **must be a metric distance**, i.e. it must
28
- * satisfy the [triangle inequality](https://en.wikipedia.org/wiki/Triangle_inequality).
48
+ * `epochs` - Sets epochs, the maximum number of fitting iterations.
29
49
  * @param {number} epochs
30
- * @returns {Array<any>}
50
+ * @returns {any}
51
+ */
52
+ step(epochs: number): any;
53
+ }
54
+ /**
55
+ */
56
+ export class wbg_rayon_PoolBuilder {
57
+ free(): void;
58
+ /**
59
+ * @returns {number}
60
+ */
61
+ numThreads(): number;
62
+ /**
63
+ * @returns {number}
31
64
  */
32
- barnes_hut(epochs: number): Array<any>;
65
+ receiver(): number;
33
66
  /**
34
67
  */
35
- theta: number;
68
+ build(): void;
36
69
  }
37
70
 
38
71
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
39
72
 
40
73
  export interface InitOutput {
74
+ readonly __wbg_bhtsnef32_free: (a: number) => void;
75
+ readonly bhtsnef32_new: (a: number, b: number) => number;
76
+ readonly bhtsnef32_step: (a: number, b: number, c: number) => void;
77
+ readonly __wbg_bhtsnef64_free: (a: number) => void;
78
+ readonly bhtsnef64_new: (a: number, b: number) => number;
79
+ readonly bhtsnef64_step: (a: number, b: number, c: number) => void;
80
+ readonly __wbg_wbg_rayon_poolbuilder_free: (a: number) => void;
81
+ readonly wbg_rayon_poolbuilder_numThreads: (a: number) => number;
82
+ readonly wbg_rayon_poolbuilder_receiver: (a: number) => number;
83
+ readonly wbg_rayon_poolbuilder_build: (a: number) => void;
84
+ readonly initThreadPool: (a: number) => number;
85
+ readonly wbg_rayon_start_worker: (a: number) => void;
41
86
  readonly memory: WebAssembly.Memory;
42
- readonly __wbg_tsne_free: (a: number) => void;
43
- readonly tsne_new: (a: number) => number;
44
- readonly tsne_barnes_hut: (a: number, b: number) => number;
45
- readonly tsne_set_theta: (a: number, b: number) => void;
46
87
  readonly __wbindgen_malloc: (a: number, b: number) => number;
47
88
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
48
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
89
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
49
90
  readonly __wbindgen_exn_store: (a: number) => void;
91
+ readonly __wbindgen_thread_destroy: (a?: number, b?: number) => void;
92
+ readonly __wbindgen_start: () => void;
50
93
  }
51
94
 
52
95
  export type SyncInitInput = BufferSource | WebAssembly.Module;
@@ -55,17 +98,19 @@ export type SyncInitInput = BufferSource | WebAssembly.Module;
55
98
  * a precompiled `WebAssembly.Module`.
56
99
  *
57
100
  * @param {SyncInitInput} module
101
+ * @param {WebAssembly.Memory} maybe_memory
58
102
  *
59
103
  * @returns {InitOutput}
60
104
  */
61
- export function initSync(module: SyncInitInput): InitOutput;
105
+ export function initSync(module: SyncInitInput, maybe_memory?: WebAssembly.Memory): InitOutput;
62
106
 
63
107
  /**
64
108
  * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
65
109
  * for everything else, calls `WebAssembly.instantiate` directly.
66
110
  *
67
111
  * @param {InitInput | Promise<InitInput>} module_or_path
112
+ * @param {WebAssembly.Memory} maybe_memory
68
113
  *
69
114
  * @returns {Promise<InitOutput>}
70
115
  */
71
- export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
116
+ export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>, maybe_memory?: WebAssembly.Memory): Promise<InitOutput>;
package/wasm_bhtsne.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { startWorkers } from './snippets/wasm-bindgen-rayon-3e04391371ad0a8e/src/workerHelpers.js';
2
+
1
3
  let wasm;
2
4
 
3
5
  const heap = new Array(128).fill(undefined);
@@ -27,7 +29,7 @@ function isLikeNone(x) {
27
29
  let cachedFloat64Memory0 = null;
28
30
 
29
31
  function getFloat64Memory0() {
30
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
32
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.buffer !== wasm.memory.buffer) {
31
33
  cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
32
34
  }
33
35
  return cachedFloat64Memory0;
@@ -36,12 +38,21 @@ function getFloat64Memory0() {
36
38
  let cachedInt32Memory0 = null;
37
39
 
38
40
  function getInt32Memory0() {
39
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
41
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.buffer !== wasm.memory.buffer) {
40
42
  cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
41
43
  }
42
44
  return cachedInt32Memory0;
43
45
  }
44
46
 
47
+ function addHeapObject(obj) {
48
+ if (heap_next === heap.length) heap.push(heap.length + 1);
49
+ const idx = heap_next;
50
+ heap_next = heap[idx];
51
+
52
+ heap[idx] = obj;
53
+ return idx;
54
+ }
55
+
45
56
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
46
57
 
47
58
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -49,7 +60,7 @@ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
49
60
  let cachedUint8Memory0 = null;
50
61
 
51
62
  function getUint8Memory0() {
52
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
63
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.buffer !== wasm.memory.buffer) {
53
64
  cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
54
65
  }
55
66
  return cachedUint8Memory0;
@@ -57,16 +68,68 @@ function getUint8Memory0() {
57
68
 
58
69
  function getStringFromWasm0(ptr, len) {
59
70
  ptr = ptr >>> 0;
60
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
71
+ return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
61
72
  }
62
73
 
63
- function addHeapObject(obj) {
64
- if (heap_next === heap.length) heap.push(heap.length + 1);
65
- const idx = heap_next;
66
- heap_next = heap[idx];
74
+ let WASM_VECTOR_LEN = 0;
67
75
 
68
- heap[idx] = obj;
69
- return idx;
76
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
77
+
78
+ const encodeString = function (arg, view) {
79
+ const buf = cachedTextEncoder.encode(arg);
80
+ view.set(buf);
81
+ return {
82
+ read: arg.length,
83
+ written: buf.length
84
+ };
85
+ };
86
+
87
+ function passStringToWasm0(arg, malloc, realloc) {
88
+
89
+ if (realloc === undefined) {
90
+ const buf = cachedTextEncoder.encode(arg);
91
+ const ptr = malloc(buf.length, 1) >>> 0;
92
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
93
+ WASM_VECTOR_LEN = buf.length;
94
+ return ptr;
95
+ }
96
+
97
+ let len = arg.length;
98
+ let ptr = malloc(len, 1) >>> 0;
99
+
100
+ const mem = getUint8Memory0();
101
+
102
+ let offset = 0;
103
+
104
+ for (; offset < len; offset++) {
105
+ const code = arg.charCodeAt(offset);
106
+ if (code > 0x7F) break;
107
+ mem[ptr + offset] = code;
108
+ }
109
+
110
+ if (offset !== len) {
111
+ if (offset !== 0) {
112
+ arg = arg.slice(offset);
113
+ }
114
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
115
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
116
+ const ret = encodeString(arg, view);
117
+
118
+ offset += ret.written;
119
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
120
+ }
121
+
122
+ WASM_VECTOR_LEN = offset;
123
+ return ptr;
124
+ }
125
+
126
+ let cachedBigInt64Memory0 = null;
127
+
128
+ function getBigInt64Memory0() {
129
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.buffer !== wasm.memory.buffer) {
130
+ cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
131
+ }
132
+ return cachedBigInt64Memory0;
70
133
  }
71
134
 
72
135
  function debugString(val) {
@@ -134,128 +197,181 @@ function debugString(val) {
134
197
  return className;
135
198
  }
136
199
 
137
- let WASM_VECTOR_LEN = 0;
138
-
139
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
200
+ function handleError(f, args) {
201
+ try {
202
+ return f.apply(this, args);
203
+ } catch (e) {
204
+ wasm.__wbindgen_exn_store(addHeapObject(e));
205
+ }
206
+ }
207
+ /**
208
+ * @param {number} num_threads
209
+ * @returns {Promise<any>}
210
+ */
211
+ export function initThreadPool(num_threads) {
212
+ const ret = wasm.initThreadPool(num_threads);
213
+ return takeObject(ret);
214
+ }
140
215
 
141
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
142
- ? function (arg, view) {
143
- return cachedTextEncoder.encodeInto(arg, view);
216
+ /**
217
+ * @param {number} receiver
218
+ */
219
+ export function wbg_rayon_start_worker(receiver) {
220
+ wasm.wbg_rayon_start_worker(receiver);
144
221
  }
145
- : function (arg, view) {
146
- const buf = cachedTextEncoder.encode(arg);
147
- view.set(buf);
148
- return {
149
- read: arg.length,
150
- written: buf.length
151
- };
152
- });
153
222
 
154
- function passStringToWasm0(arg, malloc, realloc) {
223
+ const bhtSNEf32Finalization = (typeof FinalizationRegistry === 'undefined')
224
+ ? { register: () => {}, unregister: () => {} }
225
+ : new FinalizationRegistry(ptr => wasm.__wbg_bhtsnef32_free(ptr >>> 0));
226
+ /**
227
+ * t-distributed stochastic neighbor embedding. Provides a parallel implementation of both the
228
+ * exact version of the algorithm and the tree accelerated one leveraging space partitioning trees.
229
+ */
230
+ export class bhtSNEf32 {
155
231
 
156
- if (realloc === undefined) {
157
- const buf = cachedTextEncoder.encode(arg);
158
- const ptr = malloc(buf.length, 1) >>> 0;
159
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
160
- WASM_VECTOR_LEN = buf.length;
232
+ __destroy_into_raw() {
233
+ const ptr = this.__wbg_ptr;
234
+ this.__wbg_ptr = 0;
235
+ bhtSNEf32Finalization.unregister(this);
161
236
  return ptr;
162
237
  }
163
238
 
164
- let len = arg.length;
165
- let ptr = malloc(len, 1) >>> 0;
166
-
167
- const mem = getUint8Memory0();
239
+ free() {
240
+ const ptr = this.__destroy_into_raw();
241
+ wasm.__wbg_bhtsnef32_free(ptr);
242
+ }
243
+ /**
244
+ * @param {any} data
245
+ * @param {any} opt
246
+ */
247
+ constructor(data, opt) {
248
+ const ret = wasm.bhtsnef32_new(addHeapObject(data), addHeapObject(opt));
249
+ this.__wbg_ptr = ret >>> 0;
250
+ return this;
251
+ }
252
+ /**
253
+ * Performs a parallel Barnes-Hut approximation of the t-SNE algorithm.
254
+ *
255
+ * # Arguments
256
+ *
257
+ * `epochs` - the maximum number of fitting iterations. Must be positive
258
+ * @param {number} epochs
259
+ * @returns {any}
260
+ */
261
+ step(epochs) {
262
+ try {
263
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
264
+ wasm.bhtsnef32_step(retptr, this.__wbg_ptr, epochs);
265
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
266
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
267
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
268
+ if (r2) {
269
+ throw takeObject(r1);
270
+ }
271
+ return takeObject(r0);
272
+ } finally {
273
+ wasm.__wbindgen_add_to_stack_pointer(16);
274
+ }
275
+ }
276
+ }
168
277
 
169
- let offset = 0;
278
+ const bhtSNEf64Finalization = (typeof FinalizationRegistry === 'undefined')
279
+ ? { register: () => {}, unregister: () => {} }
280
+ : new FinalizationRegistry(ptr => wasm.__wbg_bhtsnef64_free(ptr >>> 0));
281
+ /**
282
+ */
283
+ export class bhtSNEf64 {
170
284
 
171
- for (; offset < len; offset++) {
172
- const code = arg.charCodeAt(offset);
173
- if (code > 0x7F) break;
174
- mem[ptr + offset] = code;
285
+ __destroy_into_raw() {
286
+ const ptr = this.__wbg_ptr;
287
+ this.__wbg_ptr = 0;
288
+ bhtSNEf64Finalization.unregister(this);
289
+ return ptr;
175
290
  }
176
291
 
177
- if (offset !== len) {
178
- if (offset !== 0) {
179
- arg = arg.slice(offset);
292
+ free() {
293
+ const ptr = this.__destroy_into_raw();
294
+ wasm.__wbg_bhtsnef64_free(ptr);
295
+ }
296
+ /**
297
+ * @param {any} data
298
+ * @param {any} opt
299
+ */
300
+ constructor(data, opt) {
301
+ const ret = wasm.bhtsnef64_new(addHeapObject(data), addHeapObject(opt));
302
+ this.__wbg_ptr = ret >>> 0;
303
+ return this;
304
+ }
305
+ /**
306
+ * Performs a parallel Barnes-Hut approximation of the t-SNE algorithm.
307
+ *
308
+ * # Arguments
309
+ *
310
+ * `epochs` - Sets epochs, the maximum number of fitting iterations.
311
+ * @param {number} epochs
312
+ * @returns {any}
313
+ */
314
+ step(epochs) {
315
+ try {
316
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
317
+ wasm.bhtsnef64_step(retptr, this.__wbg_ptr, epochs);
318
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
319
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
320
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
321
+ if (r2) {
322
+ throw takeObject(r1);
323
+ }
324
+ return takeObject(r0);
325
+ } finally {
326
+ wasm.__wbindgen_add_to_stack_pointer(16);
180
327
  }
181
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
182
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
183
- const ret = encodeString(arg, view);
184
-
185
- offset += ret.written;
186
328
  }
187
-
188
- WASM_VECTOR_LEN = offset;
189
- return ptr;
190
329
  }
191
330
 
192
- function handleError(f, args) {
193
- try {
194
- return f.apply(this, args);
195
- } catch (e) {
196
- wasm.__wbindgen_exn_store(addHeapObject(e));
197
- }
198
- }
331
+ const wbg_rayon_PoolBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
332
+ ? { register: () => {}, unregister: () => {} }
333
+ : new FinalizationRegistry(ptr => wasm.__wbg_wbg_rayon_poolbuilder_free(ptr >>> 0));
199
334
  /**
200
- * t-distributed stochastic neighbor embedding. Provides a parallel implementation of both the
201
- * exact version of the algorithm and the tree accelerated one leveraging space partitioning trees.
202
335
  */
203
- export class tSNE {
336
+ export class wbg_rayon_PoolBuilder {
204
337
 
205
338
  static __wrap(ptr) {
206
339
  ptr = ptr >>> 0;
207
- const obj = Object.create(tSNE.prototype);
340
+ const obj = Object.create(wbg_rayon_PoolBuilder.prototype);
208
341
  obj.__wbg_ptr = ptr;
209
-
342
+ wbg_rayon_PoolBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
210
343
  return obj;
211
344
  }
212
345
 
213
346
  __destroy_into_raw() {
214
347
  const ptr = this.__wbg_ptr;
215
348
  this.__wbg_ptr = 0;
216
-
349
+ wbg_rayon_PoolBuilderFinalization.unregister(this);
217
350
  return ptr;
218
351
  }
219
352
 
220
353
  free() {
221
354
  const ptr = this.__destroy_into_raw();
222
- wasm.__wbg_tsne_free(ptr);
355
+ wasm.__wbg_wbg_rayon_poolbuilder_free(ptr);
223
356
  }
224
357
  /**
225
- * @param {Array<any>} vectors
358
+ * @returns {number}
226
359
  */
227
- constructor(vectors) {
228
- const ret = wasm.tsne_new(addHeapObject(vectors));
229
- return tSNE.__wrap(ret);
360
+ numThreads() {
361
+ const ret = wasm.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr);
362
+ return ret >>> 0;
230
363
  }
231
364
  /**
232
- * Performs a parallel Barnes-Hut approximation of the t-SNE algorithm.
233
- *
234
- * # Arguments
235
- *
236
- * * `theta` - determines the accuracy of the approximation. Must be **strictly greater than
237
- * 0.0**. Large values for θ increase the speed of the algorithm but decrease its accuracy.
238
- * For small values of θ it is less probable that a cell in the space partitioning tree will
239
- * be treated as a single point. For θ equal to 0.0 the method degenerates in the exact
240
- * version.
241
- *
242
- * * `metric_f` - metric function.
243
- *
244
- *
245
- * **Do note that** `metric_f` **must be a metric distance**, i.e. it must
246
- * satisfy the [triangle inequality](https://en.wikipedia.org/wiki/Triangle_inequality).
247
- * @param {number} epochs
248
- * @returns {Array<any>}
365
+ * @returns {number}
249
366
  */
250
- barnes_hut(epochs) {
251
- const ret = wasm.tsne_barnes_hut(this.__wbg_ptr, epochs);
252
- return takeObject(ret);
367
+ receiver() {
368
+ const ret = wasm.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr);
369
+ return ret >>> 0;
253
370
  }
254
371
  /**
255
- * @param {number} theta
256
372
  */
257
- set theta(theta) {
258
- wasm.tsne_set_theta(this.__wbg_ptr, theta);
373
+ build() {
374
+ wasm.wbg_rayon_poolbuilder_build(this.__wbg_ptr);
259
375
  }
260
376
  }
261
377
 
@@ -296,58 +412,101 @@ function __wbg_get_imports() {
296
412
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
297
413
  takeObject(arg0);
298
414
  };
415
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
416
+ const ret = getObject(arg0) === undefined;
417
+ return ret;
418
+ };
419
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
420
+ const ret = getObject(arg0) in getObject(arg1);
421
+ return ret;
422
+ };
299
423
  imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
300
424
  const obj = getObject(arg1);
301
425
  const ret = typeof(obj) === 'number' ? obj : undefined;
302
426
  getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
303
427
  getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
304
428
  };
305
- imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
306
- const ret = new Error();
429
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
430
+ const ret = typeof(getObject(arg0)) === 'bigint';
431
+ return ret;
432
+ };
433
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
434
+ const ret = BigInt.asUintN(64, arg0);
307
435
  return addHeapObject(ret);
308
436
  };
309
- imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
310
- const ret = getObject(arg1).stack;
311
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
312
- const len1 = WASM_VECTOR_LEN;
437
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
438
+ const ret = getObject(arg0) === getObject(arg1);
439
+ return ret;
440
+ };
441
+ imports.wbg.__wbindgen_is_object = function(arg0) {
442
+ const val = getObject(arg0);
443
+ const ret = typeof(val) === 'object' && val !== null;
444
+ return ret;
445
+ };
446
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
447
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
448
+ return addHeapObject(ret);
449
+ };
450
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
451
+ const ret = getObject(arg0);
452
+ return addHeapObject(ret);
453
+ };
454
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
455
+ const ret = getObject(arg0) == getObject(arg1);
456
+ return ret;
457
+ };
458
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
459
+ const v = getObject(arg0);
460
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
461
+ return ret;
462
+ };
463
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
464
+ const obj = getObject(arg1);
465
+ const ret = typeof(obj) === 'string' ? obj : undefined;
466
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
467
+ var len1 = WASM_VECTOR_LEN;
313
468
  getInt32Memory0()[arg0 / 4 + 1] = len1;
314
469
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
315
470
  };
316
- imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
317
- let deferred0_0;
318
- let deferred0_1;
471
+ imports.wbg.__wbindgen_as_number = function(arg0) {
472
+ const ret = +getObject(arg0);
473
+ return ret;
474
+ };
475
+ imports.wbg.__wbindgen_number_new = function(arg0) {
476
+ const ret = arg0;
477
+ return addHeapObject(ret);
478
+ };
479
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
480
+ const ret = getStringFromWasm0(arg0, arg1);
481
+ return addHeapObject(ret);
482
+ };
483
+ imports.wbg.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
484
+ const ret = getObject(arg0)[getObject(arg1)];
485
+ return addHeapObject(ret);
486
+ };
487
+ imports.wbg.__wbg_instanceof_Window_f401953a2cf86220 = function(arg0) {
488
+ let result;
319
489
  try {
320
- deferred0_0 = arg0;
321
- deferred0_1 = arg1;
322
- console.error(getStringFromWasm0(arg0, arg1));
323
- } finally {
324
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
490
+ result = getObject(arg0) instanceof Window;
491
+ } catch (_) {
492
+ result = false;
325
493
  }
494
+ const ret = result;
495
+ return ret;
326
496
  };
327
- imports.wbg.__wbg_randomFillSync_dc1e9a60c158336d = function() { return handleError(function (arg0, arg1) {
328
- getObject(arg0).randomFillSync(takeObject(arg1));
329
- }, arguments) };
330
- imports.wbg.__wbg_getRandomValues_37fa2ca9e4e07fab = function() { return handleError(function (arg0, arg1) {
331
- getObject(arg0).getRandomValues(getObject(arg1));
332
- }, arguments) };
333
- imports.wbg.__wbg_crypto_c48a774b022d20ac = function(arg0) {
497
+ imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
334
498
  const ret = getObject(arg0).crypto;
335
499
  return addHeapObject(ret);
336
500
  };
337
- imports.wbg.__wbindgen_is_object = function(arg0) {
338
- const val = getObject(arg0);
339
- const ret = typeof(val) === 'object' && val !== null;
340
- return ret;
341
- };
342
- imports.wbg.__wbg_process_298734cf255a885d = function(arg0) {
501
+ imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
343
502
  const ret = getObject(arg0).process;
344
503
  return addHeapObject(ret);
345
504
  };
346
- imports.wbg.__wbg_versions_e2e78e134e3e5d01 = function(arg0) {
505
+ imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) {
347
506
  const ret = getObject(arg0).versions;
348
507
  return addHeapObject(ret);
349
508
  };
350
- imports.wbg.__wbg_node_1cd7a5d853dbea79 = function(arg0) {
509
+ imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
351
510
  const ret = getObject(arg0).node;
352
511
  return addHeapObject(ret);
353
512
  };
@@ -355,27 +514,29 @@ function __wbg_get_imports() {
355
514
  const ret = typeof(getObject(arg0)) === 'string';
356
515
  return ret;
357
516
  };
358
- imports.wbg.__wbg_require_8f08ceecec0f4fee = function() { return handleError(function () {
517
+ imports.wbg.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
359
518
  const ret = module.require;
360
519
  return addHeapObject(ret);
361
520
  }, arguments) };
362
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
363
- const ret = getStringFromWasm0(arg0, arg1);
364
- return addHeapObject(ret);
365
- };
366
- imports.wbg.__wbg_msCrypto_bcb970640f50a1e8 = function(arg0) {
521
+ imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
367
522
  const ret = getObject(arg0).msCrypto;
368
523
  return addHeapObject(ret);
369
524
  };
370
- imports.wbg.__wbg_get_44be0491f933a435 = function(arg0, arg1) {
525
+ imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
526
+ getObject(arg0).randomFillSync(takeObject(arg1));
527
+ }, arguments) };
528
+ imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
529
+ getObject(arg0).getRandomValues(getObject(arg1));
530
+ }, arguments) };
531
+ imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
371
532
  const ret = getObject(arg0)[arg1 >>> 0];
372
533
  return addHeapObject(ret);
373
534
  };
374
- imports.wbg.__wbg_length_fff51ee6522a1a18 = function(arg0) {
535
+ imports.wbg.__wbg_length_cd7af8117672b8b8 = function(arg0) {
375
536
  const ret = getObject(arg0).length;
376
537
  return ret;
377
538
  };
378
- imports.wbg.__wbg_new_898a68150f225f2e = function() {
539
+ imports.wbg.__wbg_new_16b304a2cfa7ff4a = function() {
379
540
  const ret = new Array();
380
541
  return addHeapObject(ret);
381
542
  };
@@ -383,80 +544,121 @@ function __wbg_get_imports() {
383
544
  const ret = typeof(getObject(arg0)) === 'function';
384
545
  return ret;
385
546
  };
386
- imports.wbg.__wbg_newnoargs_581967eacc0e2604 = function(arg0, arg1) {
547
+ imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
387
548
  const ret = new Function(getStringFromWasm0(arg0, arg1));
388
549
  return addHeapObject(ret);
389
550
  };
390
- imports.wbg.__wbg_call_cb65541d95d71282 = function() { return handleError(function (arg0, arg1) {
551
+ imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
552
+ const ret = getObject(arg0).next;
553
+ return addHeapObject(ret);
554
+ };
555
+ imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
556
+ const ret = getObject(arg0).next();
557
+ return addHeapObject(ret);
558
+ }, arguments) };
559
+ imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
560
+ const ret = getObject(arg0).done;
561
+ return ret;
562
+ };
563
+ imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
564
+ const ret = getObject(arg0).value;
565
+ return addHeapObject(ret);
566
+ };
567
+ imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
568
+ const ret = Symbol.iterator;
569
+ return addHeapObject(ret);
570
+ };
571
+ imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
572
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
573
+ return addHeapObject(ret);
574
+ }, arguments) };
575
+ imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
391
576
  const ret = getObject(arg0).call(getObject(arg1));
392
577
  return addHeapObject(ret);
393
578
  }, arguments) };
394
- imports.wbg.__wbg_self_1ff1d729e9aae938 = function() { return handleError(function () {
579
+ imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
395
580
  const ret = self.self;
396
581
  return addHeapObject(ret);
397
582
  }, arguments) };
398
- imports.wbg.__wbg_window_5f4faef6c12b79ec = function() { return handleError(function () {
583
+ imports.wbg.__wbg_window_c6fb939a7f436783 = function() { return handleError(function () {
399
584
  const ret = window.window;
400
585
  return addHeapObject(ret);
401
586
  }, arguments) };
402
- imports.wbg.__wbg_globalThis_1d39714405582d3c = function() { return handleError(function () {
587
+ imports.wbg.__wbg_globalThis_d1e6af4856ba331b = function() { return handleError(function () {
403
588
  const ret = globalThis.globalThis;
404
589
  return addHeapObject(ret);
405
590
  }, arguments) };
406
- imports.wbg.__wbg_global_651f05c6a0944d1c = function() { return handleError(function () {
591
+ imports.wbg.__wbg_global_207b558942527489 = function() { return handleError(function () {
407
592
  const ret = global.global;
408
593
  return addHeapObject(ret);
409
594
  }, arguments) };
410
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
411
- const ret = getObject(arg0) === undefined;
412
- return ret;
595
+ imports.wbg.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
596
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
413
597
  };
414
- imports.wbg.__wbg_isArray_4c24b343cb13cfb1 = function(arg0) {
598
+ imports.wbg.__wbg_isArray_2ab64d95e09ea0ae = function(arg0) {
415
599
  const ret = Array.isArray(getObject(arg0));
416
600
  return ret;
417
601
  };
418
- imports.wbg.__wbg_push_ca1c26067ef907ac = function(arg0, arg1) {
419
- const ret = getObject(arg0).push(getObject(arg1));
602
+ imports.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2 = function(arg0) {
603
+ let result;
604
+ try {
605
+ result = getObject(arg0) instanceof ArrayBuffer;
606
+ } catch (_) {
607
+ result = false;
608
+ }
609
+ const ret = result;
420
610
  return ret;
421
611
  };
422
- imports.wbg.__wbg_call_01734de55d61e11d = function() { return handleError(function (arg0, arg1, arg2) {
612
+ imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
423
613
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
424
614
  return addHeapObject(ret);
425
615
  }, arguments) };
426
- imports.wbg.__wbg_buffer_085ec1f694018c4f = function(arg0) {
616
+ imports.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2 = function(arg0) {
617
+ const ret = Number.isSafeInteger(getObject(arg0));
618
+ return ret;
619
+ };
620
+ imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
427
621
  const ret = getObject(arg0).buffer;
428
622
  return addHeapObject(ret);
429
623
  };
430
- imports.wbg.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa = function(arg0, arg1, arg2) {
624
+ imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
431
625
  const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
432
626
  return addHeapObject(ret);
433
627
  };
434
- imports.wbg.__wbg_new_8125e318e6245eed = function(arg0) {
628
+ imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
435
629
  const ret = new Uint8Array(getObject(arg0));
436
630
  return addHeapObject(ret);
437
631
  };
438
- imports.wbg.__wbg_set_5cf90238115182c3 = function(arg0, arg1, arg2) {
632
+ imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
439
633
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
440
634
  };
441
- imports.wbg.__wbg_newwithbyteoffsetandlength_69193e31c844b792 = function(arg0, arg1, arg2) {
442
- const ret = new Float32Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
443
- return addHeapObject(ret);
635
+ imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
636
+ const ret = getObject(arg0).length;
637
+ return ret;
444
638
  };
445
- imports.wbg.__wbg_new_d086a66d1c264b3f = function(arg0) {
446
- const ret = new Float32Array(getObject(arg0));
447
- return addHeapObject(ret);
639
+ imports.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
640
+ let result;
641
+ try {
642
+ result = getObject(arg0) instanceof Uint8Array;
643
+ } catch (_) {
644
+ result = false;
645
+ }
646
+ const ret = result;
647
+ return ret;
448
648
  };
449
- imports.wbg.__wbg_newwithlength_e5d69174d6984cd7 = function(arg0) {
649
+ imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
450
650
  const ret = new Uint8Array(arg0 >>> 0);
451
651
  return addHeapObject(ret);
452
652
  };
453
- imports.wbg.__wbg_subarray_13db269f57aa838d = function(arg0, arg1, arg2) {
653
+ imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
454
654
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
455
655
  return addHeapObject(ret);
456
656
  };
457
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
458
- const ret = getObject(arg0);
459
- return addHeapObject(ret);
657
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
658
+ const v = getObject(arg1);
659
+ const ret = typeof(v) === 'bigint' ? v : undefined;
660
+ getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret;
661
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
460
662
  };
461
663
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
462
664
  const ret = debugString(getObject(arg1));
@@ -468,35 +670,44 @@ function __wbg_get_imports() {
468
670
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
469
671
  throw new Error(getStringFromWasm0(arg0, arg1));
470
672
  };
673
+ imports.wbg.__wbindgen_module = function() {
674
+ const ret = __wbg_init.__wbindgen_wasm_module;
675
+ return addHeapObject(ret);
676
+ };
471
677
  imports.wbg.__wbindgen_memory = function() {
472
678
  const ret = wasm.memory;
473
679
  return addHeapObject(ret);
474
680
  };
681
+ imports.wbg.__wbg_startWorkers_2ee336a9694dda13 = function(arg0, arg1, arg2) {
682
+ const ret = startWorkers(takeObject(arg0), takeObject(arg1), wbg_rayon_PoolBuilder.__wrap(arg2));
683
+ return addHeapObject(ret);
684
+ };
475
685
 
476
686
  return imports;
477
687
  }
478
688
 
479
689
  function __wbg_init_memory(imports, maybe_memory) {
480
-
690
+ imports.wbg.memory = maybe_memory || new WebAssembly.Memory({initial:18,maximum:16384,shared:true});
481
691
  }
482
692
 
483
693
  function __wbg_finalize_init(instance, module) {
484
694
  wasm = instance.exports;
485
695
  __wbg_init.__wbindgen_wasm_module = module;
696
+ cachedBigInt64Memory0 = null;
486
697
  cachedFloat64Memory0 = null;
487
698
  cachedInt32Memory0 = null;
488
699
  cachedUint8Memory0 = null;
489
700
 
490
-
701
+ wasm.__wbindgen_start();
491
702
  return wasm;
492
703
  }
493
704
 
494
- function initSync(module) {
705
+ function initSync(module, maybe_memory) {
495
706
  if (wasm !== undefined) return wasm;
496
707
 
497
708
  const imports = __wbg_get_imports();
498
709
 
499
- __wbg_init_memory(imports);
710
+ __wbg_init_memory(imports, maybe_memory);
500
711
 
501
712
  if (!(module instanceof WebAssembly.Module)) {
502
713
  module = new WebAssembly.Module(module);
@@ -507,7 +718,7 @@ function initSync(module) {
507
718
  return __wbg_finalize_init(instance, module);
508
719
  }
509
720
 
510
- async function __wbg_init(input) {
721
+ async function __wbg_init(input, maybe_memory) {
511
722
  if (wasm !== undefined) return wasm;
512
723
 
513
724
  if (typeof input === 'undefined') {
@@ -519,7 +730,7 @@ async function __wbg_init(input) {
519
730
  input = fetch(input);
520
731
  }
521
732
 
522
- __wbg_init_memory(imports);
733
+ __wbg_init_memory(imports, maybe_memory);
523
734
 
524
735
  const { instance, module } = await __wbg_load(await input, imports);
525
736
 
Binary file