Let `map` and `map!` take several source arrays #130
All Vouch review confidence checks passed
Residual risk 0.13 = Change Risk (0.37) × (1 − Review Confidence (0.64)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 237 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 70%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.327
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #130"
general
weight: 0.35
maleadt
AK.map!andAK.mapnow take several source arrays and callfwith one element of each, asBase.map!does and asAK.mapreduce(f, op, A, B...)already allows (thrust's binarytransform, which the README lists as the counterpart ofmap):The contract extends the single-source one:
ArgumentError), and elements are matched in column-major order, so shapes may differ;mapallocates an array with the shape and eltype of the first source;backendis resolved over the destination and all sources;dstmay be one of the sources, but must not otherwise share memory with them.Arrays with the same axes are indexed together with
eachindex(dst, srcs...), and the rest by position. This also fixes single-sourcemap!from an array without fast linear indexing, such asview(A, 1:3, 2:5), into a destination of another shape. It used to index the destination with the source's Cartesian indices and threw aBoundsError.The first commit fixes
foreachindex/foraxes(the launcher behindmap!) for index collections that do not start at 1, such aseachindexof an OffsetArray. They mapped positions1:nstraight toindices[i], so a loop over0:2visited 1, 2 and 3. With@inboundsin the loop body, as the docs recommend, that wrote out of bounds.Performance on an RTX 5080, 2^26
Float32s:| | before | after |
|---|---|---|
|
map!(f, y, x)| 651 μs | 650 μs ||
map!(+, z, x, y)| n/a | 947 μs (z .= x .+ y: 947 μs) || view → matrix (same axes) / view → vector (by position) | 653 μs /
BoundsError| 652 μs / 654 μs |Tested on CPU (threads), CUDA, OpenCL (PoCL), AMDGPU, Metal and oneAPI.