diff --git a/README.md b/README.md index 4438caf..05a2c2a 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ describes**: | Source | Published under | | --- | --- | -| branch `main`, with `params.ndarray.version: v0.42.0` in `hugo.yaml` | `https://go-ndarray.github.io/docs//`, here `/docs/0.42/` | +| branch `main`, with `params.ndarray.version: v0.43.1` in `hugo.yaml` | `https://go-ndarray.github.io/docs//`, here `/docs/0.43/` | | the newest version | also `https://go-ndarray.github.io/docs/latest/` | `https://go-ndarray.github.io/docs/` redirects to `latest/`. Each push to diff --git a/content/en/_index.md b/content/en/_index.md index 3f8d3c3..b97cb96 100644 --- a/content/en/_index.md +++ b/content/en/_index.md @@ -40,7 +40,7 @@ WebAssembly, with nothing to install — build a pipeline step by step (creation | Creation | `New`, `Zeros`, `Ones`, `Full`, `Arange`, `Linspace`, `Eye`, `Identity`, `FromData` | | Views & shape | `Slice` (`All`/`R`/`Rng`/`From`/`To`/`Step`), `Reshape`, `Ravel`, `Transpose`, `Copy` | | Elementwise | `Add`/`Sub`/`Mul`/`Div` (+`*Scalar`, +`*Into`), `Map`, `Neg`, `Abs`, comparisons (`Greater`/`Equal`/… → Bool masks), `Maximum`/`Minimum`, `Logical*`, `Real`/`Imag`/`Conj`/`Angle` | -| Ufuncs | `Sqrt`, `Exp`, `Log`/`Log2`/`Log10`, `Sin`/`Cos`/`Tan`, `Floor`/`Ceil`/`Round`, `Square`, `Power` | +| Ufuncs | `Sqrt`, `Exp`, `Log`/`Log2`/`Log10`, `Sin`/`Cos`/`Tan`, `Floor`/`Ceil`, `Round` (half to even, as `np.round`; `RoundHalfAway` keeps the old rule), `Square`, `Power` | | Reductions | `Sum`, `Mean`, `Max`/`Min`, `Prod`, `ArgMax`/`ArgMin`, `CumSum`/`CumProd`, `Clip`, `Where` (+ per-axis) | | Indexing | `Slice` (basic indexing), `MaskSelect` (`a[mask]`), `Nonzero` (`flatnonzero`), `Take` (fancy indexing) | | Manipulation | `Flatten`, `ExpandDims`, `Squeeze`, `Concatenate`, `Stack`, `VStack`, `HStack` | diff --git a/content/en/accuracy.md b/content/en/accuracy.md index 4bf2387..8576b02 100644 --- a/content/en/accuracy.md +++ b/content/en/accuracy.md @@ -8,7 +8,7 @@ description: "What go-ndarray promises about its results: a stated error bound, tags: [accuracy, numpy, math/big] --- -> Mirrored from [`README.md`](https://github.com/go-ndarray/ndarray/blob/v0.42.0/README.md#accuracy-contract) at v0.42.0. +> Mirrored from [`README.md`](https://github.com/go-ndarray/ndarray/blob/v0.43.1/README.md#accuracy-contract) at v0.43.1. The contract is **correct, and as fast as possible**. "Correct" means a stated error bound, checked against an exact oracle. Equality with NumPy's bits is not the contract: wherever it holds today, it is how a function was ported, and a faster default that stays within its bound may replace it. diff --git a/content/en/dtypes.md b/content/en/dtypes.md index 2538b90..ba08ef3 100644 --- a/content/en/dtypes.md +++ b/content/en/dtypes.md @@ -8,7 +8,7 @@ description: "Why the dtype is a run-time property of one Array type, how arrays tags: [dtypes, numpy] --- -> Mirrored from [`docs/design-dtypes.md`](https://github.com/go-ndarray/ndarray/blob/v0.42.0/docs/design-dtypes.md) at v0.42.0. +> Mirrored from [`docs/design-dtypes.md`](https://github.com/go-ndarray/ndarray/blob/v0.43.1/docs/design-dtypes.md) at v0.43.1. > Status: implemented (Phase 2). Supersedes decision 4 of > [plan-ndarray.md](roadmap.md) ("`float64` first"). @@ -111,7 +111,6 @@ dtype by dtype after correctness, `float32` first. | NumPy | here | why | |---|---|---| | `float16` exists; `sqrt(int8)` is `float16` | no `float16`; `sqrt(int8)`, `sqrt(uint8)` and `sqrt(bool)` give `float32` | Go has no half-precision arithmetic; `float32` is the smallest type that holds the result exactly | -| `round` is half-to-even | half-away-from-zero (unchanged) | documented since v0.1.0 | | `datetime64`, `str_`, `object`, structured dtypes | absent | out of scope for a numeric library | ## Element access diff --git a/content/en/linalg.md b/content/en/linalg.md index 837fabf..877e08d 100644 --- a/content/en/linalg.md +++ b/content/en/linalg.md @@ -8,11 +8,12 @@ description: "Solve, Inv, Det, Cholesky, QR, SVD, Eig and the rest of numpy.lina tags: [linalg, numpy] --- -> Mirrored from [`docs/linalg.md`](https://github.com/go-ndarray/ndarray/blob/v0.42.0/docs/linalg.md) at v0.42.0. +> Mirrored from [`docs/linalg.md`](https://github.com/go-ndarray/ndarray/blob/v0.43.1/docs/linalg.md) at v0.43.1. -Package [`linalg`](https://pkg.go.dev/github.com/go-ndarray/ndarray@v0.42.0/linalg) gives ndarray arrays the functions of +Package [`linalg`](https://pkg.go.dev/github.com/go-ndarray/ndarray@v0.43.1/linalg) gives ndarray arrays the functions of `numpy.linalg`, written in Go without cgo or assembly of its own: the -matrix products it relies on are the ndarray package's packed SIMD GEMM. +matrix products it relies on are the packed SIMD GEMM of [go-blas/blas](https://github.com/go-blas/blas), which +ndarray's `MatMul` uses too (the same kernels, moved there in v0.42.0, #122). | numpy.linalg | linalg | |---|---| diff --git a/content/en/performance.md b/content/en/performance.md index 5857d65..01c45e5 100644 --- a/content/en/performance.md +++ b/content/en/performance.md @@ -8,11 +8,11 @@ description: "go-ndarray against the pinned NumPy on one core, both sides: the m tags: [performance, numpy, refbench] --- -> Mirrored from [`docs/perf.md`](https://github.com/go-ndarray/ndarray/blob/v0.42.0/docs/perf.md) at v0.42.0. +> Mirrored from [`docs/perf.md`](https://github.com/go-ndarray/ndarray/blob/v0.43.1/docs/perf.md) at v0.43.1. -The table is [perf-table.md](https://github.com/go-ndarray/ndarray/blob/v0.42.0/docs/perf-table.md), generated by +The table is [perf-table.md](https://github.com/go-ndarray/ndarray/blob/v0.43.1/docs/perf-table.md), generated by [refbench](https://github.com/go-scikit/refbench) (go-scikit/refbench v0.3.0) -from [perf.json](https://github.com/go-ndarray/ndarray/blob/v0.42.0/docs/perf.json); nothing in it is edited by hand. The rules are +from [perf.json](https://github.com/go-ndarray/ndarray/blob/v0.43.1/docs/perf.json); nothing in it is edited by hand. The rules are those of the go-scikit performance campaign ([go-scikit/roadmap#27](https://github.com/go-scikit/roadmap/issues/27)): @@ -36,7 +36,7 @@ those of the go-scikit performance campaign `TestRefSmoke` runs every NumPy call once. - **One case per public function** (a function with several shapes of use has several rows, `Array.SumAxis/axis0` and `/axis1`), or a named exemption with - its reason in [perf-exempt.md](https://github.com/go-ndarray/ndarray/blob/v0.42.0/docs/perf-exempt.md). CI fails on a public function + its reason in [perf-exempt.md](https://github.com/go-ndarray/ndarray/blob/v0.43.1/docs/perf-exempt.md). CI fails on a public function with neither. ## What a row times @@ -105,6 +105,35 @@ rounds: element at a time. `Full` went from 131–135 µs to 84–104 µs. `Ones` calls `Full`. `FullOf`, which fills the other dtypes, was not timed. +- Float64 `Abs`, `Neg`, `Square`, `Floor`, `Ceil` and `Round` run on the + go-simd/floats v0.23.0 kernels (above the parallel threshold, split across + cores as before) instead of a scalar loop through `Map`. The results are bit + for bit those of `math.Abs`, `-x`, `x*x`, `math.Floor`, `math.Ceil` and + `math.RoundToEven`. `Abs` and `Neg` keep NaN bits exactly; for `Square`, + `Floor`, `Ceil` and `Round` a signalling NaN may come back quieted + (`TestUnaryKernelsBitIdentical`: edge table, lengths 0–33 and one above the + threshold). `Round` is now half to even, as `np.round`; the old half away + from zero is `RoundHalfAway`, on the scalar path (see the README). `go test -bench Unary` (`benchmarks/unary_bench_test.go`), 10⁵ + float64 including the result allocation, one pinned core of cfarm420 + (`GOMAXPROCS=1`, `taskset -c 9`), a test binary of v0.42.0 and one of this + change, four interleaved rounds of 1 s, 1-minute load 2.34 at the start and + 3.32 at the end. Before → after, range over the rounds: + + | operation | before (µs) | after (µs) | + |---|---|---| + | `Abs` | 244–258 | 70–75 | + | `Neg` | 243–249 | 72–75 | + | `Square` | 243–247 | 72–80 | + | `Floor` | 432–457 | 73–81 | + | `Ceil` | 437–464 | 72–81 | + | `Round` (the old one was half away from zero) | 325–340 | 71–80 | + + `Round` was measured in a second run of the same kind (four interleaved + rounds, load 2.25 to 2.42), v0.42.0 against this change. `RoundHalfAway`, + the control on the scalar path, takes 324–345 µs in the same run. These are + times of the Go code against itself; no NumPy ratio is claimed here, as the + new table run has not been made. + What remains of the allocation cause is Go's own cost. A CPU profile of a bare `make([]float64, 100000)` shows about 60% garbage-collector marking (assists in the allocating goroutine) and about 23% zeroing. NumPy frees each result diff --git a/content/en/random.md b/content/en/random.md index 6502842..e306469 100644 --- a/content/en/random.md +++ b/content/en/random.md @@ -8,9 +8,9 @@ description: "numpy.random with NumPy's numbers for the same seed: the bit gener tags: [random, numpy] --- -> Mirrored from [`docs/random.md`](https://github.com/go-ndarray/ndarray/blob/v0.42.0/docs/random.md) at v0.42.0. +> Mirrored from [`docs/random.md`](https://github.com/go-ndarray/ndarray/blob/v0.43.1/docs/random.md) at v0.43.1. -Package [`random`](https://pkg.go.dev/github.com/go-ndarray/ndarray@v0.42.0/random) is `numpy.random` over go-ndarray arrays. Its goal +Package [`random`](https://pkg.go.dev/github.com/go-ndarray/ndarray@v0.43.1/random) is `numpy.random` over go-ndarray arrays. Its goal is migration: a notebook moved from NumPy to Go keeps its numbers for the same seed. @@ -24,7 +24,7 @@ u, _ := random.Rand(3) // np.random.rand(3) ``` `Example`, `ExampleSeed` and `ExampleGenerator_ChoiceN` in -[`example_test.go`](https://github.com/go-ndarray/ndarray/blob/v0.42.0/random/example_test.go) print NumPy's own numbers. +[`example_test.go`](https://github.com/go-ndarray/ndarray/blob/v0.43.1/random/example_test.go) print NumPy's own numbers. ## What is implemented @@ -142,7 +142,7 @@ random arguments. Used as-is, that made 3% of `np.random.randn` values and 10% of `lognormal` values one ULP off. So `random` rounds `log`, `log1p`, `exp`, `expm1` and `pow` **correctly** -([`libm.go`](https://github.com/go-ndarray/ndarray/blob/v0.42.0/random/libm.go)): a fast evaluation to about 2⁻⁶⁸ with Ziv's +([`libm.go`](https://github.com/go-ndarray/ndarray/blob/v0.43.1/random/libm.go)): a fast evaluation to about 2⁻⁶⁸ with Ziv's rounding test, and a double-double fallback (about 2⁻¹⁰⁰) for the one argument in ~2¹⁵ that needs it. Checked against mpmath at 300 bits on 63,000 arguments (0 misrounded; the committed `libm.json` keeps 8,400), and the fast paths diff --git a/content/en/roadmap.md b/content/en/roadmap.md index 7521937..8bc2e71 100644 --- a/content/en/roadmap.md +++ b/content/en/roadmap.md @@ -8,7 +8,7 @@ description: "The plan for go-ndarray and what ships today." tags: [roadmap] --- -> Mirrored from [`docs/plan-ndarray.md`](https://github.com/go-ndarray/ndarray/blob/v0.42.0/docs/plan-ndarray.md) at v0.42.0. +> Mirrored from [`docs/plan-ndarray.md`](https://github.com/go-ndarray/ndarray/blob/v0.43.1/docs/plan-ndarray.md) at v0.43.1. > Goal: a **pure-Go (CGO=0)** NumPy-style N-dimensional array library, as a > **standalone, reusable** module with correct scalar kernels now and a clean @@ -94,12 +94,14 @@ suite (plus the per-arch CI jobs already wired in `.github/workflows/ci.yml`). non-positive m defaults to square), and `Reshape` `-1` dimension inference. - **Ufuncs — DONE.** Unary math (`Sqrt`/`Exp`/`Log`/`Log2`/`Log10`/`Sin`/`Cos`/ `Tan`/`Floor`/`Ceil`/`Round`/`Square`/`Power`): `Sqrt` has a SIMD kernel, - `Exp`/`Log`/`Log10` run ports of Arm's optimized-routines (v0.2.0), and the - rest go through the `Map` seam over Go's `math`; and - broadcasting comparisons returning 0/1 float masks (`Equal`/`NotEqual`/ - `Greater`/`GreaterEqual`/`Less`/`LessEqual`) plus pairwise `Maximum`/`Minimum`. - (`Round` is math.Round / half-away-from-zero, unlike numpy's banker's - rounding — documented.) A bool dtype for true masks is deferred to Phase 2. + `Exp`/`Log`/`Log10` run ports of Arm's optimized-routines (v0.2.0); since + v0.43.0 float64 `Abs`/`Neg`/`Square`/`Floor`/`Ceil`/`Round` run on + go-simd/floats vector kernels, and the rest go through the `Map` seam over + Go's `math`; and broadcasting comparisons returning 0/1 float masks + (`Equal`/`NotEqual`/`Greater`/`GreaterEqual`/`Less`/`LessEqual`) plus pairwise + `Maximum`/`Minimum`. `Round` rounds halves to even, as `np.round`, since + v0.43.0 (it was `math.Round`, half away from zero, before); `RoundHalfAway` + keeps that older rule. A bool dtype for true masks is deferred to Phase 2. - **Manipulation — DONE.** `Flatten` (always copy), `ExpandDims`/`Squeeze` (length-1 axis views), `Concatenate` (existing axis), `Stack` (new axis), and the `VStack`/`HStack` conveniences with 1-D promotion. Negative axes @@ -116,7 +118,7 @@ suite (plus the per-arch CI jobs already wired in `.github/workflows/ci.yml`). NumPy. What follows is the history of the levers behind the kernel seam, measured then against NumPy 2.2.4 (see [docs/perf.md](performance.md) and the repo's - [BENCHMARKS.md](https://github.com/go-ndarray/ndarray/blob/v0.42.0/BENCHMARKS.md)): + [BENCHMARKS.md](https://github.com/go-ndarray/ndarray/blob/v0.43.1/BENCHMARKS.md)): - **Multicore.** `Add/Sub/Mul/Div/Map`, `Sum/Max/Min`, the axis reductions, `Concatenate`/`Stack`, and the GEMM fan out across `GOMAXPROCS` above a size threshold (small arrays stay serial). Plus an allocation fix: the diff --git a/content/en/security.md b/content/en/security.md index ac6c0f0..092d225 100644 --- a/content/en/security.md +++ b/content/en/security.md @@ -8,7 +8,7 @@ description: "How to report a vulnerability, what the library guarantees, and th tags: [security] --- -> Mirrored from [`SECURITY.md`](https://github.com/go-ndarray/ndarray/blob/main/SECURITY.md) at v0.42.0. +> Mirrored from [`SECURITY.md`](https://github.com/go-ndarray/ndarray/blob/main/SECURITY.md) at v0.43.1. ## Reporting @@ -80,7 +80,7 @@ standard library's known vulnerabilities; `govulncheck ./...` reports none. ## Audit log -**2026-11-15 (unreleased).** The GEMM moved to +**2026-11-15 (v0.42.0, #122).** The GEMM moved to [go-blas/blas](https://github.com/go-blas/blas) v0.2.1 (the micro-kernels, their wrappers, the packing and their fence tests, byte for byte; the audit of that code is that repository's). What ndarray adds is `internal/blasmm`, which hands @@ -92,7 +92,7 @@ on an axis longer than one (a broadcast or reversed view) is copied to a contiguous matrix first. ndarray keeps the dot kernels (`dot_.go`), the mat-vec and the thread pool, with their wrappers and fences. -**2026-11-12 (unreleased, #103).** The gather of `random`'s `Choice` +**2026-11-12 (v0.40.2, #115, Refs #103).** The gather of `random`'s `Choice` (`takeAxis`, random/arrays.go) now copies bytes through `bytesOf`, an `unsafe.Slice` view of a slice's backing array of exactly `Len()·size` bytes. Every dtype the package stores is a fixed-size value without pointers diff --git a/hugo.yaml b/hugo.yaml index c86e8b6..fadf2f3 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -6,7 +6,7 @@ # have used since the site was built with MkDocs and mike. The CI sets it # through --baseURL, from params.ndarray.version below. This default is the # same build. -baseURL: "https://go-ndarray.github.io/docs/0.42/" +baseURL: "https://go-ndarray.github.io/docs/0.43/" title: "go-ndarray" # themes/hextra is the tannevaled/hextra fork, pinned at a release tag: # upstream Hextra plus opt-in features (partial menu items, combos, @@ -100,7 +100,7 @@ params: # The ndarray release these pages describe. Its minor version is the # documentation's version label (v0.9.1 -> 0.9): the CI reads it here. ndarray: - version: "v0.42.0" + version: "v0.43.1" navbar: displayTitle: true