@justinelliottcobb/amari-wasm 0.13.0 → 0.15.1

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.js CHANGED
@@ -236,6 +236,98 @@ function passArrayF64ToWasm0(arg, malloc) {
236
236
  WASM_VECTOR_LEN = arg.length;
237
237
  return ptr;
238
238
  }
239
+
240
+ function _assertClass(instance, klass) {
241
+ if (!(instance instanceof klass)) {
242
+ throw new Error(`expected instance of ${klass.name}`);
243
+ }
244
+ }
245
+
246
+ function takeFromExternrefTable0(idx) {
247
+ const value = wasm.__wbindgen_export_2.get(idx);
248
+ wasm.__externref_table_dealloc(idx);
249
+ return value;
250
+ }
251
+ /**
252
+ * Power method for computing dominant eigenvalue
253
+ *
254
+ * # Arguments
255
+ * * `matrix` - The matrix operator
256
+ * * `initial` - Initial guess (optional, uses random if not provided)
257
+ * * `max_iterations` - Maximum iterations
258
+ * * `tolerance` - Convergence tolerance
259
+ *
260
+ * # Returns
261
+ * [eigenvalue, eigenvector...] flattened array
262
+ * @param {WasmMatrixOperator} matrix
263
+ * @param {Float64Array | null | undefined} initial
264
+ * @param {number} max_iterations
265
+ * @param {number} tolerance
266
+ * @returns {Float64Array}
267
+ */
268
+ export function powerMethod(matrix, initial, max_iterations, tolerance) {
269
+ _assertClass(matrix, WasmMatrixOperator);
270
+ var ptr0 = isLikeNone(initial) ? 0 : passArrayF64ToWasm0(initial, wasm.__wbindgen_malloc);
271
+ var len0 = WASM_VECTOR_LEN;
272
+ const ret = wasm.powerMethod(matrix.__wbg_ptr, ptr0, len0, max_iterations, tolerance);
273
+ if (ret[3]) {
274
+ throw takeFromExternrefTable0(ret[2]);
275
+ }
276
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
277
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
278
+ return v2;
279
+ }
280
+
281
+ /**
282
+ * Inverse iteration for computing eigenvalue near a shift
283
+ *
284
+ * # Arguments
285
+ * * `matrix` - The matrix operator
286
+ * * `shift` - Value near the desired eigenvalue
287
+ * * `initial` - Initial guess (optional)
288
+ * * `max_iterations` - Maximum iterations
289
+ * * `tolerance` - Convergence tolerance
290
+ *
291
+ * # Returns
292
+ * [eigenvalue, eigenvector...] flattened array
293
+ * @param {WasmMatrixOperator} matrix
294
+ * @param {number} shift
295
+ * @param {Float64Array | null | undefined} initial
296
+ * @param {number} max_iterations
297
+ * @param {number} tolerance
298
+ * @returns {Float64Array}
299
+ */
300
+ export function inverseIteration(matrix, shift, initial, max_iterations, tolerance) {
301
+ _assertClass(matrix, WasmMatrixOperator);
302
+ var ptr0 = isLikeNone(initial) ? 0 : passArrayF64ToWasm0(initial, wasm.__wbindgen_malloc);
303
+ var len0 = WASM_VECTOR_LEN;
304
+ const ret = wasm.inverseIteration(matrix.__wbg_ptr, shift, ptr0, len0, max_iterations, tolerance);
305
+ if (ret[3]) {
306
+ throw takeFromExternrefTable0(ret[2]);
307
+ }
308
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
309
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
310
+ return v2;
311
+ }
312
+
313
+ /**
314
+ * Compute all eigenvalues of a symmetric matrix
315
+ * @param {WasmMatrixOperator} matrix
316
+ * @param {number} max_iterations
317
+ * @param {number} tolerance
318
+ * @returns {Float64Array}
319
+ */
320
+ export function computeEigenvalues(matrix, max_iterations, tolerance) {
321
+ _assertClass(matrix, WasmMatrixOperator);
322
+ const ret = wasm.computeEigenvalues(matrix.__wbg_ptr, max_iterations, tolerance);
323
+ if (ret[3]) {
324
+ throw takeFromExternrefTable0(ret[2]);
325
+ }
326
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
327
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
328
+ return v1;
329
+ }
330
+
239
331
  /**
240
332
  * Initialize the enumerative geometry module
241
333
  */
@@ -254,11 +346,6 @@ export function light_deflection_angle(impact_parameter, mass) {
254
346
  return ret;
255
347
  }
256
348
 
257
- function takeFromExternrefTable0(idx) {
258
- const value = wasm.__wbindgen_export_2.get(idx);
259
- wasm.__externref_table_dealloc(idx);
260
- return value;
261
- }
262
349
  /**
263
350
  * Convert velocity to Lorentz factor
264
351
  * @param {number} velocity_magnitude
@@ -359,11 +446,6 @@ export function expectation(f, a, b, samples) {
359
446
  return ret[0];
360
447
  }
361
448
 
362
- function _assertClass(instance, klass) {
363
- if (!(instance instanceof klass)) {
364
- throw new Error(`expected instance of ${klass.name}`);
365
- }
366
- }
367
449
  /**
368
450
  * Compute KL divergence D_KL(P||Q) between two distributions
369
451
  *
@@ -403,6 +485,32 @@ export function initAutomata() {
403
485
  wasm.initAutomata();
404
486
  }
405
487
 
488
+ function passArrayJsValueToWasm0(array, malloc) {
489
+ const ptr = malloc(array.length * 4, 4) >>> 0;
490
+ for (let i = 0; i < array.length; i++) {
491
+ const add = addToExternrefTable0(array[i]);
492
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
493
+ }
494
+ WASM_VECTOR_LEN = array.length;
495
+ return ptr;
496
+ }
497
+
498
+ let cachedFloat32ArrayMemory0 = null;
499
+
500
+ function getFloat32ArrayMemory0() {
501
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
502
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
503
+ }
504
+ return cachedFloat32ArrayMemory0;
505
+ }
506
+
507
+ function passArrayF32ToWasm0(arg, malloc) {
508
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
509
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
510
+ WASM_VECTOR_LEN = arg.length;
511
+ return ptr;
512
+ }
513
+
406
514
  function getArrayU8FromWasm0(ptr, len) {
407
515
  ptr = ptr >>> 0;
408
516
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -428,12 +536,35 @@ function passArray32ToWasm0(arg, malloc) {
428
536
  WASM_VECTOR_LEN = arg.length;
429
537
  return ptr;
430
538
  }
431
- function __wbg_adapter_28(arg0, arg1, arg2) {
432
- wasm.closure41_externref_shim(arg0, arg1, arg2);
539
+
540
+ function getArrayJsValueFromWasm0(ptr, len) {
541
+ ptr = ptr >>> 0;
542
+ const mem = getDataViewMemory0();
543
+ const result = [];
544
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
545
+ result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
546
+ }
547
+ wasm.__externref_drop_slice(ptr, len);
548
+ return result;
549
+ }
550
+
551
+ function getArrayF32FromWasm0(ptr, len) {
552
+ ptr = ptr >>> 0;
553
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
554
+ }
555
+
556
+ function passArray8ToWasm0(arg, malloc) {
557
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
558
+ getUint8ArrayMemory0().set(arg, ptr / 1);
559
+ WASM_VECTOR_LEN = arg.length;
560
+ return ptr;
561
+ }
562
+ function __wbg_adapter_30(arg0, arg1, arg2) {
563
+ wasm.closure44_externref_shim(arg0, arg1, arg2);
433
564
  }
434
565
 
435
- function __wbg_adapter_511(arg0, arg1, arg2, arg3) {
436
- wasm.closure34_externref_shim(arg0, arg1, arg2, arg3);
566
+ function __wbg_adapter_683(arg0, arg1, arg2, arg3) {
567
+ wasm.closure37_externref_shim(arg0, arg1, arg2, arg3);
437
568
  }
438
569
 
439
570
  /**
@@ -2463,6 +2594,199 @@ export class WasmAlphaConnection {
2463
2594
  }
2464
2595
  }
2465
2596
 
2597
+ const WasmBinaryHologramFinalization = (typeof FinalizationRegistry === 'undefined')
2598
+ ? { register: () => {}, unregister: () => {} }
2599
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmbinaryhologram_free(ptr >>> 0, 1));
2600
+ /**
2601
+ * WASM wrapper for BinaryHologram.
2602
+ *
2603
+ * Bit-packed binary pattern for DMD display, the output of Lee encoding.
2604
+ */
2605
+ export class WasmBinaryHologram {
2606
+
2607
+ static __wrap(ptr) {
2608
+ ptr = ptr >>> 0;
2609
+ const obj = Object.create(WasmBinaryHologram.prototype);
2610
+ obj.__wbg_ptr = ptr;
2611
+ WasmBinaryHologramFinalization.register(obj, obj.__wbg_ptr, obj);
2612
+ return obj;
2613
+ }
2614
+
2615
+ __destroy_into_raw() {
2616
+ const ptr = this.__wbg_ptr;
2617
+ this.__wbg_ptr = 0;
2618
+ WasmBinaryHologramFinalization.unregister(this);
2619
+ return ptr;
2620
+ }
2621
+
2622
+ free() {
2623
+ const ptr = this.__destroy_into_raw();
2624
+ wasm.__wbg_wasmbinaryhologram_free(ptr, 0);
2625
+ }
2626
+ /**
2627
+ * Fill factor (fraction of "on" pixels, 0 to 1).
2628
+ * @returns {number}
2629
+ */
2630
+ fillFactor() {
2631
+ const ret = wasm.wasmbinaryhologram_fillFactor(this.__wbg_ptr);
2632
+ return ret;
2633
+ }
2634
+ /**
2635
+ * Compute Hamming distance between two holograms.
2636
+ * @param {WasmBinaryHologram} other
2637
+ * @returns {number}
2638
+ */
2639
+ hammingDistance(other) {
2640
+ _assertClass(other, WasmBinaryHologram);
2641
+ const ret = wasm.wasmbinaryhologram_hammingDistance(this.__wbg_ptr, other.__wbg_ptr);
2642
+ return ret >>> 0;
2643
+ }
2644
+ /**
2645
+ * Compute normalized Hamming distance (0 to 1).
2646
+ * @param {WasmBinaryHologram} other
2647
+ * @returns {number}
2648
+ */
2649
+ normalizedHammingDistance(other) {
2650
+ _assertClass(other, WasmBinaryHologram);
2651
+ const ret = wasm.wasmbinaryhologram_normalizedHammingDistance(this.__wbg_ptr, other.__wbg_ptr);
2652
+ return ret;
2653
+ }
2654
+ /**
2655
+ * Get pixel value at (x, y).
2656
+ * @param {number} x
2657
+ * @param {number} y
2658
+ * @returns {boolean}
2659
+ */
2660
+ get(x, y) {
2661
+ const ret = wasm.wasmbinaryhologram_get(this.__wbg_ptr, x, y);
2662
+ return ret !== 0;
2663
+ }
2664
+ /**
2665
+ * Create from boolean array (as u8: 0 = false, non-zero = true).
2666
+ * @param {Uint8Array} pattern
2667
+ * @param {number} width
2668
+ * @param {number} height
2669
+ */
2670
+ constructor(pattern, width, height) {
2671
+ const ptr0 = passArray8ToWasm0(pattern, wasm.__wbindgen_malloc);
2672
+ const len0 = WASM_VECTOR_LEN;
2673
+ const ret = wasm.wasmbinaryhologram_new(ptr0, len0, width, height);
2674
+ if (ret[2]) {
2675
+ throw takeFromExternrefTable0(ret[1]);
2676
+ }
2677
+ this.__wbg_ptr = ret[0] >>> 0;
2678
+ WasmBinaryHologramFinalization.register(this, this.__wbg_ptr, this);
2679
+ return this;
2680
+ }
2681
+ /**
2682
+ * Set pixel value at (x, y).
2683
+ * @param {number} x
2684
+ * @param {number} y
2685
+ * @param {boolean} value
2686
+ */
2687
+ set(x, y, value) {
2688
+ wasm.wasmbinaryhologram_set(this.__wbg_ptr, x, y, value);
2689
+ }
2690
+ /**
2691
+ * XOR two holograms.
2692
+ * @param {WasmBinaryHologram} other
2693
+ * @returns {WasmBinaryHologram}
2694
+ */
2695
+ xor(other) {
2696
+ _assertClass(other, WasmBinaryHologram);
2697
+ const ret = wasm.wasmbinaryhologram_xor(this.__wbg_ptr, other.__wbg_ptr);
2698
+ return WasmBinaryHologram.__wrap(ret);
2699
+ }
2700
+ /**
2701
+ * Create an all-ones hologram.
2702
+ * @param {number} width
2703
+ * @param {number} height
2704
+ * @returns {WasmBinaryHologram}
2705
+ */
2706
+ static ones(width, height) {
2707
+ const ret = wasm.wasmbinaryhologram_ones(width, height);
2708
+ return WasmBinaryHologram.__wrap(ret);
2709
+ }
2710
+ /**
2711
+ * Get grid width.
2712
+ * @returns {number}
2713
+ */
2714
+ get width() {
2715
+ const ret = wasm.wasmbinaryhologram_width(this.__wbg_ptr);
2716
+ return ret >>> 0;
2717
+ }
2718
+ /**
2719
+ * Create an all-zeros hologram.
2720
+ * @param {number} width
2721
+ * @param {number} height
2722
+ * @returns {WasmBinaryHologram}
2723
+ */
2724
+ static zeros(width, height) {
2725
+ const ret = wasm.wasmbinaryhologram_zeros(width, height);
2726
+ return WasmBinaryHologram.__wrap(ret);
2727
+ }
2728
+ /**
2729
+ * Get grid height.
2730
+ * @returns {number}
2731
+ */
2732
+ get height() {
2733
+ const ret = wasm.wasmbinaryhologram_height(this.__wbg_ptr);
2734
+ return ret >>> 0;
2735
+ }
2736
+ /**
2737
+ * Get total number of pixels.
2738
+ * @returns {number}
2739
+ */
2740
+ get length() {
2741
+ const ret = wasm.wasmbinaryhologram_length(this.__wbg_ptr);
2742
+ return ret >>> 0;
2743
+ }
2744
+ /**
2745
+ * Toggle pixel at (x, y).
2746
+ * @param {number} x
2747
+ * @param {number} y
2748
+ */
2749
+ toggle(x, y) {
2750
+ wasm.wasmbinaryhologram_toggle(this.__wbg_ptr, x, y);
2751
+ }
2752
+ /**
2753
+ * Get packed binary data (for hardware interface).
2754
+ * @returns {Uint8Array}
2755
+ */
2756
+ asBytes() {
2757
+ const ret = wasm.wasmbinaryhologram_asBytes(this.__wbg_ptr);
2758
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
2759
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2760
+ return v1;
2761
+ }
2762
+ /**
2763
+ * Create an inverted copy.
2764
+ * @returns {WasmBinaryHologram}
2765
+ */
2766
+ inverted() {
2767
+ const ret = wasm.wasmbinaryhologram_inverted(this.__wbg_ptr);
2768
+ return WasmBinaryHologram.__wrap(ret);
2769
+ }
2770
+ /**
2771
+ * Count of "on" pixels.
2772
+ * @returns {number}
2773
+ */
2774
+ popcount() {
2775
+ const ret = wasm.wasmbinaryhologram_popcount(this.__wbg_ptr);
2776
+ return ret >>> 0;
2777
+ }
2778
+ /**
2779
+ * Convert to boolean array (as u8: 0 = false, 1 = true).
2780
+ * @returns {Uint8Array}
2781
+ */
2782
+ toBools() {
2783
+ const ret = wasm.wasmbinaryhologram_toBools(this.__wbg_ptr);
2784
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
2785
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2786
+ return v1;
2787
+ }
2788
+ }
2789
+
2466
2790
  const WasmChowClassFinalization = (typeof FinalizationRegistry === 'undefined')
