@danielsimonjr/mathts-wasm 0.3.0 → 0.3.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/README.md +26 -40
- package/build/mathts-debug.wasm +0 -0
- package/build/mathts-debug.wasm.map +1 -1
- package/build/mathts-debug.wat +823 -2061
- package/build/mathts.wasm +0 -0
- package/build/mathts.wat +757 -1633
- package/build/wasm-manifest.json +2 -2
- package/package.json +4 -6
- package/build/bindings/index.d.ts +0 -9
- package/build/bindings/index.d.ts.map +0 -1
- package/build/bindings/index.js +0 -8
- package/build/bindings/index.js.map +0 -1
- package/build/bindings/wasm-loader.d.ts +0 -121
- package/build/bindings/wasm-loader.d.ts.map +0 -1
- package/build/bindings/wasm-loader.js +0 -259
- package/build/bindings/wasm-loader.js.map +0 -1
- package/src/bindings/index.ts +0 -9
- package/src/bindings/wasm-loader.ts +0 -382
package/README.md
CHANGED
|
@@ -27,57 +27,44 @@ npm run asbuild
|
|
|
27
27
|
|
|
28
28
|
## Usage
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
The published entry is AssemblyScript-generated glue in `build/mathts.js` (see
|
|
31
|
+
`package.json` `exports["."]`). Import named functions directly:
|
|
31
32
|
|
|
32
33
|
```typescript
|
|
33
|
-
import {
|
|
34
|
+
import { add_f64, sqrt_f64, sin_f64 } from '@danielsimonjr/mathts-wasm';
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
const sum = wasm.add(2, 3); // 5
|
|
39
|
-
const sqrt = wasm.sqrt(16); // 4
|
|
40
|
-
const sin = wasm.sin(Math.PI / 2); // 1
|
|
41
|
-
|
|
42
|
-
// For array/matrix operations, use the raw exports
|
|
43
|
-
const exports = wasm.raw;
|
|
44
|
-
// ... work with typed arrays and pointers
|
|
36
|
+
console.log(add_f64(2, 3)); // 5
|
|
37
|
+
console.log(sqrt_f64(16)); // 4
|
|
38
|
+
console.log(sin_f64(Math.PI / 2)); // 1
|
|
45
39
|
```
|
|
46
40
|
|
|
47
|
-
|
|
41
|
+
`matrix` and `functions` load the same binary as `mathts-as.wasm` via their own
|
|
42
|
+
loaders and SHA-384 verification (`core/src/wasm-loader.ts`).
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
import { loadWasmSync } from '@danielsimonjr/mathts-wasm';
|
|
51
|
-
import fs from 'fs';
|
|
44
|
+
### Dense decompositions (AS exports)
|
|
52
45
|
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
From `algebra/decomposition.ts` (used by matrix `WASMBackend` tests, not public
|
|
47
|
+
`lu()`/`qr()` in JS):
|
|
55
48
|
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
- `matrix_lu_decompose`, `matrix_qr_decompose`, `matrix_cholesky`,
|
|
50
|
+
`matrix_inverse`, `matrix_determinant`
|
|
51
|
+
|
|
52
|
+
Call `heap_reset` after managed sequences when using bump-allocated scratch
|
|
53
|
+
(`heap.ts`). The **functions** WASM bridges call it after each managed call;
|
|
54
|
+
matrix does not — it pools buffers.
|
|
58
55
|
|
|
59
56
|
## Module Structure
|
|
60
57
|
|
|
61
58
|
```
|
|
62
59
|
assembly/
|
|
63
60
|
├── src/
|
|
64
|
-
│ ├── index.ts
|
|
65
|
-
│ ├──
|
|
66
|
-
│
|
|
67
|
-
│ ├──
|
|
68
|
-
│
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
│ ├── env/
|
|
72
|
-
│ │ └── abort.ts # Error handling
|
|
73
|
-
│ └── bindings/
|
|
74
|
-
│ ├── index.ts # Bindings entry point
|
|
75
|
-
│ └── wasm-loader.ts # JS/TS bindings (SHA-384 verified)
|
|
76
|
-
├── build/ # WASM output
|
|
77
|
-
├── tests/
|
|
78
|
-
│ └── run.js # Test runner
|
|
79
|
-
├── asconfig.json # AssemblyScript config
|
|
80
|
-
├── tsconfig.bindings.json # TypeScript bindings config
|
|
61
|
+
│ ├── index.ts # AS export surface
|
|
62
|
+
│ ├── algebra/decomposition.ts
|
|
63
|
+
│ ├── elementwise.ts, heap.ts, poly.ts, signal.ts, sort.ts, special.ts, tridiag.ts
|
|
64
|
+
│ ├── types/complex.ts
|
|
65
|
+
│ └── ops/ # scalar, array, matrix, complex-ops, fft, …
|
|
66
|
+
├── build/ # mathts.wasm, mathts.js, mathts.d.ts
|
|
67
|
+
├── tests/run.js # debug wasm smoke tests
|
|
81
68
|
└── package.json
|
|
82
69
|
```
|
|
83
70
|
|
|
@@ -122,9 +109,8 @@ assembly/
|
|
|
122
109
|
## Testing
|
|
123
110
|
|
|
124
111
|
```bash
|
|
125
|
-
#
|
|
126
|
-
npm run
|
|
127
|
-
npm test
|
|
112
|
+
npm run asbuild # release + debug (npm test needs release for test:diff)
|
|
113
|
+
npm test # tests/run.js (debug wasm) + nine kernel tests + test:diff (release wasm)
|
|
128
114
|
```
|
|
129
115
|
|
|
130
116
|
## License
|
package/build/mathts-debug.wasm
CHANGED
|
Binary file
|