Reading, rewriting and carrying a set of algorithm traits.
Writing an algorithm the way EVE writes its own means reading what the caller asked for. The tools below answer that: the readers report a decision, the rewriters turn a caller's set into the canonical one an algorithm loops on, and function_with_traits builds the callable that accepts a set at all. Calling an algorithm needs none of them, only the Options it accepts.
Convenience header:
Unrolled iterations run on the same loop step, so a custom algorithm keeps them free of dependencies, for_each_iteration rather than for_each when that takes a hand-written loop.
Contents | |
| default_simple_algo_traits | |
| Predefined set the algorithms with a short body start from. | |
| no_traits | |
| Empty set, for an algorithm that starts from no default. | |
Classes | |
| struct | eve::algo::traits< Settings > |
| Compile time set of tuning parameters an algorithm accepts. More... | |
Typedefs | |
| template<typename Traits> | |
| using | eve::algo::extra_types_to_consider = rbr::result::fetch_t<(consider_types_key | kumi::tuple{}), Traits> |
| Types eve::algo::consider_types added to the set, as a kumi::tuple. | |
| template<typename Traits, typename RorI> | |
| using | eve::algo::get_types_to_consider_for |
| Every type the cardinal selection weighs, as a kumi::tuple. | |
| template<typename Traits, typename RorI> | |
| using | eve::algo::iteration_cardinal_t |
| Cardinal an algorithm iterates with. | |
| template<typename Traits, typename RorI> | |
| using | eve::algo::get_index_type_t |
| Integral type an algorithm counts indices in. | |
Functions | |
| template<typename Traits> | |
| constexpr std::ptrdiff_t | eve::algo::get_unrolling () |
| Number of SIMD registers handled per loop step. | |
| template<typename Traits> | |
| constexpr std::ptrdiff_t | eve::algo::get_overflow () |
| Number of lanes the loop may write past its range. | |
| template<typename Traits> | |
| constexpr std::optional< std::ptrdiff_t > | eve::algo::get_expected_smaller_r () |
| Which of two ranges eve::algo::expect_smaller_range named, if any. | |
| template<typename K, typename Traits> | |
| constexpr auto | eve::algo::drop_key (K k, Traits tr) |
| Trait set without the key k. | |
| template<bool cond, typename K, typename Traits> | |
| constexpr auto | eve::algo::drop_key_if (K k, Traits tr) |
| Trait set without the key k, when cond holds. | |
| template<typename Traits> | |
| constexpr auto | eve::algo::density_for_compress_copy () |
| Output density a compressing copy writes with. | |
| template<typename Settings> | |
| constexpr auto | eve::algo::process_equivalents (traits< Settings > tr) |
| Trait set with every shorthand expanded. | |
Variables | |
| constexpr auto | eve::algo::default_to |
| Trait set where a caller's choices override an algorithm's defaults. | |
| template<typename Traits> | |
| constexpr bool | eve::algo::has_type_overrides_v = Traits::contains(force_type_key) || Traits::contains(common_with_types_key) |
| Whether a zip trait set requests a type conversion. | |
| template<template< typename > typename F> | |
| constexpr auto | eve::algo::function_with_traits = F<eve_implementation_defined>{} |
| Callable accepting a trait set, built from an algorithm's implementation. | |
| using eve::algo::extra_types_to_consider = rbr::result::fetch_t<(consider_types_key | kumi::tuple{}), Traits> |
Types eve::algo::consider_types added to the set, as a kumi::tuple.
| Traits | Trait set to read. |
Empty tuple when the set carries no eve::algo::consider_types.
| using eve::algo::get_index_type_t |
Integral type an algorithm counts indices in.
| Traits | Trait set to read. |
| RorI | Range or iterator the algorithm walks. |
| Trait set | Result |
|---|---|
| carries eve::algo::index_type | that type |
| otherwise | smallest unsigned type covering RorI |
| using eve::algo::get_types_to_consider_for |
Every type the cardinal selection weighs, as a kumi::tuple.
| Traits | Trait set to read. |
| RorI | Range or iterator the algorithm walks. |
The types RorI carries, followed by those eve::algo::consider_types added.
| using eve::algo::iteration_cardinal_t |
Cardinal an algorithm iterates with.
| Traits | Trait set to read. |
| RorI | Range or iterator the algorithm walks. |
| Trait set | Result |
|---|---|
| carries eve::algo::force_cardinal | that cardinal |
| carries allow_frequency_scaling | expected cardinal of the considered types |
| otherwise | cardinal that avoids frequency scaling |
|
constexpr |
Output density a compressing copy writes with.
| Traits | Trait set to read. |
eve::sparse when the set carries eve::algo::sparse_output, eve::dense otherwise.
|
inlineconstexpr |
Trait set without the key k.
| K | Keyword to remove. |
| Traits | Trait set to strip. |
Called once the decision k carried is taken, so the rest of the loop cannot read it again.
|
inlineconstexpr |
Trait set without the key k, when cond holds.
| cond | Condition deciding the removal. |
| K | Keyword to remove. |
| Traits | Trait set to strip. |
Keeps an if constexpr out of the call site.
|
constexpr |
Which of two ranges eve::algo::expect_smaller_range named, if any.
| Traits | Trait set to read. |
Empty optional when the set names none.
|
constexpr |
Number of lanes the loop may write past its range.
| Traits | Trait set to read, which has to carry eve::algo::overflow. |
|
constexpr |
Number of SIMD registers handled per loop step.
| Traits | Trait set to read. |
Reports 1 when the set carries no eve::algo::unroll.
|
inlineconstexpr |
Trait set with every shorthand expanded.
| Settings | Settings of the trait set to expand. |
| Written | Stands for |
|---|---|
| eve::algo::expensive_callable | no_aligning, unroll<1> and single_pass |
An algorithm reads this first, so the rest of its loop sees one canonical set.
|
inlineconstexpr |
Trait set where a caller's choices override an algorithm's defaults.
Both sets keep their eve::algo::consider_types entries, which add up rather than replace one another. Every other key comes from the caller when present.
|
constexpr |
Callable accepting a trait set, built from an algorithm's implementation.
| F | Implementation template, taking the type that carries the traits. |
Every algorithm under eve/module/algo/algo is declared this way.
|
constexpr |
Whether a zip trait set requests a type conversion.
| Traits | Trait set to read. |
True when the set carries eve::algo::force_type or eve::algo::common_with_types.