2467
2791
  ? { register: () => {}, unregister: () => {} }
2468
2792
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmchowclass_free(ptr >>> 0, 1));
@@ -3604,6 +3928,126 @@ export class WasmGeodesicIntegrator {
3604
3928
  }
3605
3929
  }
3606
3930
 
3931
+ const WasmGeometricBrownianMotionFinalization = (typeof FinalizationRegistry === 'undefined')
3932
+ ? { register: () => {}, unregister: () => {} }
3933
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmgeometricbrownianmotion_free(ptr >>> 0, 1));
3934
+ /**
3935
+ * WASM wrapper for Geometric Brownian Motion on multivector space
3936
+ *
3937
+ * dX = μX dt + σX dW
3938
+ *
3939
+ * Useful for modeling multiplicative noise processes in geometric algebra.
3940
+ */
3941
+ export class WasmGeometricBrownianMotion {
3942
+
3943
+ __destroy_into_raw() {
3944
+ const ptr = this.__wbg_ptr;
3945
+ this.__wbg_ptr = 0;
3946
+ WasmGeometricBrownianMotionFinalization.unregister(this);
3947
+ return ptr;
3948
+ }
3949
+
3950
+ free() {
3951
+ const ptr = this.__destroy_into_raw();
3952
+ wasm.__wbg_wasmgeometricbrownianmotion_free(ptr, 0);
3953
+ }
3954
+ /**
3955
+ * Sample a single path of the process
3956
+ *
3957
+ * # Arguments
3958
+ * * `initial` - Initial multivector (8 coefficients)
3959
+ * * `t_end` - End time
3960
+ * * `num_steps` - Number of time steps
3961
+ *
3962
+ * Returns flat array: (num_steps + 1) * 9 values
3963
+ * Each point is [time, coeff0, coeff1, ..., coeff7]
3964
+ * @param {Float64Array} initial
3965
+ * @param {number} t_end
3966
+ * @param {number} num_steps
3967
+ * @returns {Float64Array}
3968
+ */
3969
+ samplePath(initial, t_end, num_steps) {
3970
+ const ptr0 = passArrayF64ToWasm0(initial, wasm.__wbindgen_malloc);
3971
+ const len0 = WASM_VECTOR_LEN;
3972
+ const ret = wasm.wasmgeometricbrownianmotion_samplePath(this.__wbg_ptr, ptr0, len0, t_end, num_steps);
3973
+ if (ret[3]) {
3974
+ throw takeFromExternrefTable0(ret[2]);
3975
+ }
3976
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3977
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3978
+ return v2;
3979
+ }
3980
+ /**
3981
+ * Compute expected value at time t given initial value
3982
+ *
3983
+ * E[X(t)] = X(0) * exp(μt)
3984
+ * @param {Float64Array} initial
3985
+ * @param {number} t
3986
+ * @returns {Float64Array}
3987
+ */
3988
+ expectedValue(initial, t) {
3989
+ const ptr0 = passArrayF64ToWasm0(initial, wasm.__wbindgen_malloc);
3990
+ const len0 = WASM_VECTOR_LEN;
3991
+ const ret = wasm.wasmgeometricbrownianmotion_expectedValue(this.__wbg_ptr, ptr0, len0, t);
3992
+ if (ret[3]) {
3993
+ throw takeFromExternrefTable0(ret[2]);
3994
+ }
3995
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3996
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3997
+ return v2;
3998
+ }
3999
+ /**
4000
+ * Create a new Geometric Brownian Motion process
4001
+ *
4002
+ * # Arguments
4003
+ * * `mu` - Drift coefficient (expected growth rate)
4004
+ * * `sigma` - Diffusion coefficient (volatility)
4005
+ * @param {number} mu
4006
+ * @param {number} sigma
4007
+ */
4008
+ constructor(mu, sigma) {
4009
+ const ret = wasm.wasmdualnumber_new(mu, sigma);
4010
+ this.__wbg_ptr = ret >>> 0;
4011
+ WasmGeometricBrownianMotionFinalization.register(this, this.__wbg_ptr, this);
4012
+ return this;
4013
+ }
4014
+ /**
4015
+ * Get drift coefficient
4016
+ * @returns {number}
4017
+ */
4018
+ getMu() {
4019
+ const ret = wasm.wasmalphaconnection_getAlpha(this.__wbg_ptr);
4020
+ return ret;
4021
+ }
4022
+ /**
4023
+ * Compute variance at time t given initial value
4024
+ *
4025
+ * Var(X(t)) = X(0)² * exp(2μt) * (exp(σ²t) - 1)
4026
+ * @param {Float64Array} initial
4027
+ * @param {number} t
4028
+ * @returns {Float64Array}
4029
+ */
4030
+ variance(initial, t) {
4031
+ const ptr0 = passArrayF64ToWasm0(initial, wasm.__wbindgen_malloc);
4032
+ const len0 = WASM_VECTOR_LEN;
4033
+ const ret = wasm.wasmgeometricbrownianmotion_variance(this.__wbg_ptr, ptr0, len0, t);
4034
+ if (ret[3]) {
4035
+ throw takeFromExternrefTable0(ret[2]);
4036
+ }
4037
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
4038
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
4039
+ return v2;
4040
+ }
4041
+ /**
4042
+ * Get diffusion coefficient
4043
+ * @returns {number}
4044
+ */
4045
+ getSigma() {
4046
+ const ret = wasm.wasmdualnumber_getDual(this.__wbg_ptr);
4047
+ return ret;
4048
+ }
4049
+ }
4050
+
3607
4051
  const WasmGeometricCAFinalization = (typeof FinalizationRegistry === 'undefined')
3608
4052
  ? { register: () => {}, unregister: () => {} }
3609
4053
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmgeometricca_free(ptr >>> 0, 1));
@@ -3824,7 +4268,7 @@ export class WasmGeometricEdge {
3824
4268
  * @returns {number}
3825
4269
  */
3826
4270
  get target() {
3827
- const ret = wasm.wasmgeometricedge_target(this.__wbg_ptr);
4271
+ const ret = wasm.wasmbinaryhologram_height(this.__wbg_ptr);
3828
4272
  return ret >>> 0;
3829
4273
  }
3830
4274
  /**
@@ -3837,7 +4281,130 @@ export class WasmGeometricEdge {
3837
4281
  }
3838
4282
  }
3839
4283
 
3840
- const WasmGeometricNetworkFinalization = (typeof FinalizationRegistry === 'undefined')
4284
+ const WasmGeometricLeeEncoderFinalization = (typeof FinalizationRegistry === 'undefined')
4285
+ ? { register: () => {}, unregister: () => {} }
4286
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmgeometricleeencoder_free(ptr >>> 0, 1));
4287
+ /**
4288
+ * WASM wrapper for GeometricLeeEncoder.
4289
+ *
4290
+ * Encodes optical rotor fields to binary holograms using Lee's method.
4291
+ */
4292
+ export class WasmGeometricLeeEncoder {
4293
+
4294
+ static __wrap(ptr) {
4295
+ ptr = ptr >>> 0;
4296
+ const obj = Object.create(WasmGeometricLeeEncoder.prototype);
4297
+ obj.__wbg_ptr = ptr;
4298
+ WasmGeometricLeeEncoderFinalization.register(obj, obj.__wbg_ptr, obj);
4299
+ return obj;
4300
+ }
4301
+
4302
+ __destroy_into_raw() {
4303
+ const ptr = this.__wbg_ptr;
4304
+ this.__wbg_ptr = 0;
4305
+ WasmGeometricLeeEncoderFinalization.unregister(this);
4306
+ return ptr;
4307
+ }
4308
+
4309
+ free() {
4310
+ const ptr = this.__destroy_into_raw();
4311
+ wasm.__wbg_wasmgeometricleeencoder_free(ptr, 0);
4312
+ }
4313
+ /**
4314
+ * Get carrier angle.
4315
+ * @returns {number}
4316
+ */
4317
+ get carrierAngle() {
4318
+ const ret = wasm.wasmgeometricleeencoder_carrierAngle(this.__wbg_ptr);
4319
+ return ret;
4320
+ }
4321
+ /**
4322
+ * Create encoder with horizontal carrier (angle = 0).
4323
+ * @param {number} width
4324
+ * @param {number} height
4325
+ * @param {number} carrier_frequency
4326
+ * @returns {WasmGeometricLeeEncoder}
4327
+ */
4328
+ static withFrequency(width, height, carrier_frequency) {
4329
+ const ret = wasm.wasmgeometricleeencoder_withFrequency(width, height, carrier_frequency);
4330
+ return WasmGeometricLeeEncoder.__wrap(ret);
4331
+ }
4332
+ /**
4333
+ * Get carrier frequency.
4334
+ * @returns {number}
4335
+ */
4336
+ get carrierFrequency() {
4337
+ const ret = wasm.wasmgeometricleeencoder_carrierFrequency(this.__wbg_ptr);
4338
+ return ret;
4339
+ }
4340
+ /**
4341
+ * Theoretical diffraction efficiency for the given field.
4342
+ * @param {WasmOpticalRotorField} field
4343
+ * @returns {number}
4344
+ */
4345
+ theoreticalEfficiency(field) {
4346
+ _assertClass(field, WasmOpticalRotorField);
4347
+ const ret = wasm.wasmgeometricleeencoder_theoreticalEfficiency(this.__wbg_ptr, field.__wbg_ptr);
4348
+ return ret;
4349
+ }
4350
+ /**
4351
+ * Create encoder with configuration.
4352
+ *
4353
+ * # Arguments
4354
+ * * `width` - Grid width
4355
+ * * `height` - Grid height
4356
+ * * `carrier_frequency` - Carrier frequency in cycles per pixel
4357
+ * * `carrier_angle` - Carrier direction angle (radians, 0 = horizontal)
4358
+ * @param {number} width
4359
+ * @param {number} height
4360
+ * @param {number} carrier_frequency
4361
+ * @param {number} carrier_angle
4362
+ */
4363
+ constructor(width, height, carrier_frequency, carrier_angle) {
4364
+ const ret = wasm.wasmgeometricleeencoder_new(width, height, carrier_frequency, carrier_angle);
4365
+ this.__wbg_ptr = ret >>> 0;
4366
+ WasmGeometricLeeEncoderFinalization.register(this, this.__wbg_ptr, this);
4367
+ return this;
4368
+ }
4369
+ /**
4370
+ * Get encoder width.
4371
+ * @returns {number}
4372
+ */
4373
+ get width() {
4374
+ const ret = wasm.wasmgeometricca_generation(this.__wbg_ptr);
4375
+ return ret >>> 0;
4376
+ }
4377
+ /**
4378
+ * Encode a rotor field to binary hologram.
4379
+ * @param {WasmOpticalRotorField} field
4380
+ * @returns {WasmBinaryHologram}
4381
+ */
4382
+ encode(field) {
4383
+ _assertClass(field, WasmOpticalRotorField);
4384
+ const ret = wasm.wasmgeometricleeencoder_encode(this.__wbg_ptr, field.__wbg_ptr);
4385
+ return WasmBinaryHologram.__wrap(ret);
4386
+ }
4387
+ /**
4388
+ * Get encoder height.
4389
+ * @returns {number}
4390
+ */
4391
+ get height() {
4392
+ const ret = wasm.wasmgeometricleeencoder_height(this.__wbg_ptr);
4393
+ return ret >>> 0;
4394
+ }
4395
+ /**
4396
+ * Compute the modulated rotor field (before thresholding).
4397
+ * @param {WasmOpticalRotorField} field
4398
+ * @returns {WasmOpticalRotorField}
4399
+ */
4400
+ modulate(field) {
4401
+ _assertClass(field, WasmOpticalRotorField);
4402
+ const ret = wasm.wasmgeometricleeencoder_modulate(this.__wbg_ptr, field.__wbg_ptr);
4403
+ return WasmOpticalRotorField.__wrap(ret);
4404
+ }
4405
+ }
4406
+
4407
+ const WasmGeometricNetworkFinalization = (typeof FinalizationRegistry === 'undefined')
3841
4408
  ? { register: () => {}, unregister: () => {} }
3842
4409
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmgeometricnetwork_free(ptr >>> 0, 1));
3843
4410
  /**
@@ -4183,6 +4750,108 @@ export class WasmGpuOptimizer {
4183
4750
  }
4184
4751
  }
4185
4752
 
4753
+ const WasmGradeProjectedDistributionFinalization = (typeof FinalizationRegistry === 'undefined')
4754
+ ? { register: () => {}, unregister: () => {} }
4755
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmgradeprojecteddistribution_free(ptr >>> 0, 1));
4756
+ /**
4757
+ * WASM wrapper for grade-projected distribution
4758
+ *
4759
+ * A distribution that only operates on components of a specific grade.
4760
+ */
4761
+ export class WasmGradeProjectedDistribution {
4762
+
4763
+ __destroy_into_raw() {
4764
+ const ptr = this.__wbg_ptr;
4765
+ this.__wbg_ptr = 0;
4766
+ WasmGradeProjectedDistributionFinalization.unregister(this);
4767
+ return ptr;
4768
+ }
4769
+
4770
+ free() {
4771
+ const ptr = this.__destroy_into_raw();
4772
+ wasm.__wbg_wasmgradeprojecteddistribution_free(ptr, 0);
4773
+ }
4774
+ /**
4775
+ * Sample and embed into full multivector (other grades are zero)
4776
+ *
4777
+ * Returns 8 coefficients
4778
+ * @returns {Float64Array}
4779
+ */
4780
+ sampleFull() {
4781
+ const ret = wasm.wasmgradeprojecteddistribution_sampleFull(this.__wbg_ptr);
4782
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
4783
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
4784
+ return v1;
4785
+ }
4786
+ /**
4787
+ * Get standard deviations
4788
+ * @returns {Float64Array}
4789
+ */
4790
+ getStdDevs() {
4791
+ const ret = wasm.wasmgradeprojecteddistribution_getStdDevs(this.__wbg_ptr);
4792
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
4793
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
4794
+ return v1;
4795
+ }
4796
+ /**
4797
+ * Get number of components in this grade
4798
+ * @returns {number}
4799
+ */
4800
+ getNumComponents() {
4801
+ const ret = wasm.wasmgradeprojecteddistribution_getNumComponents(this.__wbg_ptr);
4802
+ return ret >>> 0;
4803
+ }
4804
+ /**
4805
+ * Create a grade-projected distribution from a Gaussian
4806
+ *
4807
+ * # Arguments
4808
+ * * `gaussian` - Source Gaussian distribution
4809
+ * * `grade` - Grade to project onto (0, 1, 2, or 3 for Cl(3,0,0))
4810
+ * @param {WasmGaussianMultivector} gaussian
4811
+ * @param {number} grade
4812
+ */
4813
+ constructor(gaussian, grade) {
4814
+ _assertClass(gaussian, WasmGaussianMultivector);
4815
+ const ret = wasm.wasmgradeprojecteddistribution_new(gaussian.__wbg_ptr, grade);
4816
+ if (ret[2]) {
4817
+ throw takeFromExternrefTable0(ret[1]);
4818
+ }
4819
+ this.__wbg_ptr = ret[0] >>> 0;
4820
+ WasmGradeProjectedDistributionFinalization.register(this, this.__wbg_ptr, this);
4821
+ return this;
4822
+ }
4823
+ /**
4824
+ * Sample from this grade-projected distribution
4825
+ *
4826
+ * Returns components for just this grade
4827
+ * @returns {Float64Array}
4828
+ */
4829
+ sample() {
4830
+ const ret = wasm.wasmgradeprojecteddistribution_sample(this.__wbg_ptr);
4831
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
4832
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
4833
+ return v1;
4834
+ }
4835
+ /**
4836
+ * Get the mean for this grade's components
4837
+ * @returns {Float64Array}
4838
+ */
4839
+ getMean() {
4840
+ const ret = wasm.wasmgradeprojecteddistribution_getMean(this.__wbg_ptr);
4841
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
4842
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
4843
+ return v1;
4844
+ }
4845
+ /**
4846
+ * Get the grade
4847
+ * @returns {number}
4848
+ */
4849
+ getGrade() {
4850
+ const ret = wasm.riemannianmanifold_dimension(this.__wbg_ptr);
4851
+ return ret >>> 0;
4852
+ }
4853
+ }
4854
+
4186
4855
  const WasmGrassmannianFinalization = (typeof FinalizationRegistry === 'undefined')
