Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Nov 26, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

jishnub and others added 2 commits November 26, 2025 20:26
This was broken in #59961, as
`map` deals with trailing singleton axes differently from broadcasting:
```julia
julia> map(+, ones(1), ones(1,1)) |> size
(1,)

julia> broadcast(+, ones(1), ones(1,1)) |> size
(1, 1)
```
This PR limits the new method to the case where the ndims match, in
which case there are no trailing axes and the two are equivalent. The
alternate approach suggested in
#59961 (comment) is
to reshape the arrays, but this adds overhead that nullifies the
performance improvement for small arrays.
We had two sets of constructors:
1) user-facing ones, which mimic `show`
(e.g. `MersenneTwister(seed)`, or `MersenneTwister(1, (0, 1002, 0,
1))`),
2) internal ones:
   - `MersenneTwister(seed, state, vals, ...)`
   - `MersenneTwister(seed, state)`

Internal ones were not practical to use, so they are replaced by a
single `_MersenneTwister(undef)` constructor which prepares an
uninitialized instance, which can then be initialized by `seed!`,
`copy!`, etc.

This commit also makes `const` some internal fields, and replaces
`Vector` with `Memory` for one of them.
@pull pull bot locked and limited conversation to collaborators Nov 26, 2025
@pull pull bot added the ⤵️ pull label Nov 26, 2025
@pull pull bot merged commit 24d8ab5 into MLH-Fellowship:master Nov 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants