Hello

I am post-processing some particle simulation data and for an example I would get the following two arrays:

```
Rhop_vec[50]
125749-element Array{Float32,1}:
1007.7992
1014.8219
1011.84064
1019.48114
1011.2265
1015.946
⋮
1012.1963
1016.4518
1006.3834
1014.0597
1007.33563
1021.40027
```

```
Idp_vec[50]
125749-element Array{Int32,1}:
0
1
2
251
253
255
⋮
124256
124505
125003
124754
125749
125750
```

Where “Idp_vec” is the vector holdning the index value of each particle starting from 0 to N, while “Rhop_vec” holds the corresponding density for each particle. So for an example for the first element I would have Idp = 0 and Rhop = 1007.7992.

Now comes the tricky part. Sometimes I might only want to look at particles from the range of Idp of 0 to 1500. Since the Idp_vec is clearly unstructured I have two options:

- Sort Idp_vec from lowest to highest and then enforce same sorting on Rhop_vec
- Find the specific indices directly and correlate with Rhop_vec

I have no clue which one is fastest / most efficient, but I have a hard time figuring out how to for an example implement option 1 efficiently. Currently what I am doing is the same as in the documentation, using `sortperm`

to save an array of the indices after sorting so I can transform the Rhop_vec array correspondingly, but wondered if there is a smarter way.

For the second option, I don’t know if it is viable, but I think it might be more efficient since I do not have to make any temporary arrays?

I am finishing up my own solution, but would like to hear about your past experiences.

Kind regards