21 std::sort(v2.begin(), v2.end());
22 std::cout <<
"Sort vector " << v1 <<
": " << v2 << std::endl;
27 std::cout <<
"Sort vector " << v1 <<
": " << v3 << std::endl;
31 std::cout <<
"Reverse vector " << v1 <<
": " << v4 << std::endl;
36 std::cout <<
"Indices that sort the vector " << v1 <<
": " << i << std::endl;
39 auto v6 =
Take(v5, i);
40 std::cout <<
"Sort vector " << v5 <<
" respective to the previously"
41 <<
" determined indices: " << v6 << std::endl;
44 auto v7 =
Take(v1, 2);
45 auto v8 =
Take(v1, -2);
46 std::cout <<
"Take the two first and last elements of vector " << v1
47 <<
": " << v7 <<
", " << v8 << std::endl;
52 std::cout <<
"Sort the vector " << v1 <<
", take the two last elements and "
53 <<
"reverse the selection: " << v9 << std::endl;
RVec< T > Reverse(const RVec< T > &v)
Return copy of reversed vector.
RVec< T > Take(const RVec< T > &v, const RVec< typename RVec< T >::size_type > &i)
Return elements of a vector at given indices.
RVec< typename RVec< T >::size_type > Argsort(const RVec< T > &v)
Return an RVec of indices that sort the input RVec.
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)