4187
4856
  ? { register: () => {}, unregister: () => {} }
4188
4857
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmgrassmannian_free(ptr >>> 0, 1));
@@ -4236,6 +4905,176 @@ export class WasmGrassmannian {
4236
4905
  }
4237
4906
  }
4238
4907
 
4908
+ const WasmHilbertSpaceFinalization = (typeof FinalizationRegistry === 'undefined')
4909
+ ? { register: () => {}, unregister: () => {} }
4910
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmhilbertspace_free(ptr >>> 0, 1));
4911
+ /**
4912
+ * WASM wrapper for MultivectorHilbertSpace over Cl(2,0,0)
4913
+ *
4914
+ * Provides finite-dimensional Hilbert space operations on multivectors.
4915
+ */
4916
+ export class WasmHilbertSpace {
4917
+
4918
+ __destroy_into_raw() {
4919
+ const ptr = this.__wbg_ptr;
4920
+ this.__wbg_ptr = 0;
4921
+ WasmHilbertSpaceFinalization.unregister(this);
4922
+ return ptr;
4923
+ }
4924
+
4925
+ free() {
4926
+ const ptr = this.__destroy_into_raw();
4927
+ wasm.__wbg_wasmhilbertspace_free(ptr, 0);
4928
+ }
4929
+ /**
4930
+ * Compute inner product <x, y>
4931
+ * @param {Float64Array} x
4932
+ * @param {Float64Array} y
4933
+ * @returns {number}
4934
+ */
4935
+ innerProduct(x, y) {
4936
+ const ptr0 = passArrayF64ToWasm0(x, wasm.__wbindgen_malloc);
4937
+ const len0 = WASM_VECTOR_LEN;
4938
+ const ptr1 = passArrayF64ToWasm0(y, wasm.__wbindgen_malloc);
4939
+ const len1 = WASM_VECTOR_LEN;
4940
+ const ret = wasm.wasmhilbertspace_innerProduct(this.__wbg_ptr, ptr0, len0, ptr1, len1);
4941
+ if (ret[2]) {
4942
+ throw takeFromExternrefTable0(ret[1]);
4943
+ }
4944
+ return ret[0];
4945
+ }
4946
+ /**
4947
+ * Check if two vectors are orthogonal
4948
+ * @param {Float64Array} x
4949
+ * @param {Float64Array} y
4950
+ * @param {number} tolerance
4951
+ * @returns {boolean}
4952
+ */
4953
+ isOrthogonal(x, y, tolerance) {
4954
+ const ptr0 = passArrayF64ToWasm0(x, wasm.__wbindgen_malloc);
4955
+ const len0 = WASM_VECTOR_LEN;
4956
+ const ptr1 = passArrayF64ToWasm0(y, wasm.__wbindgen_malloc);
4957
+ const len1 = WASM_VECTOR_LEN;
4958
+ const ret = wasm.wasmhilbertspace_isOrthogonal(this.__wbg_ptr, ptr0, len0, ptr1, len1, tolerance);
4959
+ if (ret[2]) {
4960
+ throw takeFromExternrefTable0(ret[1]);
4961
+ }
4962
+ return ret[0] !== 0;
4963
+ }
4964
+ /**
4965
+ * Create a multivector from coefficients
4966
+ *
4967
+ * # Arguments
4968
+ * * `coefficients` - Array of 4 coefficients [scalar, e1, e2, e12]
4969
+ * @param {Float64Array} coefficients
4970
+ * @returns {Float64Array}
4971
+ */
4972
+ fromCoefficients(coefficients) {
4973
+ const ptr0 = passArrayF64ToWasm0(coefficients, wasm.__wbindgen_malloc);
4974
+ const len0 = WASM_VECTOR_LEN;
4975
+ const ret = wasm.wasmhilbertspace_fromCoefficients(this.__wbg_ptr, ptr0, len0);
4976
+ if (ret[3]) {
4977
+ throw takeFromExternrefTable0(ret[2]);
4978
+ }
4979
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
4980
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
4981
+ return v2;
4982
+ }
4983
+ /**
4984
+ * Create a new Hilbert space Cl(2,0,0) ~ R^4
4985
+ */
4986
+ constructor() {
4987
+ const ret = wasm.wasmcountingmeasure_new();
4988
+ this.__wbg_ptr = ret >>> 0;
4989
+ WasmHilbertSpaceFinalization.register(this, this.__wbg_ptr, this);
4990
+ return this;
4991
+ }
4992
+ /**
4993
+ * Compute the norm ||x||
4994
+ * @param {Float64Array} x
4995
+ * @returns {number}
4996
+ */
4997
+ norm(x) {
4998
+ const ptr0 = passArrayF64ToWasm0(x, wasm.__wbindgen_malloc);
4999
+ const len0 = WASM_VECTOR_LEN;
5000
+ const ret = wasm.wasmhilbertspace_norm(this.__wbg_ptr, ptr0, len0);
5001
+ if (ret[2]) {
5002
+ throw takeFromExternrefTable0(ret[1]);
5003
+ }
5004
+ return ret[0];
5005
+ }
5006
+ /**
5007
+ * Orthogonal projection of x onto y
5008
+ * @param {Float64Array} x
5009
+ * @param {Float64Array} y
5010
+ * @returns {Float64Array}
5011
+ */
5012
+ project(x, y) {
5013
+ const ptr0 = passArrayF64ToWasm0(x, wasm.__wbindgen_malloc);
5014
+ const len0 = WASM_VECTOR_LEN;
5015
+ const ptr1 = passArrayF64ToWasm0(y, wasm.__wbindgen_malloc);
5016
+ const len1 = WASM_VECTOR_LEN;
5017
+ const ret = wasm.wasmhilbertspace_project(this.__wbg_ptr, ptr0, len0, ptr1, len1);
5018
+ if (ret[3]) {
5019
+ throw takeFromExternrefTable0(ret[2]);
5020
+ }
5021
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5022
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
5023
+ return v3;
5024
+ }
5025
+ /**
5026
+ * Compute distance d(x, y) = ||x - y||
5027
+ * @param {Float64Array} x
5028
+ * @param {Float64Array} y
5029
+ * @returns {number}
5030
+ */
5031
+ distance(x, y) {
5032
+ const ptr0 = passArrayF64ToWasm0(x, wasm.__wbindgen_malloc);
5033
+ const len0 = WASM_VECTOR_LEN;
5034
+ const ptr1 = passArrayF64ToWasm0(y, wasm.__wbindgen_malloc);
5035
+ const len1 = WASM_VECTOR_LEN;
5036
+ const ret = wasm.wasmhilbertspace_distance(this.__wbg_ptr, ptr0, len0, ptr1, len1);
5037
+ if (ret[2]) {
5038
+ throw takeFromExternrefTable0(ret[1]);
5039
+ }
5040
+ return ret[0];
5041
+ }
5042
+ /**
5043
+ * Get the dimension of the space (4 for Cl(2,0,0))
5044
+ * @returns {number}
5045
+ */
5046
+ dimension() {
5047
+ const ret = wasm.wasmhilbertspace_dimension(this.__wbg_ptr);
5048
+ return ret >>> 0;
5049
+ }
5050
+ /**
5051
+ * Normalize a vector to unit length
5052
+ * @param {Float64Array} x
5053
+ * @returns {Float64Array}
5054
+ */
5055
+ normalize(x) {
5056
+ const ptr0 = passArrayF64ToWasm0(x, wasm.__wbindgen_malloc);
5057
+ const len0 = WASM_VECTOR_LEN;
5058
+ const ret = wasm.wasmhilbertspace_normalize(this.__wbg_ptr, ptr0, len0);
5059
+ if (ret[3]) {
5060
+ throw takeFromExternrefTable0(ret[2]);
5061
+ }
5062
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5063
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
5064
+ return v2;
5065
+ }
5066
+ /**
5067
+ * Get the Clifford algebra signature (p, q, r)
5068
+ * @returns {Uint32Array}
5069
+ */
5070
+ signature() {
5071
+ const ret = wasm.wasmhilbertspace_signature(this.__wbg_ptr);
5072
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
5073
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
5074
+ return v1;
5075
+ }
5076
+ }
5077
+
4239
5078
  const WasmHolographicMemoryFinalization = (typeof FinalizationRegistry === 'undefined')
4240
5079
  ? { register: () => {}, unregister: () => {} }
4241
5080
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmholographicmemory_free(ptr >>> 0, 1));
@@ -4535,11 +5374,384 @@ export class WasmLebesgueMeasure {
4535
5374
  }
4536
5375
  }
4537
5376
 
4538
- const WasmModuliSpaceFinalization = (typeof FinalizationRegistry === 'undefined')
5377
+ const WasmMCMCDiagnosticsFinalization = (typeof FinalizationRegistry === 'undefined')
4539
5378
  ? { register: () => {}, unregister: () => {} }
