@justinelliottcobb/amari-wasm 0.10.0 → 0.12.2

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
@@ -1,71 +1,19 @@
1
1
  let wasm;
2
2
 
3
- function debugString(val) {
4
- // primitive types
5
- const type = typeof val;
6
- if (type == 'number' || type == 'boolean' || val == null) {
7
- return `${val}`;
8
- }
9
- if (type == 'string') {
10
- return `"${val}"`;
11
- }
12
- if (type == 'symbol') {
13
- const description = val.description;
14
- if (description == null) {
15
- return 'Symbol';
16
- } else {
17
- return `Symbol(${description})`;
18
- }
19
- }
20
- if (type == 'function') {
21
- const name = val.name;
22
- if (typeof name == 'string' && name.length > 0) {
23
- return `Function(${name})`;
24
- } else {
25
- return 'Function';
26
- }
27
- }
28
- // objects
29
- if (Array.isArray(val)) {
30
- const length = val.length;
31
- let debug = '[';
32
- if (length > 0) {
33
- debug += debugString(val[0]);
34
- }
35
- for(let i = 1; i < length; i++) {
36
- debug += ', ' + debugString(val[i]);
37
- }
38
- debug += ']';
39
- return debug;
40
- }
41
- // Test for built-in
42
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
43
- let className;
44
- if (builtInMatches && builtInMatches.length > 1) {
45
- className = builtInMatches[1];
46
- } else {
47
- // Failed to match the standard '[object ClassName]'
48
- return toString.call(val);
49
- }
50
- if (className == 'Object') {
51
- // we're a user defined class or Object
52
- // JSON.stringify avoids problems with cycles, and is generally much
53
- // easier than looping through ownProperties of `val`.
54
- try {
55
- return 'Object(' + JSON.stringify(val) + ')';
56
- } catch (_) {
57
- return 'Object';
58
- }
59
- }
60
- // errors
61
- if (val instanceof Error) {
62
- return `${val.name}: ${val.message}\n${val.stack}`;
63
- }
64
- // TODO we could test for more things here, like `Set`s and `Map`s.
65
- return className;
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_export_2.set(idx, obj);
6
+ return idx;
66
7
  }
67
8
 
68
- let WASM_VECTOR_LEN = 0;
9
+ function handleError(f, args) {
10
+ try {
11
+ return f.apply(this, args);
12
+ } catch (e) {
13
+ const idx = addToExternrefTable0(e);
14
+ wasm.__wbindgen_exn_store(idx);
15
+ }
16
+ }
69
17
 
70
18
  let cachedUint8ArrayMemory0 = null;
71
19
 
@@ -76,18 +24,43 @@ function getUint8ArrayMemory0() {
76
24
  return cachedUint8ArrayMemory0;
77
25
  }
78
26
 
79
- const cachedTextEncoder = new TextEncoder();
27
+ let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
80
28
 
81
- if (!('encodeInto' in cachedTextEncoder)) {
82
- cachedTextEncoder.encodeInto = function (arg, view) {
83
- const buf = cachedTextEncoder.encode(arg);
84
- view.set(buf);
85
- return {
86
- read: arg.length,
87
- written: buf.length
88
- };
29
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
30
+
31
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
32
+ let numBytesDecoded = 0;
33
+ function decodeText(ptr, len) {
34
+ numBytesDecoded += len;
35
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
36
+ cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
37
+ cachedTextDecoder.decode();
38
+ numBytesDecoded = len;
89
39
  }
40
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
41
+ }
42
+
43
+ function getStringFromWasm0(ptr, len) {
44
+ ptr = ptr >>> 0;
45
+ return decodeText(ptr, len);
46
+ }
47
+
48
+ let WASM_VECTOR_LEN = 0;
49
+
50
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
51
+
52
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
53
+ ? function (arg, view) {
54
+ return cachedTextEncoder.encodeInto(arg, view);
90
55
  }
56
+ : function (arg, view) {
57
+ const buf = cachedTextEncoder.encode(arg);
58
+ view.set(buf);
59
+ return {
60
+ read: arg.length,
61
+ written: buf.length
62
+ };
63
+ });
91
64
 
92
65
  function passStringToWasm0(arg, malloc, realloc) {
93
66
 
@@ -118,7 +91,7 @@ function passStringToWasm0(arg, malloc, realloc) {
118
91
  }
119
92
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
120
93
  const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
121
- const ret = cachedTextEncoder.encodeInto(arg, view);
94
+ const ret = encodeString(arg, view);
122
95
 
123
96
  offset += ret.written;
124
97
  ptr = realloc(ptr, len, offset, 1) >>> 0;
@@ -141,50 +114,15 @@ function isLikeNone(x) {
141
114
  return x === undefined || x === null;
142
115
  }
143
116
 
144
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
145
-
146
- cachedTextDecoder.decode();
147
-
148
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
149
- let numBytesDecoded = 0;
150
- function decodeText(ptr, len) {
151
- numBytesDecoded += len;
152
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
153
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
154
- cachedTextDecoder.decode();
155
- numBytesDecoded = len;
156
- }
157
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
158
- }
159
-
160
- function getStringFromWasm0(ptr, len) {
161
- ptr = ptr >>> 0;
162
- return decodeText(ptr, len);
163
- }
164
-
165
- function addToExternrefTable0(obj) {
166
- const idx = wasm.__externref_table_alloc();
167
- wasm.__wbindgen_externrefs.set(idx, obj);
168
- return idx;
169
- }
170
-
171
- function handleError(f, args) {
172
- try {
173
- return f.apply(this, args);
174
- } catch (e) {
175
- const idx = addToExternrefTable0(e);
176
- wasm.__wbindgen_exn_store(idx);
177
- }
178
- }
179
-
180
117
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
181
118
  ? { register: () => {}, unregister: () => {} }
182
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
119
+ : new FinalizationRegistry(state => {
120
+ wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
121
+ });
183
122
 
184
123
  function makeMutClosure(arg0, arg1, dtor, f) {
185
124
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
186
125
  const real = (...args) => {
187
-
188
126
  // First up with a closure we increment the internal reference
189
127
  // count. This ensures that the Rust closure environment won't
190
128
  // be deallocated while we're invoking it.
@@ -194,21 +132,84 @@ function makeMutClosure(arg0, arg1, dtor, f) {
194
132
  try {
195
133
  return f(a, state.b, ...args);
196
134
  } finally {
197
- state.a = a;
198
- real._wbg_cb_unref();
199
- }
200
- };
201
- real._wbg_cb_unref = () => {
202
- if (--state.cnt === 0) {
203
- state.dtor(state.a, state.b);
204
- state.a = 0;
205
- CLOSURE_DTORS.unregister(state);
135
+ if (--state.cnt === 0) {
136
+ wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
137
+ CLOSURE_DTORS.unregister(state);
138
+ } else {
139
+ state.a = a;
140
+ }
206
141
  }
207
142
  };
143
+ real.original = state;
208
144
  CLOSURE_DTORS.register(real, state, state);
209
145
  return real;
210
146
  }
211
147
 
148
+ function debugString(val) {
149
+ // primitive types
150
+ const type = typeof val;
151
+ if (type == 'number' || type == 'boolean' || val == null) {
152
+ return `${val}`;
153
+ }
154
+ if (type == 'string') {
155
+ return `"${val}"`;
156
+ }
157
+ if (type == 'symbol') {
158
+ const description = val.description;
159
+ if (description == null) {
160
+ return 'Symbol';
161
+ } else {
162
+ return `Symbol(${description})`;
163
+ }
164
+ }
165
+ if (type == 'function') {
166
+ const name = val.name;
167
+ if (typeof name == 'string' && name.length > 0) {
168
+ return `Function(${name})`;
169
+ } else {
170
+ return 'Function';
171
+ }
172
+ }
173
+ // objects
174
+ if (Array.isArray(val)) {
175
+ const length = val.length;
176
+ let debug = '[';
177
+ if (length > 0) {
178
+ debug += debugString(val[0]);
179
+ }
180
+ for(let i = 1; i < length; i++) {
181
+ debug += ', ' + debugString(val[i]);
182
+ }
183
+ debug += ']';
184
+ return debug;
185
+ }
186
+ // Test for built-in
187
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
188
+ let className;
189
+ if (builtInMatches && builtInMatches.length > 1) {
190
+ className = builtInMatches[1];
191
+ } else {
192
+ // Failed to match the standard '[object ClassName]'
193
+ return toString.call(val);
194
+ }
195
+ if (className == 'Object') {
196
+ // we're a user defined class or Object
197
+ // JSON.stringify avoids problems with cycles, and is generally much
198
+ // easier than looping through ownProperties of `val`.
199
+ try {
200
+ return 'Object(' + JSON.stringify(val) + ')';
201
+ } catch (_) {
202
+ return 'Object';
203
+ }
204
+ }
205
+ // errors
206
+ if (val instanceof Error) {
207
+ return `${val.name}: ${val.message}\n${val.stack}`;
208
+ }
209
+ // TODO we could test for more things here, like `Set`s and `Map`s.
210
+ return className;
211
+ }
212
+
212
213
  let cachedFloat64ArrayMemory0 = null;
213
214
 
214
215
  function getFloat64ArrayMemory0() {
@@ -254,7 +255,7 @@ export function light_deflection_angle(impact_parameter, mass) {
254
255
  }
255
256
 
256
257
  function takeFromExternrefTable0(idx) {
257
- const value = wasm.__wbindgen_externrefs.get(idx);
258
+ const value = wasm.__wbindgen_export_2.get(idx);
258
259
  wasm.__externref_table_dealloc(idx);
259
260
  return value;
260
261
  }
@@ -300,6 +301,13 @@ export function initFusion() {
300
301
  wasm.initFusion();
301
302
  }
302
303
 
304
+ /**
305
+ * Initialize the holographic memory module
306
+ */
307
+ export function initHolographic() {
308
+ wasm.initHolographic();
309
+ }
310
+
303
311
  /**
304
312
  * Integrate a JavaScript function over an interval
305
313
  *
@@ -395,6 +403,11 @@ export function initAutomata() {
395
403
  wasm.initAutomata();
396
404
  }
397
405
 
406
+ function getArrayU8FromWasm0(ptr, len) {
407
+ ptr = ptr >>> 0;
408
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
409
+ }
410
+
398
411
  let cachedUint32ArrayMemory0 = null;
399
412
 
400
413
  function getUint32ArrayMemory0() {
@@ -409,23 +422,18 @@ function getArrayU32FromWasm0(ptr, len) {
409
422
  return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
410
423
  }
411
424
 
412
- function getArrayU8FromWasm0(ptr, len) {
413
- ptr = ptr >>> 0;
414
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
415
- }
416
-
417
425
  function passArray32ToWasm0(arg, malloc) {
418
426
  const ptr = malloc(arg.length * 4, 4) >>> 0;
419
427
  getUint32ArrayMemory0().set(arg, ptr / 4);
420
428
  WASM_VECTOR_LEN = arg.length;
421
429
  return ptr;
422
430
  }
423
- function wasm_bindgen_83f782f110bf2942___convert__closures_____invoke___wasm_bindgen_83f782f110bf2942___JsValue_____(arg0, arg1, arg2) {
424
- wasm.wasm_bindgen_83f782f110bf2942___convert__closures_____invoke___wasm_bindgen_83f782f110bf2942___JsValue_____(arg0, arg1, arg2);
431
+ function __wbg_adapter_28(arg0, arg1, arg2) {
432
+ wasm.closure58_externref_shim(arg0, arg1, arg2);
425
433
  }
426
434
 
427
- function wasm_bindgen_83f782f110bf2942___convert__closures_____invoke___wasm_bindgen_83f782f110bf2942___JsValue__wasm_bindgen_83f782f110bf2942___JsValue_____(arg0, arg1, arg2, arg3) {
428
- wasm.wasm_bindgen_83f782f110bf2942___convert__closures_____invoke___wasm_bindgen_83f782f110bf2942___JsValue__wasm_bindgen_83f782f110bf2942___JsValue_____(arg0, arg1, arg2, arg3);
435
+ function __wbg_adapter_496(arg0, arg1, arg2, arg3) {
436
+ wasm.closure49_externref_shim(arg0, arg1, arg2, arg3);
429
437
  }
430
438
 
431
439
  /**
@@ -542,7 +550,6 @@ export class AutoDiff {
542
550
  return ret[0];
543
551
  }
544
552
  }
545
- if (Symbol.dispose) AutoDiff.prototype[Symbol.dispose] = AutoDiff.prototype.free;
546
553
 
547
554
  const AutomataBatchOperationsFinalization = (typeof FinalizationRegistry === 'undefined')
548
555
  ? { register: () => {}, unregister: () => {} }
@@ -624,7 +631,6 @@ export class AutomataBatchOperations {
624
631
  return v2;
625
632
  }
626
633
  }
627
- if (Symbol.dispose) AutomataBatchOperations.prototype[Symbol.dispose] = AutomataBatchOperations.prototype.free;
628
634
 
629
635
  const AutomataUtilsFinalization = (typeof FinalizationRegistry === 'undefined')
630
636
  ? { register: () => {}, unregister: () => {} }
@@ -704,7 +710,6 @@ export class AutomataUtils {
704
710
  return v1;
705
711
  }
706
712
  }
707
- if (Symbol.dispose) AutomataUtils.prototype[Symbol.dispose] = AutomataUtils.prototype.free;
708
713
 
709
714
  const BatchOperationsFinalization = (typeof FinalizationRegistry === 'undefined')
710
715
  ? { register: () => {}, unregister: () => {} }
@@ -765,7 +770,6 @@ export class BatchOperations {
765
770
  return v3;
766
771
  }
767
772
  }
768
- if (Symbol.dispose) BatchOperations.prototype[Symbol.dispose] = BatchOperations.prototype.free;
769
773
 
770
774
  const BatchOpsFinalization = (typeof FinalizationRegistry === 'undefined')
771
775
  ? { register: () => {}, unregister: () => {} }
@@ -848,7 +852,6 @@ export class BatchOps {
848
852
  return v3;
849
853
  }
850
854
  }
851
- if (Symbol.dispose) BatchOps.prototype[Symbol.dispose] = BatchOps.prototype.free;
852
855
 
853
856
  const EnumerativeBatchFinalization = (typeof FinalizationRegistry === 'undefined')
854
857
  ? { register: () => {}, unregister: () => {} }
@@ -918,7 +921,6 @@ export class EnumerativeBatch {
918
921
  return ret >>> 0;
919
922
  }
920
923
  }
921
- if (Symbol.dispose) EnumerativeBatch.prototype[Symbol.dispose] = EnumerativeBatch.prototype.free;
922
924
 
923
925
  const EnumerativeUtilsFinalization = (typeof FinalizationRegistry === 'undefined')
924
926
  ? { register: () => {}, unregister: () => {} }
@@ -1010,7 +1012,6 @@ export class EnumerativeUtils {
1010
1012
  return ret[0];
1011
1013
  }
1012
1014
  }
1013
- if (Symbol.dispose) EnumerativeUtils.prototype[Symbol.dispose] = EnumerativeUtils.prototype.free;
1014
1015
 
1015
1016
  const FusionBatchOperationsFinalization = (typeof FinalizationRegistry === 'undefined')
1016
1017
  ? { register: () => {}, unregister: () => {} }
@@ -1084,6 +1085,8 @@ export class FusionBatchOperations {
1084
1085
  }
1085
1086
  /**
1086
1087
  * Batch sensitivity analysis for gradient-based optimization
1088
+ *
1089
+ * Note: Using simplified implementation based on gradient norms
1087
1090
  * @param {Float64Array} tdc_batch
1088
1091
  * @param {number} batch_size
1089
1092
  * @returns {Float64Array}
@@ -1135,7 +1138,6 @@ export class FusionBatchOperations {
1135
1138
  return v4;
1136
1139
  }
1137
1140
  }
1138
- if (Symbol.dispose) FusionBatchOperations.prototype[Symbol.dispose] = FusionBatchOperations.prototype.free;
1139
1141
 
1140
1142
  const FusionUtilsFinalization = (typeof FinalizationRegistry === 'undefined')
1141
1143
  ? { register: () => {}, unregister: () => {} }
@@ -1182,6 +1184,8 @@ export class FusionUtils {
1182
1184
  }
1183
1185
  /**
1184
1186
  * Convert softmax probabilities to tropical representation
1187
+ *
1188
+ * Note: Direct conversion helpers are not in v0.12.0, using manual implementation
1185
1189
  * @param {Float64Array} probs
1186
1190
  * @returns {Float64Array}
1187
1191
  */
@@ -1195,6 +1199,8 @@ export class FusionUtils {
1195
1199
  }
1196
1200
  /**
1197
1201
  * Convert tropical numbers back to softmax probabilities
1202
+ *
1203
+ * Note: Direct conversion helpers are not in v0.12.0, using manual implementation
1198
1204
  * @param {Float64Array} tropical_values
1199
1205
  * @returns {Float64Array}
1200
1206
  */
@@ -1207,7 +1213,6 @@ export class FusionUtils {
1207
1213
  return v2;
1208
1214
  }
1209
1215
  }
1210
- if (Symbol.dispose) FusionUtils.prototype[Symbol.dispose] = FusionUtils.prototype.free;
1211
1216
 
1212
1217
  const InfoGeomUtilsFinalization = (typeof FinalizationRegistry === 'undefined')
1213
1218
  ? { register: () => {}, unregister: () => {} }
@@ -1322,50 +1327,139 @@ export class InfoGeomUtils {
1322
1327
  return v2;
1323
1328
  }
1324
1329
  }
