@justinelliottcobb/amari-wasm 0.9.2 → 0.9.3
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/amari_wasm.d.ts +478 -7
- package/amari_wasm.js +1166 -27
- package/amari_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/amari_wasm.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
let wasm;
|
|
2
2
|
|
|
3
|
+
function addToExternrefTable0(obj) {
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
6
|
+
return idx;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function handleError(f, args) {
|
|
10
|
+
try {
|
|
11
|
+
return f.apply(this, args);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
const idx = addToExternrefTable0(e);
|
|
14
|
+
wasm.__wbindgen_exn_store(idx);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
3
18
|
let cachedUint8ArrayMemory0 = null;
|
|
4
19
|
|
|
5
20
|
function getUint8ArrayMemory0() {
|
|
@@ -30,21 +45,6 @@ function getStringFromWasm0(ptr, len) {
|
|
|
30
45
|
return decodeText(ptr, len);
|
|
31
46
|
}
|
|
32
47
|
|
|
33
|
-
function addToExternrefTable0(obj) {
|
|
34
|
-
const idx = wasm.__externref_table_alloc();
|
|
35
|
-
wasm.__wbindgen_export_2.set(idx, obj);
|
|
36
|
-
return idx;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function handleError(f, args) {
|
|
40
|
-
try {
|
|
41
|
-
return f.apply(this, args);
|
|
42
|
-
} catch (e) {
|
|
43
|
-
const idx = addToExternrefTable0(e);
|
|
44
|
-
wasm.__wbindgen_exn_store(idx);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
48
|
function debugString(val) {
|
|
49
49
|
// primitive types
|
|
50
50
|
const type = typeof val;
|
|
@@ -173,6 +173,10 @@ function getDataViewMemory0() {
|
|
|
173
173
|
return cachedDataViewMemory0;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
function isLikeNone(x) {
|
|
177
|
+
return x === undefined || x === null;
|
|
178
|
+
}
|
|
179
|
+
|
|
176
180
|
function takeFromExternrefTable0(idx) {
|
|
177
181
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
178
182
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -185,12 +189,12 @@ function _assertClass(instance, klass) {
|
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
191
|
/**
|
|
188
|
-
* Convert Lorentz factor
|
|
189
|
-
* @param {number}
|
|
192
|
+
* Convert velocity to Lorentz factor
|
|
193
|
+
* @param {number} velocity_magnitude
|
|
190
194
|
* @returns {number}
|
|
191
195
|
*/
|
|
192
|
-
export function
|
|
193
|
-
const ret = wasm.
|
|
196
|
+
export function velocity_to_gamma(velocity_magnitude) {
|
|
197
|
+
const ret = wasm.velocity_to_gamma(velocity_magnitude);
|
|
194
198
|
if (ret[2]) {
|
|
195
199
|
throw takeFromExternrefTable0(ret[1]);
|
|
196
200
|
}
|
|
@@ -198,12 +202,12 @@ export function gamma_to_velocity(gamma) {
|
|
|
198
202
|
}
|
|
199
203
|
|
|
200
204
|
/**
|
|
201
|
-
* Convert
|
|
202
|
-
* @param {number}
|
|
205
|
+
* Convert Lorentz factor to velocity
|
|
206
|
+
* @param {number} gamma
|
|
203
207
|
* @returns {number}
|
|
204
208
|
*/
|
|
205
|
-
export function
|
|
206
|
-
const ret = wasm.
|
|
209
|
+
export function gamma_to_velocity(gamma) {
|
|
210
|
+
const ret = wasm.gamma_to_velocity(gamma);
|
|
207
211
|
if (ret[2]) {
|
|
208
212
|
throw takeFromExternrefTable0(ret[1]);
|
|
209
213
|
}
|
|
@@ -271,6 +275,102 @@ function getArrayU32FromWasm0(ptr, len) {
|
|
|
271
275
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
272
276
|
}
|
|
273
277
|
|
|
278
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
279
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
280
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
281
|
+
WASM_VECTOR_LEN = arg.length;
|
|
282
|
+
return ptr;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const AutoDiffFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
286
|
+
? { register: () => {}, unregister: () => {} }
|
|
287
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_autodiff_free(ptr >>> 0, 1));
|
|
288
|
+
/**
|
|
289
|
+
* Automatic differentiation utilities
|
|
290
|
+
*/
|
|
291
|
+
export class AutoDiff {
|
|
292
|
+
|
|
293
|
+
__destroy_into_raw() {
|
|
294
|
+
const ptr = this.__wbg_ptr;
|
|
295
|
+
this.__wbg_ptr = 0;
|
|
296
|
+
AutoDiffFinalization.unregister(this);
|
|
297
|
+
return ptr;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
free() {
|
|
301
|
+
const ptr = this.__destroy_into_raw();
|
|
302
|
+
wasm.__wbg_autodiff_free(ptr, 0);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Linear layer forward pass (y = Wx + b) with automatic gradients
|
|
306
|
+
* @param {Float64Array} inputs
|
|
307
|
+
* @param {Float64Array} weights
|
|
308
|
+
* @param {Float64Array} bias
|
|
309
|
+
* @param {number} input_size
|
|
310
|
+
* @param {number} output_size
|
|
311
|
+
* @returns {Float64Array}
|
|
312
|
+
*/
|
|
313
|
+
static linearLayer(inputs, weights, bias, input_size, output_size) {
|
|
314
|
+
const ptr0 = passArrayF64ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
315
|
+
const len0 = WASM_VECTOR_LEN;
|
|
316
|
+
const ptr1 = passArrayF64ToWasm0(weights, wasm.__wbindgen_malloc);
|
|
317
|
+
const len1 = WASM_VECTOR_LEN;
|
|
318
|
+
const ptr2 = passArrayF64ToWasm0(bias, wasm.__wbindgen_malloc);
|
|
319
|
+
const len2 = WASM_VECTOR_LEN;
|
|
320
|
+
const ret = wasm.autodiff_linearLayer(ptr0, len0, ptr1, len1, ptr2, len2, input_size, output_size);
|
|
321
|
+
if (ret[3]) {
|
|
322
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
323
|
+
}
|
|
324
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
325
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
326
|
+
return v4;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Compute mean squared error with automatic gradients
|
|
330
|
+
* @param {Float64Array} predictions
|
|
331
|
+
* @param {Float64Array} targets
|
|
332
|
+
* @returns {WasmDualNumber}
|
|
333
|
+
*/
|
|
334
|
+
static meanSquaredError(predictions, targets) {
|
|
335
|
+
const ptr0 = passArrayF64ToWasm0(predictions, wasm.__wbindgen_malloc);
|
|
336
|
+
const len0 = WASM_VECTOR_LEN;
|
|
337
|
+
const ptr1 = passArrayF64ToWasm0(targets, wasm.__wbindgen_malloc);
|
|
338
|
+
const len1 = WASM_VECTOR_LEN;
|
|
339
|
+
const ret = wasm.autodiff_meanSquaredError(ptr0, len0, ptr1, len1);
|
|
340
|
+
if (ret[2]) {
|
|
341
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
342
|
+
}
|
|
343
|
+
return WasmDualNumber.__wrap(ret[0]);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Create a dual number and evaluate a polynomial
|
|
347
|
+
* @param {number} x
|
|
348
|
+
* @param {Float64Array} coefficients
|
|
349
|
+
* @returns {WasmDualNumber}
|
|
350
|
+
*/
|
|
351
|
+
static evaluatePolynomial(x, coefficients) {
|
|
352
|
+
const ptr0 = passArrayF64ToWasm0(coefficients, wasm.__wbindgen_malloc);
|
|
353
|
+
const len0 = WASM_VECTOR_LEN;
|
|
354
|
+
const ret = wasm.autodiff_evaluatePolynomial(x, ptr0, len0);
|
|
355
|
+
return WasmDualNumber.__wrap(ret);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Compute numerical derivative using finite differences (fallback implementation)
|
|
359
|
+
* @param {number} x
|
|
360
|
+
* @param {Function} f
|
|
361
|
+
* @param {number} h
|
|
362
|
+
* @returns {number}
|
|
363
|
+
*/
|
|
364
|
+
static numericalDerivative(x, f, h) {
|
|
365
|
+
const ret = wasm.autodiff_numericalDerivative(x, f, h);
|
|
366
|
+
if (ret[2]) {
|
|
367
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
368
|
+
}
|
|
369
|
+
return ret[0];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
if (Symbol.dispose) AutoDiff.prototype[Symbol.dispose] = AutoDiff.prototype.free;
|
|
373
|
+
|
|
274
374
|
const BatchOperationsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
275
375
|
? { register: () => {}, unregister: () => {} }
|
|
276
376
|
: new FinalizationRegistry(ptr => wasm.__wbg_batchoperations_free(ptr >>> 0, 1));
|
|
@@ -332,6 +432,180 @@ export class BatchOperations {
|
|
|
332
432
|
}
|
|
333
433
|
if (Symbol.dispose) BatchOperations.prototype[Symbol.dispose] = BatchOperations.prototype.free;
|
|
334
434
|
|
|
435
|
+
const BatchOpsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
436
|
+
? { register: () => {}, unregister: () => {} }
|
|
437
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_batchops_free(ptr >>> 0, 1));
|
|
438
|
+
/**
|
|
439
|
+
* Batch operations for efficient computation
|
|
440
|
+
*/
|
|
441
|
+
export class BatchOps {
|
|
442
|
+
|
|
443
|
+
__destroy_into_raw() {
|
|
444
|
+
const ptr = this.__wbg_ptr;
|
|
445
|
+
this.__wbg_ptr = 0;
|
|
446
|
+
BatchOpsFinalization.unregister(this);
|
|
447
|
+
return ptr;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
free() {
|
|
451
|
+
const ptr = this.__destroy_into_raw();
|
|
452
|
+
wasm.__wbg_batchops_free(ptr, 0);
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Matrix multiplication with automatic gradients
|
|
456
|
+
* @param {Float64Array} a
|
|
457
|
+
* @param {Float64Array} b
|
|
458
|
+
* @param {number} a_rows
|
|
459
|
+
* @param {number} a_cols
|
|
460
|
+
* @param {number} b_rows
|
|
461
|
+
* @param {number} b_cols
|
|
462
|
+
* @returns {Float64Array}
|
|
463
|
+
*/
|
|
464
|
+
static matrixMultiply(a, b, a_rows, a_cols, b_rows, b_cols) {
|
|
465
|
+
const ptr0 = passArrayF64ToWasm0(a, wasm.__wbindgen_malloc);
|
|
466
|
+
const len0 = WASM_VECTOR_LEN;
|
|
467
|
+
const ptr1 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
468
|
+
const len1 = WASM_VECTOR_LEN;
|
|
469
|
+
const ret = wasm.batchops_matrixMultiply(ptr0, len0, ptr1, len1, a_rows, a_cols, b_rows, b_cols);
|
|
470
|
+
if (ret[3]) {
|
|
471
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
472
|
+
}
|
|
473
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
474
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
475
|
+
return v3;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Batch evaluate polynomial with derivatives
|
|
479
|
+
* @param {Float64Array} x_values
|
|
480
|
+
* @param {Float64Array} coefficients
|
|
481
|
+
* @returns {Float64Array}
|
|
482
|
+
*/
|
|
483
|
+
static batchPolynomial(x_values, coefficients) {
|
|
484
|
+
const ptr0 = passArrayF64ToWasm0(x_values, wasm.__wbindgen_malloc);
|
|
485
|
+
const len0 = WASM_VECTOR_LEN;
|
|
486
|
+
const ptr1 = passArrayF64ToWasm0(coefficients, wasm.__wbindgen_malloc);
|
|
487
|
+
const len1 = WASM_VECTOR_LEN;
|
|
488
|
+
const ret = wasm.batchops_batchPolynomial(ptr0, len0, ptr1, len1);
|
|
489
|
+
if (ret[3]) {
|
|
490
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
491
|
+
}
|
|
492
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
493
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
494
|
+
return v3;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Compute Jacobian matrix for vector function
|
|
498
|
+
* @param {Float64Array} input_values
|
|
499
|
+
* @param {string} function_name
|
|
500
|
+
* @returns {Float64Array}
|
|
501
|
+
*/
|
|
502
|
+
static computeJacobian(input_values, function_name) {
|
|
503
|
+
const ptr0 = passArrayF64ToWasm0(input_values, wasm.__wbindgen_malloc);
|
|
504
|
+
const len0 = WASM_VECTOR_LEN;
|
|
505
|
+
const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
506
|
+
const len1 = WASM_VECTOR_LEN;
|
|
507
|
+
const ret = wasm.batchops_computeJacobian(ptr0, len0, ptr1, len1);
|
|
508
|
+
if (ret[3]) {
|
|
509
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
510
|
+
}
|
|
511
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
512
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
513
|
+
return v3;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (Symbol.dispose) BatchOps.prototype[Symbol.dispose] = BatchOps.prototype.free;
|
|
517
|
+
|
|
518
|
+
const MLOpsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
519
|
+
? { register: () => {}, unregister: () => {} }
|
|
520
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_mlops_free(ptr >>> 0, 1));
|
|
521
|
+
/**
|
|
522
|
+
* Advanced machine learning operations using dual numbers
|
|
523
|
+
*/
|
|
524
|
+
export class MLOps {
|
|
525
|
+
|
|
526
|
+
__destroy_into_raw() {
|
|
527
|
+
const ptr = this.__wbg_ptr;
|
|
528
|
+
this.__wbg_ptr = 0;
|
|
529
|
+
MLOpsFinalization.unregister(this);
|
|
530
|
+
return ptr;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
free() {
|
|
534
|
+
const ptr = this.__destroy_into_raw();
|
|
535
|
+
wasm.__wbg_mlops_free(ptr, 0);
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Batch apply activation function with gradients
|
|
539
|
+
* @param {Float64Array} inputs
|
|
540
|
+
* @param {string} activation
|
|
541
|
+
* @returns {Float64Array}
|
|
542
|
+
*/
|
|
543
|
+
static batchActivation(inputs, activation) {
|
|
544
|
+
const ptr0 = passArrayF64ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
545
|
+
const len0 = WASM_VECTOR_LEN;
|
|
546
|
+
const ptr1 = passStringToWasm0(activation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
547
|
+
const len1 = WASM_VECTOR_LEN;
|
|
548
|
+
const ret = wasm.mlops_batchActivation(ptr0, len0, ptr1, len1);
|
|
549
|
+
if (ret[3]) {
|
|
550
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
551
|
+
}
|
|
552
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
553
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
554
|
+
return v3;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Compute cross-entropy loss with automatic gradients
|
|
558
|
+
* @param {Float64Array} predictions
|
|
559
|
+
* @param {Float64Array} targets
|
|
560
|
+
* @returns {WasmDualNumber}
|
|
561
|
+
*/
|
|
562
|
+
static crossEntropyLoss(predictions, targets) {
|
|
563
|
+
const ptr0 = passArrayF64ToWasm0(predictions, wasm.__wbindgen_malloc);
|
|
564
|
+
const len0 = WASM_VECTOR_LEN;
|
|
565
|
+
const ptr1 = passArrayF64ToWasm0(targets, wasm.__wbindgen_malloc);
|
|
566
|
+
const len1 = WASM_VECTOR_LEN;
|
|
567
|
+
const ret = wasm.mlops_crossEntropyLoss(ptr0, len0, ptr1, len1);
|
|
568
|
+
if (ret[2]) {
|
|
569
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
570
|
+
}
|
|
571
|
+
return WasmDualNumber.__wrap(ret[0]);
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Gradient descent step
|
|
575
|
+
* @param {Float64Array} parameters
|
|
576
|
+
* @param {Float64Array} gradients
|
|
577
|
+
* @param {number} learning_rate
|
|
578
|
+
* @returns {Float64Array}
|
|
579
|
+
*/
|
|
580
|
+
static gradientDescentStep(parameters, gradients, learning_rate) {
|
|
581
|
+
const ptr0 = passArrayF64ToWasm0(parameters, wasm.__wbindgen_malloc);
|
|
582
|
+
const len0 = WASM_VECTOR_LEN;
|
|
583
|
+
const ptr1 = passArrayF64ToWasm0(gradients, wasm.__wbindgen_malloc);
|
|
584
|
+
const len1 = WASM_VECTOR_LEN;
|
|
585
|
+
const ret = wasm.mlops_gradientDescentStep(ptr0, len0, ptr1, len1, learning_rate);
|
|
586
|
+
if (ret[3]) {
|
|
587
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
588
|
+
}
|
|
589
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
590
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
591
|
+
return v3;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Compute softmax with automatic gradients
|
|
595
|
+
* @param {Float64Array} inputs
|
|
596
|
+
* @returns {Float64Array}
|
|
597
|
+
*/
|
|
598
|
+
static softmax(inputs) {
|
|
599
|
+
const ptr0 = passArrayF64ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
600
|
+
const len0 = WASM_VECTOR_LEN;
|
|
601
|
+
const ret = wasm.mlops_softmax(ptr0, len0);
|
|
602
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
603
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
604
|
+
return v2;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (Symbol.dispose) MLOps.prototype[Symbol.dispose] = MLOps.prototype.free;
|
|
608
|
+
|
|
335
609
|
const NetworkBatchOperationsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
336
610
|
? { register: () => {}, unregister: () => {} }
|
|
337
611
|
: new FinalizationRegistry(ptr => wasm.__wbg_networkbatchoperations_free(ptr >>> 0, 1));
|
|
@@ -470,7 +744,415 @@ export class PerformanceOperations {
|
|
|
470
744
|
return v3;
|
|
471
745
|
}
|
|
472
746
|
}
|
|
473
|
-
if (Symbol.dispose) PerformanceOperations.prototype[Symbol.dispose] = PerformanceOperations.prototype.free;
|
|
747
|
+
if (Symbol.dispose) PerformanceOperations.prototype[Symbol.dispose] = PerformanceOperations.prototype.free;
|
|
748
|
+
|
|
749
|
+
const TropicalBatchFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
750
|
+
? { register: () => {}, unregister: () => {} }
|
|
751
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_tropicalbatch_free(ptr >>> 0, 1));
|
|
752
|
+
/**
|
|
753
|
+
* Batch operations for tropical numbers
|
|
754
|
+
*/
|
|
755
|
+
export class TropicalBatch {
|
|
756
|
+
|
|
757
|
+
__destroy_into_raw() {
|
|
758
|
+
const ptr = this.__wbg_ptr;
|
|
759
|
+
this.__wbg_ptr = 0;
|
|
760
|
+
TropicalBatchFinalization.unregister(this);
|
|
761
|
+
return ptr;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
free() {
|
|
765
|
+
const ptr = this.__destroy_into_raw();
|
|
766
|
+
wasm.__wbg_tropicalbatch_free(ptr, 0);
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Convert array of log probabilities to tropical numbers and find maximum
|
|
770
|
+
* @param {Float64Array} log_probs
|
|
771
|
+
* @returns {number}
|
|
772
|
+
*/
|
|
773
|
+
static maxLogProb(log_probs) {
|
|
774
|
+
const ptr0 = passArrayF64ToWasm0(log_probs, wasm.__wbindgen_malloc);
|
|
775
|
+
const len0 = WASM_VECTOR_LEN;
|
|
776
|
+
const ret = wasm.tropicalbatch_maxLogProb(ptr0, len0);
|
|
777
|
+
return ret;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Viterbi algorithm helper: find best path through trellis
|
|
781
|
+
* @param {Float64Array} prev_scores
|
|
782
|
+
* @param {Float64Array} transition_scores
|
|
783
|
+
* @param {Float64Array} emission_scores
|
|
784
|
+
* @param {number} num_states
|
|
785
|
+
* @returns {Float64Array}
|
|
786
|
+
*/
|
|
787
|
+
static viterbiStep(prev_scores, transition_scores, emission_scores, num_states) {
|
|
788
|
+
const ptr0 = passArrayF64ToWasm0(prev_scores, wasm.__wbindgen_malloc);
|
|
789
|
+
const len0 = WASM_VECTOR_LEN;
|
|
790
|
+
const ptr1 = passArrayF64ToWasm0(transition_scores, wasm.__wbindgen_malloc);
|
|
791
|
+
const len1 = WASM_VECTOR_LEN;
|
|
792
|
+
const ptr2 = passArrayF64ToWasm0(emission_scores, wasm.__wbindgen_malloc);
|
|
793
|
+
const len2 = WASM_VECTOR_LEN;
|
|
794
|
+
const ret = wasm.tropicalbatch_viterbiStep(ptr0, len0, ptr1, len1, ptr2, len2, num_states);
|
|
795
|
+
if (ret[3]) {
|
|
796
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
797
|
+
}
|
|
798
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
799
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
800
|
+
return v4;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Batch tropical addition (max operation)
|
|
804
|
+
* @param {Float64Array} values
|
|
805
|
+
* @returns {number}
|
|
806
|
+
*/
|
|
807
|
+
static batchTropicalAdd(values) {
|
|
808
|
+
const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
|
|
809
|
+
const len0 = WASM_VECTOR_LEN;
|
|
810
|
+
const ret = wasm.tropicalbatch_batchTropicalAdd(ptr0, len0);
|
|
811
|
+
return ret;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Batch tropical multiplication (addition)
|
|
815
|
+
* @param {Float64Array} values
|
|
816
|
+
* @returns {number}
|
|
817
|
+
*/
|
|
818
|
+
static batchTropicalMul(values) {
|
|
819
|
+
const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
|
|
820
|
+
const len0 = WASM_VECTOR_LEN;
|
|
821
|
+
const ret = wasm.tropicalbatch_batchTropicalMul(ptr0, len0);
|
|
822
|
+
return ret;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
if (Symbol.dispose) TropicalBatch.prototype[Symbol.dispose] = TropicalBatch.prototype.free;
|
|
826
|
+
|
|
827
|
+
const TropicalMLOpsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
828
|
+
? { register: () => {}, unregister: () => {} }
|
|
829
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_tropicalmlops_free(ptr >>> 0, 1));
|
|
830
|
+
/**
|
|
831
|
+
* Advanced tropical operations for machine learning and optimization
|
|
832
|
+
*/
|
|
833
|
+
export class TropicalMLOps {
|
|
834
|
+
|
|
835
|
+
__destroy_into_raw() {
|
|
836
|
+
const ptr = this.__wbg_ptr;
|
|
837
|
+
this.__wbg_ptr = 0;
|
|
838
|
+
TropicalMLOpsFinalization.unregister(this);
|
|
839
|
+
return ptr;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
free() {
|
|
843
|
+
const ptr = this.__destroy_into_raw();
|
|
844
|
+
wasm.__wbg_tropicalmlops_free(ptr, 0);
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Compute shortest paths using tropical algebra (Floyd-Warshall)
|
|
848
|
+
* @param {any} distance_matrix
|
|
849
|
+
* @returns {Array<any>}
|
|
850
|
+
*/
|
|
851
|
+
static shortestPaths(distance_matrix) {
|
|
852
|
+
const ret = wasm.tropicalmlops_shortestPaths(distance_matrix);
|
|
853
|
+
if (ret[2]) {
|
|
854
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
855
|
+
}
|
|
856
|
+
return takeFromExternrefTable0(ret[0]);
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Compute tropical matrix multiplication for pathfinding
|
|
860
|
+
* @param {any} a
|
|
861
|
+
* @param {any} b
|
|
862
|
+
* @returns {Array<any>}
|
|
863
|
+
*/
|
|
864
|
+
static matrixMultiply(a, b) {
|
|
865
|
+
const ret = wasm.tropicalmlops_matrixMultiply(a, b);
|
|
866
|
+
if (ret[2]) {
|
|
867
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
868
|
+
}
|
|
869
|
+
return takeFromExternrefTable0(ret[0]);
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Compute tropical convex combination (used in optimization)
|
|
873
|
+
* @param {Float64Array} values
|
|
874
|
+
* @param {Float64Array} weights
|
|
875
|
+
* @returns {number}
|
|
876
|
+
*/
|
|
877
|
+
static convexCombination(values, weights) {
|
|
878
|
+
const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
|
|
879
|
+
const len0 = WASM_VECTOR_LEN;
|
|
880
|
+
const ptr1 = passArrayF64ToWasm0(weights, wasm.__wbindgen_malloc);
|
|
881
|
+
const len1 = WASM_VECTOR_LEN;
|
|
882
|
+
const ret = wasm.tropicalmlops_convexCombination(ptr0, len0, ptr1, len1);
|
|
883
|
+
if (ret[2]) {
|
|
884
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
885
|
+
}
|
|
886
|
+
return ret[0];
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
if (Symbol.dispose) TropicalMLOps.prototype[Symbol.dispose] = TropicalMLOps.prototype.free;
|
|
890
|
+
|
|
891
|
+
const WasmDualNumberFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
892
|
+
? { register: () => {}, unregister: () => {} }
|
|
893
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmdualnumber_free(ptr >>> 0, 1));
|
|
894
|
+
/**
|
|
895
|
+
* WASM wrapper for single-variable dual numbers
|
|
896
|
+
*/
|
|
897
|
+
export class WasmDualNumber {
|
|
898
|
+
|
|
899
|
+
static __wrap(ptr) {
|
|
900
|
+
ptr = ptr >>> 0;
|
|
901
|
+
const obj = Object.create(WasmDualNumber.prototype);
|
|
902
|
+
obj.__wbg_ptr = ptr;
|
|
903
|
+
WasmDualNumberFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
904
|
+
return obj;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
__destroy_into_raw() {
|
|
908
|
+
const ptr = this.__wbg_ptr;
|
|
909
|
+
this.__wbg_ptr = 0;
|
|
910
|
+
WasmDualNumberFinalization.unregister(this);
|
|
911
|
+
return ptr;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
free() {
|
|
915
|
+
const ptr = this.__destroy_into_raw();
|
|
916
|
+
wasm.__wbg_wasmdualnumber_free(ptr, 0);
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Natural logarithm
|
|
920
|
+
* @returns {WasmDualNumber}
|
|
921
|
+
*/
|
|
922
|
+
ln() {
|
|
923
|
+
const ret = wasm.wasmdualnumber_ln(this.__wbg_ptr);
|
|
924
|
+
if (ret[2]) {
|
|
925
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
926
|
+
}
|
|
927
|
+
return WasmDualNumber.__wrap(ret[0]);
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Addition
|
|
931
|
+
* @param {WasmDualNumber} other
|
|
932
|
+
* @returns {WasmDualNumber}
|
|
933
|
+
*/
|
|
934
|
+
add(other) {
|
|
935
|
+
_assertClass(other, WasmDualNumber);
|
|
936
|
+
const ret = wasm.wasmdualnumber_add(this.__wbg_ptr, other.__wbg_ptr);
|
|
937
|
+
return WasmDualNumber.__wrap(ret);
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Cosine function
|
|
941
|
+
* @returns {WasmDualNumber}
|
|
942
|
+
*/
|
|
943
|
+
cos() {
|
|
944
|
+
const ret = wasm.wasmdualnumber_cos(this.__wbg_ptr);
|
|
945
|
+
return WasmDualNumber.__wrap(ret);
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Division
|
|
949
|
+
* @param {WasmDualNumber} other
|
|
950
|
+
* @returns {WasmDualNumber}
|
|
951
|
+
*/
|
|
952
|
+
div(other) {
|
|
953
|
+
_assertClass(other, WasmDualNumber);
|
|
954
|
+
const ret = wasm.wasmdualnumber_div(this.__wbg_ptr, other.__wbg_ptr);
|
|
955
|
+
if (ret[2]) {
|
|
956
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
957
|
+
}
|
|
958
|
+
return WasmDualNumber.__wrap(ret[0]);
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Exponential function
|
|
962
|
+
* @returns {WasmDualNumber}
|
|
963
|
+
*/
|
|
964
|
+
exp() {
|
|
965
|
+
const ret = wasm.wasmdualnumber_exp(this.__wbg_ptr);
|
|
966
|
+
return WasmDualNumber.__wrap(ret);
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Maximum of two dual numbers
|
|
970
|
+
* @param {WasmDualNumber} other
|
|
971
|
+
* @returns {WasmDualNumber}
|
|
972
|
+
*/
|
|
973
|
+
max(other) {
|
|
974
|
+
_assertClass(other, WasmDualNumber);
|
|
975
|
+
const ret = wasm.wasmdualnumber_max(this.__wbg_ptr, other.__wbg_ptr);
|
|
976
|
+
return WasmDualNumber.__wrap(ret);
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Minimum of two dual numbers
|
|
980
|
+
* @param {WasmDualNumber} other
|
|
981
|
+
* @returns {WasmDualNumber}
|
|
982
|
+
*/
|
|
983
|
+
min(other) {
|
|
984
|
+
_assertClass(other, WasmDualNumber);
|
|
985
|
+
const ret = wasm.wasmdualnumber_min(this.__wbg_ptr, other.__wbg_ptr);
|
|
986
|
+
return WasmDualNumber.__wrap(ret);
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Multiplication
|
|
990
|
+
* @param {WasmDualNumber} other
|
|
991
|
+
* @returns {WasmDualNumber}
|
|
992
|
+
*/
|
|
993
|
+
mul(other) {
|
|
994
|
+
_assertClass(other, WasmDualNumber);
|
|
995
|
+
const ret = wasm.wasmdualnumber_mul(this.__wbg_ptr, other.__wbg_ptr);
|
|
996
|
+
return WasmDualNumber.__wrap(ret);
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Negation
|
|
1000
|
+
* @returns {WasmDualNumber}
|
|
1001
|
+
*/
|
|
1002
|
+
neg() {
|
|
1003
|
+
const ret = wasm.wasmdualnumber_neg(this.__wbg_ptr);
|
|
1004
|
+
return WasmDualNumber.__wrap(ret);
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Create a new dual number with given real and dual parts
|
|
1008
|
+
* @param {number} real
|
|
1009
|
+
* @param {number} dual
|
|
1010
|
+
*/
|
|
1011
|
+
constructor(real, dual) {
|
|
1012
|
+
const ret = wasm.wasmdualnumber_new(real, dual);
|
|
1013
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1014
|
+
WasmDualNumberFinalization.register(this, this.__wbg_ptr, this);
|
|
1015
|
+
return this;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Power function
|
|
1019
|
+
* @param {number} exponent
|
|
1020
|
+
* @returns {WasmDualNumber}
|
|
1021
|
+
*/
|
|
1022
|
+
pow(exponent) {
|
|
1023
|
+
const ret = wasm.wasmdualnumber_pow(this.__wbg_ptr, exponent);
|
|
1024
|
+
return WasmDualNumber.__wrap(ret);
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Sine function
|
|
1028
|
+
* @returns {WasmDualNumber}
|
|
1029
|
+
*/
|
|
1030
|
+
sin() {
|
|
1031
|
+
const ret = wasm.wasmdualnumber_sin(this.__wbg_ptr);
|
|
1032
|
+
return WasmDualNumber.__wrap(ret);
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Subtraction
|
|
1036
|
+
* @param {WasmDualNumber} other
|
|
1037
|
+
* @returns {WasmDualNumber}
|
|
1038
|
+
*/
|
|
1039
|
+
sub(other) {
|
|
1040
|
+
_assertClass(other, WasmDualNumber);
|
|
1041
|
+
const ret = wasm.wasmdualnumber_sub(this.__wbg_ptr, other.__wbg_ptr);
|
|
1042
|
+
return WasmDualNumber.__wrap(ret);
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Tangent function
|
|
1046
|
+
* @returns {WasmDualNumber}
|
|
1047
|
+
*/
|
|
1048
|
+
tan() {
|
|
1049
|
+
const ret = wasm.wasmdualnumber_tan(this.__wbg_ptr);
|
|
1050
|
+
return WasmDualNumber.__wrap(ret);
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Hyperbolic cosine
|
|
1054
|
+
* @returns {WasmDualNumber}
|
|
1055
|
+
*/
|
|
1056
|
+
cosh() {
|
|
1057
|
+
const ret = wasm.wasmdualnumber_cosh(this.__wbg_ptr);
|
|
1058
|
+
return WasmDualNumber.__wrap(ret);
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Integer power
|
|
1062
|
+
* @param {number} n
|
|
1063
|
+
* @returns {WasmDualNumber}
|
|
1064
|
+
*/
|
|
1065
|
+
powi(n) {
|
|
1066
|
+
const ret = wasm.wasmdualnumber_powi(this.__wbg_ptr, n);
|
|
1067
|
+
return WasmDualNumber.__wrap(ret);
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* ReLU activation function
|
|
1071
|
+
* @returns {WasmDualNumber}
|
|
1072
|
+
*/
|
|
1073
|
+
relu() {
|
|
1074
|
+
const ret = wasm.wasmdualnumber_relu(this.__wbg_ptr);
|
|
1075
|
+
return WasmDualNumber.__wrap(ret);
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Hyperbolic sine
|
|
1079
|
+
* @returns {WasmDualNumber}
|
|
1080
|
+
*/
|
|
1081
|
+
sinh() {
|
|
1082
|
+
const ret = wasm.wasmdualnumber_sinh(this.__wbg_ptr);
|
|
1083
|
+
return WasmDualNumber.__wrap(ret);
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Square root
|
|
1087
|
+
* @returns {WasmDualNumber}
|
|
1088
|
+
*/
|
|
1089
|
+
sqrt() {
|
|
1090
|
+
const ret = wasm.wasmdualnumber_sqrt(this.__wbg_ptr);
|
|
1091
|
+
if (ret[2]) {
|
|
1092
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1093
|
+
}
|
|
1094
|
+
return WasmDualNumber.__wrap(ret[0]);
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Hyperbolic tangent
|
|
1098
|
+
* @returns {WasmDualNumber}
|
|
1099
|
+
*/
|
|
1100
|
+
tanh() {
|
|
1101
|
+
const ret = wasm.wasmdualnumber_tanh(this.__wbg_ptr);
|
|
1102
|
+
return WasmDualNumber.__wrap(ret);
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Sigmoid activation function
|
|
1106
|
+
* @returns {WasmDualNumber}
|
|
1107
|
+
*/
|
|
1108
|
+
sigmoid() {
|
|
1109
|
+
const ret = wasm.wasmdualnumber_sigmoid(this.__wbg_ptr);
|
|
1110
|
+
return WasmDualNumber.__wrap(ret);
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Create a constant (derivative = 0)
|
|
1114
|
+
* @param {number} value
|
|
1115
|
+
* @returns {WasmDualNumber}
|
|
1116
|
+
*/
|
|
1117
|
+
static constant(value) {
|
|
1118
|
+
const ret = wasm.wasmdualnumber_constant(value);
|
|
1119
|
+
return WasmDualNumber.__wrap(ret);
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Get the dual part (derivative)
|
|
1123
|
+
* @returns {number}
|
|
1124
|
+
*/
|
|
1125
|
+
getDual() {
|
|
1126
|
+
const ret = wasm.wasmdualnumber_getDual(this.__wbg_ptr);
|
|
1127
|
+
return ret;
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Get the real part (function value)
|
|
1131
|
+
* @returns {number}
|
|
1132
|
+
*/
|
|
1133
|
+
getReal() {
|
|
1134
|
+
const ret = wasm.wasmdualnumber_getReal(this.__wbg_ptr);
|
|
1135
|
+
return ret;
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Softplus activation function
|
|
1139
|
+
* @returns {WasmDualNumber}
|
|
1140
|
+
*/
|
|
1141
|
+
softplus() {
|
|
1142
|
+
const ret = wasm.wasmdualnumber_softplus(this.__wbg_ptr);
|
|
1143
|
+
return WasmDualNumber.__wrap(ret);
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Create a variable (derivative = 1)
|
|
1147
|
+
* @param {number} value
|
|
1148
|
+
* @returns {WasmDualNumber}
|
|
1149
|
+
*/
|
|
1150
|
+
static variable(value) {
|
|
1151
|
+
const ret = wasm.wasmdualnumber_variable(value);
|
|
1152
|
+
return WasmDualNumber.__wrap(ret);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
if (Symbol.dispose) WasmDualNumber.prototype[Symbol.dispose] = WasmDualNumber.prototype.free;
|
|
474
1156
|
|
|
475
1157
|
const WasmFourVelocityFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
476
1158
|
? { register: () => {}, unregister: () => {} }
|
|
@@ -830,6 +1512,145 @@ export class WasmGeometricNetwork {
|
|
|
830
1512
|
}
|
|
831
1513
|
if (Symbol.dispose) WasmGeometricNetwork.prototype[Symbol.dispose] = WasmGeometricNetwork.prototype.free;
|
|
832
1514
|
|
|
1515
|
+
const WasmMultiDualNumberFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1516
|
+
? { register: () => {}, unregister: () => {} }
|
|
1517
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmultidualnumber_free(ptr >>> 0, 1));
|
|
1518
|
+
/**
|
|
1519
|
+
* WASM wrapper for multi-variable dual numbers
|
|
1520
|
+
*/
|
|
1521
|
+
export class WasmMultiDualNumber {
|
|
1522
|
+
|
|
1523
|
+
static __wrap(ptr) {
|
|
1524
|
+
ptr = ptr >>> 0;
|
|
1525
|
+
const obj = Object.create(WasmMultiDualNumber.prototype);
|
|
1526
|
+
obj.__wbg_ptr = ptr;
|
|
1527
|
+
WasmMultiDualNumberFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1528
|
+
return obj;
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
__destroy_into_raw() {
|
|
1532
|
+
const ptr = this.__wbg_ptr;
|
|
1533
|
+
this.__wbg_ptr = 0;
|
|
1534
|
+
WasmMultiDualNumberFinalization.unregister(this);
|
|
1535
|
+
return ptr;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
free() {
|
|
1539
|
+
const ptr = this.__destroy_into_raw();
|
|
1540
|
+
wasm.__wbg_wasmmultidualnumber_free(ptr, 0);
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Get a specific partial derivative
|
|
1544
|
+
* @param {number} index
|
|
1545
|
+
* @returns {number}
|
|
1546
|
+
*/
|
|
1547
|
+
getPartial(index) {
|
|
1548
|
+
const ret = wasm.wasmmultidualnumber_getPartial(this.__wbg_ptr, index);
|
|
1549
|
+
if (ret[2]) {
|
|
1550
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1551
|
+
}
|
|
1552
|
+
return ret[0];
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Get the gradient (all partial derivatives)
|
|
1556
|
+
* @returns {Float64Array}
|
|
1557
|
+
*/
|
|
1558
|
+
getGradient() {
|
|
1559
|
+
const ret = wasm.wasmmultidualnumber_getGradient(this.__wbg_ptr);
|
|
1560
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1561
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1562
|
+
return v1;
|
|
1563
|
+
}
|
|
1564
|
+
/**
|
|
1565
|
+
* Get number of variables
|
|
1566
|
+
* @returns {number}
|
|
1567
|
+
*/
|
|
1568
|
+
getNumVars() {
|
|
1569
|
+
const ret = wasm.wasmmultidualnumber_getNumVars(this.__wbg_ptr);
|
|
1570
|
+
return ret >>> 0;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Addition
|
|
1574
|
+
* @param {WasmMultiDualNumber} other
|
|
1575
|
+
* @returns {WasmMultiDualNumber}
|
|
1576
|
+
*/
|
|
1577
|
+
add(other) {
|
|
1578
|
+
_assertClass(other, WasmMultiDualNumber);
|
|
1579
|
+
const ret = wasm.wasmmultidualnumber_add(this.__wbg_ptr, other.__wbg_ptr);
|
|
1580
|
+
if (ret[2]) {
|
|
1581
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1582
|
+
}
|
|
1583
|
+
return WasmMultiDualNumber.__wrap(ret[0]);
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* Multiplication
|
|
1587
|
+
* @param {WasmMultiDualNumber} other
|
|
1588
|
+
* @returns {WasmMultiDualNumber}
|
|
1589
|
+
*/
|
|
1590
|
+
mul(other) {
|
|
1591
|
+
_assertClass(other, WasmMultiDualNumber);
|
|
1592
|
+
const ret = wasm.wasmmultidualnumber_mul(this.__wbg_ptr, other.__wbg_ptr);
|
|
1593
|
+
if (ret[2]) {
|
|
1594
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1595
|
+
}
|
|
1596
|
+
return WasmMultiDualNumber.__wrap(ret[0]);
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Create a new multi-dual number
|
|
1600
|
+
* @param {number} real
|
|
1601
|
+
* @param {Float64Array} duals
|
|
1602
|
+
*/
|
|
1603
|
+
constructor(real, duals) {
|
|
1604
|
+
const ptr0 = passArrayF64ToWasm0(duals, wasm.__wbindgen_malloc);
|
|
1605
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1606
|
+
const ret = wasm.wasmmultidualnumber_new(real, ptr0, len0);
|
|
1607
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1608
|
+
WasmMultiDualNumberFinalization.register(this, this.__wbg_ptr, this);
|
|
1609
|
+
return this;
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Square root
|
|
1613
|
+
* @returns {WasmMultiDualNumber}
|
|
1614
|
+
*/
|
|
1615
|
+
sqrt() {
|
|
1616
|
+
const ret = wasm.wasmmultidualnumber_sqrt(this.__wbg_ptr);
|
|
1617
|
+
if (ret[2]) {
|
|
1618
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1619
|
+
}
|
|
1620
|
+
return WasmMultiDualNumber.__wrap(ret[0]);
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Create a constant (all derivatives are zero)
|
|
1624
|
+
* @param {number} value
|
|
1625
|
+
* @param {number} num_vars
|
|
1626
|
+
* @returns {WasmMultiDualNumber}
|
|
1627
|
+
*/
|
|
1628
|
+
static constant(value, num_vars) {
|
|
1629
|
+
const ret = wasm.wasmmultidualnumber_constant(value, num_vars);
|
|
1630
|
+
return WasmMultiDualNumber.__wrap(ret);
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Get the real part (function value)
|
|
1634
|
+
* @returns {number}
|
|
1635
|
+
*/
|
|
1636
|
+
getReal() {
|
|
1637
|
+
const ret = wasm.wasmdualnumber_getReal(this.__wbg_ptr);
|
|
1638
|
+
return ret;
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* Create a variable with derivative 1 at the specified index
|
|
1642
|
+
* @param {number} value
|
|
1643
|
+
* @param {number} num_vars
|
|
1644
|
+
* @param {number} var_index
|
|
1645
|
+
* @returns {WasmMultiDualNumber}
|
|
1646
|
+
*/
|
|
1647
|
+
static variable(value, num_vars, var_index) {
|
|
1648
|
+
const ret = wasm.wasmmultidualnumber_variable(value, num_vars, var_index);
|
|
1649
|
+
return WasmMultiDualNumber.__wrap(ret);
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
if (Symbol.dispose) WasmMultiDualNumber.prototype[Symbol.dispose] = WasmMultiDualNumber.prototype.free;
|
|
1653
|
+
|
|
833
1654
|
const WasmMultivectorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
834
1655
|
? { register: () => {}, unregister: () => {} }
|
|
835
1656
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmultivector_free(ptr >>> 0, 1));
|
|
@@ -1405,7 +2226,7 @@ export class WasmSchwarzschildMetric {
|
|
|
1405
2226
|
* @returns {number}
|
|
1406
2227
|
*/
|
|
1407
2228
|
mass() {
|
|
1408
|
-
const ret = wasm.
|
|
2229
|
+
const ret = wasm.wasmdualnumber_getReal(this.__wbg_ptr);
|
|
1409
2230
|
return ret;
|
|
1410
2231
|
}
|
|
1411
2232
|
/**
|
|
@@ -1502,7 +2323,7 @@ export class WasmSpacetimeVector {
|
|
|
1502
2323
|
* @returns {number}
|
|
1503
2324
|
*/
|
|
1504
2325
|
get x() {
|
|
1505
|
-
const ret = wasm.
|
|
2326
|
+
const ret = wasm.wasmdualnumber_getDual(this.__wbg_ptr);
|
|
1506
2327
|
return ret;
|
|
1507
2328
|
}
|
|
1508
2329
|
/**
|
|
@@ -1626,6 +2447,298 @@ export class WasmTrajectoryPoint {
|
|
|
1626
2447
|
}
|
|
1627
2448
|
if (Symbol.dispose) WasmTrajectoryPoint.prototype[Symbol.dispose] = WasmTrajectoryPoint.prototype.free;
|
|
1628
2449
|
|
|
2450
|
+
const WasmTropicalNumberFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2451
|
+
? { register: () => {}, unregister: () => {} }
|
|
2452
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtropicalnumber_free(ptr >>> 0, 1));
|
|
2453
|
+
/**
|
|
2454
|
+
* WASM wrapper for TropicalNumber
|
|
2455
|
+
*/
|
|
2456
|
+
export class WasmTropicalNumber {
|
|
2457
|
+
|
|
2458
|
+
static __wrap(ptr) {
|
|
2459
|
+
ptr = ptr >>> 0;
|
|
2460
|
+
const obj = Object.create(WasmTropicalNumber.prototype);
|
|
2461
|
+
obj.__wbg_ptr = ptr;
|
|
2462
|
+
WasmTropicalNumberFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2463
|
+
return obj;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
__destroy_into_raw() {
|
|
2467
|
+
const ptr = this.__wbg_ptr;
|
|
2468
|
+
this.__wbg_ptr = 0;
|
|
2469
|
+
WasmTropicalNumberFinalization.unregister(this);
|
|
2470
|
+
return ptr;
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
free() {
|
|
2474
|
+
const ptr = this.__destroy_into_raw();
|
|
2475
|
+
wasm.__wbg_wasmtropicalnumber_free(ptr, 0);
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Check if this is infinite
|
|
2479
|
+
* @returns {boolean}
|
|
2480
|
+
*/
|
|
2481
|
+
isInfinity() {
|
|
2482
|
+
const ret = wasm.wasmtropicalnumber_isInfinity(this.__wbg_ptr);
|
|
2483
|
+
return ret !== 0;
|
|
2484
|
+
}
|
|
2485
|
+
/**
|
|
2486
|
+
* Tropical addition (max operation)
|
|
2487
|
+
* @param {WasmTropicalNumber} other
|
|
2488
|
+
* @returns {WasmTropicalNumber}
|
|
2489
|
+
*/
|
|
2490
|
+
tropicalAdd(other) {
|
|
2491
|
+
_assertClass(other, WasmTropicalNumber);
|
|
2492
|
+
const ret = wasm.wasmtropicalnumber_add(this.__wbg_ptr, other.__wbg_ptr);
|
|
2493
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Tropical multiplication (addition)
|
|
2497
|
+
* @param {WasmTropicalNumber} other
|
|
2498
|
+
* @returns {WasmTropicalNumber}
|
|
2499
|
+
*/
|
|
2500
|
+
tropicalMul(other) {
|
|
2501
|
+
_assertClass(other, WasmTropicalNumber);
|
|
2502
|
+
const ret = wasm.wasmtropicalnumber_mul(this.__wbg_ptr, other.__wbg_ptr);
|
|
2503
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2504
|
+
}
|
|
2505
|
+
/**
|
|
2506
|
+
* Tropical power (scalar multiplication)
|
|
2507
|
+
* @param {number} n
|
|
2508
|
+
* @returns {WasmTropicalNumber}
|
|
2509
|
+
*/
|
|
2510
|
+
tropicalPow(n) {
|
|
2511
|
+
const ret = wasm.wasmtropicalnumber_tropicalPow(this.__wbg_ptr, n);
|
|
2512
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2513
|
+
}
|
|
2514
|
+
/**
|
|
2515
|
+
* Create from log probability
|
|
2516
|
+
* @param {number} log_p
|
|
2517
|
+
* @returns {WasmTropicalNumber}
|
|
2518
|
+
*/
|
|
2519
|
+
static fromLogProb(log_p) {
|
|
2520
|
+
const ret = wasm.wasmtropicalnumber_fromLogProb(log_p);
|
|
2521
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* Standard addition (for convenience)
|
|
2525
|
+
* @param {WasmTropicalNumber} other
|
|
2526
|
+
* @returns {WasmTropicalNumber}
|
|
2527
|
+
*/
|
|
2528
|
+
add(other) {
|
|
2529
|
+
_assertClass(other, WasmTropicalNumber);
|
|
2530
|
+
const ret = wasm.wasmtropicalnumber_add(this.__wbg_ptr, other.__wbg_ptr);
|
|
2531
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* Standard multiplication (for convenience)
|
|
2535
|
+
* @param {WasmTropicalNumber} other
|
|
2536
|
+
* @returns {WasmTropicalNumber}
|
|
2537
|
+
*/
|
|
2538
|
+
mul(other) {
|
|
2539
|
+
_assertClass(other, WasmTropicalNumber);
|
|
2540
|
+
const ret = wasm.wasmtropicalnumber_mul(this.__wbg_ptr, other.__wbg_ptr);
|
|
2541
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Negation
|
|
2545
|
+
* @returns {WasmTropicalNumber}
|
|
2546
|
+
*/
|
|
2547
|
+
neg() {
|
|
2548
|
+
const ret = wasm.wasmtropicalnumber_neg(this.__wbg_ptr);
|
|
2549
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2550
|
+
}
|
|
2551
|
+
/**
|
|
2552
|
+
* Create a new tropical number from a regular number
|
|
2553
|
+
* @param {number} value
|
|
2554
|
+
*/
|
|
2555
|
+
constructor(value) {
|
|
2556
|
+
const ret = wasm.wasmtropicalnumber_fromLogProb(value);
|
|
2557
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2558
|
+
WasmTropicalNumberFinalization.register(this, this.__wbg_ptr, this);
|
|
2559
|
+
return this;
|
|
2560
|
+
}
|
|
2561
|
+
/**
|
|
2562
|
+
* Create tropical one (regular zero)
|
|
2563
|
+
* @returns {WasmTropicalNumber}
|
|
2564
|
+
*/
|
|
2565
|
+
static one() {
|
|
2566
|
+
const ret = wasm.wasmtropicalnumber_one();
|
|
2567
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2568
|
+
}
|
|
2569
|
+
/**
|
|
2570
|
+
* Create tropical zero (negative infinity)
|
|
2571
|
+
* @returns {WasmTropicalNumber}
|
|
2572
|
+
*/
|
|
2573
|
+
static zero() {
|
|
2574
|
+
const ret = wasm.wasmtropicalnumber_zero();
|
|
2575
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2576
|
+
}
|
|
2577
|
+
/**
|
|
2578
|
+
* Check if this is tropical one (zero)
|
|
2579
|
+
* @returns {boolean}
|
|
2580
|
+
*/
|
|
2581
|
+
isOne() {
|
|
2582
|
+
const ret = wasm.wasmtropicalnumber_isOne(this.__wbg_ptr);
|
|
2583
|
+
return ret !== 0;
|
|
2584
|
+
}
|
|
2585
|
+
/**
|
|
2586
|
+
* Check if this is tropical zero (negative infinity)
|
|
2587
|
+
* @returns {boolean}
|
|
2588
|
+
*/
|
|
2589
|
+
isZero() {
|
|
2590
|
+
const ret = wasm.wasmtropicalnumber_isZero(this.__wbg_ptr);
|
|
2591
|
+
return ret !== 0;
|
|
2592
|
+
}
|
|
2593
|
+
/**
|
|
2594
|
+
* Convert to probability (via exp)
|
|
2595
|
+
* @returns {number}
|
|
2596
|
+
*/
|
|
2597
|
+
toProb() {
|
|
2598
|
+
const ret = wasm.wasmtropicalnumber_toProb(this.__wbg_ptr);
|
|
2599
|
+
return ret;
|
|
2600
|
+
}
|
|
2601
|
+
/**
|
|
2602
|
+
* Get the underlying value
|
|
2603
|
+
* @returns {number}
|
|
2604
|
+
*/
|
|
2605
|
+
getValue() {
|
|
2606
|
+
const ret = wasm.wasmdualnumber_getReal(this.__wbg_ptr);
|
|
2607
|
+
return ret;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
if (Symbol.dispose) WasmTropicalNumber.prototype[Symbol.dispose] = WasmTropicalNumber.prototype.free;
|
|
2611
|
+
|
|
2612
|
+
const WasmTropicalPolynomialFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2613
|
+
? { register: () => {}, unregister: () => {} }
|
|
2614
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtropicalpolynomial_free(ptr >>> 0, 1));
|
|
2615
|
+
/**
|
|
2616
|
+
* WASM wrapper for TropicalPolynomial - polynomial operations in tropical algebra
|
|
2617
|
+
*/
|
|
2618
|
+
export class WasmTropicalPolynomial {
|
|
2619
|
+
|
|
2620
|
+
__destroy_into_raw() {
|
|
2621
|
+
const ptr = this.__wbg_ptr;
|
|
2622
|
+
this.__wbg_ptr = 0;
|
|
2623
|
+
WasmTropicalPolynomialFinalization.unregister(this);
|
|
2624
|
+
return ptr;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
free() {
|
|
2628
|
+
const ptr = this.__destroy_into_raw();
|
|
2629
|
+
wasm.__wbg_wasmtropicalpolynomial_free(ptr, 0);
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* Find tropical roots of the polynomial
|
|
2633
|
+
* @returns {Array<any>}
|
|
2634
|
+
*/
|
|
2635
|
+
tropical_roots() {
|
|
2636
|
+
const ret = wasm.wasmtropicalpolynomial_tropical_roots(this.__wbg_ptr);
|
|
2637
|
+
return ret;
|
|
2638
|
+
}
|
|
2639
|
+
/**
|
|
2640
|
+
* Get the number of coefficients
|
|
2641
|
+
* @returns {number}
|
|
2642
|
+
*/
|
|
2643
|
+
coefficients_count() {
|
|
2644
|
+
const ret = wasm.wasmtropicalpolynomial_coefficients_count(this.__wbg_ptr);
|
|
2645
|
+
return ret >>> 0;
|
|
2646
|
+
}
|
|
2647
|
+
/**
|
|
2648
|
+
* Create a new tropical polynomial from coefficients
|
|
2649
|
+
* @param {Float64Array} coefficients
|
|
2650
|
+
*/
|
|
2651
|
+
constructor(coefficients) {
|
|
2652
|
+
const ptr0 = passArrayF64ToWasm0(coefficients, wasm.__wbindgen_malloc);
|
|
2653
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2654
|
+
const ret = wasm.wasmtropicalpolynomial_new(ptr0, len0);
|
|
2655
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2656
|
+
WasmTropicalPolynomialFinalization.register(this, this.__wbg_ptr, this);
|
|
2657
|
+
return this;
|
|
2658
|
+
}
|
|
2659
|
+
/**
|
|
2660
|
+
* Evaluate the polynomial at a given tropical number
|
|
2661
|
+
* @param {WasmTropicalNumber} x
|
|
2662
|
+
* @returns {WasmTropicalNumber}
|
|
2663
|
+
*/
|
|
2664
|
+
evaluate(x) {
|
|
2665
|
+
_assertClass(x, WasmTropicalNumber);
|
|
2666
|
+
const ret = wasm.wasmtropicalpolynomial_evaluate(this.__wbg_ptr, x.__wbg_ptr);
|
|
2667
|
+
return WasmTropicalNumber.__wrap(ret);
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
if (Symbol.dispose) WasmTropicalPolynomial.prototype[Symbol.dispose] = WasmTropicalPolynomial.prototype.free;
|
|
2671
|
+
|
|
2672
|
+
const WasmTropicalViterbiFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2673
|
+
? { register: () => {}, unregister: () => {} }
|
|
2674
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtropicalviterbi_free(ptr >>> 0, 1));
|
|
2675
|
+
/**
|
|
2676
|
+
* WASM wrapper for TropicalViterbi - Hidden Markov Model decoding
|
|
2677
|
+
*/
|
|
2678
|
+
export class WasmTropicalViterbi {
|
|
2679
|
+
|
|
2680
|
+
__destroy_into_raw() {
|
|
2681
|
+
const ptr = this.__wbg_ptr;
|
|
2682
|
+
this.__wbg_ptr = 0;
|
|
2683
|
+
WasmTropicalViterbiFinalization.unregister(this);
|
|
2684
|
+
return ptr;
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
free() {
|
|
2688
|
+
const ptr = this.__destroy_into_raw();
|
|
2689
|
+
wasm.__wbg_wasmtropicalviterbi_free(ptr, 0);
|
|
2690
|
+
}
|
|
2691
|
+
/**
|
|
2692
|
+
* Compute forward probabilities for all states
|
|
2693
|
+
* @param {Uint32Array} observations
|
|
2694
|
+
* @returns {Array<any>}
|
|
2695
|
+
*/
|
|
2696
|
+
forward_probabilities(observations) {
|
|
2697
|
+
const ptr0 = passArray32ToWasm0(observations, wasm.__wbindgen_malloc);
|
|
2698
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2699
|
+
const ret = wasm.wasmtropicalviterbi_forward_probabilities(this.__wbg_ptr, ptr0, len0);
|
|
2700
|
+
if (ret[2]) {
|
|
2701
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2702
|
+
}
|
|
2703
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2704
|
+
}
|
|
2705
|
+
/**
|
|
2706
|
+
* Create a new Viterbi decoder
|
|
2707
|
+
*
|
|
2708
|
+
* # Arguments
|
|
2709
|
+
* * `transitions` - Transition probability matrix (2D array)
|
|
2710
|
+
* * `emissions` - Emission probability matrix (2D array)
|
|
2711
|
+
* @param {any} transitions
|
|
2712
|
+
* @param {any} emissions
|
|
2713
|
+
*/
|
|
2714
|
+
constructor(transitions, emissions) {
|
|
2715
|
+
const ret = wasm.wasmtropicalviterbi_new(transitions, emissions);
|
|
2716
|
+
if (ret[2]) {
|
|
2717
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2718
|
+
}
|
|
2719
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
2720
|
+
WasmTropicalViterbiFinalization.register(this, this.__wbg_ptr, this);
|
|
2721
|
+
return this;
|
|
2722
|
+
}
|
|
2723
|
+
/**
|
|
2724
|
+
* Decode the most likely state sequence for given observations
|
|
2725
|
+
*
|
|
2726
|
+
* Returns an object with `states` (array of state indices) and `probability` (log probability)
|
|
2727
|
+
* @param {Uint32Array} observations
|
|
2728
|
+
* @returns {any}
|
|
2729
|
+
*/
|
|
2730
|
+
decode(observations) {
|
|
2731
|
+
const ptr0 = passArray32ToWasm0(observations, wasm.__wbindgen_malloc);
|
|
2732
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2733
|
+
const ret = wasm.wasmtropicalviterbi_decode(this.__wbg_ptr, ptr0, len0);
|
|
2734
|
+
if (ret[2]) {
|
|
2735
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2736
|
+
}
|
|
2737
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
if (Symbol.dispose) WasmTropicalViterbi.prototype[Symbol.dispose] = WasmTropicalViterbi.prototype.free;
|
|
2741
|
+
|
|
1629
2742
|
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
1630
2743
|
|
|
1631
2744
|
async function __wbg_load(module, imports) {
|
|
@@ -1664,7 +2777,23 @@ async function __wbg_load(module, imports) {
|
|
|
1664
2777
|
function __wbg_get_imports() {
|
|
1665
2778
|
const imports = {};
|
|
1666
2779
|
imports.wbg = {};
|
|
1667
|
-
imports.wbg.
|
|
2780
|
+
imports.wbg.__wbg_apply_dc50eb58583d2a57 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
2781
|
+
const ret = arg0.apply(arg1, arg2);
|
|
2782
|
+
return ret;
|
|
2783
|
+
}, arguments) };
|
|
2784
|
+
imports.wbg.__wbg_from_88bc52ce20ba6318 = function(arg0) {
|
|
2785
|
+
const ret = Array.from(arg0);
|
|
2786
|
+
return ret;
|
|
2787
|
+
};
|
|
2788
|
+
imports.wbg.__wbg_get_0da715ceaecea5c8 = function(arg0, arg1) {
|
|
2789
|
+
const ret = arg0[arg1 >>> 0];
|
|
2790
|
+
return ret;
|
|
2791
|
+
};
|
|
2792
|
+
imports.wbg.__wbg_length_186546c51cd61acd = function(arg0) {
|
|
2793
|
+
const ret = arg0.length;
|
|
2794
|
+
return ret;
|
|
2795
|
+
};
|
|
2796
|
+
imports.wbg.__wbg_log_c123554c5b238740 = function(arg0, arg1) {
|
|
1668
2797
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
1669
2798
|
};
|
|
1670
2799
|
imports.wbg.__wbg_new_19c25a3f2fa63a02 = function() {
|
|
@@ -1687,6 +2816,10 @@ function __wbg_get_imports() {
|
|
|
1687
2816
|
const ret = WasmSpacetimeVector.__wrap(arg0);
|
|
1688
2817
|
return ret;
|
|
1689
2818
|
};
|
|
2819
|
+
imports.wbg.__wbg_wasmtropicalnumber_new = function(arg0) {
|
|
2820
|
+
const ret = WasmTropicalNumber.__wrap(arg0);
|
|
2821
|
+
return ret;
|
|
2822
|
+
};
|
|
1690
2823
|
imports.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d = function(arg0, arg1) {
|
|
1691
2824
|
const ret = debugString(arg1);
|
|
1692
2825
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -1694,6 +2827,12 @@ function __wbg_get_imports() {
|
|
|
1694
2827
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1695
2828
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1696
2829
|
};
|
|
2830
|
+
imports.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb = function(arg0, arg1) {
|
|
2831
|
+
const obj = arg1;
|
|
2832
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
2833
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
2834
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
2835
|
+
};
|
|
1697
2836
|
imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
|
|
1698
2837
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1699
2838
|
};
|