4540
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmmodulispace_free(ptr >>> 0, 1));
5379
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmmcmcdiagnostics_free(ptr >>> 0, 1));
4541
5380
  /**
4542
- * WASM wrapper for moduli spaces (simplified)
5381
+ * WASM wrapper for MCMC diagnostics
5382
+ */
5383
+ export class WasmMCMCDiagnostics {
5384
+
5385
+ static __wrap(ptr) {
5386
+ ptr = ptr >>> 0;
5387
+ const obj = Object.create(WasmMCMCDiagnostics.prototype);
5388
+ obj.__wbg_ptr = ptr;
5389
+ WasmMCMCDiagnosticsFinalization.register(obj, obj.__wbg_ptr, obj);
5390
+ return obj;
5391
+ }
5392
+
5393
+ __destroy_into_raw() {
5394
+ const ptr = this.__wbg_ptr;
5395
+ this.__wbg_ptr = 0;
5396
+ WasmMCMCDiagnosticsFinalization.unregister(this);
5397
+ return ptr;
5398
+ }
5399
+
5400
+ free() {
5401
+ const ptr = this.__destroy_into_raw();
5402
+ wasm.__wbg_wasmmcmcdiagnostics_free(ptr, 0);
5403
+ }
5404
+ /**
5405
+ * Total number of steps
5406
+ * @returns {number}
5407
+ */
5408
+ get num_steps() {
5409
+ const ret = wasm.__wbg_get_wasmmcmcdiagnostics_num_steps(this.__wbg_ptr);
5410
+ return ret >>> 0;
5411
+ }
5412
+ /**
5413
+ * Total number of steps
5414
+ * @param {number} arg0
5415
+ */
5416
+ set num_steps(arg0) {
5417
+ wasm.__wbg_set_wasmmcmcdiagnostics_num_steps(this.__wbg_ptr, arg0);
5418
+ }
5419
+ /**
5420
+ * Acceptance rate
5421
+ * @returns {number}
5422
+ */
5423
+ get acceptance_rate() {
5424
+ const ret = wasm.__wbg_get_wasmmcmcdiagnostics_acceptance_rate(this.__wbg_ptr);
5425
+ return ret;
5426
+ }
5427
+ /**
5428
+ * Acceptance rate
5429
+ * @param {number} arg0
5430
+ */
5431
+ set acceptance_rate(arg0) {
5432
+ wasm.__wbg_set_wasmmcmcdiagnostics_acceptance_rate(this.__wbg_ptr, arg0);
5433
+ }
5434
+ /**
5435
+ * Check if the sampler has converged (R-hat < 1.1)
5436
+ * @returns {boolean}
5437
+ */
5438
+ isConverged() {
5439
+ const ret = wasm.wasmmcmcdiagnostics_isConverged(this.__wbg_ptr);
5440
+ return ret !== 0;
5441
+ }
5442
+ /**
5443
+ * Get effective sample size (or -1 if not computed)
5444
+ * @returns {number}
5445
+ */
5446
+ getEffectiveSampleSize() {
5447
+ const ret = wasm.wasmmcmcdiagnostics_getEffectiveSampleSize(this.__wbg_ptr);
5448
+ return ret;
5449
+ }
5450
+ /**
5451
+ * Get R-hat statistic (or -1 if not computed)
5452
+ * @returns {number}
5453
+ */
5454
+ getRHat() {
5455
+ const ret = wasm.wasmmcmcdiagnostics_getRHat(this.__wbg_ptr);
5456
+ return ret;
5457
+ }
5458
+ }
5459
+
5460
+ const WasmMatrixOperatorFinalization = (typeof FinalizationRegistry === 'undefined')
5461
+ ? { register: () => {}, unregister: () => {} }
5462
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmmatrixoperator_free(ptr >>> 0, 1));
5463
+ /**
5464
+ * WASM wrapper for matrix operators on Hilbert spaces
5465
+ *
5466
+ * Represents bounded linear operators as matrices.
5467
+ */
5468
+ export class WasmMatrixOperator {
5469
+
5470
+ static __wrap(ptr) {
5471
+ ptr = ptr >>> 0;
5472
+ const obj = Object.create(WasmMatrixOperator.prototype);
5473
+ obj.__wbg_ptr = ptr;
5474
+ WasmMatrixOperatorFinalization.register(obj, obj.__wbg_ptr, obj);
5475
+ return obj;
5476
+ }
5477
+
5478
+ __destroy_into_raw() {
5479
+ const ptr = this.__wbg_ptr;
5480
+ this.__wbg_ptr = 0;
5481
+ WasmMatrixOperatorFinalization.unregister(this);
5482
+ return ptr;
5483
+ }
5484
+
5485
+ free() {
5486
+ const ptr = this.__destroy_into_raw();
5487
+ wasm.__wbg_wasmmatrixoperator_free(ptr, 0);
5488
+ }
5489
+ /**
5490
+ * Get the matrix entries as a flat array (row-major)
5491
+ * @returns {Float64Array}
5492
+ */
5493
+ getEntries() {
5494
+ const ret = wasm.wasmmatrixoperator_getEntries(this.__wbg_ptr);
5495
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5496
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
5497
+ return v1;
5498
+ }
5499
+ /**
5500
+ * Check if the matrix is symmetric
5501
+ * @param {number} tolerance
5502
+ * @returns {boolean}
5503
+ */
5504
+ isSymmetric(tolerance) {
5505
+ const ret = wasm.wasmmatrixoperator_isSymmetric(this.__wbg_ptr, tolerance);
5506
+ return ret !== 0;
5507
+ }
5508
+ /**
5509
+ * Compute operator norm ||T||
5510
+ * @returns {number}
5511
+ */
5512
+ operatorNorm() {
5513
+ const ret = wasm.wasmmatrixoperator_operatorNorm(this.__wbg_ptr);
5514
+ return ret;
5515
+ }
5516
+ /**
5517
+ * Add two operators
5518
+ * @param {WasmMatrixOperator} other
5519
+ * @returns {WasmMatrixOperator}
5520
+ */
5521
+ add(other) {
5522
+ _assertClass(other, WasmMatrixOperator);
5523
+ const ret = wasm.wasmmatrixoperator_add(this.__wbg_ptr, other.__wbg_ptr);
5524
+ if (ret[2]) {
5525
+ throw takeFromExternrefTable0(ret[1]);
5526
+ }
5527
+ return WasmMatrixOperator.__wrap(ret[0]);
5528
+ }
5529
+ /**
5530
+ * Create a matrix operator from a flattened row-major matrix
5531
+ *
5532
+ * # Arguments
5533
+ * * `entries` - 16 entries for a 4x4 matrix in row-major order
5534
+ * @param {Float64Array} entries
5535
+ */
5536
+ constructor(entries) {
5537
+ const ptr0 = passArrayF64ToWasm0(entries, wasm.__wbindgen_malloc);
5538
+ const len0 = WASM_VECTOR_LEN;
5539
+ const ret = wasm.wasmmatrixoperator_new(ptr0, len0);
5540
+ if (ret[2]) {
5541
+ throw takeFromExternrefTable0(ret[1]);
5542
+ }
5543
+ this.__wbg_ptr = ret[0] >>> 0;
5544
+ WasmMatrixOperatorFinalization.register(this, this.__wbg_ptr, this);
5545
+ return this;
5546
+ }
5547
+ /**
5548
+ * Create a zero operator
5549
+ * @returns {WasmMatrixOperator}
5550
+ */
5551
+ static zero() {
5552
+ const ret = wasm.wasmmatrixoperator_zero();
5553
+ return WasmMatrixOperator.__wrap(ret);
5554
+ }
5555
+ /**
5556
+ * Apply the operator to a vector: T(x)
5557
+ * @param {Float64Array} x
5558
+ * @returns {Float64Array}
5559
+ */
5560
+ apply(x) {
5561
+ const ptr0 = passArrayF64ToWasm0(x, wasm.__wbindgen_malloc);
5562
+ const len0 = WASM_VECTOR_LEN;
5563
+ const ret = wasm.wasmmatrixoperator_apply(this.__wbg_ptr, ptr0, len0);
5564
+ if (ret[3]) {
5565
+ throw takeFromExternrefTable0(ret[2]);
5566
+ }
5567
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5568
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
5569
+ return v2;
5570
+ }
5571
+ /**
5572
+ * Scale operator by scalar
5573
+ * @param {number} lambda
5574
+ * @returns {WasmMatrixOperator}
5575
+ */
5576
+ scale(lambda) {
5577
+ const ret = wasm.wasmmatrixoperator_scale(this.__wbg_ptr, lambda);
5578
+ return WasmMatrixOperator.__wrap(ret);
5579
+ }
5580
+ /**
5581
+ * Compute the trace
5582
+ * @returns {number}
5583
+ */
5584
+ trace() {
5585
+ const ret = wasm.wasmmatrixoperator_trace(this.__wbg_ptr);
5586
+ return ret;
5587
+ }
5588
+ /**
5589
+ * Compose two operators (matrix multiplication)
5590
+ * @param {WasmMatrixOperator} other
5591
+ * @returns {WasmMatrixOperator}
5592
+ */
5593
+ compose(other) {
5594
+ _assertClass(other, WasmMatrixOperator);
5595
+ const ret = wasm.wasmmatrixoperator_compose(this.__wbg_ptr, other.__wbg_ptr);
5596
+ if (ret[2]) {
5597
+ throw takeFromExternrefTable0(ret[1]);
5598
+ }
5599
+ return WasmMatrixOperator.__wrap(ret[0]);
5600
+ }
5601
+ /**
5602
+ * Create a scaling operator (λI)
5603
+ * @param {number} lambda
5604
+ * @returns {WasmMatrixOperator}
5605
+ */
5606
+ static scaling(lambda) {
5607
+ const ret = wasm.wasmmatrixoperator_scaling(lambda);
5608
+ return WasmMatrixOperator.__wrap(ret);
5609
+ }
5610
+ /**
5611
+ * Create a diagonal matrix from diagonal entries
5612
+ * @param {Float64Array} entries
5613
+ * @returns {WasmMatrixOperator}
5614
+ */
5615
+ static diagonal(entries) {
5616
+ const ptr0 = passArrayF64ToWasm0(entries, wasm.__wbindgen_malloc);
5617
+ const len0 = WASM_VECTOR_LEN;
5618
+ const ret = wasm.wasmmatrixoperator_diagonal(ptr0, len0);
5619
+ if (ret[2]) {
5620
+ throw takeFromExternrefTable0(ret[1]);
5621
+ }
5622
+ return WasmMatrixOperator.__wrap(ret[0]);
5623
+ }
5624
+ /**
5625
+ * Create the identity operator
5626
+ * @returns {WasmMatrixOperator}
5627
+ */
5628
+ static identity() {
5629
+ const ret = wasm.wasmmatrixoperator_identity();
5630
+ return WasmMatrixOperator.__wrap(ret);
5631
+ }
5632
+ /**
5633
+ * Get a single matrix entry at (i, j)
5634
+ * @param {number} i
5635
+ * @param {number} j
5636
+ * @returns {number}
5637
+ */
5638
+ getEntry(i, j) {
5639
+ const ret = wasm.wasmmatrixoperator_getEntry(this.__wbg_ptr, i, j);
5640
+ if (ret[2]) {
5641
+ throw takeFromExternrefTable0(ret[1]);
5642
+ }
5643
+ return ret[0];
5644
+ }
5645
+ /**
5646
+ * Compute the transpose
5647
+ * @returns {WasmMatrixOperator}
5648
+ */
5649
+ transpose() {
5650
+ const ret = wasm.wasmmatrixoperator_transpose(this.__wbg_ptr);
5651
+ return WasmMatrixOperator.__wrap(ret);
5652
+ }
5653
+ }
5654
+
5655
+ const WasmMetropolisHastingsFinalization = (typeof FinalizationRegistry === 'undefined')
5656
+ ? { register: () => {}, unregister: () => {} }
5657
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmmetropolishastings_free(ptr >>> 0, 1));
5658
+ /**
5659
+ * WASM wrapper for Metropolis-Hastings MCMC sampler
5660
+ *
5661
+ * Samples from a target distribution using random-walk proposals.
5662
+ */
5663
+ export class WasmMetropolisHastings {
5664
+
5665
+ __destroy_into_raw() {
5666
+ const ptr = this.__wbg_ptr;
5667
+ this.__wbg_ptr = 0;
5668
+ WasmMetropolisHastingsFinalization.unregister(this);
5669
+ return ptr;
5670
+ }
5671
+
5672
+ free() {
5673
+ const ptr = this.__destroy_into_raw();
5674
+ wasm.__wbg_wasmmetropolishastings_free(ptr, 0);
5675
+ }
5676
+ /**
5677
+ * Get sampling diagnostics
5678
+ * @returns {WasmMCMCDiagnostics}
5679
+ */
5680
+ diagnostics() {
5681
+ const ret = wasm.wasmmetropolishastings_diagnostics(this.__wbg_ptr);
5682
+ return WasmMCMCDiagnostics.__wrap(ret);
5683
+ }
5684
+ /**
5685
+ * Get current sample
5686
+ * @returns {Float64Array}
5687
+ */
5688
+ getCurrent() {
5689
+ const ret = wasm.wasmmetropolishastings_getCurrent(this.__wbg_ptr);
5690
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5691
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
5692
+ return v1;
5693
+ }
5694
+ /**
5695
+ * Get current acceptance rate
5696
+ * @returns {number}
5697
+ */
5698
+ getAcceptanceRate() {
5699
+ const ret = wasm.wasmmetropolishastings_getAcceptanceRate(this.__wbg_ptr);
5700
+ return ret;
5701
+ }
5702
+ /**
5703
+ * Create a new Metropolis-Hastings sampler for a Gaussian target
5704
+ *
5705
+ * # Arguments
5706
+ * * `target` - The target Gaussian distribution to sample from
5707
+ * * `proposal_std` - Standard deviation for the proposal distribution
5708
+ * @param {WasmGaussianMultivector} target
5709
+ * @param {number} proposal_std
5710
+ */
5711
+ constructor(target, proposal_std) {
5712
+ _assertClass(target, WasmGaussianMultivector);
5713
+ const ret = wasm.wasmmetropolishastings_new(target.__wbg_ptr, proposal_std);
5714
+ this.__wbg_ptr = ret >>> 0;
5715
+ WasmMetropolisHastingsFinalization.register(this, this.__wbg_ptr, this);
5716
+ return this;
5717
+ }
5718
+ /**
5719
+ * Run the sampler for multiple steps
5720
+ *
5721
+ * # Arguments
5722
+ * * `num_samples` - Number of samples to collect
5723
+ * * `burnin` - Number of burn-in steps to discard
5724
+ *
5725
+ * Returns flat array of samples (num_samples * 8)
5726
+ * @param {number} num_samples
5727
+ * @param {number} burnin
5728
+ * @returns {Float64Array}
5729
+ */
5730
+ run(num_samples, burnin) {
5731
+ const ret = wasm.wasmmetropolishastings_run(this.__wbg_ptr, num_samples, burnin);
5732
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5733
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
5734
+ return v1;
5735
+ }
5736
+ /**
5737
+ * Take a single MCMC step
5738
+ *
5739
+ * Returns the new sample (8 coefficients)
5740
+ * @returns {Float64Array}
5741
+ */
5742
+ step() {
5743
+ const ret = wasm.wasmmetropolishastings_step(this.__wbg_ptr);
5744
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5745
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
5746
+ return v1;
5747
+ }
5748
+ }
5749
+
5750
+ const WasmModuliSpaceFinalization = (typeof FinalizationRegistry === 'undefined')
5751
+ ? { register: () => {}, unregister: () => {} }
5752
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmmodulispace_free(ptr >>> 0, 1));
5753
+ /**
5754
+ * WASM wrapper for moduli spaces (simplified)
4543
5755
  */
