Decorators

## Description

Rationale
Up to now we have five different decorators that can be used to modify the behaviour of some functors. Use of a functor with no decorator is often referred as "regular".

These are pedantic_, raw_, restricted_, saturated_, std_. (musl_ and plain_ also exist, but are used in an internal way).

if a decorator foo_ has to be called to modify the functor bar the call

z = bar( < bar parameters > );

has to be replaced by

z = foo_(bar)(< bar parameters >);
• raw_ implies

possibly big loss of accuracy, loss of correctness for not "normal" values and no support for limiting cases. The purpose of raw_ is to maximize the speed using at hand functions (often intrinsics).

• regular (no decorator) implies

possibly a loss of correctness for not "normal" values (except zero) and limiting cases that are treated in a way not always conformant to standard (if it exists). The purpose of the regular way is to maximize the speed (but with few ulp losses with "normal" and zero parameters) and treating corner cases only if the performance loss is no more than a few percent.

• pedantic_ implies

if a standard exists the function is as conformant as possible whatever the loss in performances can be.

• std_

is reserved to the direct call of a libc++ version of the function: this means that in simd mode emulation is used. In general the performance is worse even in scalar mode.

• saturated_

is only efficient if the return type is Integral, in which case the result is properly saturated

• restricted_

is used to indicate a restrained range of validity for a function. Up to now only direct trigonometic function can use this decorator which restricts their validity range to $$[-\pi/4, \pi/4]$$ (they return a nan outside), but with an important speed-up.

Note:
Not "normal" values are as defined by the libc++ fpclassify by not returning FP_NORMAL, the categories being :
result meaning
FP_INFINITE return "Inf";
FP_NAN return "NaN";
FP_NORMAL return "normal";
FP_SUBNORMAL return "subnormal";
FP_ZERO return "zero";

## Functions

template<typename T >
auto boost::simd::musl_ (T const &x)
calls a version of the functor for which the algorithm is inspired by the musl library code. More...

template<typename T >
auto boost::simd::pedantic_ (T const &x)
calls a version of the functor that can do some aggressive optimization at the cost of certain properties or corner cases of the original functor. More...

template<typename T >
auto boost::simd::plain_ (T const &x)
calls the plain version of the functor This decorator is used internally as a tag to choose the boost simd kernel among other More...

template<typename T >
auto boost::simd::raw_ (T const &x)
grant access to low-level, low-accuracy intrinsics provided by some SIMD architectures. More...

template<typename T >
auto boost::simd::restricted_ (T const &x)
restricts the range of validity of some functors (thus avoiding tests and branching), but ensures an as accurate though speedier version on the limited range. More...

template<typename T >
auto boost::simd::saturated_ (T const &x)
provides a saturated version of some functors which produce integral typed values on return. More...

## Variables

const detail::decorator< splatted_tagboost::simd::splatted_ = {}
Decorator for selecting splatted version of reduction function. More...

const detail::decorator< std_tagboost::simd::std_ = {}
provides an easy way to use the original stdlibc++ function that is mimicked by one of our functors. More...