E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ sort

auto eve::sort = functor<sort_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Sorting algorithm, based on sortin networks.

Note
this sort is unstable.

Also our implementation is not directly based on any specific one, people we are definetly not the first people to do this. Here is a list of previous work that was looked at.

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto sort(value auto x); noexcept; // 1
constexpr auto sort(value auto x, ordering auto less) noexcept; // 1
}
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto sort
sorts a register in a accedning order accroding to a comparator.
Definition sort.hpp:90
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. sorted x.

Example

// revision 1
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
auto myless = [](auto z1, auto z2){ return z1 > z2; };
eve::wide wf0{0.0, 1.0, 2.0, 3.0, -1.0, -2.0, -3.0, -4.0};
eve::wide wi0{0, 1, 2, 3, -1, -2, -3, -4};
eve::wide wu0{0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u};
std::cout << "<- wf0 = " << wf0 << "\n";
std::cout << "<- wi0 = " << wi0 << "\n";
std::cout << "<- wu0 = " << wu0 << "\n";
std::cout << "-> sort(wf0) = " << eve::sort(wf0) << "\n";
std::cout << "-> sort(wf0, myless) = " << eve::sort(wf0, myless) << "\n";
std::cout << "-> sort(wu0) = " << eve::sort(wu0) << "\n";
std::cout << "-> sort(wu0, myless) = " << eve::sort(wu0, myless) << "\n";
std::cout << "-> sort(wi0) = " << eve::sort(wi0) << "\n";
std::cout << "-> sort(wi0, myless) = " << eve::sort(wi0, myless) << "\n";
}
Wrapper for SIMD registers.
Definition wide.hpp:86