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

Detailed Description

Tracks the index as the loop runs rather than searching afterwards.

Variables

constexpr auto eve::algo::single_pass = ::rbr::flag(single_pass_tag {})

Variable Documentation

◆ single_pass

auto eve::algo::single_pass = ::rbr::flag(single_pass_tag {})
inlineconstexpr
Header file #include <eve/module/algo.hpp>
namespace eve::algo
{
inline constexpr auto single_pass = eve_implementation_defined;
}
constexpr auto single_pass
Definition traits.hpp:576

Makes a search track the index of its candidate as the loop runs, rather than search for it afterwards. By default eve::algo::min_element and eve::algo::max_element are two passes, the value then its position, which is faster on eve's benchmarks; the trait is for a body that is expensive enough for a second pass to cost more than the tracking.

std::vector<float> data(1024);
// The values come from a computation: a second pass over them costs as much as the first.
auto best = min_element[single_pass](views::map(data, [](auto x) { return eve::exp(x); }));
constexpr auto min_element
SIMD version of std::min_element.
Definition min_element.hpp:256
constexpr auto exp
elementwise_callable object computing .
Definition exp.hpp:89
struct eve::algo::views::@237367333220374116042140171311261045047321245302 map
Given a relaxed iterator/range and an operation return relaxed iterator/range that has no store and a...
See also
expensive_callable