go-ndarray
NumPy-style n-dimensional arrays in pure Go. float64, multicore + SIMD.
go-ndarray is the numpy equivalent for Go: a float64 n-dimensional array with creation routines, strided views that share data, broadcasting elementwise ops and ufuncs, reductions (incl. arg / cumulative / clip / where), manipulation, and linear algebra (a panel-packed, cache-blocked GEMM) — all in pure Go, with cgo disabled.
Ruby has no cgo-free ndarray (Numo::NArray and NMatrix are C extensions) and gonum's optimized assembly is amd64-only. go-ndarray pairs a portable scalar core with multicore fan-out and go-asmgen SIMD kernels, beating single-threaded NumPy on the parallelizable core. 100% test coverage is the bar, differentially checked against numpy 2.2.
Why go-ndarray
NumPy is the lingua franca of numerical computing, but in Go the choices are
gonum (matrix-centric, amd64-only assembly) or a C extension. go-ndarray
brings the n-dimensional array vocabulary — shapes, strided
views, broadcasting, ufuncs, reductions and linear algebra — to Go with
no cgo, cross-compiling to a static binary everywhere. The hot paths
are multicore + SIMD, so it beats single-threaded NumPy on the
parallelizable core. It is the cgo-free ndarray the Go and Ruby ecosystems lacked.
Repositories
ndarray
The library. Creation (Zeros/Arange/Linspace/…), strided views, broadcasting elementwise + ufuncs, reductions (Sum/Max/ArgMax/CumSum/Clip/Where), manipulation (Reshape/Concatenate/Stack), and linalg (MatMul/Dot) via a panel-packed cache-blocked GEMM with a go-asmgen SIMD-FMA micro-kernel.
docs
Versioned documentation site (MkDocs Material): API reference, the roadmap, and honest benchmark pages versus NumPy 2.2 / OpenBLAS. Source →
brand
Logos and icons for the organization, in SVG / PNG / JPG / ICO / ICNS across colour, white and black variants.
Quality bar
- Pure Go.
CGO_ENABLED=0across the org. No cgo, no BLAS shim. - 100% test coverage. Gated in CI, differentially checked against
numpy2.2. - Faster than NumPy on the parallelizable core (Add/Mul/Sum/Sqrt/Max) — multicore fan-out + SIMD. The packed GEMM reaches tuned-BLAS parity at 1024² (≈1.00× single-threaded vecLib, ~373 GFLOP/s) and beats the pure-Go
gonum4–10×;Dotwins at parity. Honest where tuned BLAS still leads at small n. - Multi-arch. Portable scalar core on all six 64-bit targets; go-asmgen SIMD kernels where the Go assembler allows it.
- BSD-3-Clause on every source file.