Sorting

GSL::Vector#sort!
This method sorts the elements of the vector self into ascending numerical order. The vector itself is changed.
GSL::Vector#sort
This returns a new vector whose elements are sorted into ascending numerical order. The vector self is not changed.
GSL::Vector#sort_index
This method indirectly sorts the elements of the vector self into ascending order, and returns the result as an instance of the GSL::Permutation class. The elements of the returned permutation give the index of the vector element which would have been stored in that position if the vector had been sorted in place. The first element of the permutation gives the index of the least element in self, and the last element of the permutation gives the index of the greatest element in self. The vector self is not changed.
GSL::Vector#sort_smallest(k)
GSL::Vector#sort_largest(k)
These functions return a new vector storing the k smallest or largest elements of the vector self. The argument k must be less than or equal to the length of the vector self.
GSL::Vector#sort_smallest_index(k)
GSL::Vector#sort_largest_index(k)
These functions return a new GSL::Permutation object storing the indices of the k smallest or largest elements of the vector self. k must be less than or equal to the length of the vector.

back