4544
5756
  export class WasmModuliSpace {
4545
5757
 
@@ -4935,7 +6147,7 @@ export class WasmMultiObjectiveResult {
4935
6147
  * @returns {number}
4936
6148
  */
4937
6149
  get generations() {
4938
- const ret = wasm.wasmmultiobjectiveresult_generations(this.__wbg_ptr);
6150
+ const ret = wasm.wasmbinaryhologram_width(this.__wbg_ptr);
4939
6151
  return ret >>> 0;
4940
6152
  }
4941
6153
  /**
@@ -5229,56 +6441,634 @@ export class WasmNodeMetadata {
5229
6441
  return WasmNodeMetadata.__wrap(ret);
5230
6442
  }
5231
6443
  /**
5232
- * Get a numerical property
5233
- * @param {string} key
5234
- * @returns {number | undefined}
6444
+ * Get a numerical property
6445
+ * @param {string} key
6446
+ * @returns {number | undefined}
6447
+ */
6448
+ getProperty(key) {
6449
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6450
+ const len0 = WASM_VECTOR_LEN;
6451
+ const ret = wasm.wasmnodemetadata_getProperty(this.__wbg_ptr, ptr0, len0);
6452
+ return ret[0] === 0 ? undefined : ret[1];
6453
+ }
6454
+ /**
6455
+ * Add a numerical property
6456
+ * @param {string} key
6457
+ * @param {number} value
6458
+ */
6459
+ setProperty(key, value) {
6460
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6461
+ const len0 = WASM_VECTOR_LEN;
6462
+ wasm.wasmnodemetadata_setProperty(this.__wbg_ptr, ptr0, len0, value);
6463
+ }
6464
+ /**
6465
+ * Create new empty metadata
6466
+ */
6467
+ constructor() {
6468
+ const ret = wasm.wasmnodemetadata_new();
6469
+ this.__wbg_ptr = ret >>> 0;
6470
+ WasmNodeMetadataFinalization.register(this, this.__wbg_ptr, this);
6471
+ return this;
6472
+ }
6473
+ /**
6474
+ * Get the label
6475
+ * @returns {string | undefined}
6476
+ */
6477
+ get label() {
6478
+ const ret = wasm.wasmnodemetadata_label(this.__wbg_ptr);
6479
+ let v1;
6480
+ if (ret[0] !== 0) {
6481
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
6482
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
6483
+ }
6484
+ return v1;
6485
+ }
6486
+ /**
6487
+ * Set the label
6488
+ * @param {string | null} [label]
6489
+ */
6490
+ set label(label) {
6491
+ var ptr0 = isLikeNone(label) ? 0 : passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6492
+ var len0 = WASM_VECTOR_LEN;
6493
+ wasm.wasmnodemetadata_set_label(this.__wbg_ptr, ptr0, len0);
6494
+ }
6495
+ }
6496
+
6497
+ const WasmOpticalCodebookFinalization = (typeof FinalizationRegistry === 'undefined')
6498
+ ? { register: () => {}, unregister: () => {} }
6499
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmopticalcodebook_free(ptr >>> 0, 1));
6500
+ /**
6501
+ * WASM wrapper for OpticalCodebook.
6502
+ *
6503
+ * Maps symbols to deterministically-generated rotor fields.
6504
+ */
6505
+ export class WasmOpticalCodebook {
6506
+
6507
+ __destroy_into_raw() {
6508
+ const ptr = this.__wbg_ptr;
6509
+ this.__wbg_ptr = 0;
6510
+ WasmOpticalCodebookFinalization.unregister(this);
6511
+ return ptr;
6512
+ }
6513
+
6514
+ free() {
6515
+ const ptr = this.__destroy_into_raw();
6516
+ wasm.__wbg_wasmopticalcodebook_free(ptr, 0);
6517
+ }
6518
+ /**
6519
+ * Clear the field cache (seeds retained).
6520
+ */
6521
+ clearCache() {
6522
+ wasm.wasmopticalcodebook_clearCache(this.__wbg_ptr);
6523
+ }
6524
+ /**
6525
+ * Register multiple symbols at once.
6526
+ * @param {string[]} symbols
6527
+ */
6528
+ registerAll(symbols) {
6529
+ const ptr0 = passArrayJsValueToWasm0(symbols, wasm.__wbindgen_malloc);
6530
+ const len0 = WASM_VECTOR_LEN;
6531
+ wasm.wasmopticalcodebook_registerAll(this.__wbg_ptr, ptr0, len0);
6532
+ }
6533
+ /**
6534
+ * Register a symbol with specific seed.
6535
+ * @param {string} symbol
6536
+ * @param {bigint} seed
6537
+ */
6538
+ registerWithSeed(symbol, seed) {
6539
+ const ptr0 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6540
+ const len0 = WASM_VECTOR_LEN;
6541
+ wasm.wasmopticalcodebook_registerWithSeed(this.__wbg_ptr, ptr0, len0, seed);
6542
+ }
6543
+ /**
6544
+ * Get or generate field for a symbol.
6545
+ * @param {string} symbol
6546
+ * @returns {WasmOpticalRotorField | undefined}
6547
+ */
6548
+ get(symbol) {
6549
+ const ptr0 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6550
+ const len0 = WASM_VECTOR_LEN;
6551
+ const ret = wasm.wasmopticalcodebook_get(this.__wbg_ptr, ptr0, len0);
6552
+ return ret === 0 ? undefined : WasmOpticalRotorField.__wrap(ret);
6553
+ }
6554
+ /**
6555
+ * Create a new codebook.
6556
+ *
6557
+ * # Arguments
6558
+ * * `width` - Field grid width
6559
+ * * `height` - Field grid height
6560
+ * * `base_seed` - Base seed for deterministic generation
6561
+ * @param {number} width
6562
+ * @param {number} height
6563
+ * @param {bigint} base_seed
6564
+ */
6565
+ constructor(width, height, base_seed) {
6566
+ const ret = wasm.wasmopticalcodebook_new(width, height, base_seed);
6567
+ this.__wbg_ptr = ret >>> 0;
6568
+ WasmOpticalCodebookFinalization.register(this, this.__wbg_ptr, this);
6569
+ return this;
6570
+ }
6571
+ /**
6572
+ * Number of registered symbols.
6573
+ * @returns {number}
6574
+ */
6575
+ get length() {
6576
+ const ret = wasm.wasmopticalcodebook_length(this.__wbg_ptr);
6577
+ return ret >>> 0;
6578
+ }
6579
+ /**
6580
+ * Remove a symbol from the codebook.
6581
+ * @param {string} symbol
6582
+ * @returns {boolean}
6583
+ */
6584
+ remove(symbol) {
6585
+ const ptr0 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6586
+ const len0 = WASM_VECTOR_LEN;
6587
+ const ret = wasm.wasmopticalcodebook_remove(this.__wbg_ptr, ptr0, len0);
6588
+ return ret !== 0;
6589
+ }
6590
+ /**
6591
+ * Get all registered symbol names.
6592
+ * @returns {string[]}
6593
+ */
6594
+ symbols() {
6595
+ const ret = wasm.wasmopticalcodebook_symbols(this.__wbg_ptr);
6596
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
6597
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
6598
+ return v1;
6599
+ }
6600
+ /**
6601
+ * Check if a symbol is registered.
6602
+ * @param {string} symbol
6603
+ * @returns {boolean}
6604
+ */
6605
+ contains(symbol) {
6606
+ const ptr0 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6607
+ const len0 = WASM_VECTOR_LEN;
6608
+ const ret = wasm.wasmopticalcodebook_contains(this.__wbg_ptr, ptr0, len0);
6609
+ return ret !== 0;
6610
+ }
6611
+ /**
6612
+ * Generate field without caching.
6613
+ * @param {string} symbol
6614
+ * @returns {WasmOpticalRotorField | undefined}
6615
+ */
6616
+ generate(symbol) {
6617
+ const ptr0 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6618
+ const len0 = WASM_VECTOR_LEN;
6619
+ const ret = wasm.wasmopticalcodebook_generate(this.__wbg_ptr, ptr0, len0);
6620
+ return ret === 0 ? undefined : WasmOpticalRotorField.__wrap(ret);
6621
+ }
6622
+ /**
6623
+ * Get the seed for a registered symbol.
6624
+ * @param {string} symbol
6625
+ * @returns {bigint | undefined}
6626
+ */
6627
+ getSeed(symbol) {
6628
+ const ptr0 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6629
+ const len0 = WASM_VECTOR_LEN;
6630
+ const ret = wasm.wasmopticalcodebook_getSeed(this.__wbg_ptr, ptr0, len0);
6631
+ return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
6632
+ }
6633
+ /**
6634
+ * Check if codebook is empty.
6635
+ * @returns {boolean}
6636
+ */
6637
+ isEmpty() {
6638
+ const ret = wasm.wasmopticalcodebook_isEmpty(this.__wbg_ptr);
6639
+ return ret !== 0;
6640
+ }
6641
+ /**
6642
+ * Register a symbol with auto-generated seed.
6643
+ * @param {string} symbol
6644
+ */
6645
+ register(symbol) {
6646
+ const ptr0 = passStringToWasm0(symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6647
+ const len0 = WASM_VECTOR_LEN;
6648
+ wasm.wasmopticalcodebook_register(this.__wbg_ptr, ptr0, len0);
6649
+ }
6650
+ }
6651
+
6652
+ const WasmOpticalFieldAlgebraFinalization = (typeof FinalizationRegistry === 'undefined')
6653
+ ? { register: () => {}, unregister: () => {} }
6654
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmopticalfieldalgebra_free(ptr >>> 0, 1));
6655
+ /**
6656
+ * WASM wrapper for OpticalFieldAlgebra.
6657
+ *
6658
+ * Provides VSA operations on rotor fields: bind, bundle, similarity, inverse.
6659
+ */
6660
+ export class WasmOpticalFieldAlgebra {
6661
+
6662
+ __destroy_into_raw() {
6663
+ const ptr = this.__wbg_ptr;
6664
+ this.__wbg_ptr = 0;
6665
+ WasmOpticalFieldAlgebraFinalization.unregister(this);
6666
+ return ptr;
6667
+ }
6668
+
6669
+ free() {
6670
+ const ptr = this.__destroy_into_raw();
6671
+ wasm.__wbg_wasmopticalfieldalgebra_free(ptr, 0);
6672
+ }
6673
+ /**
6674
+ * Compute the average phase (circular mean) of a field.
6675
+ * @param {WasmOpticalRotorField} field
6676
+ * @returns {number}
6677
+ */
6678
+ meanPhase(field) {
6679
+ _assertClass(field, WasmOpticalRotorField);
6680
+ const ret = wasm.wasmopticalfieldalgebra_meanPhase(this.__wbg_ptr, field.__wbg_ptr);
6681
+ return ret;
6682
+ }
6683
+ /**
6684
+ * Compute similarity between two fields.
6685
+ *
6686
+ * Returns normalized inner product.
6687
+ * Range: [-1, 1], where 1 = identical phase.
6688
+ * @param {WasmOpticalRotorField} a
6689
+ * @param {WasmOpticalRotorField} b
6690
+ * @returns {number}
6691
+ */
6692
+ similarity(a, b) {
6693
+ _assertClass(a, WasmOpticalRotorField);
6694
+ _assertClass(b, WasmOpticalRotorField);
6695
+ const ret = wasm.wasmopticalfieldalgebra_similarity(this.__wbg_ptr, a.__wbg_ptr, b.__wbg_ptr);
6696
+ if (ret[2]) {
6697
+ throw takeFromExternrefTable0(ret[1]);
6698
+ }
6699
+ return ret[0];
6700
+ }
6701
+ /**
6702
+ * Bundle with uniform weights (1/n).
6703
+ * @param {WasmOpticalRotorField[]} fields
6704
+ * @returns {WasmOpticalRotorField}
6705
+ */
6706
+ bundleUniform(fields) {
6707
+ const ptr0 = passArrayJsValueToWasm0(fields, wasm.__wbindgen_malloc);
6708
+ const len0 = WASM_VECTOR_LEN;
6709
+ const ret = wasm.wasmopticalfieldalgebra_bundleUniform(this.__wbg_ptr, ptr0, len0);
6710
+ if (ret[2]) {
6711
+ throw takeFromExternrefTable0(ret[1]);
6712
+ }
6713
+ return WasmOpticalRotorField.__wrap(ret[0]);
6714
+ }
6715
+ /**
6716
+ * Compute phase variance (circular variance) of a field.
6717
+ * @param {WasmOpticalRotorField} field
6718
+ * @returns {number}
6719
+ */
6720
+ phaseVariance(field) {
6721
+ _assertClass(field, WasmOpticalRotorField);
6722
+ const ret = wasm.wasmopticalfieldalgebra_phaseVariance(this.__wbg_ptr, field.__wbg_ptr);
6723
+ return ret;
6724
+ }
6725
+ /**
6726
+ * Create new algebra instance for fields of the given dimensions.
6727
+ * @param {number} width
6728
+ * @param {number} height
6729
+ */
6730
+ constructor(width, height) {
6731
+ const ret = wasm.wasmopticalfieldalgebra_new(width, height);
6732
+ this.__wbg_ptr = ret >>> 0;
6733
+ WasmOpticalFieldAlgebraFinalization.register(this, this.__wbg_ptr, this);
6734
+ return this;
6735
+ }
6736
+ /**
6737
+ * Bind two fields (pointwise rotor product).
6738
+ *
6739
+ * Creates an association: bound = A ⊗ B.
6740
+ * Unbind with: B ≈ inverse(A) ⊗ bound.
6741
+ * @param {WasmOpticalRotorField} a
6742
+ * @param {WasmOpticalRotorField} b
6743
+ * @returns {WasmOpticalRotorField}
6744
+ */
6745
+ bind(a, b) {
6746
+ _assertClass(a, WasmOpticalRotorField);
6747
+ _assertClass(b, WasmOpticalRotorField);
6748
+ const ret = wasm.wasmopticalfieldalgebra_bind(this.__wbg_ptr, a.__wbg_ptr, b.__wbg_ptr);
6749
+ if (ret[2]) {
6750
+ throw takeFromExternrefTable0(ret[1]);
6751
+ }
6752
+ return WasmOpticalRotorField.__wrap(ret[0]);
6753
+ }
6754
+ /**
6755
+ * Scale a field's amplitude by a constant factor.
6756
+ * @param {WasmOpticalRotorField} field
6757
+ * @param {number} factor
6758
+ * @returns {WasmOpticalRotorField}
6759
+ */
6760
+ scale(field, factor) {
6761
+ _assertClass(field, WasmOpticalRotorField);
6762
+ const ret = wasm.wasmopticalfieldalgebra_scale(this.__wbg_ptr, field.__wbg_ptr, factor);
6763
+ return WasmOpticalRotorField.__wrap(ret);
6764
+ }
6765
+ /**
6766
+ * Get algebra width.
6767
+ * @returns {number}
6768
+ */
6769
+ get width() {
6770
+ const ret = wasm.wasmlebesguemeasure_getDimension(this.__wbg_ptr);
6771
+ return ret >>> 0;
6772
+ }
6773
+ /**
6774
+ * Bundle multiple fields (weighted superposition).
6775
+ *
6776
+ * # Arguments
6777
+ * * `fields` - Flattened array of field data (scalars, bivectors, amplitudes for each field)
6778
+ * * `weights` - Weights for each field
6779
+ * * `field_count` - Number of fields
6780
+ * @param {WasmOpticalRotorField[]} fields
6781
+ * @param {Float32Array} weights
6782
+ * @returns {WasmOpticalRotorField}
6783
+ */
6784
+ bundle(fields, weights) {
6785
+ const ptr0 = passArrayJsValueToWasm0(fields, wasm.__wbindgen_malloc);
6786
+ const len0 = WASM_VECTOR_LEN;
6787
+ const ptr1 = passArrayF32ToWasm0(weights, wasm.__wbindgen_malloc);
6788
+ const len1 = WASM_VECTOR_LEN;
6789
+ const ret = wasm.wasmopticalfieldalgebra_bundle(this.__wbg_ptr, ptr0, len0, ptr1, len1);
6790
+ if (ret[2]) {
6791
+ throw takeFromExternrefTable0(ret[1]);
6792
+ }
6793
+ return WasmOpticalRotorField.__wrap(ret[0]);
6794
+ }
6795
+ /**
6796
+ * Get algebra height.
6797
+ * @returns {number}
6798
+ */
6799
+ get height() {
6800
+ const ret = wasm.wasmmodulispace_getMarkedPoints(this.__wbg_ptr);
6801
+ return ret >>> 0;
6802
+ }
6803
+ /**
6804
+ * Create random field.
6805
+ * @param {bigint} seed
6806
+ * @returns {WasmOpticalRotorField}
6807
+ */
6808
+ random(seed) {
6809
+ const ret = wasm.wasmopticalfieldalgebra_random(this.__wbg_ptr, seed);
6810
+ return WasmOpticalRotorField.__wrap(ret);
6811
+ }
6812
+ /**
6813
+ * Unbind operation: retrieve associated value.
6814
+ *
6815
+ * Given `bound = bind(key, value)`, calling `unbind(key, bound)`
6816
+ * returns (approximately) `value`.
6817
+ * @param {WasmOpticalRotorField} key
6818
+ * @param {WasmOpticalRotorField} bound
6819
+ * @returns {WasmOpticalRotorField}
6820
+ */
6821
+ unbind(key, bound) {
6822
+ _assertClass(key, WasmOpticalRotorField);
6823
+ _assertClass(bound, WasmOpticalRotorField);
6824
+ const ret = wasm.wasmopticalfieldalgebra_unbind(this.__wbg_ptr, key.__wbg_ptr, bound.__wbg_ptr);
6825
+ if (ret[2]) {
6826
+ throw takeFromExternrefTable0(ret[1]);
6827
+ }
6828
+ return WasmOpticalRotorField.__wrap(ret[0]);
6829
+ }
6830
+ /**
6831
+ * Compute inverse field (rotor reverse).
6832
+ *
6833
+ * For rotors: R^(-1) = R^† = cos(φ) - sin(φ)·e₁₂
6834
+ * @param {WasmOpticalRotorField} field
6835
+ * @returns {WasmOpticalRotorField}
6836
+ */
6837
+ inverse(field) {
6838
+ _assertClass(field, WasmOpticalRotorField);
6839
+ const ret = wasm.wasmopticalfieldalgebra_inverse(this.__wbg_ptr, field.__wbg_ptr);
6840
+ return WasmOpticalRotorField.__wrap(ret);
6841
+ }
6842
+ /**
6843
+ * Create identity field (phase = 0, amplitude = 1).
6844
+ * @returns {WasmOpticalRotorField}
6845
+ */
6846
+ identity() {
6847
+ const ret = wasm.wasmopticalfieldalgebra_identity(this.__wbg_ptr);
6848
+ return WasmOpticalRotorField.__wrap(ret);
6849
+ }
6850
+ /**
6851
+ * Add a constant phase to all pixels.
6852
+ * @param {WasmOpticalRotorField} field
6853
+ * @param {number} phase
6854
+ * @returns {WasmOpticalRotorField}
6855
+ */
6856
+ addPhase(field, phase) {
6857
+ _assertClass(field, WasmOpticalRotorField);
6858
+ const ret = wasm.wasmopticalfieldalgebra_addPhase(this.__wbg_ptr, field.__wbg_ptr, phase);
6859
+ return WasmOpticalRotorField.__wrap(ret);
6860
+ }
6861
+ }
6862
+
6863
+ const WasmOpticalRotorFieldFinalization = (typeof FinalizationRegistry === 'undefined')
6864
+ ? { register: () => {}, unregister: () => {} }
6865
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmopticalrotorfield_free(ptr >>> 0, 1));
6866
+ /**
6867
+ * WASM wrapper for OpticalRotorField.
6868
+ *
6869
+ * Represents an optical wavefront as a grid of rotors in Cl(2,0).
6870
+ * Each point has phase (rotor angle) and amplitude components.
6871
+ */
6872
+ export class WasmOpticalRotorField {
6873
+
6874
+ static __wrap(ptr) {
6875
+ ptr = ptr >>> 0;
6876
+ const obj = Object.create(WasmOpticalRotorField.prototype);
6877
+ obj.__wbg_ptr = ptr;
6878
+ WasmOpticalRotorFieldFinalization.register(obj, obj.__wbg_ptr, obj);
6879
+ return obj;
6880
+ }
6881
+
6882
+ static __unwrap(jsValue) {
6883
+ if (!(jsValue instanceof WasmOpticalRotorField)) {
6884
+ return 0;
6885
+ }
6886
+ return jsValue.__destroy_into_raw();
6887
+ }
6888
+
6889
+ __destroy_into_raw() {
6890
+ const ptr = this.__wbg_ptr;
6891
+ this.__wbg_ptr = 0;
6892
+ WasmOpticalRotorFieldFinalization.unregister(this);
6893
+ return ptr;
6894
+ }
6895
+
6896
+ free() {
6897
+ const ptr = this.__destroy_into_raw();
6898
+ wasm.__wbg_wasmopticalrotorfield_free(ptr, 0);
6899
+ }
6900
+ /**
6901
+ * Create from phase array with uniform amplitude of 1.0.
6902
+ * @param {Float32Array} phase
6903
+ * @param {number} width
6904
+ * @param {number} height
6905
+ * @returns {WasmOpticalRotorField}
6906
+ */
6907
+ static fromPhase(phase, width, height) {
6908
+ const ptr0 = passArrayF32ToWasm0(phase, wasm.__wbindgen_malloc);
6909
+ const len0 = WASM_VECTOR_LEN;
6910
+ const ret = wasm.wasmopticalrotorfield_fromPhase(ptr0, len0, width, height);
6911
+ if (ret[2]) {
6912
+ throw takeFromExternrefTable0(ret[1]);
6913
+ }
6914
+ return WasmOpticalRotorField.__wrap(ret[0]);
6915
+ }
6916
+ /**
6917
+ * Create a normalized copy (total energy = 1).
6918
+ * @returns {WasmOpticalRotorField}
6919
+ */
6920
+ normalized() {
6921
+ const ret = wasm.wasmopticalrotorfield_normalized(this.__wbg_ptr);
6922
+ return WasmOpticalRotorField.__wrap(ret);
6923
+ }
6924
+ /**
6925
+ * Clone this field.
6926
+ * @returns {WasmOpticalRotorField}
6927
+ */
6928
+ clone() {
6929
+ const ret = wasm.wasmopticalrotorfield_clone(this.__wbg_ptr);
6930
+ return WasmOpticalRotorField.__wrap(ret);
6931
+ }
6932
+ /**
6933
+ * Get all scalar (cos φ) components.
6934
+ * @returns {Float32Array}
6935
+ */
6936
+ getScalars() {
6937
+ const ret = wasm.wasmopticalrotorfield_getScalars(this.__wbg_ptr);
6938
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
6939
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
6940
+ return v1;
6941
+ }
6942
+ /**
6943
+ * Get amplitude at a point.
6944
+ * @param {number} x
6945
+ * @param {number} y
6946
+ * @returns {number}
6947
+ */
6948
+ amplitudeAt(x, y) {
6949
+ const ret = wasm.wasmopticalrotorfield_amplitudeAt(this.__wbg_ptr, x, y);
6950
+ return ret;
6951
+ }
6952
+ /**
6953
+ * Compute total energy (sum of squared amplitudes).
6954
+ * @returns {number}
6955
+ */
6956
+ totalEnergy() {
6957
+ const ret = wasm.wasmopticalrotorfield_totalEnergy(this.__wbg_ptr);
6958
+ return ret;
6959
+ }
6960
+ /**
6961
+ * Get all bivector (sin φ) components.
6962
+ * @returns {Float32Array}
6963
+ */
6964
+ getBivectors() {
6965
+ const ret = wasm.wasmopticalrotorfield_getBivectors(this.__wbg_ptr);
6966
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
6967
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
6968
+ return v1;
6969
+ }
6970
+ /**
6971
+ * Get all amplitude components.
6972
+ * @returns {Float32Array}
6973
+ */
6974
+ getAmplitudes() {
6975
+ const ret = wasm.wasmopticalrotorfield_getAmplitudes(this.__wbg_ptr);
6976
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
6977
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
6978
+ return v1;
6979
+ }
6980
+ /**
6981
+ * Create from phase and amplitude arrays.
6982
+ *
6983
+ * # Arguments
6984
+ * * `phase` - Phase values in radians (length = width * height)
6985
+ * * `amplitude` - Amplitude values (length = width * height)
6986
+ * * `width` - Grid width
6987
+ * * `height` - Grid height
6988
+ * @param {Float32Array} phase
6989
+ * @param {Float32Array} amplitude
6990
+ * @param {number} width
6991
+ * @param {number} height
6992
+ */
6993
+ constructor(phase, amplitude, width, height) {
6994
+ const ptr0 = passArrayF32ToWasm0(phase, wasm.__wbindgen_malloc);
6995
+ const len0 = WASM_VECTOR_LEN;
6996
+ const ptr1 = passArrayF32ToWasm0(amplitude, wasm.__wbindgen_malloc);
6997
+ const len1 = WASM_VECTOR_LEN;
6998
+ const ret = wasm.wasmopticalrotorfield_new(ptr0, len0, ptr1, len1, width, height);
6999
+ if (ret[2]) {
7000
+ throw takeFromExternrefTable0(ret[1]);
7001
+ }
7002
+ this.__wbg_ptr = ret[0] >>> 0;
7003
+ WasmOpticalRotorFieldFinalization.register(this, this.__wbg_ptr, this);
7004
+ return this;
7005
+ }
7006
+ /**
7007
+ * Get grid width.
7008
+ * @returns {number}
7009
+ */
7010
+ get width() {
7011
+ const ret = wasm.wasmopticalrotorfield_width(this.__wbg_ptr);
7012
+ return ret >>> 0;
7013
+ }
7014
+ /**
7015
+ * Get grid height.
7016
+ * @returns {number}
7017
+ */
7018
+ get height() {
7019
+ const ret = wasm.wasmopticalrotorfield_height(this.__wbg_ptr);
7020
+ return ret >>> 0;
7021
+ }
7022
+ /**
7023
+ * Get total number of points.
7024
+ * @returns {number}
5235
7025
  */
5236
- getProperty(key) {
5237
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5238
- const len0 = WASM_VECTOR_LEN;
5239
- const ret = wasm.wasmnodemetadata_getProperty(this.__wbg_ptr, ptr0, len0);
5240
- return ret[0] === 0 ? undefined : ret[1];
7026
+ get length() {
7027
+ const ret = wasm.wasmopticalrotorfield_length(this.__wbg_ptr);
7028
+ return ret >>> 0;
5241
7029
  }
5242
7030
  /**
5243
- * Add a numerical property
5244
- * @param {string} key
5245
- * @param {number} value
7031
+ * Create with random phase (deterministic from seed).
7032
+ * @param {number} width
7033
+ * @param {number} height
7034
+ * @param {bigint} seed
7035
+ * @returns {WasmOpticalRotorField}
5246
7036
  */
5247
- setProperty(key, value) {
5248
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5249
- const len0 = WASM_VECTOR_LEN;
5250
- wasm.wasmnodemetadata_setProperty(this.__wbg_ptr, ptr0, len0, value);
7037
+ static random(width, height, seed) {
7038
+ const ret = wasm.wasmopticalrotorfield_random(width, height, seed);
7039
+ return WasmOpticalRotorField.__wrap(ret);
5251
7040
  }
5252
7041
  /**
5253
- * Create new empty metadata
7042
+ * Create uniform field (constant phase and amplitude).
7043
+ * @param {number} phase
7044
+ * @param {number} amplitude
7045
+ * @param {number} width
7046
+ * @param {number} height
7047
+ * @returns {WasmOpticalRotorField}
5254
7048
  */
5255
- constructor() {
5256
- const ret = wasm.wasmnodemetadata_new();
5257
- this.__wbg_ptr = ret >>> 0;
5258
- WasmNodeMetadataFinalization.register(this, this.__wbg_ptr, this);
5259
- return this;
7049
+ static uniform(phase, amplitude, width, height) {
7050
+ const ret = wasm.wasmopticalrotorfield_uniform(phase, amplitude, width, height);
7051
+ return WasmOpticalRotorField.__wrap(ret);
5260
7052
  }
5261
7053
  /**
5262
- * Get the label
5263
- * @returns {string | undefined}
7054
+ * Create identity field (phase = 0, amplitude = 1).
7055
+ * @param {number} width
7056
+ * @param {number} height
7057
+ * @returns {WasmOpticalRotorField}
5264
7058
  */
5265
- get label() {
5266
- const ret = wasm.wasmnodemetadata_label(this.__wbg_ptr);
5267
- let v1;
5268
- if (ret[0] !== 0) {
5269
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
5270
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
5271
- }
5272
- return v1;
7059
+ static identity(width, height) {
7060
+ const ret = wasm.wasmopticalrotorfield_identity(width, height);
7061
+ return WasmOpticalRotorField.__wrap(ret);
5273
7062
  }
5274
7063
  /**
5275
- * Set the label
5276
- * @param {string | null} [label]
7064
+ * Get phase at a point (in radians, range [-π, π]).
7065
+ * @param {number} x
7066
+ * @param {number} y
7067
+ * @returns {number}
5277
7068
  */
5278
- set label(label) {
5279
- var ptr0 = isLikeNone(label) ? 0 : passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5280
- var len0 = WASM_VECTOR_LEN;
5281
- wasm.wasmnodemetadata_set_label(this.__wbg_ptr, ptr0, len0);
7069
+ phaseAt(x, y) {
7070
+ const ret = wasm.wasmopticalrotorfield_phaseAt(this.__wbg_ptr, x, y);
7071
+ return ret;
5282
7072
  }
5283
7073
  }
5284
7074
 
@@ -6330,6 +8120,162 @@ export class WasmSimpleOptimizer {
6330
8120
  }
6331
8121
  }
6332
8122
 
8123
+ const WasmSobolevSpaceFinalization = (typeof FinalizationRegistry === 'undefined')
8124
+ ? { register: () => {}, unregister: () => {} }
8125
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmsobolevspace_free(ptr >>> 0, 1));
8126
+ /**
8127
+ * WASM wrapper for Sobolev spaces H^k
8128
+ *
8129
+ * Provides function spaces with weak derivatives.
8130
+ */
8131
+ export class WasmSobolevSpace {
8132
+
8133
+ static __wrap(ptr) {
8134
+ ptr = ptr >>> 0;
8135
+ const obj = Object.create(WasmSobolevSpace.prototype);
8136
+ obj.__wbg_ptr = ptr;
8137
+ WasmSobolevSpaceFinalization.register(obj, obj.__wbg_ptr, obj);
8138
+ return obj;
8139
+ }
8140
+
8141
+ __destroy_into_raw() {
8142
+ const ptr = this.__wbg_ptr;
8143
+ this.__wbg_ptr = 0;
8144
+ WasmSobolevSpaceFinalization.unregister(this);
8145
+ return ptr;
8146
+ }
8147
+
8148
+ free() {
8149
+ const ptr = this.__destroy_into_raw();
8150
+ wasm.__wbg_wasmsobolevspace_free(ptr, 0);
8151
+ }
8152
+ /**
8153
+ * Compute the H^1 seminorm |f|_{H^1} = ||f'||_{L^2}
8154
+ * @param {Function} df
8155
+ * @returns {number}
8156
+ */
8157
+ h1Seminorm(df) {
8158
+ const ret = wasm.wasmsobolevspace_h1Seminorm(this.__wbg_ptr, df);
8159
+ if (ret[2]) {
8160
+ throw takeFromExternrefTable0(ret[1]);
8161
+ }
8162
+ return ret[0];
8163
+ }
8164
+ /**
8165
+ * Create H^1 over the unit interval [0, 1]
8166
+ * @returns {WasmSobolevSpace}
8167
+ */
8168
+ static h1UnitInterval() {
8169
+ const ret = wasm.wasmsobolevspace_h1UnitInterval();
8170
+ return WasmSobolevSpace.__wrap(ret);
8171
+ }
8172
+ /**
8173
+ * Create H^2 over the unit interval [0, 1]
8174
+ * @returns {WasmSobolevSpace}
8175
+ */
8176
+ static h2UnitInterval() {
8177
+ const ret = wasm.wasmsobolevspace_h2UnitInterval();
8178
+ return WasmSobolevSpace.__wrap(ret);
8179
+ }
8180
+ /**
8181
+ * Compute L^2 inner product <f, g>
8182
+ * @param {Function} f
8183
+ * @param {Function} g
8184
+ * @returns {number}
8185
+ */
8186
+ l2InnerProduct(f, g) {
8187
+ const ret = wasm.wasmsobolevspace_l2InnerProduct(this.__wbg_ptr, f, g);
8188
+ if (ret[2]) {
8189
+ throw takeFromExternrefTable0(ret[1]);
8190
+ }
8191
+ return ret[0];
8192
+ }
8193
+ /**
8194
+ * Compute the Poincare constant estimate for the domain
8195
+ *
8196
+ * For [a,b], this is (b-a)/π
8197
+ * @returns {number}
8198
+ */
8199
+ poincareConstant() {
8200
+ const ret = wasm.wasmsobolevspace_poincareConstant(this.__wbg_ptr);
8201
+ return ret;
8202
+ }
8203
+ /**
8204
+ * Set the number of quadrature points
8205
+ * @param {number} n
8206
+ */
8207
+ setQuadraturePoints(n) {
8208
+ wasm.wasmsobolevspace_setQuadraturePoints(this.__wbg_ptr, n);
8209
+ }
8210
+ /**
8211
+ * Create a Sobolev space H^k over an interval [a, b]
8212
+ *
8213
+ * # Arguments
8214
+ * * `order` - The Sobolev regularity (1 for H^1, 2 for H^2)
8215
+ * * `lower` - Lower bound of the interval
8216
+ * * `upper` - Upper bound of the interval
8217
+ * @param {number} order
8218
+ * @param {number} lower
8219
+ * @param {number} upper
8220
+ */
8221
+ constructor(order, lower, upper) {
8222
+ const ret = wasm.wasmsobolevspace_new(order, lower, upper);
8223
+ if (ret[2]) {
8224
+ throw takeFromExternrefTable0(ret[1]);
8225
+ }
8226
+ this.__wbg_ptr = ret[0] >>> 0;
8227
+ WasmSobolevSpaceFinalization.register(this, this.__wbg_ptr, this);
8228
+ return this;
8229
+ }
8230
+ /**
8231
+ * Get the domain bounds [lower, upper]
8232
+ * @returns {Float64Array}
8233
+ */
8234
+ bounds() {
8235
+ const ret = wasm.wasmsobolevspace_bounds(this.__wbg_ptr);
8236
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
8237
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
8238
+ return v1;
8239
+ }
8240
+ /**
8241
+ * Compute the H^k norm of a function using numerical integration
8242
+ *
8243
+ * # Arguments
8244
+ * * `f` - JavaScript function f(x) to evaluate
8245
+ * * `df` - JavaScript function f'(x) (first derivative)
8246
+ * @param {Function} f
8247
+ * @param {Function} df
8248
+ * @returns {number}
8249
+ */
8250
+ h1Norm(f, df) {
8251
+ const ret = wasm.wasmsobolevspace_h1Norm(this.__wbg_ptr, f, df);
8252
+ if (ret[2]) {
8253
+ throw takeFromExternrefTable0(ret[1]);
8254
+ }
8255
+ return ret[0];
8256
+ }
8257
+ /**
8258
+ * Compute L^2 norm of a function
8259
+ * @param {Function} f
8260
+ * @returns {number}
8261
+ */
8262
+ l2Norm(f) {
8263
+ const ret = wasm.wasmsobolevspace_l2Norm(this.__wbg_ptr, f);
8264
+ if (ret[2]) {
8265
+ throw takeFromExternrefTable0(ret[1]);
8266
+ }
8267
+ return ret[0];
8268
+ }
8269
+ /**
8270
+ * Get the Sobolev order k
8271
+ * @returns {number}
8272
+ */
8273
+ order() {
8274
+ const ret = wasm.wasmsobolevspace_order(this.__wbg_ptr);
8275
+ return ret >>> 0;
8276
+ }
8277
+ }
8278
+
6333
8279
  const WasmSpacetimeVectorFinalization = (typeof FinalizationRegistry === 'undefined')
6334
8280
  ? { register: () => {}, unregister: () => {} }
6335
8281
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmspacetimevector_free(ptr >>> 0, 1));
@@ -6468,17 +8414,167 @@ export class WasmSpacetimeVector {
6468
8414
  * Get string representation
6469
8415
  * @returns {string}
6470
8416
  */
6471
- to_string() {
6472
- let deferred1_0;
6473
- let deferred1_1;
6474
- try {
6475
- const ret = wasm.wasmspacetimevector_to_string(this.__wbg_ptr);
6476
- deferred1_0 = ret[0];
6477
- deferred1_1 = ret[1];
6478
- return getStringFromWasm0(ret[0], ret[1]);
6479
- } finally {
6480
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
8417
+ to_string() {
8418
+ let deferred1_0;
8419
+ let deferred1_1;
8420
+ try {
8421
+ const ret = wasm.wasmspacetimevector_to_string(this.__wbg_ptr);
8422
+ deferred1_0 = ret[0];
8423
+ deferred1_1 = ret[1];
8424
+ return getStringFromWasm0(ret[0], ret[1]);
8425
+ } finally {
8426
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
8427
+ }
8428
+ }
8429
+ }
8430
+
8431
+ const WasmSpectralDecompositionFinalization = (typeof FinalizationRegistry === 'undefined')
8432
+ ? { register: () => {}, unregister: () => {} }
8433
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmspectraldecomposition_free(ptr >>> 0, 1));
8434
+ /**
8435
+ * WASM wrapper for spectral decomposition
8436
+ *
8437
+ * Provides eigenvalue decomposition for symmetric matrices.
8438
+ */
8439
+ export class WasmSpectralDecomposition {
8440
+
8441
+ static __wrap(ptr) {
8442
+ ptr = ptr >>> 0;
8443
+ const obj = Object.create(WasmSpectralDecomposition.prototype);
8444
+ obj.__wbg_ptr = ptr;
8445
+ WasmSpectralDecompositionFinalization.register(obj, obj.__wbg_ptr, obj);
8446
+ return obj;
8447
+ }
8448
+
8449
+ __destroy_into_raw() {
8450
+ const ptr = this.__wbg_ptr;
8451
+ this.__wbg_ptr = 0;
8452
+ WasmSpectralDecompositionFinalization.unregister(this);
8453
+ return ptr;
8454
+ }
8455
+
8456
+ free() {
8457
+ const ptr = this.__destroy_into_raw();
8458
+ wasm.__wbg_wasmspectraldecomposition_free(ptr, 0);
8459
+ }
8460
+ /**
8461
+ * Get the eigenvalues
8462
+ * @returns {Float64Array}
8463
+ */
8464
+ eigenvalues() {
8465
+ const ret = wasm.wasmspectraldecomposition_eigenvalues(this.__wbg_ptr);
8466
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
8467
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
8468
+ return v1;
8469
+ }
8470
+ /**
8471
+ * Check if the decomposition is complete
8472
+ * @returns {boolean}
8473
+ */
8474
+ isComplete() {
8475
+ const ret = wasm.wasmspectraldecomposition_isComplete(this.__wbg_ptr);
8476
+ return ret !== 0;
8477
+ }
8478
+ /**
8479
+ * Get the eigenvectors as a flattened array
8480
+ *
8481
+ * Returns 4 eigenvectors of 4 components each (16 total)
8482
+ * @returns {Float64Array}
8483
+ */
8484
+ eigenvectors() {
8485
+ const ret = wasm.wasmspectraldecomposition_eigenvectors(this.__wbg_ptr);
8486
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
8487
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
8488
+ return v1;
8489
+ }
8490
+ /**
8491
+ * Apply f(T) = Σᵢ f(λᵢ) Pᵢ to a vector using functional calculus
8492
+ *
8493
+ * # Arguments
8494
+ * * `f` - JavaScript function to apply to eigenvalues
8495
+ * * `x` - Input vector
8496
+ * @param {Function} f
8497
+ * @param {Float64Array} x
8498
+ * @returns {Float64Array}
8499
+ */
8500
+ applyFunction(f, x) {
8501
+ const ptr0 = passArrayF64ToWasm0(x, wasm.__wbindgen_malloc);
8502
+ const len0 = WASM_VECTOR_LEN;
8503
+ const ret = wasm.wasmspectraldecomposition_applyFunction(this.__wbg_ptr, f, ptr0, len0);
8504
+ if (ret[3]) {
8505
+ throw takeFromExternrefTable0(ret[2]);
8506
+ }
8507
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
8508
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
8509
+ return v2;
8510
+ }
8511
+ /**
8512
+ * Get the spectral radius (largest |eigenvalue|)
8513
+ * @returns {number}
8514
+ */
8515
+ spectralRadius() {
8516
+ const ret = wasm.wasmspectraldecomposition_spectralRadius(this.__wbg_ptr);
8517
+ return ret;
8518
+ }
8519
+ /**
8520
+ * Get the condition number
8521
+ * @returns {number | undefined}
8522
+ */
8523
+ conditionNumber() {
8524
+ const ret = wasm.wasmspectraldecomposition_conditionNumber(this.__wbg_ptr);
8525
+ return ret[0] === 0 ? undefined : ret[1];
8526
+ }
8527
+ /**
8528
+ * Check if the operator is positive definite
8529
+ * @returns {boolean}
8530
+ */
8531
+ isPositiveDefinite() {
8532
+ const ret = wasm.wasmspectraldecomposition_isPositiveDefinite(this.__wbg_ptr);
8533
+ return ret !== 0;
8534
+ }
8535
+ /**
8536
+ * Check if the operator is positive semi-definite
8537
+ * @returns {boolean}
8538
+ */
8539
+ isPositiveSemidefinite() {
8540
+ const ret = wasm.wasmspectraldecomposition_isPositiveSemidefinite(this.__wbg_ptr);
8541
+ return ret !== 0;
8542
+ }
8543
+ /**
8544
+ * Apply the reconstructed operator T = Σᵢ λᵢ Pᵢ to a vector
8545
+ * @param {Float64Array} x
8546
+ * @returns {Float64Array}
8547
+ */
8548
+ apply(x) {
8549
+ const ptr0 = passArrayF64ToWasm0(x, wasm.__wbindgen_malloc);
8550
+ const len0 = WASM_VECTOR_LEN;
8551
+ const ret = wasm.wasmspectraldecomposition_apply(this.__wbg_ptr, ptr0, len0);
8552
+ if (ret[3]) {
8553
+ throw takeFromExternrefTable0(ret[2]);
8554
+ }
8555
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
8556
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
8557
+ return v2;
8558
+ }
8559
+ /**
8560
+ * Compute spectral decomposition of a symmetric matrix
8561
+ *
8562
+ * # Arguments
8563
+ * * `matrix` - The symmetric matrix operator to decompose
8564
+ * * `max_iterations` - Maximum iterations for eigenvalue computation
8565
+ * * `tolerance` - Convergence tolerance
8566
+ * @param {WasmMatrixOperator} matrix
8567
+ * @param {number} max_iterations
8568
+ * @param {number} tolerance
8569
+ * @returns {WasmSpectralDecomposition}
8570
+ */
8571
+ static compute(matrix, max_iterations, tolerance) {
8572
+ _assertClass(matrix, WasmMatrixOperator);
8573
+ const ret = wasm.wasmspectraldecomposition_compute(matrix.__wbg_ptr, max_iterations, tolerance);
8574
+ if (ret[2]) {
8575
+ throw takeFromExternrefTable0(ret[1]);
6481
8576
  }
8577
+ return WasmSpectralDecomposition.__wrap(ret[0]);
6482
8578
  }
6483
8579
  }
6484
8580
 
@@ -6506,7 +8602,7 @@ export class WasmTrajectoryPoint {
6506
8602
  * @returns {number}
6507
8603
  */
6508
8604
  get time() {
6509
- const ret = wasm.__wbg_get_wasmtrajectorypoint_time(this.__wbg_ptr);
8605
+ const ret = wasm.__wbg_get_wasmmcmcdiagnostics_acceptance_rate(this.__wbg_ptr);
6510
8606
  return ret;
6511
8607
  }
6512
8608
  /**
@@ -6514,7 +8610,7 @@ export class WasmTrajectoryPoint {
6514
8610
  * @param {number} arg0
6515
8611
  */
6516
8612
  set time(arg0) {
6517
- wasm.__wbg_set_wasmtrajectorypoint_time(this.__wbg_ptr, arg0);
8613
+ wasm.__wbg_set_wasmmcmcdiagnostics_acceptance_rate(this.__wbg_ptr, arg0);
6518
8614
  }
6519
8615
  /**
6520
8616
  * Get position
@@ -7088,7 +9184,7 @@ export class WasmTropicalNetwork {
7088
9184
  * @returns {number}
7089
9185
  */
7090
9186
  getSize() {
7091
- const ret = wasm.wasmmultiobjectiveresult_generations(this.__wbg_ptr);
9187
+ const ret = wasm.wasmbinaryhologram_width(this.__wbg_ptr);
7092
9188
  return ret >>> 0;
7093
9189
  }
7094
9190
  /**
@@ -7274,6 +9370,181 @@ export class WasmTropicalNumber {
7274
9370
  }
7275
9371
  }
7276
9372
 
9373
+ const WasmTropicalOpticalAlgebraFinalization = (typeof FinalizationRegistry === 'undefined')
9374
+ ? { register: () => {}, unregister: () => {} }
9375
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmtropicalopticalalgebra_free(ptr >>> 0, 1));
9376
+ /**
9377
+ * WASM wrapper for TropicalOpticalAlgebra.
9378
+ *
9379
+ * Tropical (min, +) operations on optical fields for attractor dynamics.
9380
+ */
9381
+ export class WasmTropicalOpticalAlgebra {
9382
+
9383
+ __destroy_into_raw() {
9384
+ const ptr = this.__wbg_ptr;
9385
+ this.__wbg_ptr = 0;
9386
+ WasmTropicalOpticalAlgebraFinalization.unregister(this);
9387
+ return ptr;
9388
+ }
9389
+
9390
+ free() {
9391
+ const ptr = this.__destroy_into_raw();
9392
+ wasm.__wbg_wasmtropicalopticalalgebra_free(ptr, 0);
9393
+ }
9394
+ /**
9395
+ * Tropical addition: pointwise minimum of phase magnitudes.
9396
+ *
9397
+ * For each pixel, selects the rotor with smaller absolute phase.
9398
+ * @param {WasmOpticalRotorField} a
9399
+ * @param {WasmOpticalRotorField} b
9400
+ * @returns {WasmOpticalRotorField}
9401
+ */
9402
+ tropicalAdd(a, b) {
9403
+ _assertClass(a, WasmOpticalRotorField);
9404
+ _assertClass(b, WasmOpticalRotorField);
9405
+ const ret = wasm.wasmtropicalopticalalgebra_tropicalAdd(this.__wbg_ptr, a.__wbg_ptr, b.__wbg_ptr);
9406
+ if (ret[2]) {
9407
+ throw takeFromExternrefTable0(ret[1]);
9408
+ }
9409
+ return WasmOpticalRotorField.__wrap(ret[0]);
9410
+ }
9411
+ /**
9412
+ * Tropical maximum: pointwise maximum of phase magnitudes.
9413
+ * @param {WasmOpticalRotorField} a
9414
+ * @param {WasmOpticalRotorField} b
9415
+ * @returns {WasmOpticalRotorField}
9416
+ */
9417
+ tropicalMax(a, b) {
9418
+ _assertClass(a, WasmOpticalRotorField);
9419
+ _assertClass(b, WasmOpticalRotorField);
9420
+ const ret = wasm.wasmtropicalopticalalgebra_tropicalMax(this.__wbg_ptr, a.__wbg_ptr, b.__wbg_ptr);
9421
+ if (ret[2]) {
9422
+ throw takeFromExternrefTable0(ret[1]);
9423
+ }
9424
+ return WasmOpticalRotorField.__wrap(ret[0]);
9425
+ }
9426
+ /**
9427
+ * Tropical multiplication: binding operation (phase addition).
9428
+ * @param {WasmOpticalRotorField} a
9429
+ * @param {WasmOpticalRotorField} b
9430
+ * @returns {WasmOpticalRotorField}
9431
+ */
9432
+ tropicalMul(a, b) {
9433
+ _assertClass(a, WasmOpticalRotorField);
9434
+ _assertClass(b, WasmOpticalRotorField);
9435
+ const ret = wasm.wasmtropicalopticalalgebra_tropicalMul(this.__wbg_ptr, a.__wbg_ptr, b.__wbg_ptr);
9436
+ if (ret[2]) {
9437
+ throw takeFromExternrefTable0(ret[1]);
9438
+ }
9439
+ return WasmOpticalRotorField.__wrap(ret[0]);
9440
+ }
9441
+ /**
9442
+ * Compute phase distance between two fields.
9443
+ *
9444
+ * Returns the sum of absolute phase differences.
9445
+ * @param {WasmOpticalRotorField} a
9446
+ * @param {WasmOpticalRotorField} b
9447
+ * @returns {number}
9448
+ */
9449
+ phaseDistance(a, b) {
9450
+ _assertClass(a, WasmOpticalRotorField);
9451
+ _assertClass(b, WasmOpticalRotorField);
9452
+ const ret = wasm.wasmtropicalopticalalgebra_phaseDistance(this.__wbg_ptr, a.__wbg_ptr, b.__wbg_ptr);
9453
+ if (ret[2]) {
9454
+ throw takeFromExternrefTable0(ret[1]);
9455
+ }
9456
+ return ret[0];
9457
+ }
9458
+ /**
9459
+ * Soft tropical addition using logsumexp-style smoothing.
9460
+ *
9461
+ * # Arguments
9462
+ * * `a`, `b` - Fields to combine
9463
+ * * `beta` - Temperature parameter (large = hard min, small = soft average)
9464
+ * @param {WasmOpticalRotorField} a
9465
+ * @param {WasmOpticalRotorField} b
9466
+ * @param {number} beta
9467
+ * @returns {WasmOpticalRotorField}
9468
+ */
9469
+ softTropicalAdd(a, b, beta) {
9470
+ _assertClass(a, WasmOpticalRotorField);
9471
+ _assertClass(b, WasmOpticalRotorField);
9472
+ const ret = wasm.wasmtropicalopticalalgebra_softTropicalAdd(this.__wbg_ptr, a.__wbg_ptr, b.__wbg_ptr, beta);
9473
+ if (ret[2]) {
9474
+ throw takeFromExternrefTable0(ret[1]);
9475
+ }
9476
+ return WasmOpticalRotorField.__wrap(ret[0]);
9477
+ }
9478
+ /**
9479
+ * Iterate attractor dynamics until convergence.
9480
+ *
9481
+ * # Arguments
9482
+ * * `initial` - Starting state
9483
+ * * `attractors` - Set of attractor fields
9484
+ * * `max_iterations` - Maximum iterations
9485
+ * * `tolerance` - Convergence tolerance
9486
+ *
9487
+ * Returns (final_state, iterations_taken).
9488
+ * @param {WasmOpticalRotorField} initial
9489
+ * @param {WasmOpticalRotorField[]} attractors
9490
+ * @param {number} max_iterations
9491
+ * @param {number} tolerance
9492
+ * @returns {WasmOpticalRotorField}
9493
+ */
9494
+ attractorConverge(initial, attractors, max_iterations, tolerance) {
9495
+ _assertClass(initial, WasmOpticalRotorField);
9496
+ const ptr0 = passArrayJsValueToWasm0(attractors, wasm.__wbindgen_malloc);
9497
+ const len0 = WASM_VECTOR_LEN;
9498
+ const ret = wasm.wasmtropicalopticalalgebra_attractorConverge(this.__wbg_ptr, initial.__wbg_ptr, ptr0, len0, max_iterations, tolerance);
9499
+ if (ret[2]) {
9500
+ throw takeFromExternrefTable0(ret[1]);
9501
+ }
9502
+ return WasmOpticalRotorField.__wrap(ret[0]);
9503
+ }
9504
+ /**
9505
+ * Compute normalized phase distance (average per pixel).
9506
+ * @param {WasmOpticalRotorField} a
9507
+ * @param {WasmOpticalRotorField} b
9508
+ * @returns {number}
9509
+ */
9510
+ normalizedPhaseDistance(a, b) {
9511
+ _assertClass(a, WasmOpticalRotorField);
9512
+ _assertClass(b, WasmOpticalRotorField);
9513
+ const ret = wasm.wasmtropicalopticalalgebra_normalizedPhaseDistance(this.__wbg_ptr, a.__wbg_ptr, b.__wbg_ptr);
9514
+ if (ret[2]) {
9515
+ throw takeFromExternrefTable0(ret[1]);
9516
+ }
9517
+ return ret[0];
9518
+ }
9519
+ /**
9520
+ * Create new tropical algebra instance for fields of the given dimensions.
9521
+ * @param {number} width
9522
+ * @param {number} height
9523
+ */
9524
+ constructor(width, height) {
9525
+ const ret = wasm.wasmopticalfieldalgebra_new(width, height);
9526
+ this.__wbg_ptr = ret >>> 0;
9527
+ WasmTropicalOpticalAlgebraFinalization.register(this, this.__wbg_ptr, this);
9528
+ return this;
9529
+ }
9530
+ /**
9531
+ * Get algebra width.
9532
+ * @returns {number}
9533
+ */
9534
+ get width() {
9535
+ const ret = wasm.wasmlebesguemeasure_getDimension(this.__wbg_ptr);
9536
+ return ret >>> 0;
9537
+ }
9538
+ /**
9539
+ * Get algebra height.
9540
+ * @returns {number}
9541
+ */
9542
+ get height() {
9543
+ const ret = wasm.wasmmodulispace_getMarkedPoints(this.__wbg_ptr);
9544
+ return ret >>> 0;
9545
+ }
9546
+ }
9547
+
7277
9548
  const WasmTropicalPolynomialFinalization = (typeof FinalizationRegistry === 'undefined')
7278
9549
  ? { register: () => {}, unregister: () => {} }
7279
9550
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmtropicalpolynomial_free(ptr >>> 0, 1));
@@ -7402,6 +9673,166 @@ export class WasmTropicalViterbi {
7402
9673
  }
7403
9674
  }
7404
9675
 
9676
+ const WasmUncertainMultivectorFinalization = (typeof FinalizationRegistry === 'undefined')
9677
+ ? { register: () => {}, unregister: () => {} }
9678
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmuncertainmultivector_free(ptr >>> 0, 1));
9679
+ /**
9680
+ * WASM wrapper for uncertain multivector (mean + covariance)
9681
+ *
9682
+ * Represents a multivector with associated uncertainty, useful for
9683
+ * error propagation through geometric operations.
9684
+ */
9685
+ export class WasmUncertainMultivector {
9686
+
9687
+ static __wrap(ptr) {
9688
+ ptr = ptr >>> 0;
9689
+ const obj = Object.create(WasmUncertainMultivector.prototype);
9690
+ obj.__wbg_ptr = ptr;
9691
+ WasmUncertainMultivectorFinalization.register(obj, obj.__wbg_ptr, obj);
9692
+ return obj;
9693
+ }
9694
+
9695
+ __destroy_into_raw() {
9696
+ const ptr = this.__wbg_ptr;
9697
+ this.__wbg_ptr = 0;
9698
+ WasmUncertainMultivectorFinalization.unregister(this);
9699
+ return ptr;
9700
+ }
9701
+
9702
+ free() {
9703
+ const ptr = this.__destroy_into_raw();
9704
+ wasm.__wbg_wasmuncertainmultivector_free(ptr, 0);
9705
+ }
9706
+ /**
9707
+ * Get standard deviations
9708
+ * @returns {Float64Array}
9709
+ */
9710
+ getStdDevs() {
9711
+ const ret = wasm.wasmuncertainmultivector_getStdDevs(this.__wbg_ptr);
9712
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
9713
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
9714
+ return v1;
9715
+ }
9716
+ /**
9717
+ * Create a deterministic (zero variance) uncertain multivector
9718
+ * @param {Float64Array} value
9719
+ * @returns {WasmUncertainMultivector}
9720
+ */
9721
+ static deterministic(value) {
9722
+ const ptr0 = passArrayF64ToWasm0(value, wasm.__wbindgen_malloc);
9723
+ const len0 = WASM_VECTOR_LEN;
9724
+ const ret = wasm.wasmuncertainmultivector_deterministic(ptr0, len0);
9725
+ if (ret[2]) {
9726
+ throw takeFromExternrefTable0(ret[1]);
9727
+ }
9728
+ return WasmUncertainMultivector.__wrap(ret[0]);
9729
+ }
9730
+ /**
9731
+ * Get variances (diagonal of covariance)
9732
+ * @returns {Float64Array}
9733
+ */
9734
+ getVariances() {
9735
+ const ret = wasm.wasmuncertainmultivector_getVariances(this.__wbg_ptr);
9736
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
9737
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
9738
+ return v1;
9739
+ }
9740
+ /**
9741
+ * Get the covariance matrix (64 values, row-major)
9742
+ * @returns {Float64Array}
9743
+ */
9744
+ getCovariance() {
9745
+ const ret = wasm.wasmuncertainmultivector_getCovariance(this.__wbg_ptr);
9746
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
9747
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
9748
+ return v1;
9749
+ }
9750
+ /**
9751
+ * Create with full covariance matrix
9752
+ *
9753
+ * # Arguments
9754
+ * * `mean` - 8 coefficients for the mean
9755
+ * * `covariance` - 64 values for 8x8 covariance matrix (row-major)
9756
+ * @param {Float64Array} mean
9757
+ * @param {Float64Array} covariance
9758
+ * @returns {WasmUncertainMultivector}
9759
+ */
9760
+ static withCovariance(mean, covariance) {
9761
+ const ptr0 = passArrayF64ToWasm0(mean, wasm.__wbindgen_malloc);
9762
+ const len0 = WASM_VECTOR_LEN;
9763
+ const ptr1 = passArrayF64ToWasm0(covariance, wasm.__wbindgen_malloc);
9764
+ const len1 = WASM_VECTOR_LEN;
9765
+ const ret = wasm.wasmuncertainmultivector_withCovariance(ptr0, len0, ptr1, len1);
9766
+ if (ret[2]) {
9767
+ throw takeFromExternrefTable0(ret[1]);
9768
+ }
9769
+ return WasmUncertainMultivector.__wrap(ret[0]);
9770
+ }
9771
+ /**
9772
+ * Get total variance (trace of covariance)
9773
+ * @returns {number}
9774
+ */
9775
+ getTotalVariance() {
9776
+ const ret = wasm.wasmuncertainmultivector_getTotalVariance(this.__wbg_ptr);
9777
+ return ret;
9778
+ }
9779
+ /**
9780
+ * Add two uncertain multivectors (assuming independence)
9781
+ *
9782
+ * For Z = X + Y: E[Z] = E[X] + E[Y], Var(Z) = Var(X) + Var(Y)
9783
+ * @param {WasmUncertainMultivector} other
9784
+ * @returns {WasmUncertainMultivector}
9785
+ */
9786
+ add(other) {
9787
+ _assertClass(other, WasmUncertainMultivector);
9788
+ const ret = wasm.wasmuncertainmultivector_add(this.__wbg_ptr, other.__wbg_ptr);
9789
+ return WasmUncertainMultivector.__wrap(ret);
9790
+ }
9791
+ /**
9792
+ * Create an uncertain multivector with diagonal covariance
9793
+ *
9794
+ * # Arguments
9795
+ * * `mean` - 8 coefficients for the mean
9796
+ * * `variances` - 8 values for per-coefficient variance
9797
+ * @param {Float64Array} mean
9798
+ * @param {Float64Array} variances
9799
+ */
9800
+ constructor(mean, variances) {
9801
+ const ptr0 = passArrayF64ToWasm0(mean, wasm.__wbindgen_malloc);
9802
+ const len0 = WASM_VECTOR_LEN;
9803
+ const ptr1 = passArrayF64ToWasm0(variances, wasm.__wbindgen_malloc);
9804
+ const len1 = WASM_VECTOR_LEN;
9805
+ const ret = wasm.wasmuncertainmultivector_new(ptr0, len0, ptr1, len1);
9806
+ if (ret[2]) {
9807
+ throw takeFromExternrefTable0(ret[1]);
9808
+ }
9809
+ this.__wbg_ptr = ret[0] >>> 0;
9810
+ WasmUncertainMultivectorFinalization.register(this, this.__wbg_ptr, this);
9811
+ return this;
9812
+ }
9813
+ /**
9814
+ * Linear propagation: scale by a constant
9815
+ *
9816
+ * For Y = aX: E[Y] = aE[X], Var(Y) = a²Var(X)
9817
+ * @param {number} scalar
9818
+ * @returns {WasmUncertainMultivector}
9819
+ */
9820
+ scale(scalar) {
9821
+ const ret = wasm.wasmuncertainmultivector_scale(this.__wbg_ptr, scalar);
9822
+ return WasmUncertainMultivector.__wrap(ret);
9823
+ }
9824
+ /**
9825
+ * Get the mean
9826
+ * @returns {Float64Array}
9827
+ */
9828
+ getMean() {
9829
+ const ret = wasm.wasmuncertainmultivector_getMean(this.__wbg_ptr);
9830
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
9831
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
9832
+ return v1;
9833
+ }
9834
+ }
9835
+
7405
9836
  const WasmUniformMultivectorFinalization = (typeof FinalizationRegistry === 'undefined')
7406
9837
  ? { register: () => {}, unregister: () => {} }
7407
9838
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmuniformmultivector_free(ptr >>> 0, 1));
@@ -7560,6 +9991,69 @@ export class WasmUniformMultivector {
7560
9991
  }
