| 48 | |
| 49 | template <class TIndicesType> |
| 50 | inline void GenerateQueryDocsOrder(ui64 seed, ui32 blockSize, TConstArrayRef<TGroupBounds> groupBounds, TVector<TIndicesType>* orderPtr) { |
| 51 | TVector<ui32> order; |
| 52 | Shuffle(seed, blockSize, groupBounds.size(), &order); |
| 53 | auto& docwiseOrder = *orderPtr; |
| 54 | // we assume groupBounds are sorted in ascending order |
| 55 | docwiseOrder.yresize(groupBounds.back().End); |
| 56 | |
| 57 | ui32 cursor = 0; |
| 58 | for (ui32 groupId = 0; groupId < order.size(); ++groupId) { |
| 59 | const auto group = groupBounds[order[groupId]]; |
| 60 | std::iota(docwiseOrder.begin() + cursor, docwiseOrder.begin() + cursor + group.GetSize(), group.Begin); |
| 61 | cursor += group.GetSize(); |
| 62 | } |
| 63 | Y_ASSERT(cursor == docwiseOrder.size()); |
| 64 | } |
| 65 | |
| 66 | // TODO(kirillovs): this function is used only for cuda unittests, maybe remove later |
| 67 | template <class TIndicesType> |