@danielsimonjr/mathts-wasm 0.1.5 → 0.2.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/build/bindings/wasm-loader.d.ts.map +1 -1
- package/build/bindings/wasm-loader.js +1 -1
- package/build/bindings/wasm-loader.js.map +1 -1
- package/build/mathts-debug.d.ts +178 -10
- package/build/mathts-debug.js +74 -10
- package/build/mathts-debug.wasm +0 -0
- package/build/mathts-debug.wasm.map +1 -1
- package/build/mathts-debug.wat +8770 -6098
- package/build/mathts.d.ts +178 -10
- package/build/mathts.js +74 -10
- package/build/mathts.wasm +0 -0
- package/build/mathts.wat +10463 -8459
- package/build/wasm-manifest.json +2 -2
- package/package.json +66 -66
- package/src/bindings/wasm-loader.ts +12 -13
package/build/wasm-manifest.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mathts-debug.wasm": "sha384-
|
|
3
|
-
"mathts.wasm": "sha384-
|
|
2
|
+
"mathts-debug.wasm": "sha384-2XY5Is1QXa0uDoKvRI7PxiFVjuw7kkUrwdG/4uc5+4ggMisxnpC/mjY2TN2wvKTR",
|
|
3
|
+
"mathts.wasm": "sha384-q4RGhtVhsLmeCfG5lYpL70f51laygEpfcKGuxKWFnoC9iSXZPXMUEYE9V8W8gYZu"
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@danielsimonjr/mathts-wasm",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "MathTS WebAssembly module - high-performance numerical computing",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "build/mathts.js",
|
|
7
|
-
"types": "build/mathts.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./build/mathts.js",
|
|
11
|
-
"types": "./build/mathts.d.ts"
|
|
12
|
-
},
|
|
13
|
-
"./wasm": {
|
|
14
|
-
"import": "./build/mathts.wasm"
|
|
15
|
-
},
|
|
16
|
-
"./debug": {
|
|
17
|
-
"import": "./build/mathts-debug.wasm"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"files": [
|
|
21
|
-
"build/",
|
|
22
|
-
"src/bindings/"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"asbuild:debug": "asc src/index.ts --target debug",
|
|
26
|
-
"asbuild:release": "asc src/index.ts --target release",
|
|
27
|
-
"asbuild": "npm run asbuild:debug && npm run asbuild:release && npm run gen:manifest",
|
|
28
|
-
"gen:manifest": "node scripts/gen-wasm-manifest.mjs",
|
|
29
|
-
"build:bindings": "tsc -p tsconfig.bindings.json",
|
|
30
|
-
"build": "npm run asbuild && npm run build:bindings",
|
|
31
|
-
"clean": "rm -rf build/",
|
|
32
|
-
"test": "node tests/run.js && node tests/
|
|
33
|
-
"test:diff": "node tests/diff-special.test.mjs && node tests/diff-decomposition.test.mjs",
|
|
34
|
-
"coverage:matrix": "python -X utf8 tests/audit/coverage_matrix.py",
|
|
35
|
-
"golden:gen": "python -X utf8 tests/golden/generate_goldens.py",
|
|
36
|
-
"benchmark": "node --experimental-wasm-simd benchmarks/run.js"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@assemblyscript/loader": "^0.28.17",
|
|
40
|
-
"assemblyscript": "^0.27.27",
|
|
41
|
-
"typescript": "^5.3.0"
|
|
42
|
-
},
|
|
43
|
-
"keywords": [
|
|
44
|
-
"math",
|
|
45
|
-
"wasm",
|
|
46
|
-
"webassembly",
|
|
47
|
-
"assemblyscript",
|
|
48
|
-
"numerical",
|
|
49
|
-
"matrix",
|
|
50
|
-
"linear-algebra",
|
|
51
|
-
"simd"
|
|
52
|
-
],
|
|
53
|
-
"author": "Daniel Simon Jr.",
|
|
54
|
-
"license": "MIT",
|
|
55
|
-
"repository": {
|
|
56
|
-
"type": "git",
|
|
57
|
-
"url": "https://github.com/danielsimonjr/mathts",
|
|
58
|
-
"directory": "assembly"
|
|
59
|
-
},
|
|
60
|
-
"bugs": {
|
|
61
|
-
"url": "https://github.com/danielsimonjr/MathTS/issues"
|
|
62
|
-
},
|
|
63
|
-
"publishConfig": {
|
|
64
|
-
"access": "public"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@danielsimonjr/mathts-wasm",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "MathTS WebAssembly module - high-performance numerical computing",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "build/mathts.js",
|
|
7
|
+
"types": "build/mathts.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./build/mathts.js",
|
|
11
|
+
"types": "./build/mathts.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./wasm": {
|
|
14
|
+
"import": "./build/mathts.wasm"
|
|
15
|
+
},
|
|
16
|
+
"./debug": {
|
|
17
|
+
"import": "./build/mathts-debug.wasm"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"build/",
|
|
22
|
+
"src/bindings/"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"asbuild:debug": "asc src/index.ts --target debug",
|
|
26
|
+
"asbuild:release": "asc src/index.ts --target release",
|
|
27
|
+
"asbuild": "npm run asbuild:debug && npm run asbuild:release && npm run gen:manifest",
|
|
28
|
+
"gen:manifest": "node scripts/gen-wasm-manifest.mjs",
|
|
29
|
+
"build:bindings": "tsc -p tsconfig.bindings.json",
|
|
30
|
+
"build": "npm run asbuild && npm run build:bindings",
|
|
31
|
+
"clean": "rm -rf build/",
|
|
32
|
+
"test": "node tests/run.js && node tests/special-numtheory.test.mjs && node tests/polynomial.test.mjs && node tests/signal.test.mjs && node tests/linalg.test.mjs && node tests/curvefit.test.mjs && node tests/optimization.test.mjs && node tests/approx.test.mjs && node tests/tensor.test.mjs && node tests/phase2-kernels.test.mjs && npm run test:diff",
|
|
33
|
+
"test:diff": "node tests/diff-special.test.mjs && node tests/diff-decomposition.test.mjs",
|
|
34
|
+
"coverage:matrix": "python -X utf8 tests/audit/coverage_matrix.py",
|
|
35
|
+
"golden:gen": "python -X utf8 tests/golden/generate_goldens.py",
|
|
36
|
+
"benchmark": "node --experimental-wasm-simd benchmarks/run.js"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@assemblyscript/loader": "^0.28.17",
|
|
40
|
+
"assemblyscript": "^0.27.27",
|
|
41
|
+
"typescript": "^5.3.0"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"math",
|
|
45
|
+
"wasm",
|
|
46
|
+
"webassembly",
|
|
47
|
+
"assemblyscript",
|
|
48
|
+
"numerical",
|
|
49
|
+
"matrix",
|
|
50
|
+
"linear-algebra",
|
|
51
|
+
"simd"
|
|
52
|
+
],
|
|
53
|
+
"author": "Daniel Simon Jr.",
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/danielsimonjr/mathts",
|
|
58
|
+
"directory": "assembly"
|
|
59
|
+
},
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/danielsimonjr/MathTS/issues"
|
|
62
|
+
},
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -16,7 +16,7 @@ interface WasmManifest {
|
|
|
16
16
|
|
|
17
17
|
async function sha384Base64(buffer: ArrayBuffer | Uint8Array): Promise<string> {
|
|
18
18
|
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
19
|
-
const isNode = typeof process !== 'undefined' && (process as
|
|
19
|
+
const isNode = typeof process !== 'undefined' && (process as { versions?: { node?: string } }).versions?.node !== undefined;
|
|
20
20
|
let digest: Uint8Array;
|
|
21
21
|
if (isNode) {
|
|
22
22
|
const { createHash } = await import('crypto');
|
|
@@ -36,13 +36,13 @@ async function sha384Base64(buffer: ArrayBuffer | Uint8Array): Promise<string> {
|
|
|
36
36
|
const b64 =
|
|
37
37
|
typeof btoa === 'function'
|
|
38
38
|
? btoa(bin)
|
|
39
|
-
: (globalThis as
|
|
39
|
+
: (globalThis as { Buffer: { from(data: Uint8Array): { toString(encoding: string): string } } }).Buffer.from(digest).toString('base64');
|
|
40
40
|
return `sha384-${b64}`;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
async function loadManifest(wasmPath: string): Promise<WasmManifest | null> {
|
|
44
44
|
const manifestPath = wasmPath.replace(/[^/\\]+$/, 'wasm-manifest.json');
|
|
45
|
-
const isNode = typeof process !== 'undefined' && (process as
|
|
45
|
+
const isNode = typeof process !== 'undefined' && (process as { versions?: { node?: string } }).versions?.node !== undefined;
|
|
46
46
|
try {
|
|
47
47
|
if (isNode) {
|
|
48
48
|
const fs = await import('fs');
|
|
@@ -116,11 +116,10 @@ export interface MathTSWasmExports {
|
|
|
116
116
|
matrix_trace(dataPtr: number, rows: number, cols: number): number;
|
|
117
117
|
matrix_norm_frobenius(dataPtr: number): number;
|
|
118
118
|
|
|
119
|
-
// Dense matrix decompositions — AS exports
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
// See `assembly/src/algebra/decomposition.ts` for the kernels.
|
|
119
|
+
// Dense matrix decompositions — AS exports so the AS backend can stop
|
|
120
|
+
// falling back to JS for these ops. AS calling convention: pass
|
|
121
|
+
// typed-array *header* references (the AS runtime carries length, no
|
|
122
|
+
// ptr+len args). See `assembly/src/algebra/decomposition.ts` for the kernels.
|
|
124
123
|
matrix_lu_decompose?(
|
|
125
124
|
a: Float64Array,
|
|
126
125
|
n: number,
|
|
@@ -140,10 +139,10 @@ export interface MathTSWasmExports {
|
|
|
140
139
|
matrix_determinant?(a: Float64Array, n: number, work: Float64Array): number;
|
|
141
140
|
|
|
142
141
|
// Bitwise operations (Int32Array, elementwise) — AS-backend kernels.
|
|
143
|
-
//
|
|
144
|
-
// `*ArrayPerElement` naming (declared in
|
|
145
|
-
// functions/src/wasm/WasmLoader.ts's interface); the AS kernels keep
|
|
146
|
-
//
|
|
142
|
+
// A legacy backend shipped an equivalent set under the `*Array` /
|
|
143
|
+
// `*ArrayPerElement` naming (still declared, now vestigial, in
|
|
144
|
+
// functions/src/wasm/WasmLoader.ts's interface); the AS kernels keep the
|
|
145
|
+
// `_i32_array` suffix to match AS export-name discoverability.
|
|
147
146
|
bitAnd_i32_array?(a: Int32Array, b: Int32Array, result: Int32Array): void;
|
|
148
147
|
bitOr_i32_array?(a: Int32Array, b: Int32Array, result: Int32Array): void;
|
|
149
148
|
bitXor_i32_array?(a: Int32Array, b: Int32Array, result: Int32Array): void;
|
|
@@ -228,7 +227,7 @@ function createImports(): WebAssembly.Imports {
|
|
|
228
227
|
},
|
|
229
228
|
|
|
230
229
|
// Trace for debugging (optional)
|
|
231
|
-
trace(
|
|
230
|
+
trace(_messagePtr: number, _numArgs: number): void {
|
|
232
231
|
// Debug tracing - can be implemented if needed
|
|
233
232
|
},
|
|
234
233
|
|