MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ mountain_positions()

MAYAFLUX_API std::vector< size_t > MayaFlux::Kinesis::Discrete::mountain_positions ( size_t count)
nodiscard

Target position of each rank in a mountain arrangement of count values.

Ranks alternate between the two ends and fill inward, so an ascending sequence laid out by these positions rises from the first position to the centre and falls to the last: rank 0 goes to position 0, rank 1 to the last position, rank 2 to position 1, and so on. BIDIRECTIONAL sorting applies it.

Parameters
countNumber of values
Returns
One position per rank, a permutation of 0 to count - 1

Definition at line 22 of file Sort.cpp.

23{
24 std::vector<size_t> positions(count);
25 size_t left = 0;
26 size_t right_taken = 0;
27 for (size_t rank = 0; rank < count; ++rank) {
28 if (rank % 2 == 0) {
29 positions[rank] = left++;
30 } else {
31 positions[rank] = count - 1 - right_taken++;
32 }
33 }
34 return positions;
35}
std::vector< double > count(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Sample count per window (as double for pipeline uniformity).
Definition Analysis.cpp:506

References count().

Referenced by MayaFlux::Yantra::BitonicSorter< OutputType >::order(), sort_span(), and span_sort_indices().

Here is the call graph for this function:
Here is the caller graph for this function: