How do I sort one vector based on values of another
what about this one x[order(match(x,y))]
what about this one x[order(match(x,y))]
Natural ordering is a kind of alphanumerical sort which seems natural to humans. In a classical alphanumerical sort we will have something like : 1 10 11 12 2 20 21 3 4 5 6 7 If you’re using Natural ordering, it will be : 1 2 3 4 5 6 7 10 11 12 … Read more
I can think of 2 possibilities, one of which is suggested already by @JaredHoberock. I don’t know of a general methodology to fuse for-loop iterations in thrust, but the second method is the more general approach. My guess is that the first method would be the faster of the two approaches, in this case. Use … Read more
While we won’t give you the answer, we can suggest a few useful things. For example, you compare two elements of a list (at $idx1 and $idx2) with this: string compare [lindex $theList $idx1] [lindex $theList $idx2] And you might use this procedure to swap those two elements: proc swap {nameOfListVar idx1 idx2} { upvar … Read more