If you don't mind losing the original permutation (it's overwritten), you
can use Base.permute!! (unexported).  However, in most cases, this is still
actually slower than A[p].  Not sure how that would be for sorting
rows/columns.

Kevin

On Wed, Mar 11, 2015 at 7:49 AM, Davide Lasagna <[email protected]>
wrote:

> Well, thanks Tim for pointing this out.
>
> Cheers,
>
> Davide
>
>
> On Wednesday, March 11, 2015 at 2:42:38 PM UTC, Tim Holy wrote:
>>
>> Good that you clarified that, but are you aware that permute! makes a
>> copy of
>> the permutation? So there's no memory savings, and it's about 4x slower
>> than
>> an out-of-place copy.
>>
>> --Tim
>>
>> On Wednesday, March 11, 2015 07:09:38 AM Davide Lasagna wrote:
>> > But A[p, :] makes copies, and I want it to be in place.
>> >
>> > Davide
>> >
>> > On Wednesday, March 11, 2015 at 2:02:31 PM UTC, Tim Holy wrote:
>> > > A[p, :]
>> > >
>> > > --Tim
>> > >
>> > > On Wednesday, March 11, 2015 05:49:47 AM Davide Lasagna wrote:
>> > > > Hi,
>> > > >
>> > > >
>> > > > permute!(v, p) permutes the elements of v according to the
>> permutation
>> > > > vector p.
>> > > >
>> > > > Is there any equivalent built in function for permuting rows of a
>> > >
>> > > matrix?
>> > >
>> > > > Given the memory layout of julia matrices it should not be too
>> difficult
>> > >
>> > > to
>> > >
>> > > > have a similar function for matrices as well.
>> > > >
>> > > > Thanks,
>> > > >
>> > > > Davide
>>
>>

Reply via email to