43void rankVect(
const std::vector<T1> &vect, T2 &res) {
44 PRECONDITION(res.size() >= vect.size(),
"vector size mismatch");
45 unsigned int nEntries = rdcast<unsigned int>(vect.size());
47 std::vector<unsigned int> indices(nEntries);
48 for (
unsigned int i = 0; i < nEntries; ++i) {
51 std::sort(indices.begin(), indices.end(),
52 [&](
auto i1,
auto i2) { return vect[i1] < vect[i2]; });
55 unsigned int lastIdx = indices[0];
56 for (
auto idx : indices) {
57 if (vect[idx] == vect[lastIdx]) {
60 res[idx] = ++currRank;