thanks.  i ended up creating the array because it's multi-dimensional (i 
didn't know about the matlab-like using an array as a set of indices, which 
is described in the docs near the permute function and ended up using that).

i *am* worried about memory (trying to keep the main loop in 64kB L1 on a 
celeron!) but this particular operation is once every 10 secs, so isn't 
critical at all (main loop does 3 million iterations in that time - i love 
julia!).

cheers, andrew

On Friday, 10 January 2014 20:32:53 UTC-3, Kevin Squire wrote:
>
> If you have the memory, it is usually faster to create a new array. Going 
> the other way, if you don't mind the permutation being overwritten, you can 
> use the (unexported) Base.permute!! function. (permute! Makes a copy of the 
> permutation and then calls permute!!.)
>
> Cheers,  kevin
>
> On Friday, January 10, 2014, andrew cooke wrote:
>
>> sounds very much like it would be!  thanks!
>>
>> On Friday, 10 January 2014 14:09:51 UTC-3, Alex wrote:
>>>
>>> Maybe permute!(v,p) is what you are looking for: http://docs.julialang.
>>> org/en/release-0.2/stdlib/base/?highlight=permute!#Base.permute!
>>>
>>> Cheers,
>>> Alex.
>>>
>>> On Friday, 10 January 2014 17:12:08 UTC+1, andrew cooke wrote:
>>>>
>>>> is there some efficient way of applying a permutation (in-place)?
>>>>
>>>> in other words, i am using sortperm() on one array to find a 
>>>> permutation which i then want to use to in-place sort some data in another 
>>>> array (along a particular dimension).  is there a library function that 
>>>> does this?
>>>>
>>>> thanks,
>>>> andrew
>>>>
>>>>

Reply via email to