Ipermute in Julia

Dear Julia experts,

How do I inverse permute in Julia? (It’s called ipermute in Matlab) More info here.

I found a function called invpermute! With a 3-D array, invpermute! does not seem to work.

Any help would be sincerely appreciated!

I believe the equivalent of permute in MatLab is permutedims in Julia. And while we don’t have an invpermutedims in Base, it’s simple to define your own:

invpermutedims(A::AbstractArray, perm) = permutedims(A, invperm(perm))
2 Likes

That seems to have done it. Thank you so much!