To add to Doug's point, permutedims! is non-allocating, but it's not in-place.
After all, you can't stash a 3-by-5 matrix in a 5-by-3 matrix. The syntax is
permutedims!(output, input, perm)
where output already has the right size.
Since permutedims! is undocumented, DumpsterDoofus, would you add it to
https://github.com/JuliaLang/julia/blob/master/doc/stdlib/base.rst?
(just click on the little pencil icon)
--Tim
On Wednesday, September 17, 2014 11:03:24 AM DumpsterDoofus wrote:
> I am having trouble with `permute!`, the in-place version of `permutedims`.
> I tried the following:
>
> A = rand(Float32, 20, 30, 40, 2);
>
> permute!(A, [1;2;3;4])
>
> which produced the following:
>
> ERROR: BoundsError()
> in permute!! at combinatorics.jl:196
> in permute! at combinatorics.jl:212
>
> Strangely, executing the the in-place version,
>
> permutedims(A, [1;2;3;4])
>
> works fine, giving the correct result.
>
> What is going on here?