@danielsimonjr/mathts-wasm 0.1.5 → 0.2.0

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.
@@ -1,4 +1,4 @@
1
1
  {
2
- "mathts-debug.wasm": "sha384-KzTdnFUpxcpQaICrJd8xXGk8VHawWc3THNRWyYr+eYddzuJR3aFVIil1m3/Gsxka",
3
- "mathts.wasm": "sha384-5Riad6qN9+B0bHxTlj6fvOwiOYBDx8byKGX6Ojv7RAyrLl6RkKq6CPlpX+oY4QCE"
2
+ "mathts-debug.wasm": "sha384-GGkKbOhPCYn0eHYamRsLj0Jhsw53Eq9/xSph6G/dOPy39sAM546lEJXElWXQcyXQ",
3
+ "mathts.wasm": "sha384-eSck1dw9Rtu8oUAQ/0GMpC1L4bhAPNVS72581QGAyd1xDlRvonQT/XA2RZjpxghB"
4
4
  }
package/package.json CHANGED
@@ -1,66 +1,66 @@
1
- {
2
- "name": "@danielsimonjr/mathts-wasm",
3
- "version": "0.1.5",
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/svd.test.mjs && 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 && 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
- }
1
+ {
2
+ "name": "@danielsimonjr/mathts-wasm",
3
+ "version": "0.2.0",
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 any).versions?.node !== undefined;
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 any).Buffer.from(digest).toString('base64');
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 any).versions?.node !== undefined;
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 added in tandem with the
120
- // Rust crate's `decomposition.rs` so the AS backend can stop falling
121
- // back to JS for these ops. AS calling convention: pass typed-array
122
- // *header* references (the AS runtime carries length, no ptr+len args).
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
- // The Rust backend ships an equivalent set under the `*Array` /
144
- // `*ArrayPerElement` naming (declared in
145
- // functions/src/wasm/WasmLoader.ts's interface); the AS kernels keep
146
- // the `_i32_array` suffix to match AS export-name discoverability.
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(messagePtr: number, numArgs: number): void {
230
+ trace(_messagePtr: number, _numArgs: number): void {
232
231
  // Debug tracing - can be implemented if needed
233
232
  },
234
233