@justinelliottcobb/amari-wasm 0.21.0 → 0.23.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.
- package/README.md +70 -25
- package/amari_wasm.d.ts +7393 -5820
- package/amari_wasm.js +14736 -11060
- package/amari_wasm_bg.wasm +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @justinelliottcobb/amari-wasm v0.
|
|
1
|
+
# @justinelliottcobb/amari-wasm v0.22.0
|
|
2
2
|
|
|
3
3
|
**Unified Mathematical Computing Library with High-Precision WebAssembly Support**
|
|
4
4
|
|
|
@@ -15,6 +15,8 @@ Amari is a comprehensive mathematical computing library that brings advanced alg
|
|
|
15
15
|
| [Geometric Algebra](docs/geometric-algebra.md) | amari-core | v0.1 | Multivectors, rotors, geometric products for 3D rotations and spatial transformations |
|
|
16
16
|
| [Tropical Algebra](docs/tropical-algebra.md) | amari-tropical | v0.9.3 | Max-plus semiring operations plus `0.21.0` ordinal-weighted optimization carriers below ε₀ |
|
|
17
17
|
| [Automatic Differentiation](docs/automatic-differentiation.md) | amari-dual | v0.9.3 | Forward-mode AD with `0.21.0` branch policies, multi-dual seeding, and fixed-size gradient wrappers |
|
|
18
|
+
| Combinatorial Game Theory | amari-cgt | v0.22.0 | Short normal-play games, cuts, outcomes, comparison, nimbers, and inspection helpers |
|
|
19
|
+
| Short Surreal Numbers | amari-surreal | v0.22.0 | Exact dyadic short-surreal arithmetic and conversion to/from numeric CGT games |
|
|
18
20
|
| [Cellular Automata](docs/cellular-automata.md) | amari-automata | v0.9.4 | Geometric cellular automata with multivector states |
|
|
19
21
|
| [Holographic Memory](docs/holographic-memory.md) | amari-fusion | v0.12.3 | Vector Symbolic Architecture for associative memory with binding and bundling |
|
|
20
22
|
| [Measure Theory](docs/measure-theory.md) | amari-measure | v0.10.0 | Lebesgue integration, probability measures, and measure-theoretic foundations |
|
|
@@ -30,6 +32,41 @@ Amari is a comprehensive mathematical computing library that brings advanced alg
|
|
|
30
32
|
|
|
31
33
|
Also includes bindings for: amari-network (geometric network analysis), amari-optimization (gradient descent, NSGA-II), amari-info-geom (Fisher metrics, statistical manifolds), amari-calculus (differential geometry, manifolds).
|
|
32
34
|
|
|
35
|
+
### v0.23.0 Arbitrary-Signature GA (new in development)
|
|
36
|
+
|
|
37
|
+
The `0.23.0` release introduces generic runtime-signature multivector support:
|
|
38
|
+
|
|
39
|
+
- `WasmGenericMultivector(p, q, r)` — create and operate on multivectors of any Clifford algebra signature Cl(p, q, r) at runtime. Signature is chosen at construction time and all operations (geometric product, inner product, outer product, reverse, grade projection, exp, normalize, inverse) automatically use the correct metric.
|
|
40
|
+
- `WasmGenericRotor` — rotors for any signature, created from bivectors via the exponential map.
|
|
41
|
+
- **Match-table dispatch** for all 84 signatures with total dimension ≤ 6 (compile-time optimized).
|
|
42
|
+
- **Cayley-table fallback** for larger dimensions with thread-local caching.
|
|
43
|
+
|
|
44
|
+
8 fast-path aliases provide pre-configured wrappers for the most common signatures:
|
|
45
|
+
|
|
46
|
+
| Alias | Signature | Use case |
|
|
47
|
+
|-------|-----------|----------|
|
|
48
|
+
| `WasmMultivector300` / `GA` | Cl(3,0,0) | 3D Euclidean rotations, graphics |
|
|
49
|
+
| `WasmMultivector210` / `ST` | Cl(2,1,0) | 2+1 spacetime physics |
|
|
50
|
+
| `WasmMultivector310` / `MINK` | Cl(3,1,0) | 3+1 Minkowski relativity |
|
|
51
|
+
| `WasmMultivector200` / `PL` | Cl(2,0,0) | 2D planar / complex numbers |
|
|
52
|
+
| `WasmMultivector030` / `QUAT` | Cl(0,3,0) | Pure quaternion algebra |
|
|
53
|
+
| `WasmMultivector410` / `CGA` | Cl(4,1,0) | Conformal GA (translations as rotors) |
|
|
54
|
+
| `WasmMultivector500` / `P5D` | Cl(5,0,0) | 5D Euclidean / projective GA |
|
|
55
|
+
| `WasmMultivector110` / `S2D` | Cl(1,1,0) | Split-complex / 1+1 spacetime |
|
|
56
|
+
|
|
57
|
+
Backward compatibility: `WasmMultivector` and `WasmRotor` remain as aliases for `WasmMultivector300` and `WasmRotor300`.
|
|
58
|
+
|
|
59
|
+
### v0.22.0 CGT / Surreal WASM Surface
|
|
60
|
+
|
|
61
|
+
The `0.22.0` release exposes the new short-game and short-surreal Rust APIs to JavaScript/TypeScript:
|
|
62
|
+
|
|
63
|
+
- `WasmCgtArena` and `WasmGameId` for arena-backed short games, focused one-option cuts, addition/subtraction/negation, comparison, outcomes, canonicalization, and formatting.
|
|
64
|
+
- `WasmGameInspection` for birthday, canonical form, outcome, numeric/impartial classification, and reachable-node counts.
|
|
65
|
+
- `WasmDyadic` for exact dyadic arithmetic with checked division inside the short-surreal layer.
|
|
66
|
+
- `WasmShortSurreal` for exact short-surreal arithmetic plus conversion from numeric CGT games and reconstruction back into a `WasmCgtArena`.
|
|
67
|
+
|
|
68
|
+
The scope remains intentionally short/exact: loopy games, misère play, symbolic infinite surreals, and surcomplex arithmetic are not part of the `0.22.0` WASM surface.
|
|
69
|
+
|
|
33
70
|
### v0.21.0 Tropical / Dual WASM Surface
|
|
34
71
|
|
|
35
72
|
The `0.21.0` release exposes the new optimization-oriented Rust APIs to JavaScript/TypeScript:
|
|
@@ -61,39 +98,47 @@ yarn add @justinelliottcobb/amari-wasm
|
|
|
61
98
|
## Quick Start
|
|
62
99
|
|
|
63
100
|
```typescript
|
|
64
|
-
import init, {
|
|
101
|
+
import init, {
|
|
102
|
+
WasmGenericMultivector,
|
|
103
|
+
WasmGenericRotor,
|
|
104
|
+
WasmMultivector, // alias for WasmMultivector300 (Cl 3,0,0)
|
|
105
|
+
WasmRotor,
|
|
106
|
+
} from '@justinelliottcobb/amari-wasm';
|
|
65
107
|
|
|
66
108
|
async function main() {
|
|
67
109
|
await init();
|
|
68
110
|
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
111
|
+
// ── Generic API: any signature at runtime ──
|
|
112
|
+
|
|
113
|
+
// Cl(2,1,0) — 2+1 spacetime
|
|
114
|
+
const e1 = WasmGenericMultivector.basisVector(2, 1, 0, 0);
|
|
115
|
+
const e3 = WasmGenericMultivector.basisVector(2, 1, 0, 2);
|
|
116
|
+
|
|
117
|
+
// e3 squares to -1 in Cl(2,1,0) (negative metric signature)
|
|
118
|
+
const e3Sq = e3.geometric_product(e3);
|
|
119
|
+
console.log(e3Sq.getCoefficient(0)); // -1
|
|
120
|
+
|
|
121
|
+
// ── Fast-path alias: Cl(3,0,0) Euclidean ──
|
|
122
|
+
|
|
123
|
+
const a = WasmMultivector.basisVector(0); // e1
|
|
124
|
+
const b = WasmMultivector.basisVector(1); // e2
|
|
125
|
+
const product = a.geometric_product(b);
|
|
126
|
+
console.log(product.getCoefficients()); // [0, 0, 0, 1, 0, 0, 0, 0] = e12
|
|
127
|
+
|
|
128
|
+
// ── Rotor in Cl(3,0,0) ──
|
|
129
|
+
|
|
130
|
+
const bivector = a.outer_product(b); // e12 bivector plane
|
|
131
|
+
const rotor = WasmGenericRotor.fromBivector(bivector, Math.PI / 2);
|
|
132
|
+
const rotated = rotor.apply(a);
|
|
133
|
+
// 90° rotation in e12 plane: e1 → e2
|
|
134
|
+
console.log(Math.abs(rotated.getCoefficient(2))); // ≈ 1.0
|
|
92
135
|
}
|
|
93
136
|
|
|
94
137
|
main();
|
|
95
138
|
```
|
|
96
139
|
|
|
140
|
+
**Fast-path aliases**: `WasmMultivector300`, `WasmMultivector210` (ST), `WasmMultivector310` (Minkowski), `WasmMultivector200` (planar), `WasmMultivector030` (quaternion), `WasmMultivector410` (CGA), `WasmMultivector500` (5D), `WasmMultivector110` (split). Each has a matching `WasmRotor*` and a TypeScript convenience export (`GA`, `ST`, `MINK`, `PL`, `QUAT`, `CGA`, `P5D`, `S2D`).
|
|
141
|
+
|
|
97
142
|
See the [docs/](docs/) directory for detailed guides and API references for each module.
|
|
98
143
|
|
|
99
144
|
## Use Cases
|