vector ordering problem
- To: mathgroup at smc.vnet.net
- Subject: [mg126697] vector ordering problem
- From: Marco Lazzaretti <marco.lazzaretti82 at gmail.com>
- Date: Thu, 31 May 2012 02:51:02 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Hi,
I have these two vectors, vector1 and vector2.
I need to have vector2 sorted by a positions vector, given by a
vector1.
e.g.
vector1 ={32,4,28,11,20}
position_vector1= Ordering[vector1]
position_vector1 = {5,1,4,2,3}
vector2 = {78,12,95,14,35}
requested output
{35,78,14,12,95}
that is, I have this position vector, as an output from another
calculation; then i need my input vector to be sorted as the position
vector says.
Obviously, my real input vector is quite bigger so i can't sort it
manually... I hope the small example can explain my problem better
than my words...