@justinelliottcobb/amari-wasm 0.9.6 → 0.9.7-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/amari_wasm.d.ts +154 -9
- package/amari_wasm.js +526 -43
- package/amari_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/amari_wasm.d.ts
CHANGED
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
* Initialize the enumerative geometry module
|
|
5
5
|
*/
|
|
6
6
|
export function initEnumerative(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Convert velocity to Lorentz factor
|
|
9
|
-
*/
|
|
10
|
-
export function velocity_to_gamma(velocity_magnitude: number): number;
|
|
11
7
|
/**
|
|
12
8
|
* Calculate light deflection angle for photon grazing massive object
|
|
13
9
|
*/
|
|
14
10
|
export function light_deflection_angle(impact_parameter: number, mass: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Validate that this module loaded correctly
|
|
13
|
+
*/
|
|
14
|
+
export function validate_relativistic_module(): boolean;
|
|
15
15
|
/**
|
|
16
16
|
* Convert Lorentz factor to velocity
|
|
17
17
|
*/
|
|
18
18
|
export function gamma_to_velocity(gamma: number): number;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Convert velocity to Lorentz factor
|
|
21
21
|
*/
|
|
22
|
-
export function
|
|
22
|
+
export function velocity_to_gamma(velocity_magnitude: number): number;
|
|
23
23
|
/**
|
|
24
24
|
* Initialize the WASM module
|
|
25
25
|
*/
|
|
@@ -899,6 +899,33 @@ export class WasmGeometricNetwork {
|
|
|
899
899
|
*/
|
|
900
900
|
numNodes(): number;
|
|
901
901
|
}
|
|
902
|
+
/**
|
|
903
|
+
* GPU-accelerated optimization wrapper for WASM
|
|
904
|
+
*/
|
|
905
|
+
export class WasmGpuOptimizer {
|
|
906
|
+
free(): void;
|
|
907
|
+
[Symbol.dispose](): void;
|
|
908
|
+
/**
|
|
909
|
+
* Initialize GPU context for optimization
|
|
910
|
+
*/
|
|
911
|
+
initializeGpu(): Promise<boolean>;
|
|
912
|
+
/**
|
|
913
|
+
* Batch optimization with parallel processing simulation
|
|
914
|
+
*/
|
|
915
|
+
optimizeBatch(problems_data: Float64Array, problem_size: number, num_problems: number, max_iterations: number, tolerance: number): Promise<Float64Array>;
|
|
916
|
+
/**
|
|
917
|
+
* Check if GPU acceleration is available
|
|
918
|
+
*/
|
|
919
|
+
isGpuAvailable(): boolean;
|
|
920
|
+
/**
|
|
921
|
+
* Optimize a quadratic function with GPU acceleration
|
|
922
|
+
*/
|
|
923
|
+
optimizeQuadraticGpu(coefficients: Float64Array, initial_point: Float64Array, max_iterations: number, tolerance: number): Promise<WasmOptimizationResult>;
|
|
924
|
+
/**
|
|
925
|
+
* Create a new GPU optimizer
|
|
926
|
+
*/
|
|
927
|
+
constructor();
|
|
928
|
+
}
|
|
902
929
|
/**
|
|
903
930
|
* WASM wrapper for Grassmannian varieties
|
|
904
931
|
*/
|
|
@@ -1020,6 +1047,42 @@ export class WasmMultiDualNumber {
|
|
|
1020
1047
|
*/
|
|
1021
1048
|
static variable(value: number, num_vars: number, var_index: number): WasmMultiDualNumber;
|
|
1022
1049
|
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Simple multi-objective optimizer for WASM
|
|
1052
|
+
*/
|
|
1053
|
+
export class WasmMultiObjectiveOptimizer {
|
|
1054
|
+
free(): void;
|
|
1055
|
+
[Symbol.dispose](): void;
|
|
1056
|
+
/**
|
|
1057
|
+
* Optimize a simple bi-objective problem
|
|
1058
|
+
* f1 = sum(x_i^2), f2 = sum((x_i - 1)^2)
|
|
1059
|
+
*/
|
|
1060
|
+
optimizeBiObjective(dimension: number, population_size: number, generations: number): WasmMultiObjectiveResult;
|
|
1061
|
+
/**
|
|
1062
|
+
* Create a new multi-objective optimizer
|
|
1063
|
+
*/
|
|
1064
|
+
constructor();
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Multi-objective optimization result
|
|
1068
|
+
*/
|
|
1069
|
+
export class WasmMultiObjectiveResult {
|
|
1070
|
+
private constructor();
|
|
1071
|
+
free(): void;
|
|
1072
|
+
[Symbol.dispose](): void;
|
|
1073
|
+
/**
|
|
1074
|
+
* Get number of generations
|
|
1075
|
+
*/
|
|
1076
|
+
readonly generations: number;
|
|
1077
|
+
/**
|
|
1078
|
+
* Get Pareto front as flattened array
|
|
1079
|
+
*/
|
|
1080
|
+
readonly pareto_front: Float64Array;
|
|
1081
|
+
/**
|
|
1082
|
+
* Check if optimization converged
|
|
1083
|
+
*/
|
|
1084
|
+
readonly converged: boolean;
|
|
1085
|
+
}
|
|
1023
1086
|
/**
|
|
1024
1087
|
* WASM wrapper for Multivector with TypedArray support
|
|
1025
1088
|
*/
|
|
@@ -1142,6 +1205,46 @@ export class WasmNodeMetadata {
|
|
|
1142
1205
|
*/
|
|
1143
1206
|
set label(value: string | null | undefined);
|
|
1144
1207
|
}
|
|
1208
|
+
/**
|
|
1209
|
+
* WASM wrapper for optimization results
|
|
1210
|
+
*/
|
|
1211
|
+
export class WasmOptimizationResult {
|
|
1212
|
+
private constructor();
|
|
1213
|
+
free(): void;
|
|
1214
|
+
[Symbol.dispose](): void;
|
|
1215
|
+
/**
|
|
1216
|
+
* Get number of iterations
|
|
1217
|
+
*/
|
|
1218
|
+
readonly iterations: number;
|
|
1219
|
+
/**
|
|
1220
|
+
* Get final objective value
|
|
1221
|
+
*/
|
|
1222
|
+
readonly objective_value: number;
|
|
1223
|
+
/**
|
|
1224
|
+
* Get solution vector
|
|
1225
|
+
*/
|
|
1226
|
+
readonly solution: Float64Array;
|
|
1227
|
+
/**
|
|
1228
|
+
* Check if optimization converged
|
|
1229
|
+
*/
|
|
1230
|
+
readonly converged: boolean;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Utility functions for optimization
|
|
1234
|
+
*/
|
|
1235
|
+
export class WasmOptimizationUtils {
|
|
1236
|
+
private constructor();
|
|
1237
|
+
free(): void;
|
|
1238
|
+
[Symbol.dispose](): void;
|
|
1239
|
+
/**
|
|
1240
|
+
* Compute numerical gradient
|
|
1241
|
+
*/
|
|
1242
|
+
static numericalGradient(coefficients: Float64Array, point: Float64Array, epsilon: number): Float64Array;
|
|
1243
|
+
/**
|
|
1244
|
+
* Check if a point dominates another in multi-objective optimization
|
|
1245
|
+
*/
|
|
1246
|
+
static dominates(objectives1: Float64Array, objectives2: Float64Array): boolean;
|
|
1247
|
+
}
|
|
1145
1248
|
/**
|
|
1146
1249
|
* WASM wrapper for projective spaces
|
|
1147
1250
|
*/
|
|
@@ -1363,6 +1466,21 @@ export class WasmSensitivityMap {
|
|
|
1363
1466
|
*/
|
|
1364
1467
|
getTotalSensitivity(): number;
|
|
1365
1468
|
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Simple quadratic optimization problem for WASM demonstration
|
|
1471
|
+
*/
|
|
1472
|
+
export class WasmSimpleOptimizer {
|
|
1473
|
+
free(): void;
|
|
1474
|
+
[Symbol.dispose](): void;
|
|
1475
|
+
/**
|
|
1476
|
+
* Optimize a simple quadratic function: minimize sum(c_i * x_i^2)
|
|
1477
|
+
*/
|
|
1478
|
+
optimizeQuadratic(coefficients: Float64Array, initial_point: Float64Array): WasmOptimizationResult;
|
|
1479
|
+
/**
|
|
1480
|
+
* Create a new simple optimizer
|
|
1481
|
+
*/
|
|
1482
|
+
constructor();
|
|
1483
|
+
}
|
|
1366
1484
|
/**
|
|
1367
1485
|
* WASM wrapper for spacetime vectors
|
|
1368
1486
|
*/
|
|
@@ -1748,6 +1866,7 @@ export interface InitOutput {
|
|
|
1748
1866
|
readonly __wbg_wasmmultidualnumber_free: (a: number, b: number) => void;
|
|
1749
1867
|
readonly __wbg_wasmmultivector_free: (a: number, b: number) => void;
|
|
1750
1868
|
readonly __wbg_wasmnodemetadata_free: (a: number, b: number) => void;
|
|
1869
|
+
readonly __wbg_wasmoptimizationresult_free: (a: number, b: number) => void;
|
|
1751
1870
|
readonly __wbg_wasmprojectivespace_free: (a: number, b: number) => void;
|
|
1752
1871
|
readonly __wbg_wasmpropagationanalysis_free: (a: number, b: number) => void;
|
|
1753
1872
|
readonly __wbg_wasmrelativisticparticle_free: (a: number, b: number) => void;
|
|
@@ -1927,6 +2046,11 @@ export interface InitOutput {
|
|
|
1927
2046
|
readonly wasmgeometricnetwork_spectralClustering: (a: number, b: number) => [number, number, number];
|
|
1928
2047
|
readonly wasmgeometricnetwork_toTropicalNetwork: (a: number) => [number, number, number];
|
|
1929
2048
|
readonly wasmgeometricnetwork_withCapacity: (a: number, b: number) => number;
|
|
2049
|
+
readonly wasmgpuoptimizer_initializeGpu: (a: number) => any;
|
|
2050
|
+
readonly wasmgpuoptimizer_isGpuAvailable: (a: number) => number;
|
|
2051
|
+
readonly wasmgpuoptimizer_new: () => number;
|
|
2052
|
+
readonly wasmgpuoptimizer_optimizeBatch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
2053
|
+
readonly wasmgpuoptimizer_optimizeQuadraticGpu: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
1930
2054
|
readonly wasmgrassmannian_getDimension: (a: number) => number;
|
|
1931
2055
|
readonly wasmgrassmannian_getParameters: (a: number) => [number, number];
|
|
1932
2056
|
readonly wasmgrassmannian_new: (a: number, b: number) => [number, number, number];
|
|
@@ -1949,6 +2073,10 @@ export interface InitOutput {
|
|
|
1949
2073
|
readonly wasmmultidualnumber_new: (a: number, b: number, c: number) => number;
|
|
1950
2074
|
readonly wasmmultidualnumber_sqrt: (a: number) => [number, number, number];
|
|
1951
2075
|
readonly wasmmultidualnumber_variable: (a: number, b: number, c: number) => number;
|
|
2076
|
+
readonly wasmmultiobjectiveoptimizer_optimizeBiObjective: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2077
|
+
readonly wasmmultiobjectiveresult_converged: (a: number) => number;
|
|
2078
|
+
readonly wasmmultiobjectiveresult_generations: (a: number) => number;
|
|
2079
|
+
readonly wasmmultiobjectiveresult_pareto_front: (a: number) => [number, number];
|
|
1952
2080
|
readonly wasmmultivector_add: (a: number, b: number) => number;
|
|
1953
2081
|
readonly wasmmultivector_basisVector: (a: number) => [number, number, number];
|
|
1954
2082
|
readonly wasmmultivector_exp: (a: number) => number;
|
|
@@ -1975,10 +2103,14 @@ export interface InitOutput {
|
|
|
1975
2103
|
readonly wasmnodemetadata_setProperty: (a: number, b: number, c: number, d: number) => void;
|
|
1976
2104
|
readonly wasmnodemetadata_set_label: (a: number, b: number, c: number) => void;
|
|
1977
2105
|
readonly wasmnodemetadata_withLabel: (a: number, b: number) => number;
|
|
2106
|
+
readonly wasmoptimizationresult_converged: (a: number) => number;
|
|
2107
|
+
readonly wasmoptimizationresult_iterations: (a: number) => number;
|
|
2108
|
+
readonly wasmoptimizationresult_solution: (a: number) => [number, number];
|
|
2109
|
+
readonly wasmoptimizationutils_dominates: (a: number, b: number, c: number, d: number) => number;
|
|
2110
|
+
readonly wasmoptimizationutils_numericalGradient: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
1978
2111
|
readonly wasmprojectivespace_bezoutIntersection: (a: number, b: number, c: number) => number;
|
|
1979
2112
|
readonly wasmprojectivespace_hasDimension: (a: number, b: number) => number;
|
|
1980
2113
|
readonly wasmprojectivespace_new: (a: number) => number;
|
|
1981
|
-
readonly wasmpropagationanalysis_convergence_time: (a: number) => number;
|
|
1982
2114
|
readonly wasmpropagationanalysis_coverage: (a: number) => [number, number];
|
|
1983
2115
|
readonly wasmpropagationanalysis_influence_scores: (a: number) => [number, number];
|
|
1984
2116
|
readonly wasmrelativisticconstants_earth_mass: () => number;
|
|
@@ -2012,6 +2144,7 @@ export interface InitOutput {
|
|
|
2012
2144
|
readonly wasmsensitivitymap_getAllSensitivities: (a: number) => [number, number, number];
|
|
2013
2145
|
readonly wasmsensitivitymap_getMostSensitive: (a: number, b: number) => [number, number];
|
|
2014
2146
|
readonly wasmsensitivitymap_getTotalSensitivity: (a: number) => number;
|
|
2147
|
+
readonly wasmsimpleoptimizer_optimizeQuadratic: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
2015
2148
|
readonly wasmspacetimevector_is_null: (a: number) => number;
|
|
2016
2149
|
readonly wasmspacetimevector_is_spacelike: (a: number) => number;
|
|
2017
2150
|
readonly wasmspacetimevector_is_timelike: (a: number) => number;
|
|
@@ -2051,7 +2184,6 @@ export interface InitOutput {
|
|
|
2051
2184
|
readonly wasmtropicaldualdistribution_mostLikelySequence: (a: number, b: number) => [number, number];
|
|
2052
2185
|
readonly wasmtropicaldualdistribution_new: (a: number, b: number) => number;
|
|
2053
2186
|
readonly wasmtropicalnetwork_fromWeights: (a: number, b: number, c: number) => [number, number, number];
|
|
2054
|
-
readonly wasmtropicalnetwork_getSize: (a: number) => number;
|
|
2055
2187
|
readonly wasmtropicalnetwork_new: (a: number) => number;
|
|
2056
2188
|
readonly wasmtropicalnetwork_setEdge: (a: number, b: number, c: number, d: number) => [number, number];
|
|
2057
2189
|
readonly wasmtropicalnetwork_shortestPathTropical: (a: number, b: number, c: number) => [number, number, number];
|
|
@@ -2067,7 +2199,6 @@ export interface InitOutput {
|
|
|
2067
2199
|
readonly wasmtropicalnumber_toProb: (a: number) => number;
|
|
2068
2200
|
readonly wasmtropicalnumber_tropicalPow: (a: number, b: number) => number;
|
|
2069
2201
|
readonly wasmtropicalnumber_zero: () => number;
|
|
2070
|
-
readonly wasmtropicalpolynomial_coefficients_count: (a: number) => number;
|
|
2071
2202
|
readonly wasmtropicalpolynomial_evaluate: (a: number, b: number) => number;
|
|
2072
2203
|
readonly wasmtropicalpolynomial_new: (a: number, b: number) => number;
|
|
2073
2204
|
readonly wasmtropicalpolynomial_tropical_roots: (a: number) => any;
|
|
@@ -2079,6 +2210,7 @@ export interface InitOutput {
|
|
|
2079
2210
|
readonly wasmspacetimevector_t: (a: number) => number;
|
|
2080
2211
|
readonly wasmtropicalnumber_tropicalMul: (a: number, b: number) => number;
|
|
2081
2212
|
readonly wasmtrajectorypoint_position: (a: number) => number;
|
|
2213
|
+
readonly wasmtropicalpolynomial_coefficients_count: (a: number) => number;
|
|
2082
2214
|
readonly wasmtropicalnumber_tropicalAdd: (a: number, b: number) => number;
|
|
2083
2215
|
readonly wasmcommunity_cohesion_score: (a: number) => number;
|
|
2084
2216
|
readonly wasmdualnumber_getReal: (a: number) => number;
|
|
@@ -2086,12 +2218,15 @@ export interface InitOutput {
|
|
|
2086
2218
|
readonly wasmevaluationresult_getGradientNorm: (a: number) => number;
|
|
2087
2219
|
readonly wasmgeometricedge_weight: (a: number) => number;
|
|
2088
2220
|
readonly wasmmultidualnumber_getReal: (a: number) => number;
|
|
2221
|
+
readonly wasmoptimizationresult_objective_value: (a: number) => number;
|
|
2089
2222
|
readonly wasmprojectivespace_getDimension: (a: number) => number;
|
|
2223
|
+
readonly wasmpropagationanalysis_convergence_time: (a: number) => number;
|
|
2090
2224
|
readonly wasmschwarzschildmetric_mass: (a: number) => number;
|
|
2091
2225
|
readonly wasmspacetimevector_x: (a: number) => number;
|
|
2092
2226
|
readonly wasmspacetimevector_y: (a: number) => number;
|
|
2093
2227
|
readonly wasmspacetimevector_z: (a: number) => number;
|
|
2094
2228
|
readonly wasmtropicalcurve_getGenus: (a: number) => number;
|
|
2229
|
+
readonly wasmtropicalnetwork_getSize: (a: number) => number;
|
|
2095
2230
|
readonly wasmtropicalnumber_getValue: (a: number) => number;
|
|
2096
2231
|
readonly __wbg_automatabatchoperations_free: (a: number, b: number) => void;
|
|
2097
2232
|
readonly __wbg_automatautils_free: (a: number, b: number) => void;
|
|
@@ -2110,19 +2245,29 @@ export interface InitOutput {
|
|
|
2110
2245
|
readonly __wbg_wasmdualnumber_free: (a: number, b: number) => void;
|
|
2111
2246
|
readonly __wbg_wasmfourvelocity_free: (a: number, b: number) => void;
|
|
2112
2247
|
readonly __wbg_wasmgeometricedge_free: (a: number, b: number) => void;
|
|
2248
|
+
readonly __wbg_wasmgpuoptimizer_free: (a: number, b: number) => void;
|
|
2249
|
+
readonly __wbg_wasmmultiobjectiveoptimizer_free: (a: number, b: number) => void;
|
|
2250
|
+
readonly __wbg_wasmoptimizationutils_free: (a: number, b: number) => void;
|
|
2113
2251
|
readonly __wbg_wasmrelativisticconstants_free: (a: number, b: number) => void;
|
|
2252
|
+
readonly __wbg_wasmsimpleoptimizer_free: (a: number, b: number) => void;
|
|
2114
2253
|
readonly __wbg_wasmspacetimevector_free: (a: number, b: number) => void;
|
|
2115
2254
|
readonly __wbg_wasmtropicalcurve_free: (a: number, b: number) => void;
|
|
2116
2255
|
readonly __wbg_wasmtropicalnumber_free: (a: number, b: number) => void;
|
|
2256
|
+
readonly __wbg_wasmmultiobjectiveresult_free: (a: number, b: number) => void;
|
|
2117
2257
|
readonly wasmrotor_inverse: (a: number) => number;
|
|
2118
2258
|
readonly __wbg_wasmrotor_free: (a: number, b: number) => void;
|
|
2259
|
+
readonly wasmmultiobjectiveoptimizer_new: () => number;
|
|
2260
|
+
readonly wasmsimpleoptimizer_new: () => number;
|
|
2119
2261
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
2120
2262
|
readonly __externref_table_alloc: () => number;
|
|
2121
2263
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
2122
2264
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
2123
2265
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
2124
2266
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
2267
|
+
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
2125
2268
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
2269
|
+
readonly closure38_externref_shim: (a: number, b: number, c: any) => void;
|
|
2270
|
+
readonly closure28_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
2126
2271
|
readonly __wbindgen_start: () => void;
|
|
2127
2272
|
}
|
|
2128
2273
|
|
package/amari_wasm.js
CHANGED
|
@@ -108,6 +108,10 @@ function getDataViewMemory0() {
|
|
|
108
108
|
return cachedDataViewMemory0;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
function isLikeNone(x) {
|
|
112
|
+
return x === undefined || x === null;
|
|
113
|
+
}
|
|
114
|
+
|
|
111
115
|
function debugString(val) {
|
|
112
116
|
// primitive types
|
|
113
117
|
const type = typeof val;
|
|
@@ -173,8 +177,52 @@ function debugString(val) {
|
|
|
173
177
|
return className;
|
|
174
178
|
}
|
|
175
179
|
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
181
|
+
? { register: () => {}, unregister: () => {} }
|
|
182
|
+
: new FinalizationRegistry(
|
|
183
|
+
state => {
|
|
184
|
+
wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
189
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
190
|
+
const real = (...args) => {
|
|
191
|
+
|
|
192
|
+
// First up with a closure we increment the internal reference
|
|
193
|
+
// count. This ensures that the Rust closure environment won't
|
|
194
|
+
// be deallocated while we're invoking it.
|
|
195
|
+
state.cnt++;
|
|
196
|
+
const a = state.a;
|
|
197
|
+
state.a = 0;
|
|
198
|
+
try {
|
|
199
|
+
return f(a, state.b, ...args);
|
|
200
|
+
} finally {
|
|
201
|
+
if (--state.cnt === 0) {
|
|
202
|
+
wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
|
|
203
|
+
CLOSURE_DTORS.unregister(state);
|
|
204
|
+
} else {
|
|
205
|
+
state.a = a;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
real.original = state;
|
|
210
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
211
|
+
return real;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
215
|
+
|
|
216
|
+
function getFloat64ArrayMemory0() {
|
|
217
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
218
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
219
|
+
}
|
|
220
|
+
return cachedFloat64ArrayMemory0;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function getArrayF64FromWasm0(ptr, len) {
|
|
224
|
+
ptr = ptr >>> 0;
|
|
225
|
+
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
178
226
|
}
|
|
179
227
|
|
|
180
228
|
function _assertClass(instance, klass) {
|
|
@@ -205,20 +253,6 @@ function takeFromExternrefTable0(idx) {
|
|
|
205
253
|
return value;
|
|
206
254
|
}
|
|
207
255
|
|
|
208
|
-
let cachedFloat64ArrayMemory0 = null;
|
|
209
|
-
|
|
210
|
-
function getFloat64ArrayMemory0() {
|
|
211
|
-
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
212
|
-
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
213
|
-
}
|
|
214
|
-
return cachedFloat64ArrayMemory0;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function getArrayF64FromWasm0(ptr, len) {
|
|
218
|
-
ptr = ptr >>> 0;
|
|
219
|
-
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
256
|
function getArrayU32FromWasm0(ptr, len) {
|
|
223
257
|
ptr = ptr >>> 0;
|
|
224
258
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
@@ -230,19 +264,12 @@ export function initEnumerative() {
|
|
|
230
264
|
wasm.initEnumerative();
|
|
231
265
|
}
|
|
232
266
|
|
|
233
|
-
|
|
234
|
-
*
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
export function velocity_to_gamma(velocity_magnitude) {
|
|
239
|
-
const ret = wasm.velocity_to_gamma(velocity_magnitude);
|
|
240
|
-
if (ret[2]) {
|
|
241
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
242
|
-
}
|
|
243
|
-
return ret[0];
|
|
267
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
268
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
269
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
270
|
+
WASM_VECTOR_LEN = arg.length;
|
|
271
|
+
return ptr;
|
|
244
272
|
}
|
|
245
|
-
|
|
246
273
|
/**
|
|
247
274
|
* Calculate light deflection angle for photon grazing massive object
|
|
248
275
|
* @param {number} impact_parameter
|
|
@@ -254,6 +281,15 @@ export function light_deflection_angle(impact_parameter, mass) {
|
|
|
254
281
|
return ret;
|
|
255
282
|
}
|
|
256
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Validate that this module loaded correctly
|
|
286
|
+
* @returns {boolean}
|
|
287
|
+
*/
|
|
288
|
+
export function validate_relativistic_module() {
|
|
289
|
+
const ret = wasm.validate_relativistic_module();
|
|
290
|
+
return ret !== 0;
|
|
291
|
+
}
|
|
292
|
+
|
|
257
293
|
/**
|
|
258
294
|
* Convert Lorentz factor to velocity
|
|
259
295
|
* @param {number} gamma
|
|
@@ -268,20 +304,18 @@ export function gamma_to_velocity(gamma) {
|
|
|
268
304
|
}
|
|
269
305
|
|
|
270
306
|
/**
|
|
271
|
-
*
|
|
272
|
-
* @
|
|
307
|
+
* Convert velocity to Lorentz factor
|
|
308
|
+
* @param {number} velocity_magnitude
|
|
309
|
+
* @returns {number}
|
|
273
310
|
*/
|
|
274
|
-
export function
|
|
275
|
-
const ret = wasm.
|
|
276
|
-
|
|
311
|
+
export function velocity_to_gamma(velocity_magnitude) {
|
|
312
|
+
const ret = wasm.velocity_to_gamma(velocity_magnitude);
|
|
313
|
+
if (ret[2]) {
|
|
314
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
315
|
+
}
|
|
316
|
+
return ret[0];
|
|
277
317
|
}
|
|
278
318
|
|
|
279
|
-
function passArrayF64ToWasm0(arg, malloc) {
|
|
280
|
-
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
281
|
-
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
282
|
-
WASM_VECTOR_LEN = arg.length;
|
|
283
|
-
return ptr;
|
|
284
|
-
}
|
|
285
319
|
/**
|
|
286
320
|
* Initialize the WASM module
|
|
287
321
|
*/
|
|
@@ -307,6 +341,13 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
307
341
|
ptr = ptr >>> 0;
|
|
308
342
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
309
343
|
}
|
|
344
|
+
function __wbg_adapter_8(arg0, arg1, arg2) {
|
|
345
|
+
wasm.closure38_externref_shim(arg0, arg1, arg2);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function __wbg_adapter_387(arg0, arg1, arg2, arg3) {
|
|
349
|
+
wasm.closure28_externref_shim(arg0, arg1, arg2, arg3);
|
|
350
|
+
}
|
|
310
351
|
|
|
311
352
|
const AutoDiffFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
312
353
|
? { register: () => {}, unregister: () => {} }
|
|
@@ -2950,6 +2991,84 @@ export class WasmGeometricNetwork {
|
|
|
2950
2991
|
}
|
|
2951
2992
|
if (Symbol.dispose) WasmGeometricNetwork.prototype[Symbol.dispose] = WasmGeometricNetwork.prototype.free;
|
|
2952
2993
|
|
|
2994
|
+
const WasmGpuOptimizerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2995
|
+
? { register: () => {}, unregister: () => {} }
|
|
2996
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmgpuoptimizer_free(ptr >>> 0, 1));
|
|
2997
|
+
/**
|
|
2998
|
+
* GPU-accelerated optimization wrapper for WASM
|
|
2999
|
+
*/
|
|
3000
|
+
export class WasmGpuOptimizer {
|
|
3001
|
+
|
|
3002
|
+
__destroy_into_raw() {
|
|
3003
|
+
const ptr = this.__wbg_ptr;
|
|
3004
|
+
this.__wbg_ptr = 0;
|
|
3005
|
+
WasmGpuOptimizerFinalization.unregister(this);
|
|
3006
|
+
return ptr;
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
free() {
|
|
3010
|
+
const ptr = this.__destroy_into_raw();
|
|
3011
|
+
wasm.__wbg_wasmgpuoptimizer_free(ptr, 0);
|
|
3012
|
+
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Initialize GPU context for optimization
|
|
3015
|
+
* @returns {Promise<boolean>}
|
|
3016
|
+
*/
|
|
3017
|
+
initializeGpu() {
|
|
3018
|
+
const ret = wasm.wasmgpuoptimizer_initializeGpu(this.__wbg_ptr);
|
|
3019
|
+
return ret;
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* Batch optimization with parallel processing simulation
|
|
3023
|
+
* @param {Float64Array} problems_data
|
|
3024
|
+
* @param {number} problem_size
|
|
3025
|
+
* @param {number} num_problems
|
|
3026
|
+
* @param {number} max_iterations
|
|
3027
|
+
* @param {number} tolerance
|
|
3028
|
+
* @returns {Promise<Float64Array>}
|
|
3029
|
+
*/
|
|
3030
|
+
optimizeBatch(problems_data, problem_size, num_problems, max_iterations, tolerance) {
|
|
3031
|
+
const ptr0 = passArrayF64ToWasm0(problems_data, wasm.__wbindgen_malloc);
|
|
3032
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3033
|
+
const ret = wasm.wasmgpuoptimizer_optimizeBatch(this.__wbg_ptr, ptr0, len0, problem_size, num_problems, max_iterations, tolerance);
|
|
3034
|
+
return ret;
|
|
3035
|
+
}
|
|
3036
|
+
/**
|
|
3037
|
+
* Check if GPU acceleration is available
|
|
3038
|
+
* @returns {boolean}
|
|
3039
|
+
*/
|
|
3040
|
+
isGpuAvailable() {
|
|
3041
|
+
const ret = wasm.wasmgpuoptimizer_isGpuAvailable(this.__wbg_ptr);
|
|
3042
|
+
return ret !== 0;
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* Optimize a quadratic function with GPU acceleration
|
|
3046
|
+
* @param {Float64Array} coefficients
|
|
3047
|
+
* @param {Float64Array} initial_point
|
|
3048
|
+
* @param {number} max_iterations
|
|
3049
|
+
* @param {number} tolerance
|
|
3050
|
+
* @returns {Promise<WasmOptimizationResult>}
|
|
3051
|
+
*/
|
|
3052
|
+
optimizeQuadraticGpu(coefficients, initial_point, max_iterations, tolerance) {
|
|
3053
|
+
const ptr0 = passArrayF64ToWasm0(coefficients, wasm.__wbindgen_malloc);
|
|
3054
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3055
|
+
const ptr1 = passArrayF64ToWasm0(initial_point, wasm.__wbindgen_malloc);
|
|
3056
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3057
|
+
const ret = wasm.wasmgpuoptimizer_optimizeQuadraticGpu(this.__wbg_ptr, ptr0, len0, ptr1, len1, max_iterations, tolerance);
|
|
3058
|
+
return ret;
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* Create a new GPU optimizer
|
|
3062
|
+
*/
|
|
3063
|
+
constructor() {
|
|
3064
|
+
const ret = wasm.wasmgpuoptimizer_new();
|
|
3065
|
+
this.__wbg_ptr = ret >>> 0;
|
|
3066
|
+
WasmGpuOptimizerFinalization.register(this, this.__wbg_ptr, this);
|
|
3067
|
+
return this;
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
if (Symbol.dispose) WasmGpuOptimizer.prototype[Symbol.dispose] = WasmGpuOptimizer.prototype.free;
|
|
3071
|
+
|
|
2953
3072
|
const WasmGrassmannianFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2954
3073
|
? { register: () => {}, unregister: () => {} }
|
|
2955
3074
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmgrassmannian_free(ptr >>> 0, 1));
|
|
@@ -3299,6 +3418,108 @@ export class WasmMultiDualNumber {
|
|
|
3299
3418
|
}
|
|
3300
3419
|
if (Symbol.dispose) WasmMultiDualNumber.prototype[Symbol.dispose] = WasmMultiDualNumber.prototype.free;
|
|
3301
3420
|
|
|
3421
|
+
const WasmMultiObjectiveOptimizerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3422
|
+
? { register: () => {}, unregister: () => {} }
|
|
3423
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmultiobjectiveoptimizer_free(ptr >>> 0, 1));
|
|
3424
|
+
/**
|
|
3425
|
+
* Simple multi-objective optimizer for WASM
|
|
3426
|
+
*/
|
|
3427
|
+
export class WasmMultiObjectiveOptimizer {
|
|
3428
|
+
|
|
3429
|
+
__destroy_into_raw() {
|
|
3430
|
+
const ptr = this.__wbg_ptr;
|
|
3431
|
+
this.__wbg_ptr = 0;
|
|
3432
|
+
WasmMultiObjectiveOptimizerFinalization.unregister(this);
|
|
3433
|
+
return ptr;
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3436
|
+
free() {
|
|
3437
|
+
const ptr = this.__destroy_into_raw();
|
|
3438
|
+
wasm.__wbg_wasmmultiobjectiveoptimizer_free(ptr, 0);
|
|
3439
|
+
}
|
|
3440
|
+
/**
|
|
3441
|
+
* Optimize a simple bi-objective problem
|
|
3442
|
+
* f1 = sum(x_i^2), f2 = sum((x_i - 1)^2)
|
|
3443
|
+
* @param {number} dimension
|
|
3444
|
+
* @param {number} population_size
|
|
3445
|
+
* @param {number} generations
|
|
3446
|
+
* @returns {WasmMultiObjectiveResult}
|
|
3447
|
+
*/
|
|
3448
|
+
optimizeBiObjective(dimension, population_size, generations) {
|
|
3449
|
+
const ret = wasm.wasmmultiobjectiveoptimizer_optimizeBiObjective(this.__wbg_ptr, dimension, population_size, generations);
|
|
3450
|
+
if (ret[2]) {
|
|
3451
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3452
|
+
}
|
|
3453
|
+
return WasmMultiObjectiveResult.__wrap(ret[0]);
|
|
3454
|
+
}
|
|
3455
|
+
/**
|
|
3456
|
+
* Create a new multi-objective optimizer
|
|
3457
|
+
*/
|
|
3458
|
+
constructor() {
|
|
3459
|
+
const ret = wasm.wasmgpuoptimizer_new();
|
|
3460
|
+
this.__wbg_ptr = ret >>> 0;
|
|
3461
|
+
WasmMultiObjectiveOptimizerFinalization.register(this, this.__wbg_ptr, this);
|
|
3462
|
+
return this;
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
if (Symbol.dispose) WasmMultiObjectiveOptimizer.prototype[Symbol.dispose] = WasmMultiObjectiveOptimizer.prototype.free;
|
|
3466
|
+
|
|
3467
|
+
const WasmMultiObjectiveResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3468
|
+
? { register: () => {}, unregister: () => {} }
|
|
3469
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmultiobjectiveresult_free(ptr >>> 0, 1));
|
|
3470
|
+
/**
|
|
3471
|
+
* Multi-objective optimization result
|
|
3472
|
+
*/
|
|
3473
|
+
export class WasmMultiObjectiveResult {
|
|
3474
|
+
|
|
3475
|
+
static __wrap(ptr) {
|
|
3476
|
+
ptr = ptr >>> 0;
|
|
3477
|
+
const obj = Object.create(WasmMultiObjectiveResult.prototype);
|
|
3478
|
+
obj.__wbg_ptr = ptr;
|
|
3479
|
+
WasmMultiObjectiveResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3480
|
+
return obj;
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3483
|
+
__destroy_into_raw() {
|
|
3484
|
+
const ptr = this.__wbg_ptr;
|
|
3485
|
+
this.__wbg_ptr = 0;
|
|
3486
|
+
WasmMultiObjectiveResultFinalization.unregister(this);
|
|
3487
|
+
return ptr;
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
free() {
|
|
3491
|
+
const ptr = this.__destroy_into_raw();
|
|
3492
|
+
wasm.__wbg_wasmmultiobjectiveresult_free(ptr, 0);
|
|
3493
|
+
}
|
|
3494
|
+
/**
|
|
3495
|
+
* Get number of generations
|
|
3496
|
+
* @returns {number}
|
|
3497
|
+
*/
|
|
3498
|
+
get generations() {
|
|
3499
|
+
const ret = wasm.wasmmultiobjectiveresult_generations(this.__wbg_ptr);
|
|
3500
|
+
return ret >>> 0;
|
|
3501
|
+
}
|
|
3502
|
+
/**
|
|
3503
|
+
* Get Pareto front as flattened array
|
|
3504
|
+
* @returns {Float64Array}
|
|
3505
|
+
*/
|
|
3506
|
+
get pareto_front() {
|
|
3507
|
+
const ret = wasm.wasmmultiobjectiveresult_pareto_front(this.__wbg_ptr);
|
|
3508
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3509
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3510
|
+
return v1;
|
|
3511
|
+
}
|
|
3512
|
+
/**
|
|
3513
|
+
* Check if optimization converged
|
|
3514
|
+
* @returns {boolean}
|
|
3515
|
+
*/
|
|
3516
|
+
get converged() {
|
|
3517
|
+
const ret = wasm.wasmmultiobjectiveresult_converged(this.__wbg_ptr);
|
|
3518
|
+
return ret !== 0;
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
if (Symbol.dispose) WasmMultiObjectiveResult.prototype[Symbol.dispose] = WasmMultiObjectiveResult.prototype.free;
|
|
3522
|
+
|
|
3302
3523
|
const WasmMultivectorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3303
3524
|
? { register: () => {}, unregister: () => {} }
|
|
3304
3525
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmultivector_free(ptr >>> 0, 1));
|
|
@@ -3625,6 +3846,126 @@ export class WasmNodeMetadata {
|
|
|
3625
3846
|
}
|
|
3626
3847
|
if (Symbol.dispose) WasmNodeMetadata.prototype[Symbol.dispose] = WasmNodeMetadata.prototype.free;
|
|
3627
3848
|
|
|
3849
|
+
const WasmOptimizationResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3850
|
+
? { register: () => {}, unregister: () => {} }
|
|
3851
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmoptimizationresult_free(ptr >>> 0, 1));
|
|
3852
|
+
/**
|
|
3853
|
+
* WASM wrapper for optimization results
|
|
3854
|
+
*/
|
|
3855
|
+
export class WasmOptimizationResult {
|
|
3856
|
+
|
|
3857
|
+
static __wrap(ptr) {
|
|
3858
|
+
ptr = ptr >>> 0;
|
|
3859
|
+
const obj = Object.create(WasmOptimizationResult.prototype);
|
|
3860
|
+
obj.__wbg_ptr = ptr;
|
|
3861
|
+
WasmOptimizationResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3862
|
+
return obj;
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3865
|
+
__destroy_into_raw() {
|
|
3866
|
+
const ptr = this.__wbg_ptr;
|
|
3867
|
+
this.__wbg_ptr = 0;
|
|
3868
|
+
WasmOptimizationResultFinalization.unregister(this);
|
|
3869
|
+
return ptr;
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
free() {
|
|
3873
|
+
const ptr = this.__destroy_into_raw();
|
|
3874
|
+
wasm.__wbg_wasmoptimizationresult_free(ptr, 0);
|
|
3875
|
+
}
|
|
3876
|
+
/**
|
|
3877
|
+
* Get number of iterations
|
|
3878
|
+
* @returns {number}
|
|
3879
|
+
*/
|
|
3880
|
+
get iterations() {
|
|
3881
|
+
const ret = wasm.wasmoptimizationresult_iterations(this.__wbg_ptr);
|
|
3882
|
+
return ret >>> 0;
|
|
3883
|
+
}
|
|
3884
|
+
/**
|
|
3885
|
+
* Get final objective value
|
|
3886
|
+
* @returns {number}
|
|
3887
|
+
*/
|
|
3888
|
+
get objective_value() {
|
|
3889
|
+
const ret = wasm.wasmalphaconnection_getAlpha(this.__wbg_ptr);
|
|
3890
|
+
return ret;
|
|
3891
|
+
}
|
|
3892
|
+
/**
|
|
3893
|
+
* Get solution vector
|
|
3894
|
+
* @returns {Float64Array}
|
|
3895
|
+
*/
|
|
3896
|
+
get solution() {
|
|
3897
|
+
const ret = wasm.wasmoptimizationresult_solution(this.__wbg_ptr);
|
|
3898
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3899
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3900
|
+
return v1;
|
|
3901
|
+
}
|
|
3902
|
+
/**
|
|
3903
|
+
* Check if optimization converged
|
|
3904
|
+
* @returns {boolean}
|
|
3905
|
+
*/
|
|
3906
|
+
get converged() {
|
|
3907
|
+
const ret = wasm.wasmoptimizationresult_converged(this.__wbg_ptr);
|
|
3908
|
+
return ret !== 0;
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
if (Symbol.dispose) WasmOptimizationResult.prototype[Symbol.dispose] = WasmOptimizationResult.prototype.free;
|
|
3912
|
+
|
|
3913
|
+
const WasmOptimizationUtilsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3914
|
+
? { register: () => {}, unregister: () => {} }
|
|
3915
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmoptimizationutils_free(ptr >>> 0, 1));
|
|
3916
|
+
/**
|
|
3917
|
+
* Utility functions for optimization
|
|
3918
|
+
*/
|
|
3919
|
+
export class WasmOptimizationUtils {
|
|
3920
|
+
|
|
3921
|
+
__destroy_into_raw() {
|
|
3922
|
+
const ptr = this.__wbg_ptr;
|
|
3923
|
+
this.__wbg_ptr = 0;
|
|
3924
|
+
WasmOptimizationUtilsFinalization.unregister(this);
|
|
3925
|
+
return ptr;
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3928
|
+
free() {
|
|
3929
|
+
const ptr = this.__destroy_into_raw();
|
|
3930
|
+
wasm.__wbg_wasmoptimizationutils_free(ptr, 0);
|
|
3931
|
+
}
|
|
3932
|
+
/**
|
|
3933
|
+
* Compute numerical gradient
|
|
3934
|
+
* @param {Float64Array} coefficients
|
|
3935
|
+
* @param {Float64Array} point
|
|
3936
|
+
* @param {number} epsilon
|
|
3937
|
+
* @returns {Float64Array}
|
|
3938
|
+
*/
|
|
3939
|
+
static numericalGradient(coefficients, point, epsilon) {
|
|
3940
|
+
const ptr0 = passArrayF64ToWasm0(coefficients, wasm.__wbindgen_malloc);
|
|
3941
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3942
|
+
const ptr1 = passArrayF64ToWasm0(point, wasm.__wbindgen_malloc);
|
|
3943
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3944
|
+
const ret = wasm.wasmoptimizationutils_numericalGradient(ptr0, len0, ptr1, len1, epsilon);
|
|
3945
|
+
if (ret[3]) {
|
|
3946
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3947
|
+
}
|
|
3948
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3949
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3950
|
+
return v3;
|
|
3951
|
+
}
|
|
3952
|
+
/**
|
|
3953
|
+
* Check if a point dominates another in multi-objective optimization
|
|
3954
|
+
* @param {Float64Array} objectives1
|
|
3955
|
+
* @param {Float64Array} objectives2
|
|
3956
|
+
* @returns {boolean}
|
|
3957
|
+
*/
|
|
3958
|
+
static dominates(objectives1, objectives2) {
|
|
3959
|
+
const ptr0 = passArrayF64ToWasm0(objectives1, wasm.__wbindgen_malloc);
|
|
3960
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3961
|
+
const ptr1 = passArrayF64ToWasm0(objectives2, wasm.__wbindgen_malloc);
|
|
3962
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3963
|
+
const ret = wasm.wasmoptimizationutils_dominates(ptr0, len0, ptr1, len1);
|
|
3964
|
+
return ret !== 0;
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
if (Symbol.dispose) WasmOptimizationUtils.prototype[Symbol.dispose] = WasmOptimizationUtils.prototype.free;
|
|
3968
|
+
|
|
3628
3969
|
const WasmProjectiveSpaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3629
3970
|
? { register: () => {}, unregister: () => {} }
|
|
3630
3971
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmprojectivespace_free(ptr >>> 0, 1));
|
|
@@ -3716,7 +4057,7 @@ export class WasmPropagationAnalysis {
|
|
|
3716
4057
|
* @returns {number}
|
|
3717
4058
|
*/
|
|
3718
4059
|
get convergenceTime() {
|
|
3719
|
-
const ret = wasm.
|
|
4060
|
+
const ret = wasm.wasmoptimizationresult_iterations(this.__wbg_ptr);
|
|
3720
4061
|
return ret >>> 0;
|
|
3721
4062
|
}
|
|
3722
4063
|
/**
|
|
@@ -4228,6 +4569,54 @@ export class WasmSensitivityMap {
|
|
|
4228
4569
|
}
|
|
4229
4570
|
if (Symbol.dispose) WasmSensitivityMap.prototype[Symbol.dispose] = WasmSensitivityMap.prototype.free;
|
|
4230
4571
|
|
|
4572
|
+
const WasmSimpleOptimizerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4573
|
+
? { register: () => {}, unregister: () => {} }
|
|
4574
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsimpleoptimizer_free(ptr >>> 0, 1));
|
|
4575
|
+
/**
|
|
4576
|
+
* Simple quadratic optimization problem for WASM demonstration
|
|
4577
|
+
*/
|
|
4578
|
+
export class WasmSimpleOptimizer {
|
|
4579
|
+
|
|
4580
|
+
__destroy_into_raw() {
|
|
4581
|
+
const ptr = this.__wbg_ptr;
|
|
4582
|
+
this.__wbg_ptr = 0;
|
|
4583
|
+
WasmSimpleOptimizerFinalization.unregister(this);
|
|
4584
|
+
return ptr;
|
|
4585
|
+
}
|
|
4586
|
+
|
|
4587
|
+
free() {
|
|
4588
|
+
const ptr = this.__destroy_into_raw();
|
|
4589
|
+
wasm.__wbg_wasmsimpleoptimizer_free(ptr, 0);
|
|
4590
|
+
}
|
|
4591
|
+
/**
|
|
4592
|
+
* Optimize a simple quadratic function: minimize sum(c_i * x_i^2)
|
|
4593
|
+
* @param {Float64Array} coefficients
|
|
4594
|
+
* @param {Float64Array} initial_point
|
|
4595
|
+
* @returns {WasmOptimizationResult}
|
|
4596
|
+
*/
|
|
4597
|
+
optimizeQuadratic(coefficients, initial_point) {
|
|
4598
|
+
const ptr0 = passArrayF64ToWasm0(coefficients, wasm.__wbindgen_malloc);
|
|
4599
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4600
|
+
const ptr1 = passArrayF64ToWasm0(initial_point, wasm.__wbindgen_malloc);
|
|
4601
|
+
const len1 = WASM_VECTOR_LEN;
|
|
4602
|
+
const ret = wasm.wasmsimpleoptimizer_optimizeQuadratic(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
4603
|
+
if (ret[2]) {
|
|
4604
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4605
|
+
}
|
|
4606
|
+
return WasmOptimizationResult.__wrap(ret[0]);
|
|
4607
|
+
}
|
|
4608
|
+
/**
|
|
4609
|
+
* Create a new simple optimizer
|
|
4610
|
+
*/
|
|
4611
|
+
constructor() {
|
|
4612
|
+
const ret = wasm.wasmgpuoptimizer_new();
|
|
4613
|
+
this.__wbg_ptr = ret >>> 0;
|
|
4614
|
+
WasmSimpleOptimizerFinalization.register(this, this.__wbg_ptr, this);
|
|
4615
|
+
return this;
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
if (Symbol.dispose) WasmSimpleOptimizer.prototype[Symbol.dispose] = WasmSimpleOptimizer.prototype.free;
|
|
4619
|
+
|
|
4231
4620
|
const WasmSpacetimeVectorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4232
4621
|
? { register: () => {}, unregister: () => {} }
|
|
4233
4622
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmspacetimevector_free(ptr >>> 0, 1));
|
|
@@ -4883,7 +5272,7 @@ export class WasmTropicalNetwork {
|
|
|
4883
5272
|
* @returns {number}
|
|
4884
5273
|
*/
|
|
4885
5274
|
getSize() {
|
|
4886
|
-
const ret = wasm.
|
|
5275
|
+
const ret = wasm.wasmmultiobjectiveresult_generations(this.__wbg_ptr);
|
|
4887
5276
|
return ret >>> 0;
|
|
4888
5277
|
}
|
|
4889
5278
|
/**
|
|
@@ -5095,7 +5484,7 @@ export class WasmTropicalPolynomial {
|
|
|
5095
5484
|
* @returns {number}
|
|
5096
5485
|
*/
|
|
5097
5486
|
coefficients_count() {
|
|
5098
|
-
const ret = wasm.
|
|
5487
|
+
const ret = wasm.wasmgpuoptimizer_isGpuAvailable(this.__wbg_ptr);
|
|
5099
5488
|
return ret >>> 0;
|
|
5100
5489
|
}
|
|
5101
5490
|
/**
|
|
@@ -5235,6 +5624,14 @@ function __wbg_get_imports() {
|
|
|
5235
5624
|
const ret = arg0.apply(arg1, arg2);
|
|
5236
5625
|
return ret;
|
|
5237
5626
|
}, arguments) };
|
|
5627
|
+
imports.wbg.__wbg_call_13410aac570ffff7 = function() { return handleError(function (arg0, arg1) {
|
|
5628
|
+
const ret = arg0.call(arg1);
|
|
5629
|
+
return ret;
|
|
5630
|
+
}, arguments) };
|
|
5631
|
+
imports.wbg.__wbg_call_a5400b25a865cfd8 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
5632
|
+
const ret = arg0.call(arg1, arg2);
|
|
5633
|
+
return ret;
|
|
5634
|
+
}, arguments) };
|
|
5238
5635
|
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
5239
5636
|
let deferred0_0;
|
|
5240
5637
|
let deferred0_1;
|
|
@@ -5261,7 +5658,7 @@ function __wbg_get_imports() {
|
|
|
5261
5658
|
imports.wbg.__wbg_log_6c7b5f4f00b8ce3f = function(arg0) {
|
|
5262
5659
|
console.log(arg0);
|
|
5263
5660
|
};
|
|
5264
|
-
imports.wbg.
|
|
5661
|
+
imports.wbg.__wbg_log_a7603c93036d4d3e = function(arg0, arg1) {
|
|
5265
5662
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
5266
5663
|
};
|
|
5267
5664
|
imports.wbg.__wbg_new_19c25a3f2fa63a02 = function() {
|
|
@@ -5272,14 +5669,47 @@ function __wbg_get_imports() {
|
|
|
5272
5669
|
const ret = new Array();
|
|
5273
5670
|
return ret;
|
|
5274
5671
|
};
|
|
5672
|
+
imports.wbg.__wbg_new_2e3c58a15f39f5f9 = function(arg0, arg1) {
|
|
5673
|
+
try {
|
|
5674
|
+
var state0 = {a: arg0, b: arg1};
|
|
5675
|
+
var cb0 = (arg0, arg1) => {
|
|
5676
|
+
const a = state0.a;
|
|
5677
|
+
state0.a = 0;
|
|
5678
|
+
try {
|
|
5679
|
+
return __wbg_adapter_387(a, state0.b, arg0, arg1);
|
|
5680
|
+
} finally {
|
|
5681
|
+
state0.a = a;
|
|
5682
|
+
}
|
|
5683
|
+
};
|
|
5684
|
+
const ret = new Promise(cb0);
|
|
5685
|
+
return ret;
|
|
5686
|
+
} finally {
|
|
5687
|
+
state0.a = state0.b = 0;
|
|
5688
|
+
}
|
|
5689
|
+
};
|
|
5275
5690
|
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
5276
5691
|
const ret = new Error();
|
|
5277
5692
|
return ret;
|
|
5278
5693
|
};
|
|
5694
|
+
imports.wbg.__wbg_newnoargs_254190557c45b4ec = function(arg0, arg1) {
|
|
5695
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
5696
|
+
return ret;
|
|
5697
|
+
};
|
|
5279
5698
|
imports.wbg.__wbg_push_330b2eb93e4e1212 = function(arg0, arg1) {
|
|
5280
5699
|
const ret = arg0.push(arg1);
|
|
5281
5700
|
return ret;
|
|
5282
5701
|
};
|
|
5702
|
+
imports.wbg.__wbg_queueMicrotask_25d0739ac89e8c88 = function(arg0) {
|
|
5703
|
+
queueMicrotask(arg0);
|
|
5704
|
+
};
|
|
5705
|
+
imports.wbg.__wbg_queueMicrotask_4488407636f5bf24 = function(arg0) {
|
|
5706
|
+
const ret = arg0.queueMicrotask;
|
|
5707
|
+
return ret;
|
|
5708
|
+
};
|
|
5709
|
+
imports.wbg.__wbg_resolve_4055c623acdd6a1b = function(arg0) {
|
|
5710
|
+
const ret = Promise.resolve(arg0);
|
|
5711
|
+
return ret;
|
|
5712
|
+
};
|
|
5283
5713
|
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
5284
5714
|
arg0[arg1] = arg2;
|
|
5285
5715
|
};
|
|
@@ -5297,10 +5727,34 @@ function __wbg_get_imports() {
|
|
|
5297
5727
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5298
5728
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5299
5729
|
};
|
|
5730
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12 = function() {
|
|
5731
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
5732
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
5733
|
+
};
|
|
5734
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184 = function() {
|
|
5735
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
5736
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
5737
|
+
};
|
|
5738
|
+
imports.wbg.__wbg_static_accessor_SELF_995b214ae681ff99 = function() {
|
|
5739
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
5740
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
5741
|
+
};
|
|
5742
|
+
imports.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea = function() {
|
|
5743
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
5744
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
5745
|
+
};
|
|
5746
|
+
imports.wbg.__wbg_then_e22500defe16819f = function(arg0, arg1) {
|
|
5747
|
+
const ret = arg0.then(arg1);
|
|
5748
|
+
return ret;
|
|
5749
|
+
};
|
|
5300
5750
|
imports.wbg.__wbg_wasmcommunity_new = function(arg0) {
|
|
5301
5751
|
const ret = WasmCommunity.__wrap(arg0);
|
|
5302
5752
|
return ret;
|
|
5303
5753
|
};
|
|
5754
|
+
imports.wbg.__wbg_wasmoptimizationresult_new = function(arg0) {
|
|
5755
|
+
const ret = WasmOptimizationResult.__wrap(arg0);
|
|
5756
|
+
return ret;
|
|
5757
|
+
};
|
|
5304
5758
|
imports.wbg.__wbg_wasmspacetimevector_new = function(arg0) {
|
|
5305
5759
|
const ret = WasmSpacetimeVector.__wrap(arg0);
|
|
5306
5760
|
return ret;
|
|
@@ -5309,6 +5763,15 @@ function __wbg_get_imports() {
|
|
|
5309
5763
|
const ret = WasmTropicalNumber.__wrap(arg0);
|
|
5310
5764
|
return ret;
|
|
5311
5765
|
};
|
|
5766
|
+
imports.wbg.__wbg_wbindgencbdrop_eb10308566512b88 = function(arg0) {
|
|
5767
|
+
const obj = arg0.original;
|
|
5768
|
+
if (obj.cnt-- == 1) {
|
|
5769
|
+
obj.a = 0;
|
|
5770
|
+
return true;
|
|
5771
|
+
}
|
|
5772
|
+
const ret = false;
|
|
5773
|
+
return ret;
|
|
5774
|
+
};
|
|
5312
5775
|
imports.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d = function(arg0, arg1) {
|
|
5313
5776
|
const ret = debugString(arg1);
|
|
5314
5777
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -5316,6 +5779,14 @@ function __wbg_get_imports() {
|
|
|
5316
5779
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5317
5780
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5318
5781
|
};
|
|
5782
|
+
imports.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74 = function(arg0) {
|
|
5783
|
+
const ret = typeof(arg0) === 'function';
|
|
5784
|
+
return ret;
|
|
5785
|
+
};
|
|
5786
|
+
imports.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5 = function(arg0) {
|
|
5787
|
+
const ret = arg0 === undefined;
|
|
5788
|
+
return ret;
|
|
5789
|
+
};
|
|
5319
5790
|
imports.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb = function(arg0, arg1) {
|
|
5320
5791
|
const obj = arg1;
|
|
5321
5792
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
@@ -5335,6 +5806,18 @@ function __wbg_get_imports() {
|
|
|
5335
5806
|
const ret = BigInt.asUintN(64, arg0);
|
|
5336
5807
|
return ret;
|
|
5337
5808
|
};
|
|
5809
|
+
imports.wbg.__wbindgen_cast_69f35aa0fcaecc47 = function(arg0, arg1) {
|
|
5810
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 37, function: Function { arguments: [Externref], shim_idx: 38, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
5811
|
+
const ret = makeMutClosure(arg0, arg1, 37, __wbg_adapter_8);
|
|
5812
|
+
return ret;
|
|
5813
|
+
};
|
|
5814
|
+
imports.wbg.__wbindgen_cast_b63aeb0d85365734 = function(arg0, arg1) {
|
|
5815
|
+
var v0 = getArrayF64FromWasm0(arg0, arg1).slice();
|
|
5816
|
+
wasm.__wbindgen_free(arg0, arg1 * 8, 8);
|
|
5817
|
+
// Cast intrinsic for `Vector(F64) -> Externref`.
|
|
5818
|
+
const ret = v0;
|
|
5819
|
+
return ret;
|
|
5820
|
+
};
|
|
5338
5821
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
5339
5822
|
// Cast intrinsic for `F64 -> Externref`.
|
|
5340
5823
|
const ret = arg0;
|
package/amari_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"Amari Contributors"
|
|
6
6
|
],
|
|
7
7
|
"description": "WebAssembly bindings for Amari mathematical computing library - geometric algebra, tropical algebra, automatic differentiation, fusion systems, and information geometry",
|
|
8
|
-
"version": "0.9.
|
|
8
|
+
"version": "0.9.7-1",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|