1325
- if (Symbol.dispose) InfoGeomUtils.prototype[Symbol.dispose] = InfoGeomUtils.prototype.free;
1326
1330
 
1327
- const MLOpsFinalization = (typeof FinalizationRegistry === 'undefined')
1331
+ const IntegrationFinalization = (typeof FinalizationRegistry === 'undefined')
1328
1332
  ? { register: () => {}, unregister: () => {} }
1329
- : new FinalizationRegistry(ptr => wasm.__wbg_mlops_free(ptr >>> 0, 1));
1333
+ : new FinalizationRegistry(ptr => wasm.__wbg_integration_free(ptr >>> 0, 1));
1330
1334
  /**
1331
- * Advanced machine learning operations using dual numbers
1335
+ * Numerical integration operations
1336
+ *
1337
+ * Provides definite integrals, line integrals, and surface integrals
1338
+ * using adaptive quadrature.
1332
1339
  */
1333
- export class MLOps {
1340
+ export class Integration {
1334
1341
 
1335
1342
  __destroy_into_raw() {
1336
1343
  const ptr = this.__wbg_ptr;
1337
1344
  this.__wbg_ptr = 0;
1338
- MLOpsFinalization.unregister(this);
1345
+ IntegrationFinalization.unregister(this);
1339
1346
  return ptr;
1340
1347
  }
1341
1348
 
1342
1349
  free() {
1343
1350
  const ptr = this.__destroy_into_raw();
1344
- wasm.__wbg_mlops_free(ptr, 0);
1351
+ wasm.__wbg_integration_free(ptr, 0);
1345
1352
  }
1346
1353
  /**
1347
- * Batch apply activation function with gradients
1348
- * @param {Float64Array} inputs
1349
- * @param {string} activation
1350
- * @returns {Float64Array}
1354
+ * Compute 1D definite integral using Simpson's rule
1355
+ *
1356
+ * ∫[a,b] f(x) dx
1357
+ *
1358
+ * # Arguments
1359
+ *
1360
+ * * `func` - JavaScript function to integrate
1361
+ * * `a` - Lower bound
1362
+ * * `b` - Upper bound
1363
+ * * `n` - Number of subdivisions (must be even)
1364
+ *
1365
+ * # Returns
1366
+ *
1367
+ * Integral value
1368
+ *
1369
+ * # JavaScript Example
1370
+ *
1371
+ * ```javascript
1372
+ * // Integrate x^2 from 0 to 1
1373
+ * const result = Integration.integrate1D(x => x*x, 0, 1, 100);
1374
+ * // Returns approximately 0.333...
1375
+ * ```
1376
+ * @param {Function} func
1377
+ * @param {number} a
1378
+ * @param {number} b
1379
+ * @param {number} n
1380
+ * @returns {number}
1351
1381
  */
1352
- static batchActivation(inputs, activation) {
1353
- const ptr0 = passArrayF64ToWasm0(inputs, wasm.__wbindgen_malloc);
1354
- const len0 = WASM_VECTOR_LEN;
1355
- const ptr1 = passStringToWasm0(activation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1356
- const len1 = WASM_VECTOR_LEN;
1357
- const ret = wasm.mlops_batchActivation(ptr0, len0, ptr1, len1);
1358
- if (ret[3]) {
1359
- throw takeFromExternrefTable0(ret[2]);
1382
+ static integrate1D(func, a, b, n) {
1383
+ const ret = wasm.integration_integrate1D(func, a, b, n);
1384
+ if (ret[2]) {
1385
+ throw takeFromExternrefTable0(ret[1]);
1360
1386
  }
1361
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1362
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1363
- return v3;
1387
+ return ret[0];
1364
1388
  }
1365
1389
  /**
1366
- * Compute cross-entropy loss with automatic gradients
1367
- * @param {Float64Array} predictions
1368
- * @param {Float64Array} targets
1390
+ * Compute 2D integral over a rectangle using Simpson's rule
1391
+ *
1392
+ * ∫∫[a,b]×[c,d] f(x,y) dx dy
1393
+ *
1394
+ * # Arguments
1395
+ *
1396
+ * * `func` - JavaScript function (x, y) => f(x, y)
1397
+ * * `ax` - Lower x bound
1398
+ * * `bx` - Upper x bound
1399
+ * * `ay` - Lower y bound
1400
+ * * `by` - Upper y bound
1401
+ * * `nx` - Number of x subdivisions (must be even)
1402
+ * * `ny` - Number of y subdivisions (must be even)
1403
+ * @param {Function} func
1404
+ * @param {number} ax
1405
+ * @param {number} bx
1406
+ * @param {number} ay
1407
+ * @param {number} by
1408
+ * @param {number} nx
1409
+ * @param {number} ny
1410
+ * @returns {number}
1411
+ */
1412
+ static integrate2D(func, ax, bx, ay, by, nx, ny) {
1413
+ const ret = wasm.integration_integrate2D(func, ax, bx, ay, by, nx, ny);
1414
+ if (ret[2]) {
1415
+ throw takeFromExternrefTable0(ret[1]);
1416
+ }
1417
+ return ret[0];
1418
+ }
1419
+ }
1420
+
1421
+ const MLOpsFinalization = (typeof FinalizationRegistry === 'undefined')
1422
+ ? { register: () => {}, unregister: () => {} }
1423
+ : new FinalizationRegistry(ptr => wasm.__wbg_mlops_free(ptr >>> 0, 1));
1424
+ /**
1425
+ * Advanced machine learning operations using dual numbers
1426
+ */
1427
+ export class MLOps {
1428
+
1429
+ __destroy_into_raw() {
1430
+ const ptr = this.__wbg_ptr;
1431
+ this.__wbg_ptr = 0;
1432
+ MLOpsFinalization.unregister(this);
1433
+ return ptr;
1434
+ }
1435
+
1436
+ free() {
1437
+ const ptr = this.__destroy_into_raw();
1438
+ wasm.__wbg_mlops_free(ptr, 0);
1439
+ }
1440
+ /**
1441
+ * Batch apply activation function with gradients
1442
+ * @param {Float64Array} inputs
1443
+ * @param {string} activation
1444
+ * @returns {Float64Array}
1445
+ */
1446
+ static batchActivation(inputs, activation) {
1447
+ const ptr0 = passArrayF64ToWasm0(inputs, wasm.__wbindgen_malloc);
1448
+ const len0 = WASM_VECTOR_LEN;
1449
+ const ptr1 = passStringToWasm0(activation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1450
+ const len1 = WASM_VECTOR_LEN;
1451
+ const ret = wasm.mlops_batchActivation(ptr0, len0, ptr1, len1);
1452
+ if (ret[3]) {
1453
+ throw takeFromExternrefTable0(ret[2]);
1454
+ }
1455
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1456
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1457
+ return v3;
1458
+ }
1459
+ /**
1460
+ * Compute cross-entropy loss with automatic gradients
1461
+ * @param {Float64Array} predictions
1462
+ * @param {Float64Array} targets
1369
1463
  * @returns {WasmDualNumber}
1370
1464
  */
1371
1465
  static crossEntropyLoss(predictions, targets) {
@@ -1413,7 +1507,6 @@ export class MLOps {
1413
1507
  return v2;
1414
1508
  }
1415
1509
  }
1416
- if (Symbol.dispose) MLOps.prototype[Symbol.dispose] = MLOps.prototype.free;
1417
1510
 
1418
1511
  const NetworkUtilsFinalization = (typeof FinalizationRegistry === 'undefined')
1419
1512
  ? { register: () => {}, unregister: () => {} }
@@ -1472,7 +1565,164 @@ export class NetworkUtils {
1472
1565
  return WasmGeometricNetwork.__wrap(ret[0]);
1473
1566
  }
1474
1567
  }
1475
- if (Symbol.dispose) NetworkUtils.prototype[Symbol.dispose] = NetworkUtils.prototype.free;
1568
+
1569
+ const NumericalDerivativeFinalization = (typeof FinalizationRegistry === 'undefined')
1570
+ ? { register: () => {}, unregister: () => {} }
1571
+ : new FinalizationRegistry(ptr => wasm.__wbg_numericalderivative_free(ptr >>> 0, 1));
1572
+ /**
1573
+ * Numerical derivative operations
1574
+ *
1575
+ * Provides gradient, divergence, curl, and Laplacian computations
1576
+ * using centered finite differences.
1577
+ */
1578
+ export class NumericalDerivative {
1579
+
1580
+ __destroy_into_raw() {
1581
+ const ptr = this.__wbg_ptr;
1582
+ this.__wbg_ptr = 0;
1583
+ NumericalDerivativeFinalization.unregister(this);
1584
+ return ptr;
1585
+ }
1586
+
1587
+ free() {
1588
+ const ptr = this.__destroy_into_raw();
1589
+ wasm.__wbg_numericalderivative_free(ptr, 0);
1590
+ }
1591
+ /**
1592
+ * Compute divergence of a vector field at a point
1593
+ *
1594
+ * ∇·F = ∂Fx/∂x + ∂Fy/∂y + ∂Fz/∂z
1595
+ *
1596
+ * # Arguments
1597
+ *
1598
+ * * `field` - Vector field
1599
+ * * `point` - Evaluation point
1600
+ *
1601
+ * # Returns
1602
+ *
1603
+ * Divergence (scalar)
1604
+ * @param {VectorField} field
1605
+ * @param {Float64Array} point
1606
+ * @returns {number}
1607
+ */
1608
+ divergence(field, point) {
1609
+ _assertClass(field, VectorField);
1610
+ const ptr0 = passArrayF64ToWasm0(point, wasm.__wbindgen_malloc);
1611
+ const len0 = WASM_VECTOR_LEN;
1612
+ const ret = wasm.numericalderivative_divergence(this.__wbg_ptr, field.__wbg_ptr, ptr0, len0);
1613
+ if (ret[2]) {
1614
+ throw takeFromExternrefTable0(ret[1]);
1615
+ }
1616
+ return ret[0];
1617
+ }
1618
+ /**
1619
+ * Create a new numerical derivative computer
1620
+ *
1621
+ * # Arguments
1622
+ *
1623
+ * * `step_size` - Optional step size for finite differences (default: 1e-5)
1624
+ * @param {number | null} [step_size]
1625
+ */
1626
+ constructor(step_size) {
1627
+ const ret = wasm.numericalderivative_new(!isLikeNone(step_size), isLikeNone(step_size) ? 0 : step_size);
1628
+ this.__wbg_ptr = ret >>> 0;
1629
+ NumericalDerivativeFinalization.register(this, this.__wbg_ptr, this);
1630
+ return this;
1631
+ }
1632
+ /**
1633
+ * Compute curl of a 3D vector field at a point
1634
+ *
1635
+ * ∇×F = [∂Fz/∂y - ∂Fy/∂z, ∂Fx/∂z - ∂Fz/∂x, ∂Fy/∂x - ∂Fx/∂y]
1636
+ *
1637
+ * # Arguments
1638
+ *
1639
+ * * `field` - 3D vector field
1640
+ * * `point` - Evaluation point [x, y, z]
1641
+ *
1642
+ * # Returns
1643
+ *
1644
+ * Curl vector [cx, cy, cz]
1645
+ * @param {VectorField} field
1646
+ * @param {Float64Array} point
1647
+ * @returns {Float64Array}
1648
+ */
1649
+ curl(field, point) {
1650
+ _assertClass(field, VectorField);
1651
+ const ptr0 = passArrayF64ToWasm0(point, wasm.__wbindgen_malloc);
1652
+ const len0 = WASM_VECTOR_LEN;
1653
+ const ret = wasm.numericalderivative_curl(this.__wbg_ptr, field.__wbg_ptr, ptr0, len0);
1654
+ if (ret[3]) {
1655
+ throw takeFromExternrefTable0(ret[2]);
1656
+ }
1657
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1658
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1659
+ return v2;
1660
+ }
1661
+ /**
1662
+ * Compute gradient of a scalar field at a point
1663
+ *
1664
+ * ∇f = [∂f/∂x, ∂f/∂y, ∂f/∂z]
1665
+ *
1666
+ * # Arguments
1667
+ *
1668
+ * * `field` - Scalar field
1669
+ * * `point` - Evaluation point
1670
+ *
1671
+ * # Returns
1672
+ *
1673
+ * Gradient vector
1674
+ *
1675
+ * # JavaScript Example
1676
+ *
1677
+ * ```javascript
1678
+ * const field = ScalarField.fromFunction2D((x, y) => x*x + y*y);
1679
+ * const derivative = new NumericalDerivative();
1680
+ * const grad = derivative.gradient(field, [1.0, 2.0]); // Returns [2.0, 4.0]
1681
+ * ```
1682
+ * @param {ScalarField} field
1683
+ * @param {Float64Array} point
1684
+ * @returns {Float64Array}
1685
+ */
1686
+ gradient(field, point) {
1687
+ _assertClass(field, ScalarField);
1688
+ const ptr0 = passArrayF64ToWasm0(point, wasm.__wbindgen_malloc);
1689
+ const len0 = WASM_VECTOR_LEN;
1690
+ const ret = wasm.numericalderivative_gradient(this.__wbg_ptr, field.__wbg_ptr, ptr0, len0);
1691
+ if (ret[3]) {
1692
+ throw takeFromExternrefTable0(ret[2]);
1693
+ }
1694
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1695
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1696
+ return v2;
1697
+ }
1698
+ /**
1699
+ * Compute Laplacian of a scalar field at a point
1700
+ *
1701
+ * ∇²f = ∂²f/∂x² + ∂²f/∂y² + ∂²f/∂z²
1702
+ *
1703
+ * # Arguments
1704
+ *
1705
+ * * `field` - Scalar field
1706
+ * * `point` - Evaluation point
1707
+ *
1708
+ * # Returns
1709
+ *
1710
+ * Laplacian (scalar)
1711
+ * @param {ScalarField} field
1712
+ * @param {Float64Array} point
1713
+ * @returns {number}
1714
+ */
1715
+ laplacian(field, point) {
1716
+ _assertClass(field, ScalarField);
1717
+ const ptr0 = passArrayF64ToWasm0(point, wasm.__wbindgen_malloc);
1718
+ const len0 = WASM_VECTOR_LEN;
1719
+ const ret = wasm.numericalderivative_laplacian(this.__wbg_ptr, field.__wbg_ptr, ptr0, len0);
1720
+ if (ret[2]) {
1721
+ throw takeFromExternrefTable0(ret[1]);
1722
+ }
1723
+ return ret[0];
1724
+ }
1725
+ }
1476
1726
 
1477
1727
  const PerformanceOperationsFinalization = (typeof FinalizationRegistry === 'undefined')
1478
1728
  ? { register: () => {}, unregister: () => {} }
@@ -1554,7 +1804,356 @@ export class PerformanceOperations {
1554
1804
  return v3;
1555
1805
  }
1556
1806
  }
1557
- if (Symbol.dispose) PerformanceOperations.prototype[Symbol.dispose] = PerformanceOperations.prototype.free;
1807
+
1808
+ const RiemannianManifoldFinalization = (typeof FinalizationRegistry === 'undefined')
1809
+ ? { register: () => {}, unregister: () => {} }
1810
+ : new FinalizationRegistry(ptr => wasm.__wbg_riemannianmanifold_free(ptr >>> 0, 1));
1811
+ /**
1812
+ * Riemannian manifold with metric tensor
1813
+ *
1814
+ * Represents a curved space with a metric that defines distances and angles.
1815
+ *
1816
+ * # JavaScript Example
1817
+ *
1818
+ * ```javascript
1819
+ * // Create a 2D sphere of radius 1
1820
+ * const sphere = RiemannianManifold.sphere(1.0);
1821
+ *
1822
+ * // Compute scalar curvature at the north pole
1823
+ * const R = sphere.scalarCurvature([0.0, 0.0]); // Returns 2.0 for unit sphere
1824
+ * ```
1825
+ */
1826
+ export class RiemannianManifold {
1827
+
1828
+ static __wrap(ptr) {
1829
+ ptr = ptr >>> 0;
1830
+ const obj = Object.create(RiemannianManifold.prototype);
1831
+ obj.__wbg_ptr = ptr;
1832
+ RiemannianManifoldFinalization.register(obj, obj.__wbg_ptr, obj);
1833
+ return obj;
1834
+ }
1835
+
1836
+ __destroy_into_raw() {
1837
+ const ptr = this.__wbg_ptr;
1838
+ this.__wbg_ptr = 0;
1839
+ RiemannianManifoldFinalization.unregister(this);
1840
+ return ptr;
1841
+ }
1842
+
1843
+ free() {
1844
+ const ptr = this.__destroy_into_raw();
1845
+ wasm.__wbg_riemannianmanifold_free(ptr, 0);
1846
+ }
1847
+ /**
1848
+ * Create a 2D hyperbolic plane (Poincaré half-plane model)
1849
+ *
1850
+ * Metric: ds² = (dx² + dy²) / y²
1851
+ * @returns {RiemannianManifold}
1852
+ */
1853
+ static hyperbolic() {
1854
+ const ret = wasm.riemannianmanifold_hyperbolic();
1855
+ return RiemannianManifold.__wrap(ret);
1856
+ }
1857
+ /**
1858
+ * Compute Christoffel symbol Γ^k_ij at a point
1859
+ *
1860
+ * # Arguments
1861
+ *
1862
+ * * `k` - Upper index
1863
+ * * `i` - First lower index
1864
+ * * `j` - Second lower index
1865
+ * * `coords` - Coordinates
1866
+ * @param {number} k
1867
+ * @param {number} i
1868
+ * @param {number} j
1869
+ * @param {Float64Array} coords
1870
+ * @returns {number}
1871
+ */
1872
+ christoffel(k, i, j, coords) {
1873
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1874
+ const len0 = WASM_VECTOR_LEN;
1875
+ const ret = wasm.riemannianmanifold_christoffel(this.__wbg_ptr, k, i, j, ptr0, len0);
1876
+ if (ret[2]) {
1877
+ throw takeFromExternrefTable0(ret[1]);
1878
+ }
1879
+ return ret[0];
1880
+ }
1881
+ /**
1882
+ * Compute Ricci tensor component R_ij
1883
+ *
1884
+ * # Arguments
1885
+ *
1886
+ * * `i` - First index
1887
+ * * `j` - Second index
1888
+ * * `coords` - Coordinates
1889
+ * @param {number} i
1890
+ * @param {number} j
1891
+ * @param {Float64Array} coords
1892
+ * @returns {number}
1893
+ */
1894
+ ricciTensor(i, j, coords) {
1895
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1896
+ const len0 = WASM_VECTOR_LEN;
1897
+ const ret = wasm.riemannianmanifold_ricciTensor(this.__wbg_ptr, i, j, ptr0, len0);
1898
+ if (ret[2]) {
1899
+ throw takeFromExternrefTable0(ret[1]);
1900
+ }
1901
+ return ret[0];
1902
+ }
1903
+ /**
1904
+ * Compute Riemann curvature tensor component R^i_jkl
1905
+ *
1906
+ * # Arguments
1907
+ *
1908
+ * * `i` - Upper index
1909
+ * * `j` - First lower index
1910
+ * * `k` - Second lower index
1911
+ * * `l` - Third lower index
1912
+ * * `coords` - Coordinates
1913
+ * @param {number} i
1914
+ * @param {number} j
1915
+ * @param {number} k
1916
+ * @param {number} l
1917
+ * @param {Float64Array} coords
1918
+ * @returns {number}
1919
+ */
1920
+ riemannTensor(i, j, k, l, coords) {
1921
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1922
+ const len0 = WASM_VECTOR_LEN;
1923
+ const ret = wasm.riemannianmanifold_riemannTensor(this.__wbg_ptr, i, j, k, l, ptr0, len0);
1924
+ if (ret[2]) {
1925
+ throw takeFromExternrefTable0(ret[1]);
1926
+ }
1927
+ return ret[0];
1928
+ }
1929
+ /**
1930
+ * Compute scalar curvature R
1931
+ *
1932
+ * # Arguments
1933
+ *
1934
+ * * `coords` - Coordinates
1935
+ *
1936
+ * # Returns
1937
+ *
1938
+ * Scalar curvature value
1939
+ * @param {Float64Array} coords
1940
+ * @returns {number}
1941
+ */
1942
+ scalarCurvature(coords) {
1943
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1944
+ const len0 = WASM_VECTOR_LEN;
1945
+ const ret = wasm.riemannianmanifold_scalarCurvature(this.__wbg_ptr, ptr0, len0);
1946
+ if (ret[2]) {
1947
+ throw takeFromExternrefTable0(ret[1]);
1948
+ }
1949
+ return ret[0];
1950
+ }
1951
+ /**
1952
+ * Create a 2D sphere of given radius
1953
+ *
1954
+ * Metric: ds² = dθ² + sin²θ dφ²
1955
+ *
1956
+ * # Arguments
1957
+ *
1958
+ * * `radius` - Sphere radius
1959
+ * @param {number} radius
1960
+ * @returns {RiemannianManifold}
1961
+ */
1962
+ static sphere(radius) {
1963
+ const ret = wasm.riemannianmanifold_sphere(radius);
1964
+ if (ret[2]) {
1965
+ throw takeFromExternrefTable0(ret[1]);
1966
+ }
1967
+ return RiemannianManifold.__wrap(ret[0]);
1968
+ }
1969
+ /**
1970
+ * Compute geodesic trajectory
1971
+ *
1972
+ * Solves the geodesic equations using RK4 integration.
1973
+ *
1974
+ * # Arguments
1975
+ *
1976
+ * * `initial_pos` - Initial position
1977
+ * * `initial_vel` - Initial velocity
1978
+ * * `t_max` - Maximum time
1979
+ * * `dt` - Time step
1980
+ *
1981
+ * # Returns
1982
+ *
1983
+ * Flat array of trajectory points and velocities:
1984
+ * [x0, y0, vx0, vy0, x1, y1, vx1, vy1, ...]
1985
+ * @param {Float64Array} initial_pos
1986
+ * @param {Float64Array} initial_vel
1987
+ * @param {number} t_max
1988
+ * @param {number} dt
1989
+ * @returns {Float64Array}
1990
+ */
1991
+ geodesic(initial_pos, initial_vel, t_max, dt) {
1992
+ const ptr0 = passArrayF64ToWasm0(initial_pos, wasm.__wbindgen_malloc);
1993
+ const len0 = WASM_VECTOR_LEN;
1994
+ const ptr1 = passArrayF64ToWasm0(initial_vel, wasm.__wbindgen_malloc);
1995
+ const len1 = WASM_VECTOR_LEN;
1996
+ const ret = wasm.riemannianmanifold_geodesic(this.__wbg_ptr, ptr0, len0, ptr1, len1, t_max, dt);
1997
+ if (ret[3]) {
1998
+ throw takeFromExternrefTable0(ret[2]);
1999
+ }
2000
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2001
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2002
+ return v3;
2003
+ }
2004
+ /**
2005
+ * Get the dimension of the manifold
2006
+ * @returns {number}
2007
+ */
2008
+ get dimension() {
2009
+ const ret = wasm.riemannianmanifold_dimension(this.__wbg_ptr);
2010
+ return ret >>> 0;
2011
+ }
2012
+ /**
2013
+ * Create a Euclidean (flat) manifold
2014
+ *
2015
+ * # Arguments
2016
+ *
2017
+ * * `dimension` - Dimension (2 or 3)
2018
+ * @param {number} dimension
2019
+ * @returns {RiemannianManifold}
2020
+ */
2021
+ static euclidean(dimension) {
2022
+ const ret = wasm.riemannianmanifold_euclidean(dimension);
2023
+ if (ret[2]) {
2024
+ throw takeFromExternrefTable0(ret[1]);
2025
+ }
2026
+ return RiemannianManifold.__wrap(ret[0]);
2027
+ }
2028
+ }
2029
+
2030
+ const ScalarFieldFinalization = (typeof FinalizationRegistry === 'undefined')
2031
+ ? { register: () => {}, unregister: () => {} }
2032
+ : new FinalizationRegistry(ptr => wasm.__wbg_scalarfield_free(ptr >>> 0, 1));
2033
+ /**
2034
+ * Scalar field f: ℝⁿ → ℝ
2035
+ *
2036
+ * Represents a function that maps points in n-dimensional space to real numbers.
2037
+ *
2038
+ * # JavaScript Example
2039
+ *
2040
+ * ```javascript
2041
+ * // Create a scalar field f(x, y) = x² + y²
2042
+ * const field = WasmScalarField.fromFunction2D((x, y) => x*x + y*y);
2043
+ *
2044
+ * // Evaluate at a point
2045
+ * const value = field.evaluate([1.0, 2.0]); // Returns 5.0
2046
+ * ```
2047
+ */
2048
+ export class ScalarField {
2049
+
2050
+ static __wrap(ptr) {
2051
+ ptr = ptr >>> 0;
2052
+ const obj = Object.create(ScalarField.prototype);
2053
+ obj.__wbg_ptr = ptr;
2054
+ ScalarFieldFinalization.register(obj, obj.__wbg_ptr, obj);
2055
+ return obj;
2056
+ }
2057
+
2058
+ __destroy_into_raw() {
2059
+ const ptr = this.__wbg_ptr;
2060
+ this.__wbg_ptr = 0;
2061
+ ScalarFieldFinalization.unregister(this);
2062
+ return ptr;
2063
+ }
2064
+
2065
+ free() {
2066
+ const ptr = this.__destroy_into_raw();
2067
+ wasm.__wbg_scalarfield_free(ptr, 0);
2068
+ }
2069
+ /**
2070
+ * Batch evaluate the field at multiple points
2071
+ *
2072
+ * # Arguments
2073
+ *
2074
+ * * `points` - Array of points as flat array [x1, y1, x2, y2, ...]
2075
+ *
2076
+ * # Returns
2077
+ *
2078
+ * Array of field values
2079
+ * @param {Float64Array} points
2080
+ * @returns {Float64Array}
2081
+ */
2082
+ batchEvaluate(points) {
2083
+ const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
2084
+ const len0 = WASM_VECTOR_LEN;
2085
+ const ret = wasm.scalarfield_batchEvaluate(this.__wbg_ptr, ptr0, len0);
2086
+ if (ret[3]) {
2087
+ throw takeFromExternrefTable0(ret[2]);
2088
+ }
2089
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2090
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2091
+ return v2;
2092
+ }
2093
+ /**
2094
+ * Create a 2D scalar field from a JavaScript function
2095
+ *
2096
+ * # Arguments
2097
+ *
2098
+ * * `func` - JavaScript function (x, y) => f(x, y)
2099
+ * @param {Function} func
2100
+ * @returns {ScalarField}
2101
+ */
2102
+ static fromFunction2D(func) {
2103
+ const ret = wasm.scalarfield_fromFunction2D(func);
2104
+ return ScalarField.__wrap(ret);
2105
+ }
2106
+ /**
2107
+ * Create a 3D scalar field from a JavaScript function
2108
+ *
2109
+ * # Arguments
2110
+ *
2111
+ * * `func` - JavaScript function (x, y, z) => f(x, y, z)
2112
+ * @param {Function} func
2113
+ * @returns {ScalarField}
2114
+ */
2115
+ static fromFunction3D(func) {
2116
+ const ret = wasm.scalarfield_fromFunction3D(func);
2117
+ return ScalarField.__wrap(ret);
2118
+ }
2119
+ /**
2120
+ * Create a 2D scalar field from a JavaScript function
2121
+ *
2122
+ * # Arguments
2123
+ *
2124
+ * * `func` - JavaScript function (x, y) => f(x, y)
2125
+ * @param {Function} func
2126
+ * @param {number} dimension
2127
+ */
2128
+ constructor(func, dimension) {
2129
+ const ret = wasm.scalarfield_new(func, dimension);
2130
+ this.__wbg_ptr = ret >>> 0;
2131
+ ScalarFieldFinalization.register(this, this.__wbg_ptr, this);
2132
+ return this;
2133
+ }
2134
+ /**
2135
+ * Evaluate the scalar field at a point
2136
+ *
2137
+ * # Arguments
2138
+ *
2139
+ * * `point` - Coordinates [x, y] or [x, y, z]
2140
+ *
2141
+ * # Returns
2142
+ *
2143
+ * Field value at the point
2144
+ * @param {Float64Array} point
2145
+ * @returns {number}
2146
+ */
2147
+ evaluate(point) {
2148
+ const ptr0 = passArrayF64ToWasm0(point, wasm.__wbindgen_malloc);
2149
+ const len0 = WASM_VECTOR_LEN;
2150
+ const ret = wasm.scalarfield_evaluate(this.__wbg_ptr, ptr0, len0);
2151
+ if (ret[2]) {
2152
+ throw takeFromExternrefTable0(ret[1]);
2153
+ }
2154
+ return ret[0];
2155
+ }
2156
+ }
1558
2157
 
1559
2158
  const TropicalBatchFinalization = (typeof FinalizationRegistry === 'undefined')
1560
2159
  ? { register: () => {}, unregister: () => {} }
@@ -1632,7 +2231,6 @@ export class TropicalBatch {
1632
2231
  return ret;
1633
2232
  }
1634
2233
  }
1635
- if (Symbol.dispose) TropicalBatch.prototype[Symbol.dispose] = TropicalBatch.prototype.free;
1636
2234
 
1637
2235
  const TropicalMLOpsFinalization = (typeof FinalizationRegistry === 'undefined')
1638
2236
  ? { register: () => {}, unregister: () => {} }
@@ -1658,45 +2256,146 @@ export class TropicalMLOps {
1658
2256
  * @param {any} distance_matrix
1659
2257
  * @returns {Array<any>}
1660
2258
  */
1661
- static shortestPaths(distance_matrix) {
1662
- const ret = wasm.tropicalmlops_shortestPaths(distance_matrix);
1663
- if (ret[2]) {
1664
- throw takeFromExternrefTable0(ret[1]);
1665
- }
1666
- return takeFromExternrefTable0(ret[0]);
2259
+ static shortestPaths(distance_matrix) {
2260
+ const ret = wasm.tropicalmlops_shortestPaths(distance_matrix);
2261
+ if (ret[2]) {
2262
+ throw takeFromExternrefTable0(ret[1]);
2263
+ }
2264
+ return takeFromExternrefTable0(ret[0]);
2265
+ }
2266
+ /**
2267
+ * Compute tropical matrix multiplication for pathfinding
2268
+ * @param {any} a
2269
+ * @param {any} b
2270
+ * @returns {Array<any>}
2271
+ */
2272
+ static matrixMultiply(a, b) {
2273
+ const ret = wasm.tropicalmlops_matrixMultiply(a, b);
2274
+ if (ret[2]) {
2275
+ throw takeFromExternrefTable0(ret[1]);
2276
+ }
2277
+ return takeFromExternrefTable0(ret[0]);
2278
+ }
2279
+ /**
2280
+ * Compute tropical convex combination (used in optimization)
2281
+ * @param {Float64Array} values
2282
+ * @param {Float64Array} weights
2283
+ * @returns {number}
2284
+ */
2285
+ static convexCombination(values, weights) {
2286
+ const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
2287
+ const len0 = WASM_VECTOR_LEN;
2288
+ const ptr1 = passArrayF64ToWasm0(weights, wasm.__wbindgen_malloc);
2289
+ const len1 = WASM_VECTOR_LEN;
2290
+ const ret = wasm.tropicalmlops_convexCombination(ptr0, len0, ptr1, len1);
2291
+ if (ret[2]) {
2292
+ throw takeFromExternrefTable0(ret[1]);
2293
+ }
2294
+ return ret[0];
2295
+ }
2296
+ }
2297
+
2298
+ const VectorFieldFinalization = (typeof FinalizationRegistry === 'undefined')
2299
+ ? { register: () => {}, unregister: () => {} }
2300
+ : new FinalizationRegistry(ptr => wasm.__wbg_vectorfield_free(ptr >>> 0, 1));
2301
+ /**
2302
+ * Vector field F: ℝⁿ → ℝⁿ
2303
+ *
2304
+ * Represents a function that maps points to vectors.
2305
+ *
2306
+ * # JavaScript Example
2307
+ *
2308
+ * ```javascript
2309
+ * // Create a 2D vector field F(x, y) = [y, -x] (rotation)
2310
+ * const field = WasmVectorField.fromFunction2D((x, y) => [y, -x]);
2311
+ *
2312
+ * // Evaluate at a point
2313
+ * const vector = field.evaluate([1.0, 2.0]); // Returns [2.0, -1.0]
2314
+ * ```
2315
+ */
2316
+ export class VectorField {
2317
+
2318
+ static __wrap(ptr) {
2319
+ ptr = ptr >>> 0;
2320
+ const obj = Object.create(VectorField.prototype);
2321
+ obj.__wbg_ptr = ptr;
2322
+ VectorFieldFinalization.register(obj, obj.__wbg_ptr, obj);
2323
+ return obj;
2324
+ }
2325
+
2326
+ __destroy_into_raw() {
2327
+ const ptr = this.__wbg_ptr;
2328
+ this.__wbg_ptr = 0;
2329
+ VectorFieldFinalization.unregister(this);
2330
+ return ptr;
2331
+ }
2332
+
2333
+ free() {
2334
+ const ptr = this.__destroy_into_raw();
2335
+ wasm.__wbg_vectorfield_free(ptr, 0);
2336
+ }
2337
+ /**
2338
+ * Create a 2D vector field from a JavaScript function
2339
+ *
2340
+ * # Arguments
2341
+ *
2342
+ * * `func` - JavaScript function (x, y) => [fx, fy]
2343
+ * @param {Function} func
2344
+ * @returns {VectorField}
2345
+ */
2346
+ static fromFunction2D(func) {
2347
+ const ret = wasm.vectorfield_fromFunction2D(func);
2348
+ return VectorField.__wrap(ret);
2349
+ }
2350
+ /**
2351
+ * Create a 3D vector field from a JavaScript function
2352
+ *
2353
+ * # Arguments
2354
+ *
2355
+ * * `func` - JavaScript function (x, y, z) => [fx, fy, fz]
2356
+ * @param {Function} func
2357
+ * @returns {VectorField}
2358
+ */
2359
+ static fromFunction3D(func) {
2360
+ const ret = wasm.vectorfield_fromFunction3D(func);
2361
+ return VectorField.__wrap(ret);
1667
2362
  }
1668
2363
  /**
1669
- * Compute tropical matrix multiplication for pathfinding
1670
- * @param {any} a
1671
- * @param {any} b
1672
- * @returns {Array<any>}
2364
+ * Create a vector field from a JavaScript function
2365
+ * @param {Function} func
2366
+ * @param {number} dimension
1673
2367
  */
1674
- static matrixMultiply(a, b) {
1675
- const ret = wasm.tropicalmlops_matrixMultiply(a, b);
1676
- if (ret[2]) {
1677
- throw takeFromExternrefTable0(ret[1]);
1678
- }
1679
- return takeFromExternrefTable0(ret[0]);
2368
+ constructor(func, dimension) {
2369
+ const ret = wasm.vectorfield_new(func, dimension);
2370
+ this.__wbg_ptr = ret >>> 0;
2371
+ VectorFieldFinalization.register(this, this.__wbg_ptr, this);
2372
+ return this;
1680
2373
  }
1681
2374
  /**
1682
- * Compute tropical convex combination (used in optimization)
1683
- * @param {Float64Array} values
1684
- * @param {Float64Array} weights
1685
- * @returns {number}
2375
+ * Evaluate the vector field at a point
2376
+ *
2377
+ * # Arguments
2378
+ *
2379
+ * * `point` - Coordinates [x, y] or [x, y, z]
2380
+ *
2381
+ * # Returns
2382
+ *
2383
+ * Vector at the point
2384
+ * @param {Float64Array} point
2385
+ * @returns {Float64Array}
1686
2386
  */
1687
- static convexCombination(values, weights) {
1688
- const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
2387
+ evaluate(point) {
2388
+ const ptr0 = passArrayF64ToWasm0(point, wasm.__wbindgen_malloc);
1689
2389
  const len0 = WASM_VECTOR_LEN;
1690
- const ptr1 = passArrayF64ToWasm0(weights, wasm.__wbindgen_malloc);
1691
- const len1 = WASM_VECTOR_LEN;
1692
- const ret = wasm.tropicalmlops_convexCombination(ptr0, len0, ptr1, len1);
1693
- if (ret[2]) {
1694
- throw takeFromExternrefTable0(ret[1]);
2390
+ const ret = wasm.vectorfield_evaluate(this.__wbg_ptr, ptr0, len0);
2391
+ if (ret[3]) {
2392
+ throw takeFromExternrefTable0(ret[2]);
1695
2393
  }
1696
- return ret[0];
2394
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2395
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2396
+ return v2;
1697
2397
  }
1698
2398
  }
1699
- if (Symbol.dispose) TropicalMLOps.prototype[Symbol.dispose] = TropicalMLOps.prototype.free;
1700
2399
 
1701
2400
  const WasmAlphaConnectionFinalization = (typeof FinalizationRegistry === 'undefined')
1702
2401
  ? { register: () => {}, unregister: () => {} }
@@ -1763,7 +2462,6 @@ export class WasmAlphaConnection {
1763
2462
  return ret;
1764
2463
  }
1765
2464
  }
1766
- if (Symbol.dispose) WasmAlphaConnection.prototype[Symbol.dispose] = WasmAlphaConnection.prototype.free;
1767
2465
 
1768
2466
  const WasmChowClassFinalization = (typeof FinalizationRegistry === 'undefined')
1769
2467
  ? { register: () => {}, unregister: () => {} }
@@ -1873,7 +2571,67 @@ export class WasmChowClass {
1873
2571
  return WasmChowClass.__wrap(ret);
1874
2572
  }
1875
2573
  }
1876
- if (Symbol.dispose) WasmChowClass.prototype[Symbol.dispose] = WasmChowClass.prototype.free;
2574
+
2575
+ const WasmCleanupResultFinalization = (typeof FinalizationRegistry === 'undefined')
2576
+ ? { register: () => {}, unregister: () => {} }
2577
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmcleanupresult_free(ptr >>> 0, 1));
2578
+ /**
2579
+ * WASM wrapper for cleanup results
2580
+ */
2581
+ export class WasmCleanupResult {
2582
+
2583
+ static __wrap(ptr) {
2584
+ ptr = ptr >>> 0;
2585
+ const obj = Object.create(WasmCleanupResult.prototype);
2586
+ obj.__wbg_ptr = ptr;
2587
+ WasmCleanupResultFinalization.register(obj, obj.__wbg_ptr, obj);
2588
+ return obj;
2589
+ }
2590
+
2591
+ __destroy_into_raw() {
2592
+ const ptr = this.__wbg_ptr;
2593
+ this.__wbg_ptr = 0;
2594
+ WasmCleanupResultFinalization.unregister(this);
2595
+ return ptr;
2596
+ }
2597
+
2598
+ free() {
2599
+ const ptr = this.__destroy_into_raw();
2600
+ wasm.__wbg_wasmcleanupresult_free(ptr, 0);
2601
+ }
2602
+ /**
2603
+ * Get the cleaned (denoised) value
2604
+ * @returns {WasmTropicalDualClifford}
2605
+ */
2606
+ getCleaned() {
2607
+ const ret = wasm.wasmcleanupresult_getCleaned(this.__wbg_ptr);
2608
+ return WasmTropicalDualClifford.__wrap(ret);
2609
+ }
2610
+ /**
2611
+ * Check if the cleanup converged
2612
+ * @returns {boolean}
2613
+ */
2614
+ didConverge() {
2615
+ const ret = wasm.wasmcleanupresult_didConverge(this.__wbg_ptr);
2616
+ return ret !== 0;
2617
+ }
2618
+ /**
2619
+ * Get the number of iterations used
2620
+ * @returns {number}
2621
+ */
2622
+ getIterations() {
2623
+ const ret = wasm.wasmcleanupresult_getIterations(this.__wbg_ptr);
2624
+ return ret >>> 0;
2625
+ }
2626
+ /**
2627
+ * Get the index of the best matching codebook item
2628
+ * @returns {number}
2629
+ */
2630
+ getBestMatchIndex() {
2631
+ const ret = wasm.wasmcleanupresult_getBestMatchIndex(this.__wbg_ptr);
2632
+ return ret >>> 0;
2633
+ }
2634
+ }
1877
2635
 
1878
2636
  const WasmCommunityFinalization = (typeof FinalizationRegistry === 'undefined')
1879
2637
  ? { register: () => {}, unregister: () => {} }
@@ -1931,7 +2689,6 @@ export class WasmCommunity {
1931
2689
  return v1;
1932
2690
  }
1933
2691
  }
1934
- if (Symbol.dispose) WasmCommunity.prototype[Symbol.dispose] = WasmCommunity.prototype.free;
1935
2692
 
1936
2693
  const WasmCountingMeasureFinalization = (typeof FinalizationRegistry === 'undefined')
1937
2694
  ? { register: () => {}, unregister: () => {} }
@@ -1985,7 +2742,6 @@ export class WasmCountingMeasure {
1985
2742
  return this;
1986
2743
  }
1987
2744
  }
1988
- if (Symbol.dispose) WasmCountingMeasure.prototype[Symbol.dispose] = WasmCountingMeasure.prototype.free;
1989
2745
 
1990
2746
  const WasmDualNumberFinalization = (typeof FinalizationRegistry === 'undefined')
1991
2747
  ? { register: () => {}, unregister: () => {} }
@@ -2167,6 +2923,8 @@ export class WasmDualNumber {
2167
2923
  }
2168
2924
  /**
2169
2925
  * ReLU activation function
2926
+ *
2927
+ * Note: Manual implementation as relu() is not in v0.12.0 DualNumber API
2170
2928
  * @returns {WasmDualNumber}
2171
2929
  */
2172
2930
  relu() {
@@ -2235,6 +2993,9 @@ export class WasmDualNumber {
2235
2993
  }
2236
2994
  /**
2237
2995
  * Softplus activation function
2996
+ *
2997
+ * Note: Manual implementation as softplus() is not in v0.12.0 DualNumber API
2998
+ * softplus(x) = ln(1 + exp(x))
2238
2999
  * @returns {WasmDualNumber}
2239
3000
  */
2240
3001
  softplus() {
@@ -2251,7 +3012,6 @@ export class WasmDualNumber {
2251
3012
  return WasmDualNumber.__wrap(ret);
2252
3013
  }
2253
3014
  }
2254
- if (Symbol.dispose) WasmDualNumber.prototype[Symbol.dispose] = WasmDualNumber.prototype.free;
2255
3015
 
2256
3016
  const WasmDuallyFlatManifoldFinalization = (typeof FinalizationRegistry === 'undefined')
2257
3017
  ? { register: () => {}, unregister: () => {} }
@@ -2360,7 +3120,6 @@ export class WasmDuallyFlatManifold {
2360
3120
  return this;
2361
3121
  }
2362
3122
  }
2363
- if (Symbol.dispose) WasmDuallyFlatManifold.prototype[Symbol.dispose] = WasmDuallyFlatManifold.prototype.free;
2364
3123
 
2365
3124
  const WasmEvaluationResultFinalization = (typeof FinalizationRegistry === 'undefined')
2366
3125
  ? { register: () => {}, unregister: () => {} }
@@ -2433,7 +3192,6 @@ export class WasmEvaluationResult {
2433
3192
  return takeFromExternrefTable0(ret[0]);
2434
3193
  }
2435
3194
  }
2436
- if (Symbol.dispose) WasmEvaluationResult.prototype[Symbol.dispose] = WasmEvaluationResult.prototype.free;
2437
3195
 
2438
3196
  const WasmFisherInformationMatrixFinalization = (typeof FinalizationRegistry === 'undefined')
2439
3197
  ? { register: () => {}, unregister: () => {} }
@@ -2489,7 +3247,6 @@ export class WasmFisherInformationMatrix {
2489
3247
  return ret !== 0;
2490
3248
  }
2491
3249
  }
2492
- if (Symbol.dispose) WasmFisherInformationMatrix.prototype[Symbol.dispose] = WasmFisherInformationMatrix.prototype.free;
2493
3250
 
2494
3251
  const WasmFisherMeasureFinalization = (typeof FinalizationRegistry === 'undefined')
2495
3252
  ? { register: () => {}, unregister: () => {} }
@@ -2566,7 +3323,6 @@ export class WasmFisherMeasure {
2566
3323
  return ret[0];
2567
3324
  }
2568
3325
  }
2569
- if (Symbol.dispose) WasmFisherMeasure.prototype[Symbol.dispose] = WasmFisherMeasure.prototype.free;
2570
3326
 
2571
3327
  const WasmFourVelocityFinalization = (typeof FinalizationRegistry === 'undefined')
2572
3328
  ? { register: () => {}, unregister: () => {} }
@@ -2666,7 +3422,6 @@ export class WasmFourVelocity {
2666
3422
  }
2667
3423
  }
2668
3424
  }
2669
- if (Symbol.dispose) WasmFourVelocity.prototype[Symbol.dispose] = WasmFourVelocity.prototype.free;
2670
3425
 
2671
3426
  const WasmGeodesicIntegratorFinalization = (typeof FinalizationRegistry === 'undefined')
