MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::math::adl_accumulator Concept Reference

Configuration 3 via the ADL hook: does Acc's own namespace provide the super-accumulator functions for products of Values? More...

#include <accumulator_traits.hpp>

Concept definition

template<typename Acc, typename Value>
concept mtl::math::adl_accumulator = requires(Acc& a, const Acc& ca, const Value& v) {
{ accumulator_value(ca, std::type_identity<Value>{}) } -> std::convertible_to<Value>;
}
Configuration 3 via the ADL hook: does Acc's own namespace provide the super-accumulator functions fo...
Definition accumulator_traits.hpp:170
R accumulator_value(const exact_accumulator< T > &a, std::type_identity< R >)
The single round-out, to nearest-even, of the exact sum to R (float or double).
Definition exact_accumulator.hpp:239
void accumulator_clear(exact_accumulator< T > &a)
Definition exact_accumulator.hpp:185
void accumulator_assign(exact_accumulator< T > &a, const V &v)
Definition exact_accumulator.hpp:214
void accumulator_add_product(exact_accumulator< T > &a, const V &m, const V &v)
Definition exact_accumulator.hpp:192

Detailed Description

Configuration 3 via the ADL hook: does Acc's own namespace provide the super-accumulator functions for products of Values?

The functions, found by argument-dependent lookup on Acc:

accumulator_clear(acc) acc = 0 accumulator_assign(acc, v) acc = v, exactly accumulator_add_product(acc, m, v) acc += m * v accumulator_value(acc, std::type_identity<R>{}) -> R, the single round-out accumulator_merge(acc, other) acc += other (optional)

accumulator_value takes a std::type_identity<Result> tag rather than an explicit template argument so that the call is an ordinary ADL call on every compiler. accumulator_merge is optional: an accumulator without it still satisfies the hook, and only merge() is unavailable.

Constrain the functions on the accumulator type. They are also looked up in the namespaces associated with Value, so an unconstrained template <class A> void accumulator_clear(A&) in a number library would claim accumulator_traits<double, its_number> too.