Skip to content

Stop documenting that permute! is "in-place"; it isn't and never has been non-allocating #58902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions base/combinatorics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,12 @@ end
"""
permute!(v, p)
Permute vector `v` in-place, according to permutation `p`. No checking is done
to verify that `p` is a permutation.
Permute vector `v` according to permutation `p`, storing the result back into `v`.
No checking is done to verify that `p` is a permutation.
To return a new permutation, use `v[p]`. This is generally faster than `permute!(v, p)`;
it is even faster to write into a pre-allocated output array with `u .= @view v[p]`.
(Even though `permute!` overwrites `v` in-place, it internally requires some allocation
to keep track of which elements have been moved.)
(Even though `permute!` overwrites `v` in-place, it internally requires some allocation.)
$(_DOCS_ALIASING_WARNING)
Expand Down