7561
9992
  }
7562
9993
 
9994
+ const WasmWienerProcessFinalization = (typeof FinalizationRegistry === 'undefined')
9995
+ ? { register: () => {}, unregister: () => {} }
9996
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmwienerprocess_free(ptr >>> 0, 1));
9997
+ /**
9998
+ * WASM wrapper for Wiener process (Brownian motion)
9999
+ *
10000
+ * Standard Brownian motion W(t) with W(0) = 0
10001
+ */
10002
+ export class WasmWienerProcess {
10003
+
10004
+ __destroy_into_raw() {
10005
+ const ptr = this.__wbg_ptr;
10006
+ this.__wbg_ptr = 0;
10007
+ WasmWienerProcessFinalization.unregister(this);
10008
+ return ptr;
10009
+ }
10010
+
10011
+ free() {
10012
+ const ptr = this.__destroy_into_raw();
10013
+ wasm.__wbg_wasmwienerprocess_free(ptr, 0);
10014
+ }
10015
+ /**
10016
+ * Sample a path of the Wiener process
10017
+ *
10018
+ * # Arguments
10019
+ * * `t_end` - End time
10020
+ * * `num_steps` - Number of time steps
10021
+ *
10022
+ * Returns flat array: (num_steps + 1) * (dim + 1) values
10023
+ * Each point is [time, w0, w1, ...]
10024
+ * @param {number} t_end
10025
+ * @param {number} num_steps
10026
+ * @returns {Float64Array}
10027
+ */
10028
+ samplePath(t_end, num_steps) {
10029
+ const ret = wasm.wasmwienerprocess_samplePath(this.__wbg_ptr, t_end, num_steps);
10030
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
10031
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
10032
+ return v1;
10033
+ }
10034
+ /**
10035
+ * Create a new Wiener process
10036
+ *
10037
+ * # Arguments
10038
+ * * `dim` - Dimension of the process (default 8 for multivector space)
10039
+ * @param {number | null} [dim]
10040
+ */
10041
+ constructor(dim) {
10042
+ const ret = wasm.wasmwienerprocess_new(isLikeNone(dim) ? 0x100000001 : (dim) >>> 0);
10043
+ this.__wbg_ptr = ret >>> 0;
10044
+ WasmWienerProcessFinalization.register(this, this.__wbg_ptr, this);
10045
+ return this;
10046
+ }
10047
+ /**
10048
+ * Get dimension
10049
+ * @returns {number}
10050
+ */
10051
+ getDim() {
10052
+ const ret = wasm.wasmlebesguemeasure_getDimension(this.__wbg_ptr);
10053
+ return ret >>> 0;
10054
+ }
10055
+ }
10056
+
7563
10057
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
7564
10058
 