2672
3427
  ? { register: () => {}, unregister: () => {} }
@@ -2721,7 +3476,6 @@ export class WasmGeodesicIntegrator {
2721
3476
  return WasmGeodesicIntegrator.__wrap(ret);
2722
3477
  }
2723
3478
  }
2724
- if (Symbol.dispose) WasmGeodesicIntegrator.prototype[Symbol.dispose] = WasmGeodesicIntegrator.prototype.free;
2725
3479
 
2726
3480
  const WasmGeometricCAFinalization = (typeof FinalizationRegistry === 'undefined')
2727
3481
  ? { register: () => {}, unregister: () => {} }
@@ -2898,7 +3652,6 @@ export class WasmGeometricCA {
2898
3652
  }
2899
3653
  }
2900
3654
  }
2901
- if (Symbol.dispose) WasmGeometricCA.prototype[Symbol.dispose] = WasmGeometricCA.prototype.free;
2902
3655
 
2903
3656
  const WasmGeometricEdgeFinalization = (typeof FinalizationRegistry === 'undefined')
2904
3657
  ? { register: () => {}, unregister: () => {} }
@@ -2956,7 +3709,6 @@ export class WasmGeometricEdge {
2956
3709
  return ret;
2957
3710
  }
2958
3711
  }
2959
- if (Symbol.dispose) WasmGeometricEdge.prototype[Symbol.dispose] = WasmGeometricEdge.prototype.free;
2960
3712
 
