14 output_storage.assign(data.begin(), data.end());
15 sort_span(std::span<double>(output_storage), direction, algorithm);
16 return { output_storage.data(), output_storage.size() };
27 output_storage.resize(
channels.size());
28 std::vector<std::span<double>>
out;
30 for (
size_t i = 0; i <
channels.size(); ++i)
37 std::vector<size_t> idx(data.size());
38 std::iota(idx.begin(), idx.end(), 0);
42 std::ranges::sort(idx, [&](
size_t a,
size_t b) {
return comp(data[
a], data[
b]); });
48 std::vector<std::vector<size_t>>
out;
Discrete sequence sorting primitives for MayaFlux::Kinesis.
std::vector< float > * out
std::vector< std::vector< size_t > > channels_sort_indices(const std::vector< std::span< double > > &channels, SortingDirection direction)
Per-channel sort indices.
void sort_span(std::span< double > data, SortingDirection direction, SortingAlgorithm algorithm)
Sort a single span in-place.
auto double_comparator(SortingDirection direction) noexcept
Direction-based comparator for doubles.
std::vector< std::span< double > > sort_channels_into(const std::vector< std::span< const double > > &channels, std::vector< std::vector< double > > &output_storage, SortingDirection direction, SortingAlgorithm algorithm)
Sort all channels into caller-owned output buffers.
std::span< double > sort_span_into(std::span< const double > data, std::vector< double > &output_storage, SortingDirection direction, SortingAlgorithm algorithm)
Sort a span into a caller-owned output buffer.
std::vector< size_t > span_sort_indices(std::span< double > data, SortingDirection direction)
Indices that would sort a span in the given direction.
void execute(Iterator begin, Iterator end, Comparator comp, SortingAlgorithm algorithm)
Execute a sorting algorithm on an iterator range.
void sort_channels(std::vector< std::span< double > > &channels, SortingDirection direction, SortingAlgorithm algorithm)
Sort all channels in-place.
SortingAlgorithm
Available sorting algorithm backends.
SortingDirection
Ascending or descending sort order.