Repository navigation
perf!: float64 Abs, Neg, Square, Floor, Ceil, Round on go-simd/floats v0.23.0; Round is half to even, add RoundHalfAway - #123
Merged
Conversation
… kernels Bump go-simd/floats to v0.23.0 and route the contiguous float64 case of Abs, Neg, Square, Floor and Ceil through its SIMD kernels, still split across cores above kernels.ParThreshold. Results are bit for bit those of math.Abs, -x, x*x, math.Floor and math.Ceil (a signalling NaN may come back quieted). Round is unchanged: it rounds half away from zero, which floats.RoundEven does not. On 10^5 float64, one core of cfarm420: Abs 244-258 -> 70-75 us, Neg 243-249 -> 72-75, Square 243-247 -> 72-80, Floor 432-457 -> 73-81, Ceil 437-464 -> 72-81 (result allocation included). Refs #118 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…udit entries docs/linalg.md and docs/design-linalg.md named the ndarray package's own GEMM; since #122 it is go-blas/blas. SECURITY.md: the go-blas entry is v0.42.0 (#122, commit 208bdac, tag v0.42.0 contains it); the Choice gather entry is v0.40.2 (#115, 8ac94fb, first tag containing it, Refs #103). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…RoundHalfAway Round now rounds exact halves to the even neighbour on every dtype (float64 on the go-simd/floats RoundEven kernel; float32 and each part of a complex number through math.RoundToEven), as np.round with no decimals. The old half-away-from-zero behaviour (math.Round) is RoundHalfAway, on the scalar path, on the same dtypes. Integers and bools are unchanged by both. There is no decimals variant. Tests: halves and the edge table for both against math.RoundToEven and math.Round; Abs and Neg now compared with strict NaN bits, the others with is-NaN only. On 10^5 float64, cfarm420 one core: Round 325-340 -> 71-80 us; RoundHalfAway (control) 324-345 us. Refs #118 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rpart) TestPerf requires every public function to have a row or an exemption. RoundHalfAway rounds halves away from zero; np.round is half to even, which is Array.Round, so there is nothing to time it against. Refs #118 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
tannevaled
added a commit
that referenced
this pull request
Nov 15, 2026
docs/plan-ndarray.md still said Round is math.Round (half away from zero) and that Floor/Ceil/Round/Square go through the Map seam. Since v0.43.0 (#123) Round rounds halves to even, as np.round, RoundHalfAway keeps the older rule, and the float64 forms of Abs/Neg/Square/Floor/Ceil/Round run on go-simd/floats kernels. The docs site mirrors this file, so the stale sentence was being republished. Refs #123 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
tannevaled
added a commit
to go-ndarray/docs
that referenced
this pull request
Nov 15, 2026
Labels, hugo.yaml version and README move to v0.43.1 (baseURL stays /docs/0.43/).
roadmap.md is re-synced from docs/plan-ndarray.md at v0.43.1, which fixes the
stale Round sentence (ndarray#124); the other mirrored sources are unchanged
since v0.43.0. security.md keeps its v0.40.2 audit label verbatim
("v0.40.2, #115, Refs #103").
Refs go-ndarray/ndarray#123
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tannevaled
added a commit
to go-ndarray/go-ndarray.github.io
that referenced
this pull request
Nov 15, 2026
The card says "library · v0.43.1" and the playground builds against ndarray v0.43.1 (docs-only release); its tests pass. Refs go-ndarray/ndarray#123 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tannevaled
added a commit
to go-ndarray/docs
that referenced
this pull request
Nov 15, 2026
* docs: ndarray v0.43.0 Every mirrored page, hugo.yaml (version and baseURL /docs/0.43/) and the README now point at v0.43.0. Re-synced from the v0.43.0 sources, which changed since v0.42.0: performance.md (docs/perf.md, "Since the table": float64 Abs/Neg/Square/Floor/Ceil/Round on go-simd/floats v0.23.0), linalg.md (docs/linalg.md, GEMM from go-blas/blas), dtypes.md (docs/design-dtypes.md, the round row is gone) and security.md (SECURITY.md, version labels fixed; by hand, as its README says). roadmap.md, random.md and accuracy.md are unchanged in their sources and only relabelled. The home page's ufunc row says Round is half to even and RoundHalfAway keeps the old rule. performance-history.md is history and is left alone. Refs go-ndarray/ndarray#123 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs: ndarray v0.43.1 Labels, hugo.yaml version and README move to v0.43.1 (baseURL stays /docs/0.43/). roadmap.md is re-synced from docs/plan-ndarray.md at v0.43.1, which fixes the stale Round sentence (ndarray#124); the other mirrored sources are unchanged since v0.43.0. security.md keeps its v0.40.2 audit label verbatim ("v0.40.2, #115, Refs #103"). Refs go-ndarray/ndarray#123 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
tannevaled
added a commit
to go-ndarray/go-ndarray.github.io
that referenced
this pull request
Nov 15, 2026
* landing: ndarray v0.43.0 The card says "library · v0.43.0". The "Broadcasting and ufuncs" family says Round is half to even as np.round (RoundHalfAway keeps the old rule) and that float64 Abs, Neg, Square, Floor, Ceil and Round run on go-simd/floats vector kernels. The playground builds against ndarray v0.43.0 (go-simd/floats goes to v0.23.0 with it); its tests pass. Refs go-ndarray/ndarray#123 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * landing: ndarray v0.43.1 The card says "library · v0.43.1" and the playground builds against ndarray v0.43.1 (docs-only release); its tests pass. Refs go-ndarray/ndarray#123 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Float64
Abs,Neg,Square,Floor,CeilandRoundnow run on the go-simd/floats v0.23.0 kernels (go.mod bumped from v0.17.0), split across cores above the parallel threshold as before. Workspace allocation, strided inputs (materialised first) and the integer dtypes are unchanged.Behaviour change (MINOR):
Roundis half to even, asnp.round. On exact halvesRoundof 0.5, 1.5, 2.5 and -0.5 gives 0, 2, 2 and -0 instead of 1, 2, 3 and -1. It holds on every dtype: float64 (theRoundEvenkernel), float32 and each part of a complex number (math.RoundToEven); integers and bools are returned unchanged. The old behaviour is the newRoundHalfAway(math.Round, scalar path, same dtypes), whose doc comment says how it differs fromRoundandnp.round. There is no decimals variant. README (API section and the note on the change) and docs are updated; the repository has no changelog file, so this body is the release note for the next MINOR.Bit identity.
TestUnaryKernelsBitIdenticalcompares each op withmath.Abs,-x,x*x,math.Floor,math.Ceil,math.RoundToEvenandmath.Roundon lengths 0 to 33 and one aboveParThreshold, over an edge table (±0, ±Inf, NaNs including a signalling one, subnormals, halves, ±2^52 and ±2^63 neighbours) and random bit patterns.AbsandNegare compared with exact NaN bits; forSquare,Floor,CeilandRounda signalling NaN may come back quieted. Strided views are covered too. The 100% coverage gate holds locally.Measured (
go test -bench Unary, newbenchmarks/unary_bench_test.go), 10^5 float64 including the result allocation, cfarm420 (AMD EPYC 7773X),GOMAXPROCS=1,taskset -c 9, a v0.42.0 test binary against one of this branch, four interleaved rounds of 1 s each (two runs; 1-minute load 2.3 to 3.3):No NumPy ratio is claimed: these are Go against Go, and the new table run has not been made.
Also in this PR: docs/linalg.md and docs/design-linalg.md name go-blas/blas for the GEMM, and SECURITY.md gives its two "unreleased" audit entries their releases (v0.42.0, #122; v0.40.2, #115).
Refs #118
🤖 Generated with Claude Code