2961
3713
  const WasmGeometricNetworkFinalization = (typeof FinalizationRegistry === 'undefined')
2962
3714
  ? { register: () => {}, unregister: () => {} }
@@ -3226,7 +3978,6 @@ export class WasmGeometricNetwork {
3226
3978
  return ret >>> 0;
3227
3979
  }
3228
3980
  }
3229
- if (Symbol.dispose) WasmGeometricNetwork.prototype[Symbol.dispose] = WasmGeometricNetwork.prototype.free;
3230
3981
 
3231
3982
  const WasmGpuOptimizerFinalization = (typeof FinalizationRegistry === 'undefined')
3232
3983
  ? { register: () => {}, unregister: () => {} }
@@ -3304,7 +4055,6 @@ export class WasmGpuOptimizer {
3304
4055
  return this;
3305
4056
  }
3306
4057
  }
3307
- if (Symbol.dispose) WasmGpuOptimizer.prototype[Symbol.dispose] = WasmGpuOptimizer.prototype.free;
3308
4058
 
3309
4059
  const WasmGrassmannianFinalization = (typeof FinalizationRegistry === 'undefined')
3310
4060
  ? { register: () => {}, unregister: () => {} }
@@ -3358,7 +4108,163 @@ export class WasmGrassmannian {
3358
4108
  return this;
3359
4109
  }
3360
4110
  }
3361
- if (Symbol.dispose) WasmGrassmannian.prototype[Symbol.dispose] = WasmGrassmannian.prototype.free;
4111
+
4112
+ const WasmHolographicMemoryFinalization = (typeof FinalizationRegistry === 'undefined')
4113
+ ? { register: () => {}, unregister: () => {} }
4114
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmholographicmemory_free(ptr >>> 0, 1));
4115
+ /**
4116
+ * WASM wrapper for HolographicMemory
4117
+ */
4118
+ export class WasmHolographicMemory {
4119
+
4120
+ static __wrap(ptr) {
4121
+ ptr = ptr >>> 0;
4122
+ const obj = Object.create(WasmHolographicMemory.prototype);
4123
+ obj.__wbg_ptr = ptr;
4124
+ WasmHolographicMemoryFinalization.register(obj, obj.__wbg_ptr, obj);
4125
+ return obj;
4126
+ }
4127
+
4128
+ __destroy_into_raw() {
4129
+ const ptr = this.__wbg_ptr;
4130
+ this.__wbg_ptr = 0;
4131
+ WasmHolographicMemoryFinalization.unregister(this);
4132
+ return ptr;
4133
+ }
4134
+
4135
+ free() {
4136
+ const ptr = this.__destroy_into_raw();
4137
+ wasm.__wbg_wasmholographicmemory_free(ptr, 0);
4138
+ }
4139
+ /**
4140
+ * Get the number of stored items
4141
+ * @returns {number}
4142
+ */
4143
+ itemCount() {
4144
+ const ret = wasm.wasmholographicmemory_itemCount(this.__wbg_ptr);
4145
+ return ret >>> 0;
4146
+ }
4147
+ /**
4148
+ * Batch store multiple key-value pairs
4149
+ * @param {Float64Array} keys
4150
+ * @param {Float64Array} values
4151
+ */
4152
+ storeBatch(keys, values) {
4153
+ const ptr0 = passArrayF64ToWasm0(keys, wasm.__wbindgen_malloc);
4154
+ const len0 = WASM_VECTOR_LEN;
4155
+ const ptr1 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
4156
+ const len1 = WASM_VECTOR_LEN;
4157
+ const ret = wasm.wasmholographicmemory_storeBatch(this.__wbg_ptr, ptr0, len0, ptr1, len1);
4158
+ if (ret[1]) {
4159
+ throw takeFromExternrefTable0(ret[0]);
4160
+ }
4161
+ }
4162
+ /**
4163
+ * Get the estimated SNR (signal-to-noise ratio)
4164
+ * @returns {number}
4165
+ */
4166
+ estimatedSnr() {
4167
+ const ret = wasm.wasmholographicmemory_estimatedSnr(this.__wbg_ptr);
4168
+ return ret;
4169
+ }
4170
+ /**
4171
+ * Check if memory is near capacity
4172
+ * @returns {boolean}
4173
+ */
4174
+ isNearCapacity() {
4175
+ const ret = wasm.wasmholographicmemory_isNearCapacity(this.__wbg_ptr);
4176
+ return ret !== 0;
4177
+ }
4178
+ /**
4179
+ * Check if memory probably contains a key
4180
+ * @param {WasmTropicalDualClifford} key
4181
+ * @returns {boolean}
4182
+ */
4183
+ probablyContains(key) {
4184
+ _assertClass(key, WasmTropicalDualClifford);
4185
+ const ret = wasm.wasmholographicmemory_probablyContains(this.__wbg_ptr, key.__wbg_ptr);
4186
+ return ret !== 0;
4187
+ }
4188
+ /**
4189
+ * Create with key tracking enabled (for attribution)
4190
+ * @returns {WasmHolographicMemory}
4191
+ */
4192
+ static withKeyTracking() {
4193
+ const ret = wasm.wasmholographicmemory_withKeyTracking();
4194
+ return WasmHolographicMemory.__wrap(ret);
4195
+ }
4196
+ /**
4197
+ * Get the theoretical capacity
4198
+ * @returns {number}
4199
+ */
4200
+ theoreticalCapacity() {
4201
+ const ret = wasm.wasmholographicmemory_theoreticalCapacity(this.__wbg_ptr);
4202
+ return ret >>> 0;
4203
+ }
4204
+ /**
4205
+ * Retrieve with custom temperature
4206
+ * @param {WasmTropicalDualClifford} key
4207
+ * @param {number} beta
4208
+ * @returns {WasmRetrievalResult}
4209
+ */
4210
+ retrieveAtTemperature(key, beta) {
4211
+ _assertClass(key, WasmTropicalDualClifford);
4212
+ const ret = wasm.wasmholographicmemory_retrieveAtTemperature(this.__wbg_ptr, key.__wbg_ptr, beta);
4213
+ return WasmRetrievalResult.__wrap(ret);
4214
+ }
4215
+ /**
4216
+ * Create with custom bundle temperature
4217
+ * @param {number} beta
4218
+ * @returns {WasmHolographicMemory}
4219
+ */
4220
+ static withBundleTemperature(beta) {
4221
+ const ret = wasm.wasmholographicmemory_withBundleTemperature(beta);
4222
+ return WasmHolographicMemory.__wrap(ret);
4223
+ }
4224
+ /**
4225
+ * Create a new holographic memory with default settings
4226
+ */
4227
+ constructor() {
4228
+ const ret = wasm.wasmholographicmemory_new();
4229
+ this.__wbg_ptr = ret >>> 0;
4230
+ WasmHolographicMemoryFinalization.register(this, this.__wbg_ptr, this);
4231
+ return this;
4232
+ }
4233
+ /**
4234
+ * Clear all stored items
4235
+ */
4236
+ clear() {
4237
+ wasm.wasmholographicmemory_clear(this.__wbg_ptr);
4238
+ }
4239
+ /**
4240
+ * Merge another memory into this one
4241
+ * @param {WasmHolographicMemory} other
4242
+ */
4243
+ merge(other) {
4244
+ _assertClass(other, WasmHolographicMemory);
4245
+ wasm.wasmholographicmemory_merge(this.__wbg_ptr, other.__wbg_ptr);
4246
+ }
4247
+ /**
4248
+ * Store a key-value pair in memory
4249
+ * @param {WasmTropicalDualClifford} key
4250
+ * @param {WasmTropicalDualClifford} value
4251
+ */
4252
+ store(key, value) {
4253
+ _assertClass(key, WasmTropicalDualClifford);
4254
+ _assertClass(value, WasmTropicalDualClifford);
4255
+ wasm.wasmholographicmemory_store(this.__wbg_ptr, key.__wbg_ptr, value.__wbg_ptr);
4256
+ }
4257
+ /**
4258
+ * Retrieve a value by key
4259
+ * @param {WasmTropicalDualClifford} key
4260
+ * @returns {WasmRetrievalResult}
4261
+ */
4262
+ retrieve(key) {
4263
+ _assertClass(key, WasmTropicalDualClifford);
4264
+ const ret = wasm.wasmholographicmemory_retrieve(this.__wbg_ptr, key.__wbg_ptr);
4265
+ return WasmRetrievalResult.__wrap(ret);
4266
+ }
4267
+ }
3362
4268
 
3363
4269
  const WasmInverseCADesignerFinalization = (typeof FinalizationRegistry === 'undefined')
3364
4270
  ? { register: () => {}, unregister: () => {} }
@@ -3432,7 +4338,6 @@ export class WasmInverseCADesigner {
3432
4338
  return v1;
3433
4339
  }
3434
4340
  }
3435
- if (Symbol.dispose) WasmInverseCADesigner.prototype[Symbol.dispose] = WasmInverseCADesigner.prototype.free;
3436
4341
 
3437
4342
  const WasmLebesgueMeasureFinalization = (typeof FinalizationRegistry === 'undefined')
3438
4343
  ? { register: () => {}, unregister: () => {} }
@@ -3515,7 +4420,6 @@ export class WasmLebesgueMeasure {
3515
4420
  return this;
3516
4421
  }
3517
4422
  }
3518
- if (Symbol.dispose) WasmLebesgueMeasure.prototype[Symbol.dispose] = WasmLebesgueMeasure.prototype.free;
3519
4423
 
3520
4424
  const WasmModuliSpaceFinalization = (typeof FinalizationRegistry === 'undefined')
3521
4425
  ? { register: () => {}, unregister: () => {} }
@@ -3597,7 +4501,6 @@ export class WasmModuliSpace {
3597
4501
  return WasmModuliSpace.__wrap(ret);
3598
4502
  }
3599
4503
  }
3600
- if (Symbol.dispose) WasmModuliSpace.prototype[Symbol.dispose] = WasmModuliSpace.prototype.free;
3601
4504
 
3602
4505
  const WasmMultiDualNumberFinalization = (typeof FinalizationRegistry === 'undefined')
3603
4506
  ? { register: () => {}, unregister: () => {} }
@@ -3736,7 +4639,6 @@ export class WasmMultiDualNumber {
3736
4639
  return WasmMultiDualNumber.__wrap(ret);
3737
4640
  }
3738
4641
  }
3739
- if (Symbol.dispose) WasmMultiDualNumber.prototype[Symbol.dispose] = WasmMultiDualNumber.prototype.free;
3740
4642
 
3741
4643
  const WasmMultiObjectiveOptimizerFinalization = (typeof FinalizationRegistry === 'undefined')
3742
4644
  ? { register: () => {}, unregister: () => {} }
@@ -3782,7 +4684,6 @@ export class WasmMultiObjectiveOptimizer {
3782
4684
  return this;
3783
4685
  }
3784
4686
  }
3785
- if (Symbol.dispose) WasmMultiObjectiveOptimizer.prototype[Symbol.dispose] = WasmMultiObjectiveOptimizer.prototype.free;
3786
4687
 
3787
4688
  const WasmMultiObjectiveResultFinalization = (typeof FinalizationRegistry === 'undefined')
3788
4689
  ? { register: () => {}, unregister: () => {} }
@@ -3838,7 +4739,6 @@ export class WasmMultiObjectiveResult {
3838
4739
  return ret !== 0;
3839
4740
  }
3840
4741
  }
3841
- if (Symbol.dispose) WasmMultiObjectiveResult.prototype[Symbol.dispose] = WasmMultiObjectiveResult.prototype.free;
3842
4742
 
3843
4743
  const WasmMultivectorFinalization = (typeof FinalizationRegistry === 'undefined')
3844
4744
  ? { register: () => {}, unregister: () => {} }
@@ -4071,7 +4971,6 @@ export class WasmMultivector {
4071
4971
  return WasmMultivector.__wrap(ret[0]);
4072
4972
  }
4073
4973
  }
4074
- if (Symbol.dispose) WasmMultivector.prototype[Symbol.dispose] = WasmMultivector.prototype.free;
4075
4974
 
4076
4975
  const WasmNodeMetadataFinalization = (typeof FinalizationRegistry === 'undefined')
4077
4976
  ? { register: () => {}, unregister: () => {} }
@@ -4164,7 +5063,6 @@ export class WasmNodeMetadata {
4164
5063
  wasm.wasmnodemetadata_set_label(this.__wbg_ptr, ptr0, len0);
4165
5064
  }
4166
5065
  }
4167
- if (Symbol.dispose) WasmNodeMetadata.prototype[Symbol.dispose] = WasmNodeMetadata.prototype.free;
4168
5066
 
4169
5067
  const WasmOptimizationResultFinalization = (typeof FinalizationRegistry === 'undefined')
