You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3c86317
Browse filesBrowse the repository at this point in the historyBrowse files
NDArray: the go-ndarray playground's Ruby API, on go-ndarray v0.11.0 (#813)
The go-ndarray playground shows each pipeline as Go | Ruby | NumPy and runs the
Ruby column in the browser through cmd/wasm. This implements the API its code
generator emits (ruby-ndarray-contract.md):
- creation: arange(stop | start, stop | start, stop, step), linspace, eye(n, m, k),
zeros()/ones() (0-d with no shape, or a shape Array), full(value, *shape)
- views: reshape (with -1), T, squeeze(*axes), expand_dims, dup/copy (copy of
the data), and NumPy basic indexing through a[...]: Integer, true for ':', a
Range (exclusive, inclusive, endless, beginless) or an
Enumerator::ArithmeticSequence ((0..) % 2, (-1..) % -1, (5...1) % -2)
- elementwise: square, ** (scalar, array with broadcasting, and 2 ** a through
NDArray#coerce), clip, NDArray.maximum/minimum
- reductions: sum/mean/max/min/prod/argmax/argmin with (axis, keepdims:), cumsum
- products and joins: NDArray.outer, NDArray.concatenate/stack(axis:)
- p/inspect/to_s print go-ndarray's NumPy-style Repr
Every method now checks its arguments: a wrong count raises ArgumentError, a
wrong type TypeError, an index or axis out of range IndexError, other go-ndarray
errors ArgumentError with go-ndarray's message. NDArray.arange(5) and
NDArray.full() used to raise "ArgumentError: arange: runtime error: index out of
range [1] with length 1", a recovered Go panic. TestNativeFaultBecomesRubyError
relied on that bug; it now plants its own faulting native.
go-ndarray v0.3.0 -> v0.11.0 (and go-fft v0.1.14 -> v0.23.0 with it), outside
the grouped Renovate PR #792.
The README no longer says the browser target does not build (it has since
#684), in three places; readme_wasm_lane_test.go now catches that wording across
line breaks. web/smoke.mjs runs an NDArray program in the JS host.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@@ -615,11 +623,11 @@ throughput tracks the underlying driver rather than the interpreter:
615
623
`eval`/`require` calls (if any) would raise in the closed binary, since there
616
624
is no front-end left to compile source at runtime.
617
625
618
-
-**WebAssembly:**the **WASI** target (`GOOS=wasip1 GOARCH=wasm`) builds and runs,
619
-
and is gated in CI. The **browser** target (`GOOS=js GOARCH=wasm`) does **not**
620
-
currently build — the playground under `cmd/wasm`, the `JS` bridge and
621
-
`rbgo build --closed --target wasm` are all blocked behind one compile error in
622
-
`internal/vm`. See [WebAssembly](#webassembly) and *What does not work yet*.
626
+
-**WebAssembly:**both targets build and are gated in CI: **WASI**
627
+
(`GOOS=wasip1 GOARCH=wasm`) is built and run under wazero, and the **browser**
628
+
target (`GOOS=js GOARCH=wasm`, the playground under `cmd/wasm` and the `JS`
629
+
bridge) is built and run in node by `web/smoke.mjs`. See
630
+
[WebAssembly](#webassembly).
623
631
624
632
### What does not work yet
625
633
@@ -689,7 +697,7 @@ Otherwise:
689
697
|**linux, macOS, windows**| the full suite under `-race`. The **100 % coverage gate** is enforced on linux and macOS only — a few POSIX-only paths (opening `/dev/null` as a character device) are unreachable on windows, so its coverage is structurally below 100 % |
690
698
|**amd64, arm64**|`go test ./...` on native runners |
691
699
|**wasip1/wasm**| built with `CGO_ENABLED=0 GOOS=wasip1 GOARCH=wasm` and **run** under [wazero](https://wazero.io), a pure-Go runtime — verified here: `wazero run rbgo.wasm -e 'puts (1..10).sum'` prints `55`|
692
-
|**js/wasm (browser)**|`CGO_ENABLED=0 GOOS=js GOARCH=wasm go build ./...` plus `go vet` over `./cmd/wasm ./cmd/rbgo ./internal/vm` (`wasm (js, browser)` in `ci.yml`). Added with #684, which fixed the three `syscall` constants the `js` port does not define |
700
+
|**js/wasm (browser)**|`CGO_ENABLED=0 GOOS=js GOARCH=wasm go build ./...` plus `go vet` over `./cmd/wasm ./cmd/rbgo ./internal/vm`, then the playground module is **run** in node by `web/smoke.mjs` (`wasm (js, browser)` in `ci.yml`). Added with #684, which fixed the three `syscall` constants the `js` port does not define |
693
701
694
702
**Not on the pull-request path** — validated on a nightly schedule instead:
695
703
`riscv64`, `loong64`, `ppc64le` and `s390x`, under QEMU
0 commit comments