7565
10059
  async function __wbg_load(module, imports) {
@@ -7641,7 +10135,7 @@ function __wbg_get_imports() {
7641
10135
  const ret = arg0.length;
7642
10136
  return ret;
7643
10137
  };
7644
- imports.wbg.__wbg_log_7696259bf4d9d36d = function(arg0, arg1) {
10138
+ imports.wbg.__wbg_log_9f891854f8fc562b = function(arg0, arg1) {
7645
10139
  console.log(getStringFromWasm0(arg0, arg1));
7646
10140
  };
7647
10141
  imports.wbg.__wbg_log_ea240990d83e374e = function(arg0) {
@@ -7666,7 +10160,7 @@ function __wbg_get_imports() {
7666
10160
  const a = state0.a;
7667
10161
  state0.a = 0;
7668
10162
  try {
7669
- return __wbg_adapter_511(a, state0.b, arg0, arg1);
10163
+ return __wbg_adapter_683(a, state0.b, arg0, arg1);
7670
10164
  } finally {
7671
10165
  state0.a = a;
7672
10166
  }
@@ -7741,6 +10235,10 @@ function __wbg_get_imports() {
7741
10235
  const ret = WasmCommunity.__wrap(arg0);
7742
10236
  return ret;
7743
10237
  };
10238
+ imports.wbg.__wbg_wasmopticalrotorfield_unwrap = function(arg0) {
10239
+ const ret = WasmOpticalRotorField.__unwrap(arg0);
10240
+ return ret;
10241
+ };
7744
10242
  imports.wbg.__wbg_wasmoptimizationresult_new = function(arg0) {
7745
10243
  const ret = WasmOptimizationResult.__wrap(arg0);
7746
10244
  return ret;
@@ -7766,8 +10264,8 @@ function __wbg_get_imports() {
7766
10264
  const ret = false;
7767
10265
  return ret;
7768
10266
  };
7769
- imports.wbg.__wbindgen_closure_wrapper1647 = function(arg0, arg1, arg2) {
7770
- const ret = makeMutClosure(arg0, arg1, 40, __wbg_adapter_28);
10267
+ imports.wbg.__wbindgen_closure_wrapper1973 = function(arg0, arg1, arg2) {
10268
+ const ret = makeMutClosure(arg0, arg1, 43, __wbg_adapter_30);
7771
10269
  return ret;
7772
10270
  };
7773
10271
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
@@ -7811,6 +10309,14 @@ function __wbg_get_imports() {
7811
10309
  const ret = arg0;
7812
10310
  return ret;
7813
10311
  };
10312
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
10313
+ const obj = arg1;
10314
+ const ret = typeof(obj) === 'string' ? obj : undefined;
10315
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
10316
+ var len1 = WASM_VECTOR_LEN;
10317
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
10318
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
10319
+ };
7814
10320
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
7815
10321
  const ret = getStringFromWasm0(arg0, arg1);
7816
10322
  return ret;
@@ -7830,6 +10336,7 @@ function __wbg_finalize_init(instance, module) {
7830
10336
  wasm = instance.exports;
7831
10337
  __wbg_init.__wbindgen_wasm_module = module;
7832
10338
  cachedDataViewMemory0 = null;
10339
+ cachedFloat32ArrayMemory0 = null;
7833
10340
  cachedFloat64ArrayMemory0 = null;
7834
10341
  cachedUint32ArrayMemory0 = null;
7835
10342
  cachedUint8ArrayMemory0 = null;