4170
5068
  ? { register: () => {}, unregister: () => {} }
@@ -4198,7 +5096,7 @@ export class WasmOptimizationResult {
4198
5096
  * @returns {number}
4199
5097
  */
4200
5098
  get iterations() {
4201
- const ret = wasm.wasmoptimizationresult_iterations(this.__wbg_ptr);
5099
+ const ret = wasm.riemannianmanifold_dimension(this.__wbg_ptr);
4202
5100
  return ret >>> 0;
4203
5101
  }
4204
5102
  /**
@@ -4228,7 +5126,6 @@ export class WasmOptimizationResult {
4228
5126
  return ret !== 0;
4229
5127
  }
4230
5128
  }
4231
- if (Symbol.dispose) WasmOptimizationResult.prototype[Symbol.dispose] = WasmOptimizationResult.prototype.free;
4232
5129
 
4233
5130
  const WasmOptimizationUtilsFinalization = (typeof FinalizationRegistry === 'undefined')
4234
5131
  ? { register: () => {}, unregister: () => {} }
@@ -4284,7 +5181,6 @@ export class WasmOptimizationUtils {
4284
5181
  return ret !== 0;
4285
5182
  }
4286
5183
  }
4287
- if (Symbol.dispose) WasmOptimizationUtils.prototype[Symbol.dispose] = WasmOptimizationUtils.prototype.free;
4288
5184
 
4289
5185
  const WasmParametricDensityFinalization = (typeof FinalizationRegistry === 'undefined')
4290
5186
  ? { register: () => {}, unregister: () => {} }
@@ -4416,7 +5312,6 @@ export class WasmParametricDensity {
4416
5312
  return v2;
4417
5313
  }
4418
5314
  }
4419
- if (Symbol.dispose) WasmParametricDensity.prototype[Symbol.dispose] = WasmParametricDensity.prototype.free;
4420
5315
 
4421
5316
  const WasmProbabilityMeasureFinalization = (typeof FinalizationRegistry === 'undefined')
4422
5317
  ? { register: () => {}, unregister: () => {} }
@@ -4498,7 +5393,6 @@ export class WasmProbabilityMeasure {
4498
5393
  return WasmProbabilityMeasure.__wrap(ret[0]);
4499
5394
  }
4500
5395
  }
4501
- if (Symbol.dispose) WasmProbabilityMeasure.prototype[Symbol.dispose] = WasmProbabilityMeasure.prototype.free;
4502
5396
 
4503
5397
  const WasmProjectiveSpaceFinalization = (typeof FinalizationRegistry === 'undefined')
4504
5398
  ? { register: () => {}, unregister: () => {} }
@@ -4557,7 +5451,6 @@ export class WasmProjectiveSpace {
4557
5451
  return this;
4558
5452
  }
4559
5453
  }
4560
- if (Symbol.dispose) WasmProjectiveSpace.prototype[Symbol.dispose] = WasmProjectiveSpace.prototype.free;
4561
5454
 
4562
5455
  const WasmPropagationAnalysisFinalization = (typeof FinalizationRegistry === 'undefined')
4563
5456
  ? { register: () => {}, unregister: () => {} }
@@ -4591,7 +5484,7 @@ export class WasmPropagationAnalysis {
4591
5484
  * @returns {number}
4592
5485
  */
4593
5486
  get convergenceTime() {
4594
- const ret = wasm.wasmoptimizationresult_iterations(this.__wbg_ptr);
5487
+ const ret = wasm.riemannianmanifold_dimension(this.__wbg_ptr);
4595
5488
  return ret >>> 0;
4596
5489
  }
4597
5490
  /**
@@ -4615,7 +5508,6 @@ export class WasmPropagationAnalysis {
4615
5508
  return v1;
4616
5509
  }
4617
5510
  }
4618
- if (Symbol.dispose) WasmPropagationAnalysis.prototype[Symbol.dispose] = WasmPropagationAnalysis.prototype.free;
4619
5511
 
4620
5512
  const WasmRelativisticConstantsFinalization = (typeof FinalizationRegistry === 'undefined')
4621
5513
  ? { register: () => {}, unregister: () => {} }
@@ -4669,7 +5561,6 @@ export class WasmRelativisticConstants {
4669
5561
  return ret;
4670
5562
  }
4671
5563
  }
4672
- if (Symbol.dispose) WasmRelativisticConstants.prototype[Symbol.dispose] = WasmRelativisticConstants.prototype.free;
4673
5564
 
4674
5565
  const WasmRelativisticParticleFinalization = (typeof FinalizationRegistry === 'undefined')
4675
5566
  ? { register: () => {}, unregister: () => {} }
@@ -4788,39 +5679,172 @@ export class WasmRelativisticParticle {
4788
5679
  return this;
4789
5680
  }
4790
5681
  /**
4791
- * Get rest mass
5682
+ * Get rest mass
5683
+ * @returns {number}
5684
+ */
5685
+ mass() {
5686
+ const ret = wasm.wasmrelativisticparticle_mass(this.__wbg_ptr);
5687
+ return ret;
5688
+ }
5689
+ /**
5690
+ * Get electric charge
5691
+ * @returns {number}
5692
+ */
5693
+ charge() {
5694
+ const ret = wasm.wasmrelativisticparticle_charge(this.__wbg_ptr);
5695
+ return ret;
5696
+ }
5697
+ /**
5698
+ * Get string representation
5699
+ * @returns {string}
5700
+ */
5701
+ to_string() {
5702
+ let deferred1_0;
5703
+ let deferred1_1;
5704
+ try {
5705
+ const ret = wasm.wasmrelativisticparticle_to_string(this.__wbg_ptr);
5706
+ deferred1_0 = ret[0];
5707
+ deferred1_1 = ret[1];
5708
+ return getStringFromWasm0(ret[0], ret[1]);
5709
+ } finally {
5710
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
5711
+ }
5712
+ }
5713
+ }
5714
+
5715
+ const WasmResonatorFinalization = (typeof FinalizationRegistry === 'undefined')
5716
+ ? { register: () => {}, unregister: () => {} }
5717
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmresonator_free(ptr >>> 0, 1));
5718
+ /**
5719
+ * WASM wrapper for Resonator (iterative cleanup)
5720
+ */
5721
+ export class WasmResonator {
5722
+
5723
+ static __wrap(ptr) {
5724
+ ptr = ptr >>> 0;
5725
+ const obj = Object.create(WasmResonator.prototype);
5726
+ obj.__wbg_ptr = ptr;
5727
+ WasmResonatorFinalization.register(obj, obj.__wbg_ptr, obj);
5728
+ return obj;
5729
+ }
5730
+
5731
+ __destroy_into_raw() {
5732
+ const ptr = this.__wbg_ptr;
5733
+ this.__wbg_ptr = 0;
5734
+ WasmResonatorFinalization.unregister(this);
5735
+ return ptr;
5736
+ }
5737
+
5738
+ free() {
5739
+ const ptr = this.__destroy_into_raw();
5740
+ wasm.__wbg_wasmresonator_free(ptr, 0);
5741
+ }
5742
+ /**
5743
+ * Create with custom configuration
5744
+ * @param {Float64Array} codebook_flat
5745
+ * @param {number} max_iterations
5746
+ * @param {number} convergence_threshold
5747
+ * @returns {WasmResonator}
5748
+ */
5749
+ static withConfig(codebook_flat, max_iterations, convergence_threshold) {
5750
+ const ptr0 = passArrayF64ToWasm0(codebook_flat, wasm.__wbindgen_malloc);
5751
+ const len0 = WASM_VECTOR_LEN;
5752
+ const ret = wasm.wasmresonator_withConfig(ptr0, len0, max_iterations, convergence_threshold);
5753
+ if (ret[2]) {
5754
+ throw takeFromExternrefTable0(ret[1]);
5755
+ }
5756
+ return WasmResonator.__wrap(ret[0]);
5757
+ }
5758
+ /**
5759
+ * Get the codebook size
5760
+ * @returns {number}
5761
+ */
5762
+ codebookSize() {
5763
+ const ret = wasm.wasmresonator_codebookSize(this.__wbg_ptr);
5764
+ return ret >>> 0;
5765
+ }
5766
+ /**
5767
+ * Create a resonator from a codebook of TDC vectors
5768
+ * @param {Float64Array} codebook_flat
5769
+ */
5770
+ constructor(codebook_flat) {
5771
+ const ptr0 = passArrayF64ToWasm0(codebook_flat, wasm.__wbindgen_malloc);
5772
+ const len0 = WASM_VECTOR_LEN;
5773
+ const ret = wasm.wasmresonator_new(ptr0, len0);
5774
+ if (ret[2]) {
5775
+ throw takeFromExternrefTable0(ret[1]);
5776
+ }
5777
+ this.__wbg_ptr = ret[0] >>> 0;
5778
+ WasmResonatorFinalization.register(this, this.__wbg_ptr, this);
5779
+ return this;
5780
+ }
5781
+ /**
5782
+ * Clean up a noisy input to find the closest codebook item
5783
+ * @param {WasmTropicalDualClifford} input
5784
+ * @returns {WasmCleanupResult}
5785
+ */
5786
+ cleanup(input) {
5787
+ _assertClass(input, WasmTropicalDualClifford);
5788
+ const ret = wasm.wasmresonator_cleanup(this.__wbg_ptr, input.__wbg_ptr);
5789
+ return WasmCleanupResult.__wrap(ret);
5790
+ }
5791
+ }
5792
+
5793
+ const WasmRetrievalResultFinalization = (typeof FinalizationRegistry === 'undefined')
5794
+ ? { register: () => {}, unregister: () => {} }
5795
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmretrievalresult_free(ptr >>> 0, 1));
5796
+ /**
5797
+ * WASM wrapper for retrieval results
5798
+ */
5799
+ export class WasmRetrievalResult {
5800
+
5801
+ static __wrap(ptr) {
5802
+ ptr = ptr >>> 0;
5803
+ const obj = Object.create(WasmRetrievalResult.prototype);
5804
+ obj.__wbg_ptr = ptr;
5805
+ WasmRetrievalResultFinalization.register(obj, obj.__wbg_ptr, obj);
5806
+ return obj;
5807
+ }
5808
+
5809
+ __destroy_into_raw() {
5810
+ const ptr = this.__wbg_ptr;
5811
+ this.__wbg_ptr = 0;
5812
+ WasmRetrievalResultFinalization.unregister(this);
5813
+ return ptr;
5814
+ }
5815
+
5816
+ free() {
5817
+ const ptr = this.__destroy_into_raw();
5818
+ wasm.__wbg_wasmretrievalresult_free(ptr, 0);
5819
+ }
5820
+ /**
5821
+ * Get the retrieval confidence (0 to 1)
4792
5822
  * @returns {number}
4793
5823
  */
4794
- mass() {
4795
- const ret = wasm.wasmrelativisticparticle_mass(this.__wbg_ptr);
5824
+ getConfidence() {
5825
+ const ret = wasm.wasmretrievalresult_getConfidence(this.__wbg_ptr);
4796
5826
  return ret;
4797
5827
  }
4798
5828
  /**
4799
- * Get electric charge
4800
- * @returns {number}
5829
+ * Get attribution as arrays of [index, weight] pairs
5830
+ * @returns {any}
4801
5831
  */
4802
- charge() {
4803
- const ret = wasm.wasmrelativisticparticle_charge(this.__wbg_ptr);
4804
- return ret;
5832
+ getAttribution() {
5833
+ const ret = wasm.wasmretrievalresult_getAttribution(this.__wbg_ptr);
5834
+ if (ret[2]) {
5835
+ throw takeFromExternrefTable0(ret[1]);
5836
+ }
5837
+ return takeFromExternrefTable0(ret[0]);
4805
5838
  }
4806
5839
  /**
4807
- * Get string representation
4808
- * @returns {string}
5840
+ * Get the retrieved value
5841
+ * @returns {WasmTropicalDualClifford}
4809
5842
  */
4810
- to_string() {
4811
- let deferred1_0;
4812
- let deferred1_1;
4813
- try {
4814
- const ret = wasm.wasmrelativisticparticle_to_string(this.__wbg_ptr);
4815
- deferred1_0 = ret[0];
4816
- deferred1_1 = ret[1];
4817
- return getStringFromWasm0(ret[0], ret[1]);
4818
- } finally {
4819
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4820
- }
5843
+ getValue() {
5844
+ const ret = wasm.wasmretrievalresult_getValue(this.__wbg_ptr);
5845
+ return WasmTropicalDualClifford.__wrap(ret);
4821
5846
  }
4822
5847
  }
4823
- if (Symbol.dispose) WasmRelativisticParticle.prototype[Symbol.dispose] = WasmRelativisticParticle.prototype.free;
4824
5848
 
4825
5849
  const WasmRotorFinalization = (typeof FinalizationRegistry === 'undefined')
4826
5850
  ? { register: () => {}, unregister: () => {} }
@@ -4889,7 +5913,6 @@ export class WasmRotor {
4889
5913
  return WasmRotor.__wrap(ret);
4890
5914
  }
4891
5915
  }
4892
- if (Symbol.dispose) WasmRotor.prototype[Symbol.dispose] = WasmRotor.prototype.free;
4893
5916
 
4894
5917
  const WasmSchwarzschildMetricFinalization = (typeof FinalizationRegistry === 'undefined')
4895
5918
  ? { register: () => {}, unregister: () => {} }
@@ -4980,7 +6003,6 @@ export class WasmSchwarzschildMetric {
4980
6003
  return WasmSchwarzschildMetric.__wrap(ret);
4981
6004
  }
4982
6005
  }
4983
- if (Symbol.dispose) WasmSchwarzschildMetric.prototype[Symbol.dispose] = WasmSchwarzschildMetric.prototype.free;
4984
6006
 
4985
6007
  const WasmSelfAssemblerFinalization = (typeof FinalizationRegistry === 'undefined')
4986
6008
  ? { register: () => {}, unregister: () => {} }
@@ -5041,7 +6063,6 @@ export class WasmSelfAssembler {
5041
6063
  return this;
5042
6064
  }
5043
6065
  }
5044
- if (Symbol.dispose) WasmSelfAssembler.prototype[Symbol.dispose] = WasmSelfAssembler.prototype.free;
5045
6066
 
5046
6067
  const WasmSensitivityMapFinalization = (typeof FinalizationRegistry === 'undefined')
5047
6068
  ? { register: () => {}, unregister: () => {} }
@@ -5101,7 +6122,6 @@ export class WasmSensitivityMap {
5101
6122
  return ret;
5102
6123
  }
5103
6124
  }
5104
- if (Symbol.dispose) WasmSensitivityMap.prototype[Symbol.dispose] = WasmSensitivityMap.prototype.free;
5105
6125
 
5106
6126
  const WasmSimpleOptimizerFinalization = (typeof FinalizationRegistry === 'undefined')
5107
6127
  ? { register: () => {}, unregister: () => {} }
@@ -5149,7 +6169,6 @@ export class WasmSimpleOptimizer {
5149
6169
  return this;
5150
6170
  }
5151
6171
  }
5152
- if (Symbol.dispose) WasmSimpleOptimizer.prototype[Symbol.dispose] = WasmSimpleOptimizer.prototype.free;
5153
6172
 
5154
6173
  const WasmSpacetimeVectorFinalization = (typeof FinalizationRegistry === 'undefined')
5155
6174
  ? { register: () => {}, unregister: () => {} }
@@ -5302,7 +6321,6 @@ export class WasmSpacetimeVector {
5302
6321
  }
5303
6322
  }
5304
6323
  }
5305
- if (Symbol.dispose) WasmSpacetimeVector.prototype[Symbol.dispose] = WasmSpacetimeVector.prototype.free;
5306
6324
 
5307
6325
  const WasmTrajectoryPointFinalization = (typeof FinalizationRegistry === 'undefined')
5308
6326
  ? { register: () => {}, unregister: () => {} }
@@ -5347,7 +6365,6 @@ export class WasmTrajectoryPoint {
5347
6365
  return WasmSpacetimeVector.__wrap(ret);
5348
6366
  }
5349
6367
  }
5350
- if (Symbol.dispose) WasmTrajectoryPoint.prototype[Symbol.dispose] = WasmTrajectoryPoint.prototype.free;
5351
6368
 
5352
6369
  const WasmTropicalCurveFinalization = (typeof FinalizationRegistry === 'undefined')
5353
6370
  ? { register: () => {}, unregister: () => {} }
@@ -5404,7 +6421,6 @@ export class WasmTropicalCurve {
5404
6421
  return ret >>> 0;
5405
6422
  }
5406
6423
  }
5407
- if (Symbol.dispose) WasmTropicalCurve.prototype[Symbol.dispose] = WasmTropicalCurve.prototype.free;
5408
6424
 
5409
6425
  const WasmTropicalDualCliffordFinalization = (typeof FinalizationRegistry === 'undefined')
5410
6426
  ? { register: () => {}, unregister: () => {} }
@@ -5433,6 +6449,111 @@ export class WasmTropicalDualClifford {
5433
6449
  const ptr = this.__destroy_into_raw();
5434
6450
  wasm.__wbg_wasmtropicaldualclifford_free(ptr, 0);
5435
6451
  }
6452
+ /**
6453
+ * Compute similarity between two TDC objects
6454
+ *
6455
+ * Uses the proper Clifford inner product with reverse: <A B̃>₀ / (|A| |B|)
6456
+ * Returns a value in [-1, 1].
6457
+ * @param {WasmTropicalDualClifford} other
6458
+ * @returns {number}
6459
+ */
6460
+ similarity(other) {
6461
+ _assertClass(other, WasmTropicalDualClifford);
6462
+ const ret = wasm.wasmtropicaldualclifford_similarity(this.__wbg_ptr, other.__wbg_ptr);
6463
+ return ret;
6464
+ }
6465
+ /**
6466
+ * Create a random unit vector TDC (grade 1 only)
6467
+ *
6468
+ * Unit vectors are guaranteed invertible and useful for
6469
+ * proper VSA (Vector Symbolic Architecture) operations.
6470
+ * @returns {WasmTropicalDualClifford}
6471
+ */
6472
+ static randomVector() {
6473
+ const ret = wasm.wasmtropicaldualclifford_randomVector();
6474
+ return WasmTropicalDualClifford.__wrap(ret);
6475
+ }
6476
+ /**
6477
+ * Compute binding inverse
6478
+ *
6479
+ * If successful, `x.bind(x.bindingInverse()) ≈ identity`
6480
+ * @returns {WasmTropicalDualClifford}
6481
+ */
6482
+ bindingInverse() {
6483
+ const ret = wasm.wasmtropicaldualclifford_bindingInverse(this.__wbg_ptr);
6484
+ if (ret[2]) {
6485
+ throw takeFromExternrefTable0(ret[1]);
6486
+ }
6487
+ return WasmTropicalDualClifford.__wrap(ret[0]);
6488
+ }
6489
+ /**
6490
+ * Get the binding identity element
6491
+ *
6492
+ * `x.bind(identity) = x` for any x
6493
+ * @returns {WasmTropicalDualClifford}
6494
+ */
6495
+ static bindingIdentity() {
6496
+ const ret = wasm.wasmtropicaldualclifford_bindingIdentity();
6497
+ return WasmTropicalDualClifford.__wrap(ret);
6498
+ }
6499
+ /**
6500
+ * Normalize the TDC to unit norm
6501
+ * @returns {WasmTropicalDualClifford}
6502
+ */
6503
+ normalizeToUnit() {
6504
+ const ret = wasm.wasmtropicaldualclifford_normalizeToUnit(this.__wbg_ptr);
6505
+ return WasmTropicalDualClifford.__wrap(ret);
6506
+ }
6507
+ /**
6508
+ * Compute Clifford similarity (proper inner product with reverse)
6509
+ * @param {WasmTropicalDualClifford} other
6510
+ * @returns {number}
6511
+ */
6512
+ cliffordSimilarity(other) {
6513
+ _assertClass(other, WasmTropicalDualClifford);
6514
+ const ret = wasm.wasmtropicaldualclifford_cliffordSimilarity(this.__wbg_ptr, other.__wbg_ptr);
6515
+ return ret;
6516
+ }
6517
+ /**
6518
+ * Bind two TDC objects using geometric product (creates associations)
6519
+ *
6520
+ * The result is dissimilar to both inputs - useful for creating
6521
+ * key-value associations in holographic memory.
6522
+ * @param {WasmTropicalDualClifford} other
6523
+ * @returns {WasmTropicalDualClifford}
6524
+ */
6525
+ bind(other) {
6526
+ _assertClass(other, WasmTropicalDualClifford);
6527
+ const ret = wasm.wasmtropicaldualclifford_bind(this.__wbg_ptr, other.__wbg_ptr);
6528
+ return WasmTropicalDualClifford.__wrap(ret);
6529
+ }
6530
+ /**
6531
+ * Bundle two TDC objects (superposition/aggregation)
6532
+ *
6533
+ * The result is similar to both inputs - useful for storing
6534
+ * multiple associations in the same memory trace.
6535
+ * `beta` controls soft (1.0) vs hard (∞) bundling.
6536
+ * @param {WasmTropicalDualClifford} other
6537
+ * @param {number} beta
6538
+ * @returns {WasmTropicalDualClifford}
6539
+ */
6540
+ bundle(other, beta) {
6541
+ _assertClass(other, WasmTropicalDualClifford);
6542
+ const ret = wasm.wasmtropicaldualclifford_bundle(this.__wbg_ptr, other.__wbg_ptr, beta);
6543
+ return WasmTropicalDualClifford.__wrap(ret);
6544
+ }
6545
+ /**
6546
+ * Unbind: retrieve associated value
6547
+ *
6548
+ * If `bound = key.bind(value)`, then `key.unbind(bound) ≈ value`
6549
+ * @param {WasmTropicalDualClifford} other
6550
+ * @returns {WasmTropicalDualClifford}
6551
+ */
6552
+ unbind(other) {
6553
+ _assertClass(other, WasmTropicalDualClifford);
6554
+ const ret = wasm.wasmtropicaldualclifford_unbind(this.__wbg_ptr, other.__wbg_ptr);
6555
+ return WasmTropicalDualClifford.__wrap(ret);
6556
+ }
5436
6557
  /**
5437
6558
  * Create from logits (array of log-probabilities)
5438
6559
  * @param {Float64Array} logits
@@ -5484,6 +6605,8 @@ export class WasmTropicalDualClifford {
5484
6605
  }
5485
6606
  /**
5486
6607
  * Create from probability distribution
6608
+ *
6609
+ * Note: Converts probabilities to log space for tropical representation
5487
6610
  * @param {Float64Array} probs
5488
6611
  * @returns {WasmTropicalDualClifford}
5489
6612
  */
@@ -5524,6 +6647,9 @@ export class WasmTropicalDualClifford {
5524
6647
  }
5525
6648
  /**
5526
6649
  * Perform sensitivity analysis for gradient-based optimization
6650
+ *
6651
+ * Note: This feature is not yet available in v0.12.0
6652
+ * TODO: Re-enable when sensitivity_analysis is added to TropicalDualClifford
5527
6653
  * @returns {WasmSensitivityMap}
5528
6654
  */
5529
6655
  sensitivityAnalysis() {
@@ -5635,93 +6761,6 @@ export class WasmTropicalDualClifford {
5635
6761
  return WasmTropicalDualClifford.__wrap(ret);
5636
6762
  }
5637
6763
  }
5638
- if (Symbol.dispose) WasmTropicalDualClifford.prototype[Symbol.dispose] = WasmTropicalDualClifford.prototype.free;
5639
-
5640
- const WasmTropicalDualDistributionFinalization = (typeof FinalizationRegistry === 'undefined')
5641
- ? { register: () => {}, unregister: () => {} }
5642
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmtropicaldualdistribution_free(ptr >>> 0, 1));
5643
- /**
5644
- * WASM wrapper for LLM token distributions
5645
- */
5646
- export class WasmTropicalDualDistribution {
5647
-
5648
- __destroy_into_raw() {
5649
- const ptr = this.__wbg_ptr;
5650
- this.__wbg_ptr = 0;
5651
- WasmTropicalDualDistributionFinalization.unregister(this);
5652
- return ptr;
5653
- }
5654
-
5655
- free() {
5656
- const ptr = this.__destroy_into_raw();
5657
- wasm.__wbg_wasmtropicaldualdistribution_free(ptr, 0);
5658
- }
5659
- /**
5660
- * Compute KL divergence with automatic gradients
5661
- * @param {WasmTropicalDualDistribution} other
5662
- * @returns {any}
5663
- */
5664
- klDivergence(other) {
5665
- _assertClass(other, WasmTropicalDualDistribution);
5666
- const ret = wasm.wasmtropicaldualdistribution_klDivergence(this.__wbg_ptr, other.__wbg_ptr);
5667
- if (ret[2]) {
5668
- throw takeFromExternrefTable0(ret[1]);
5669
- }
5670
- return takeFromExternrefTable0(ret[0]);
5671
- }
5672
- /**
5673
- * Get vocabulary size
5674
- * @returns {number}
5675
- */
5676
- getVocabSize() {
5677
- const ret = wasm.wasmtropicaldualdistribution_getVocabSize(this.__wbg_ptr);
5678
- return ret >>> 0;
5679
- }
5680
- /**
5681
- * Get attention pattern as tropical polytope vertices
5682
- * @returns {Float64Array}
5683
- */
5684
- attentionPolytope() {
5685
- const ret = wasm.wasmtropicaldualdistribution_attentionPolytope(this.__wbg_ptr);
5686
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
5687
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
5688
- return v1;
5689
- }
5690
- /**
5691
- * Compute geometric alignment with reference distribution
5692
- * @param {WasmTropicalDualDistribution} reference
5693
- * @returns {number}
5694
- */
5695
- geometricAlignment(reference) {
5696
- _assertClass(reference, WasmTropicalDualDistribution);
5697
- const ret = wasm.wasmtropicaldualdistribution_geometricAlignment(this.__wbg_ptr, reference.__wbg_ptr);
5698
- return ret;
5699
- }
5700
- /**
5701
- * Generate most likely sequence using tropical algebra (Viterbi-like)
5702
- * @param {number} length
5703
- * @returns {Uint32Array}
5704
- */
5705
- mostLikelySequence(length) {
5706
- const ret = wasm.wasmtropicaldualdistribution_mostLikelySequence(this.__wbg_ptr, length);
5707
- var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
5708
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
5709
- return v1;
5710
- }
5711
- /**
5712
- * Create from logit vector (typical LLM output)
5713
- * @param {Float64Array} logits
5714
- */
5715
- constructor(logits) {
5716
- const ptr0 = passArrayF64ToWasm0(logits, wasm.__wbindgen_malloc);
5717
- const len0 = WASM_VECTOR_LEN;
5718
- const ret = wasm.wasmtropicaldualdistribution_new(ptr0, len0);
5719
- this.__wbg_ptr = ret >>> 0;
5720
- WasmTropicalDualDistributionFinalization.register(this, this.__wbg_ptr, this);
5721
- return this;
5722
- }
5723
- }
5724
- if (Symbol.dispose) WasmTropicalDualDistribution.prototype[Symbol.dispose] = WasmTropicalDualDistribution.prototype.free;
5725
6764
 
5726
6765
  const WasmTropicalMeasureFinalization = (typeof FinalizationRegistry === 'undefined')
5727
6766
  ? { register: () => {}, unregister: () => {} }
@@ -5805,7 +6844,6 @@ export class WasmTropicalMeasure {
5805
6844
  return v2;
5806
6845
  }
5807
6846
  }
5808
- if (Symbol.dispose) WasmTropicalMeasure.prototype[Symbol.dispose] = WasmTropicalMeasure.prototype.free;
5809
6847
 
5810
6848
  const WasmTropicalNetworkFinalization = (typeof FinalizationRegistry === 'undefined')
5811
6849
  ? { register: () => {}, unregister: () => {} }
@@ -5906,7 +6944,6 @@ export class WasmTropicalNetwork {
5906
6944
  }
5907
6945
  }
5908
6946
  }
5909
- if (Symbol.dispose) WasmTropicalNetwork.prototype[Symbol.dispose] = WasmTropicalNetwork.prototype.free;
5910
6947
 
5911
6948
  const WasmTropicalNumberFinalization = (typeof FinalizationRegistry === 'undefined')
5912
6949
  ? { register: () => {}, unregister: () => {} }
@@ -5937,6 +6974,8 @@ export class WasmTropicalNumber {
5937
6974
  }
5938
6975
  /**
5939
6976
  * Check if this is infinite
6977
+ *
6978
+ * Note: Manual implementation as is_infinity() not in v0.12.0 API
5940
6979
  * @returns {boolean}
5941
6980
  */
5942
6981
  isInfinity() {
@@ -5974,6 +7013,8 @@ export class WasmTropicalNumber {
5974
7013
  }
5975
7014
  /**
5976
7015
  * Create from log probability
7016
+ *
7017
+ * Note: Manual implementation as from_log_prob() not in v0.12.0 API
5977
7018
  * @param {number} log_p
5978
7019
  * @returns {WasmTropicalNumber}
5979
7020
  */
@@ -6003,6 +7044,8 @@ export class WasmTropicalNumber {
6003
7044
  }
6004
7045
  /**
6005
7046
  * Negation
7047
+ *
7048
+ * Note: Manual implementation as Neg trait not implemented in v0.12.0 API
6006
7049
  * @returns {WasmTropicalNumber}
6007
7050
  */
6008
7051
  neg() {
@@ -6032,7 +7075,7 @@ export class WasmTropicalNumber {
6032
7075
  * @returns {WasmTropicalNumber}
6033
7076
  */
6034
7077
  static zero() {
6035
- const ret = wasm.wasmtropicalnumber_zero();
7078
+ const ret = wasm.wasmtropicalnumber_one();
6036
7079
  return WasmTropicalNumber.__wrap(ret);
6037
7080
  }
6038
7081
  /**
@@ -6048,11 +7091,13 @@ export class WasmTropicalNumber {
6048
7091
  * @returns {boolean}
6049
7092
  */
6050
7093
  isZero() {
6051
- const ret = wasm.wasmtropicalnumber_isZero(this.__wbg_ptr);
7094
+ const ret = wasm.wasmtropicalnumber_isInfinity(this.__wbg_ptr);
6052
7095
  return ret !== 0;
6053
7096
  }
6054
7097
  /**
6055
7098
  * Convert to probability (via exp)
7099
+ *
7100
+ * Note: Manual implementation as to_prob() not in v0.12.0 API
6056
7101
  * @returns {number}
6057
7102
  */
6058
7103
  toProb() {
@@ -6068,7 +7113,6 @@ export class WasmTropicalNumber {
6068
7113
  return ret;
6069
7114
  }
6070
7115
  }
6071
- if (Symbol.dispose) WasmTropicalNumber.prototype[Symbol.dispose] = WasmTropicalNumber.prototype.free;
6072
7116
 
6073
7117
  const WasmTropicalPolynomialFinalization = (typeof FinalizationRegistry === 'undefined')
6074
7118
  ? { register: () => {}, unregister: () => {} }
@@ -6128,7 +7172,6 @@ export class WasmTropicalPolynomial {
6128
7172
  return WasmTropicalNumber.__wrap(ret);
6129
7173
  }
6130
7174
  }
6131
- if (Symbol.dispose) WasmTropicalPolynomial.prototype[Symbol.dispose] = WasmTropicalPolynomial.prototype.free;
6132
7175
 
6133
7176
  const WasmTropicalViterbiFinalization = (typeof FinalizationRegistry === 'undefined')
6134
7177
  ? { register: () => {}, unregister: () => {} }
@@ -6198,7 +7241,6 @@ export class WasmTropicalViterbi {
6198
7241
  return takeFromExternrefTable0(ret[0]);
6199
7242
  }
6200
7243
  }
6201
- if (Symbol.dispose) WasmTropicalViterbi.prototype[Symbol.dispose] = WasmTropicalViterbi.prototype.free;
6202
7244
 
6203
7245
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
6204
7246
 
@@ -6238,42 +7280,23 @@ async function __wbg_load(module, imports) {
6238
7280
  function __wbg_get_imports() {
6239
7281
  const imports = {};
6240
7282
  imports.wbg = {};
6241
- imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
6242
- const ret = debugString(arg1);
6243
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6244
- const len1 = WASM_VECTOR_LEN;
6245
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
6246
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
6247
- };
6248
- imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
6249
- const ret = typeof(arg0) === 'function';
7283
+ imports.wbg.__wbg_apply_8745fdcf855d21f5 = function() { return handleError(function (arg0, arg1, arg2) {
7284
+ const ret = arg0.apply(arg1, arg2);
6250
7285
  return ret;
6251
- };
6252
- imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
6253
- const ret = arg0 === undefined;
7286
+ }, arguments) };
7287
+ imports.wbg.__wbg_call_1b920c3ac0afee4b = function() { return handleError(function (arg0, arg1, arg2, arg3) {
7288
+ const ret = arg0.call(arg1, arg2, arg3);
6254
7289
  return ret;
6255
- };
6256
- imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
6257
- const obj = arg1;
6258
- const ret = typeof(obj) === 'number' ? obj : undefined;
6259
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
6260
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
6261
- };
6262
- imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
6263
- throw new Error(getStringFromWasm0(arg0, arg1));
6264
- };
6265
- imports.wbg.__wbg__wbg_cb_unref_2454a539ea5790d9 = function(arg0) {
6266
- arg0._wbg_cb_unref();
6267
- };
6268
- imports.wbg.__wbg_apply_04097a755e1e4a1e = function() { return handleError(function (arg0, arg1, arg2) {
6269
- const ret = arg0.apply(arg1, arg2);
7290
+ }, arguments) };
7291
+ imports.wbg.__wbg_call_36f1bbf64b4cf7c7 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
7292
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
6270
7293
  return ret;
6271
7294
  }, arguments) };
6272
- imports.wbg.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
7295
+ imports.wbg.__wbg_call_f2db6205e5c51dc8 = function() { return handleError(function (arg0, arg1, arg2) {
6273
7296
  const ret = arg0.call(arg1, arg2);
6274
7297
  return ret;
6275
7298
  }, arguments) };
6276
- imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
7299
+ imports.wbg.__wbg_call_fbe8be8bf6436ce5 = function() { return handleError(function (arg0, arg1) {
6277
7300
  const ret = arg0.call(arg1);
6278
7301
  return ret;
6279
7302
  }, arguments) };
@@ -6288,36 +7311,44 @@ function __wbg_get_imports() {
6288
7311
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
6289
7312
  }
6290
7313
  };
6291
- imports.wbg.__wbg_from_a4ad7cbddd0d7135 = function(arg0) {
7314
+ imports.wbg.__wbg_from_12ff8e47307bd4c7 = function(arg0) {
6292
7315
  const ret = Array.from(arg0);
6293
7316
  return ret;
6294
7317
  };
6295
- imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
7318
+ imports.wbg.__wbg_get_a131a44bd1eb6979 = function(arg0, arg1) {
6296
7319
  const ret = arg0[arg1 >>> 0];
6297
7320
  return ret;
6298
7321
  };
6299
- imports.wbg.__wbg_length_cdd215e10d9dd507 = function(arg0) {
7322
+ imports.wbg.__wbg_length_f00ec12454a5d9fd = function(arg0) {
6300
7323
  const ret = arg0.length;
6301
7324
  return ret;
6302
7325
  };
6303
- imports.wbg.__wbg_log_8cec76766b8c0e33 = function(arg0) {
6304
- console.log(arg0);
6305
- };
6306
- imports.wbg.__wbg_log_b51718ac10a384d9 = function(arg0, arg1) {
7326
+ imports.wbg.__wbg_log_bf345a94df4f1349 = function(arg0, arg1) {
6307
7327
  console.log(getStringFromWasm0(arg0, arg1));
6308
7328
  };
6309
- imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
7329
+ imports.wbg.__wbg_log_ea240990d83e374e = function(arg0) {
7330
+ console.log(arg0);
7331
+ };
7332
+ imports.wbg.__wbg_new_07b483f72211fd66 = function() {
6310
7333
  const ret = new Object();
6311
7334
  return ret;
6312
7335
  };
6313
- imports.wbg.__wbg_new_3c3d849046688a66 = function(arg0, arg1) {
7336
+ imports.wbg.__wbg_new_58353953ad2097cc = function() {
7337
+ const ret = new Array();
7338
+ return ret;
7339
+ };
7340
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
7341
+ const ret = new Error();
7342
+ return ret;
7343
+ };
7344
+ imports.wbg.__wbg_new_e30c39c06edaabf2 = function(arg0, arg1) {
6314
7345
  try {
6315
7346
  var state0 = {a: arg0, b: arg1};
6316
7347
  var cb0 = (arg0, arg1) => {
6317
7348
  const a = state0.a;
6318
7349
  state0.a = 0;
6319
7350
  try {
6320
- return wasm_bindgen_83f782f110bf2942___convert__closures_____invoke___wasm_bindgen_83f782f110bf2942___JsValue__wasm_bindgen_83f782f110bf2942___JsValue_____(a, state0.b, arg0, arg1);
7351
+ return __wbg_adapter_496(a, state0.b, arg0, arg1);
6321
7352
  } finally {
6322
7353
  state0.a = a;
6323
7354
  }
@@ -6328,40 +7359,32 @@ function __wbg_get_imports() {
6328
7359
  state0.a = state0.b = 0;
6329
7360
  }
6330
7361
  };
6331
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
6332
- const ret = new Error();
6333
- return ret;
6334
- };
6335
- imports.wbg.__wbg_new_e17d9f43105b08be = function() {
6336
- const ret = new Array();
6337
- return ret;
6338
- };
6339
- imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
7362
+ imports.wbg.__wbg_newnoargs_ff528e72d35de39a = function(arg0, arg1) {
6340
7363
  const ret = new Function(getStringFromWasm0(arg0, arg1));
6341
7364
  return ret;
6342
7365
  };
6343
- imports.wbg.__wbg_push_df81a39d04db858c = function(arg0, arg1) {
7366
+ imports.wbg.__wbg_push_73fd7b5550ebf707 = function(arg0, arg1) {
6344
7367
  const ret = arg0.push(arg1);
6345
7368
  return ret;
6346
7369
  };
6347
- imports.wbg.__wbg_queueMicrotask_34d692c25c47d05b = function(arg0) {
7370
+ imports.wbg.__wbg_queueMicrotask_46c1df247678729f = function(arg0) {
7371
+ queueMicrotask(arg0);
7372
+ };
7373
+ imports.wbg.__wbg_queueMicrotask_8acf3ccb75ed8d11 = function(arg0) {
6348
7374
  const ret = arg0.queueMicrotask;
6349
7375
  return ret;
6350
7376
  };
6351
- imports.wbg.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
6352
- queueMicrotask(arg0);
6353
- };
6354
- imports.wbg.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
7377
+ imports.wbg.__wbg_resolve_0dac8c580ffd4678 = function(arg0) {
6355
7378
  const ret = Promise.resolve(arg0);
6356
7379
  return ret;
6357
7380
  };
6358
7381
  imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
6359
7382
  arg0[arg1] = arg2;
6360
7383
  };
6361
- imports.wbg.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
7384
+ imports.wbg.__wbg_set_7422acbe992d64ab = function(arg0, arg1, arg2) {
6362
7385
  arg0[arg1 >>> 0] = arg2;
6363
7386
  };
6364
- imports.wbg.__wbg_set_c2abbebe8b9ebee1 = function() { return handleError(function (arg0, arg1, arg2) {
7387
+ imports.wbg.__wbg_set_c43293f93a35998a = function() { return handleError(function (arg0, arg1, arg2) {
6365
7388
  const ret = Reflect.set(arg0, arg1, arg2);
6366
7389
  return ret;
6367
7390
  }, arguments) };
@@ -6372,23 +7395,23 @@ function __wbg_get_imports() {
6372
7395
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
6373
7396
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
6374
7397
  };
6375
- imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
7398
+ imports.wbg.__wbg_static_accessor_GLOBAL_487c52c58d65314d = function() {
6376
7399
  const ret = typeof global === 'undefined' ? null : global;
6377
7400
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
6378
7401
  };
6379
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
7402
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_ee9704f328b6b291 = function() {
6380
7403
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
6381
7404
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
6382
7405
  };
6383
- imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
7406
+ imports.wbg.__wbg_static_accessor_SELF_78c9e3071b912620 = function() {
6384
7407
  const ret = typeof self === 'undefined' ? null : self;
6385
7408
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
6386
7409
  };
6387
- imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
7410
+ imports.wbg.__wbg_static_accessor_WINDOW_a093d21393777366 = function() {
6388
7411
  const ret = typeof window === 'undefined' ? null : window;
6389
7412
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
6390
7413
  };
6391
- imports.wbg.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
7414
+ imports.wbg.__wbg_then_db882932c0c714c6 = function(arg0, arg1) {
6392
7415
  const ret = arg0.then(arg1);
6393
7416
  return ret;
6394
7417
  };
@@ -6408,35 +7431,38 @@ function __wbg_get_imports() {
6408
7431
  const ret = WasmTropicalNumber.__wrap(arg0);
6409
7432
  return ret;
6410
7433
  };
6411
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
6412
- // Cast intrinsic for `Ref(String) -> Externref`.
6413
- const ret = getStringFromWasm0(arg0, arg1);
7434
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
7435
+ const ret = BigInt.asUintN(64, arg0);
6414
7436
  return ret;
6415
7437
  };
6416
- imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
6417
- // Cast intrinsic for `U64 -> Externref`.
6418
- const ret = BigInt.asUintN(64, arg0);
7438
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
7439
+ const obj = arg0.original;
7440
+ if (obj.cnt-- == 1) {
7441
+ obj.a = 0;
7442
+ return true;
7443
+ }
7444
+ const ret = false;
6419
7445
  return ret;
6420
7446
  };
6421
- imports.wbg.__wbindgen_cast_69f35aa0fcaecc47 = function(arg0, arg1) {
6422
- // Cast intrinsic for `Closure(Closure { dtor_idx: 37, function: Function { arguments: [Externref], shim_idx: 38, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
6423
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_83f782f110bf2942___closure__destroy___dyn_core_f622c628fd7f704e___ops__function__FnMut__wasm_bindgen_83f782f110bf2942___JsValue____Output_______, wasm_bindgen_83f782f110bf2942___convert__closures_____invoke___wasm_bindgen_83f782f110bf2942___JsValue_____);
7447
+ imports.wbg.__wbindgen_closure_wrapper1715 = function(arg0, arg1, arg2) {
7448
+ const ret = makeMutClosure(arg0, arg1, 57, __wbg_adapter_28);
6424
7449
  return ret;
6425
7450
  };
6426
- imports.wbg.__wbindgen_cast_b63aeb0d85365734 = function(arg0, arg1) {
7451
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
7452
+ const ret = debugString(arg1);
7453
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7454
+ const len1 = WASM_VECTOR_LEN;
7455
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
7456
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
7457
+ };
7458
+ imports.wbg.__wbindgen_float64_array_new = function(arg0, arg1) {
6427
7459
  var v0 = getArrayF64FromWasm0(arg0, arg1).slice();
6428
7460
  wasm.__wbindgen_free(arg0, arg1 * 8, 8);
6429
- // Cast intrinsic for `Vector(F64) -> Externref`.
6430
7461
  const ret = v0;
6431
7462
  return ret;
6432
7463
  };
6433
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
6434
- // Cast intrinsic for `F64 -> Externref`.
6435
- const ret = arg0;
6436
- return ret;
6437
- };
6438
7464
  imports.wbg.__wbindgen_init_externref_table = function() {
6439
- const table = wasm.__wbindgen_externrefs;
7465
+ const table = wasm.__wbindgen_export_2;
6440
7466
  const offset = table.grow(4);
6441
7467
  table.set(0, undefined);
6442
7468
  table.set(offset + 0, undefined);
@@ -6445,10 +7471,39 @@ function __wbg_get_imports() {
6445
7471
  table.set(offset + 3, false);
6446
7472
  ;
6447
7473
  };
7474
+ imports.wbg.__wbindgen_is_function = function(arg0) {
7475
+ const ret = typeof(arg0) === 'function';
7476
+ return ret;
7477
+ };
7478
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
7479
+ const ret = arg0 === undefined;
7480
+ return ret;
7481
+ };
7482
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
7483
+ const obj = arg1;
7484
+ const ret = typeof(obj) === 'number' ? obj : undefined;
7485
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
7486
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
7487
+ };
7488
+ imports.wbg.__wbindgen_number_new = function(arg0) {
7489
+ const ret = arg0;
7490
+ return ret;
7491
+ };
7492
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
7493
+ const ret = getStringFromWasm0(arg0, arg1);
7494
+ return ret;
7495
+ };
7496
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
7497
+ throw new Error(getStringFromWasm0(arg0, arg1));
7498
+ };
6448
7499
 
6449
7500
  return imports;
6450
7501
  }
6451
7502
 
7503
+ function __wbg_init_memory(imports, memory) {
7504
+
7505
+ }
7506
+
6452
7507
  function __wbg_finalize_init(instance, module) {
6453
7508
  wasm = instance.exports;
6454
7509
  __wbg_init.__wbindgen_wasm_module = module;
@@ -6476,6 +7531,8 @@ function initSync(module) {
6476
7531
 
6477
7532
  const imports = __wbg_get_imports();
6478
7533
 
7534
+ __wbg_init_memory(imports);
7535
+
6479
7536
  if (!(module instanceof WebAssembly.Module)) {
6480
7537
  module = new WebAssembly.Module(module);
6481
7538
  }
@@ -6506,6 +7563,8 @@ async function __wbg_init(module_or_path) {
6506
7563
  module_or_path = fetch(module_or_path);
6507
7564
  }
6508
7565
 
7566
+ __wbg_init_memory(imports);
7567
+
6509
7568
  const { instance, module } = await __wbg_load(await module_or_path, imports);
6510
7569
 
6511
7570
  return __wbg_finalize_init(instance, module);